From 9d367f95db0b41d911a62969a2292023bd035b8d Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 13 Feb 2017 17:18:06 +0100 Subject: [PATCH] [ongoing] new space interface --- .../javascripts/controllers/spaces.coffee | 21 ++++++++++++ app/assets/javascripts/router.coffee.erb | 8 +++++ app/assets/templates/spaces/_form.html | 0 app/assets/templates/spaces/new.html.erb | 33 +++++++++++++++++++ config/locales/app.admin.en.yml | 6 ++++ config/locales/app.admin.fr.yml | 6 ++++ 6 files changed, 74 insertions(+) create mode 100644 app/assets/templates/spaces/_form.html create mode 100644 app/assets/templates/spaces/new.html.erb diff --git a/app/assets/javascripts/controllers/spaces.coffee b/app/assets/javascripts/controllers/spaces.coffee index 33d3b9439..c1d445fd3 100644 --- a/app/assets/javascripts/controllers/spaces.coffee +++ b/app/assets/javascripts/controllers/spaces.coffee @@ -43,3 +43,24 @@ Application.Controllers.controller "SpacesController", ["$scope", "$state", 'spa $state: $state ] + + +## +# Controller used in the space creation page (admin) +## +Application.Controllers.controller "NewSpaceController", ["$scope", "$state", 'CSRF',($scope, $state, CSRF) -> + CSRF.setMetaTags() + + ## API URL where the form will be posted + $scope.actionUrl = "/api/spaces/" + + ## Form action on the above URL + $scope.method = "post" + + ## default machine parameters + $scope.space = + space_files_attributes: [] + + ## Using the SpacesController + new SpacesController($scope, $state) +] \ No newline at end of file diff --git a/app/assets/javascripts/router.coffee.erb b/app/assets/javascripts/router.coffee.erb index 9aacff334..db08d8ff8 100644 --- a/app/assets/javascripts/router.coffee.erb +++ b/app/assets/javascripts/router.coffee.erb @@ -407,6 +407,14 @@ angular.module('application.router', ['ui.router']). url: '/spaces/:id/reserve' .state 'app.admin.space_new', url: '/spaces/new' + views: + 'main@': + templateUrl: '<%= asset_path "spaces/new.html" %>' + controller: 'NewSpaceController' + resolve: + translations: [ 'Translations', (Translations) -> + Translations.query(['app.admin.space_new', 'app.shared.space']).$promise + ] # trainings .state 'app.public.trainings_list', diff --git a/app/assets/templates/spaces/_form.html b/app/assets/templates/spaces/_form.html new file mode 100644 index 000000000..e69de29bb diff --git a/app/assets/templates/spaces/new.html.erb b/app/assets/templates/spaces/new.html.erb new file mode 100644 index 000000000..6a6f9350e --- /dev/null +++ b/app/assets/templates/spaces/new.html.erb @@ -0,0 +1,33 @@ +
+
+ +
+
+

{{ 'add_a_new_space' }}

+
+ +
+ +
+ +
+ + +
+ +
+ + + + +
+ +
+
diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml index 53237b8c3..1266164c6 100644 --- a/config/locales/app.admin.en.yml +++ b/config/locales/app.admin.en.yml @@ -69,6 +69,12 @@ en: beware_when_creating_a_training_its_reservation_prices_are_initialized_to_zero: "Beware, when creating a training, its reservation prices are initialized at zero." dont_forget_to_change_them_before_creating_slots_for_this_training: "Don't forget to change them before creating slots for this training." + space_new: + # create a new space + add_a_new_space: "Add a new space" + watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "Watch out! When creating a new space, its prices are initialized at 0 for all subscriptions." + consider_changing_its_prices_before_creating_any_reservation_slot: "Consider changing its prices before creating any reservation slot." + events: # events tracking and management events_monitoring: "Events monitoring" diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml index 8926a4cb7..49ccce0dc 100644 --- a/config/locales/app.admin.fr.yml +++ b/config/locales/app.admin.fr.yml @@ -69,6 +69,12 @@ fr: beware_when_creating_a_training_its_reservation_prices_are_initialized_to_zero: "Attention, lors de la création d'une formation, ses tarifs de réservation sont initialisés à zero." dont_forget_to_change_them_before_creating_slots_for_this_training: "Pensez à les modifier avant de créer des créneaux pour cette formation." + space_new: + # créer un nouvel espace + add_a_new_space: "Ajouter un nouvel espace" + watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "Attention, lors de la création d'un espace, ses tarifs de réservation sont initialisés à zero pour tout les abonnements." + consider_changing_its_prices_before_creating_any_reservation_slot: "Pensez à modifier ces prix avant de créer des créneaux pour cette machine." + events: # gestion et suivi des évènements events_monitoring: "Suivi des évènements"