1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

trainings gallery

This commit is contained in:
Sylvain 2016-06-23 16:47:15 +02:00
parent 973d3637e3
commit 45ab06c73c
9 changed files with 95 additions and 9 deletions

View File

@ -19,7 +19,7 @@ Application.Controllers.controller "MainNavController", ["$scope", "$location",
linkIcon: 'calendar'
}
{
state: 'app.logged.trainings_reserve'
state: 'app.public.trainings_list'
linkText: 'trainings_registrations'
linkIcon: 'graduation-cap'
}

View File

@ -1,5 +1,15 @@
'use strict'
Application.Controllers.controller "TrainingsController", ['$scope', '$state', 'trainingsPromise', ($scope, $state, trainingsPromise) ->
$scope.trainings = trainingsPromise
$scope.reserveTraining = (training, event) ->
$state.go('app.logged.trainings_reserve')
$scope.showTraining = (training) ->
$state.go('app.logged.trainings_reserve')
]
##
# Controller used in the training reservation agenda page.
# This controller is very similar to the machine reservation controller with one major difference: here, ONLY ONE

View File

@ -364,6 +364,19 @@ angular.module('application.router', ['ui.router']).
]
# trainings
.state 'app.public.trainings_list',
url: '/trainings'
views:
'main@':
templateUrl: '<%= asset_path "trainings/index.html" %>'
controller: 'TrainingsController'
resolve:
trainingsPromise: ['Training', (Training)->
Training.query().$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query(['app.public.trainings_list']).$promise
]
.state 'app.logged.trainings_reserve',
url: '/trainings/reserve'
views:

View File

@ -0,0 +1,59 @@
<section class="heading b-b">
<div class="row no-gutter">
<div class="col-xs-2 col-sm-2 col-md-1">
<section class="heading-btn">
<a href="#" ng-click="backPrevLocation($event)"><i class="fa fa-long-arrow-left "></i></a>
</section>
</div>
<div class="col-xs-10 col-sm-10 col-md-8 b-l b-r-md">
<section class="heading-title">
<h1 translate>{{ 'the_trainings' }}</h1>
</section>
</div>
</div>
</section>
<section class="m-lg">
<div class="row" ng-repeat="training in (trainings.length/3 | array)">
<div class="col-xs-12 col-sm-6 col-md-4" ng-repeat="training in trainings.slice(3*$index, 3*$index + 3)">
<div class="widget panel panel-default" ng-click="showTraining(training)">
<div class="panel-heading picture" ng-if="!training.training_image">
<img src="data:image/png;base64," data-src="holder.js/100%x100%/text:&#xf03e;/font:FontAwesome/icon" bs-holder class="img-responsive">
</div>
<div class="panel-heading picture" style="background-image:url({{training.training_image}})" ng-if="training.training_image">
</div>
<div class="panel-body" style="heigth:170px;">
<h1 class="m-b">{{training.name}}</h1>
<p ng-show="training.description">{{training.description | humanize : 140 }}</p>
</div>
<div class="panel-footer no-padder">
<div class="text-center clearfix">
<div class="col-sm-6 b-r no-padder">
<div class="btn btn-default btn-block no-b padder-v red" ng-click="reserveTraining(training, $event)">
<i class="fa fa-bookmark"></i> {{ 'book' | translate }}
</div>
</div>
<div class="col-sm-6 no-padder">
<div class="btn btn-default btn-block padder-v no-b red" ng-click="showTraining(training)">
<i class="fa fa-eye"></i> {{ 'consult' | translate }}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>

View File

@ -1,8 +1,8 @@
user_is_admin = (current_user and current_user.is_admin?)
json.array!(@trainings) do |training|
json.id training.id
json.name training.name
json.description training.description
json.machine_ids training.machine_ids
json.extract! training, :id, :name, :description, :machine_ids, :nb_total_places
json.training_image training.training_image.attachment.large.url if training.training_image
json.availabilities training.availabilities do |a|
json.id a.id
json.start_at a.start_at.iso8601
@ -13,7 +13,6 @@ json.array!(@trainings) do |training|
json.is_valid slot.reservation.user.trainings.include?(training)
end
end if attribute_requested?(@requested_attributes, 'availabilities')
json.nb_total_places training.nb_total_places
json.plan_ids training.plan_ids if current_user and current_user.is_admin?
json.plan_ids training.plan_ids if user_is_admin
end

View File

@ -160,7 +160,6 @@ en:
# list of machines
the_fablab_s_machines: "The FabLab's machines"
add_a_machine: "Add a machine"
book: "Book"
_or_the_: " or the "
machines_show:

View File

@ -160,7 +160,6 @@ fr:
# liste des machines
the_fablab_s_machines: "Les machines du FabLab"
add_a_machine: "Ajouter une machine"
book: "Réserver"
_or_the_: " ou la "
machines_show:
@ -172,6 +171,11 @@ fr:
unauthorized_operation: "Opération non autorisée"
the_machine_cant_be_deleted_because_it_is_already_reserved_by_some_users: "La machine ne peut pas être supprimée car elle a déjà été réservée par des utilisateurs."
trainings_list:
# liste des formations
the_trainings: "Les formations"
plans:
# page récapitulative des abonnements
subcriptions: "Les abonnements"

View File

@ -88,6 +88,7 @@ en:
_for_your_changes_to_take_effect: "for your changes to take effect."
illustration: "Illustration"
add_an_illustration: "Add an illustration."
book: "Book"
messages:
you_will_lose_any_unsaved_modification_if_you_quit_this_page: "You will lose any unsaved modification if you quit this page"

View File

@ -88,6 +88,7 @@ fr:
_for_your_changes_to_take_effect: "pour que les modifications soient prises en compte."
illustration: "Visuel"
add_an_illustration: "Ajouter un visuel"
book: "Réserver"
messages:
you_will_lose_any_unsaved_modification_if_you_quit_this_page: "Vous perdrez les modifications non enregistrées si vous quittez cette page"