From 10fc7b69e9e60f24e068f566da2ffb03aaf78d2f Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 29 Nov 2016 16:46:19 +0100 Subject: [PATCH] Ability to display optional information message on event reservation page --- CHANGELOG.md | 1 + app/assets/javascripts/controllers/admin/settings.coffee | 3 ++- app/assets/javascripts/controllers/events.coffee.erb | 3 +++ app/assets/javascripts/router.coffee.erb | 3 ++- app/assets/stylesheets/app.utilities.scss | 1 + app/assets/templates/admin/settings/general.html | 8 ++++++++ app/assets/templates/events/show.html.erb | 7 +++++++ app/models/setting.rb | 3 ++- config/locales/app.admin.en.yml | 1 + config/locales/app.admin.fr.yml | 1 + 10 files changed, 28 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f3a9077c..32a811f89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## next release - Ability to create coupons with cash amounts (previously only percentages were allowed) - Improved error messages when something wrong append when paying a machine reservation by stripe +- Ability to display optional information message on event reservation page - Fix a bug: misconfigured Twitter's ENV variables results in HTTP error 500 - Fix a bug: wallet is not debited when paying locally with a user who have invoices disabled - Fix a bug: wrong error message about rounding inconsistency is logged on invoice generation diff --git a/app/assets/javascripts/controllers/admin/settings.coffee b/app/assets/javascripts/controllers/admin/settings.coffee index ea83a1525..a1e3b94a8 100644 --- a/app/assets/javascripts/controllers/admin/settings.coffee +++ b/app/assets/javascripts/controllers/admin/settings.coffee @@ -45,6 +45,7 @@ Application.Controllers.controller "SettingsController", ["$scope", 'Setting', ' $scope.trainingExplicationsAlert = { name: 'training_explications_alert', value: settingsPromise.training_explications_alert } $scope.trainingInformationMessage = { name: 'training_information_message', value: settingsPromise.training_information_message} $scope.subscriptionExplicationsAlert = { name: 'subscription_explications_alert', value: settingsPromise.subscription_explications_alert } + $scope.eventExplicationsAlert = {name: 'event_explications_alert', value: settingsPromise.event_explications_alert } $scope.windowStart = { name: 'booking_window_start', value: settingsPromise.booking_window_start } $scope.windowEnd = { name: 'booking_window_end', value: settingsPromise.booking_window_end } $scope.mainColorSetting = { name: 'main_color', value: settingsPromise.main_color } @@ -73,7 +74,7 @@ Application.Controllers.controller "SettingsController", ["$scope", 'Setting', ' $scope.cancelDelay = name: 'booking_cancel_delay' value: parseInt(settingsPromise.booking_cancel_delay) - + $scope.enableReminder = name: 'reminder_enable' value: (settingsPromise.reminder_enable == 'true') diff --git a/app/assets/javascripts/controllers/events.coffee.erb b/app/assets/javascripts/controllers/events.coffee.erb index 32f3b54b7..58ec0fe31 100644 --- a/app/assets/javascripts/controllers/events.coffee.erb +++ b/app/assets/javascripts/controllers/events.coffee.erb @@ -173,6 +173,9 @@ Application.Controllers.controller "ShowEventController", ["$scope", "$state", " ## Global config: delay in hours before a booking while changing the booking slot is forbidden $scope.moveBookingDelay = parseInt(settingsPromise.booking_move_delay) + ## Message displayed to the end user about rules that applies to events reservations + $scope.eventExplicationsAlert = settingsPromise.event_explications_alert + ## diff --git a/app/assets/javascripts/router.coffee.erb b/app/assets/javascripts/router.coffee.erb index 5d7f16cc0..b62151748 100644 --- a/app/assets/javascripts/router.coffee.erb +++ b/app/assets/javascripts/router.coffee.erb @@ -522,7 +522,7 @@ angular.module('application.router', ['ui.router']). PriceCategory.query().$promise ] settingsPromise: ['Setting', (Setting)-> - Setting.query(names: "['booking_move_enable', 'booking_move_delay']").$promise + Setting.query(names: "['booking_move_enable', 'booking_move_delay', 'event_explications_alert']").$promise ] translations: [ 'Translations', (Translations) -> Translations.query(['app.public.events_show', 'app.shared.member_select', 'app.shared.stripe', @@ -1037,6 +1037,7 @@ angular.module('application.router', ['ui.router']). 'training_explications_alert', 'training_information_message', 'subscription_explications_alert', + 'event_explications_alert', 'booking_window_start', 'booking_window_end', 'booking_move_enable', diff --git a/app/assets/stylesheets/app.utilities.scss b/app/assets/stylesheets/app.utilities.scss index eca31e638..245791515 100644 --- a/app/assets/stylesheets/app.utilities.scss +++ b/app/assets/stylesheets/app.utilities.scss @@ -56,6 +56,7 @@ p, .widget p { .block.hide{display: none;} .inline{display:inline-block !important;} .none{display: none;} +.pull-left{float: left;} .pull-right-lg{float: right;} .pull-none{float: none;} .rounded{border-radius: 500px;} diff --git a/app/assets/templates/admin/settings/general.html b/app/assets/templates/admin/settings/general.html index cceea1e2a..04bbee272 100644 --- a/app/assets/templates/admin/settings/general.html +++ b/app/assets/templates/admin/settings/general.html @@ -77,6 +77,14 @@ +
+

{{ 'message_of_the_events_page' }}

+
+
+ +
diff --git a/app/assets/templates/events/show.html.erb b/app/assets/templates/events/show.html.erb index fdc031755..17b611282 100644 --- a/app/assets/templates/events/show.html.erb +++ b/app/assets/templates/events/show.html.erb @@ -178,6 +178,13 @@ + +

+ +

+

+
+ diff --git a/app/models/setting.rb b/app/models/setting.rb index 49b02a568..7ed15dbbd 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -30,7 +30,8 @@ class Setting < ActiveRecord::Base fablab_name name_genre reminder_enable - reminder_delay ) + reminder_delay + event_explications_alert ) } after_update :update_stylesheet if :value_changed? diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml index 7fa15d81e..bb0d52ad7 100644 --- a/config/locales/app.admin.en.yml +++ b/config/locales/app.admin.en.yml @@ -492,6 +492,7 @@ en: warning_message_of_the_training_booking_page: "Warning message of the training booking page:" information_message_of_the_training_reservation_page: "Information message of the training reservation page:" message_of_the_subscriptions_page: "Message of the subscriptions page:" + message_of_the_events_page: "Message of the events page:" legal_documents: "Legal documents" if_these_documents_are_not_filled_no_consent_about_them_will_be_asked_to_the_user: "If these documents are not filled, no consent about them will be asked." general_terms_and_conditions_(T&C): "General terms and conditions (T&C)" diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml index e4d9ae5e4..510652ebc 100644 --- a/config/locales/app.admin.fr.yml +++ b/config/locales/app.admin.fr.yml @@ -492,6 +492,7 @@ fr: warning_message_of_the_training_booking_page: "Message d'avertissement sur la page de réservation d'une formation :" information_message_of_the_training_reservation_page: "Message d'information sur la page de réservation d'une formation :" message_of_the_subscriptions_page: "Message sur la page des abonnements :" + message_of_the_events_page: "Message sur la page des évènements :" legal_documents: "Documents légaux" if_these_documents_are_not_filled_no_consent_about_them_will_be_asked_to_the_user: "Si ces documents ne sont pas renseignés, aucun consentement à leur sujet ne sera demandé à l'utilisateur." general_terms_and_conditions_(T&C): "Conditions générales de vente (CGV)"