diff --git a/app/assets/javascripts/controllers/events.js.erb b/app/assets/javascripts/controllers/events.js.erb index 40768ee4b..514d331f3 100644 --- a/app/assets/javascripts/controllers/events.js.erb +++ b/app/assets/javascripts/controllers/events.js.erb @@ -859,6 +859,7 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', ' controller: 'ReserveSlotSameTimeController', resolve: { sameTimeReservations: function() { return sameTimeReservations; }, + bookOverlappingSlotsPromise: ['Setting', function (Setting) { return Setting.get({ name: 'book_overlapping_slots' }).$promise; }] } }); modalInstance.result.then(callback); diff --git a/app/assets/javascripts/directives/cart.js.erb b/app/assets/javascripts/directives/cart.js.erb index 35fb70539..8fe332ac7 100644 --- a/app/assets/javascripts/directives/cart.js.erb +++ b/app/assets/javascripts/directives/cart.js.erb @@ -361,7 +361,8 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs', size: 'md', controller: 'ReserveSlotSameTimeController', resolve: { - sameTimeReservations: function() { return sameTimeReservations; } + sameTimeReservations: function() { return sameTimeReservations; }, + bookOverlappingSlotsPromise: ['Setting', function (Setting) { return Setting.get({ name: 'book_overlapping_slots' }).$promise; }] } }); modalInstance.result.then(function(res) { @@ -783,10 +784,10 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs', /** * Controller of the modal showing the reservations the same date at the same time */ -Application.Controllers.controller('ReserveSlotSameTimeController', ['$scope', '$uibModalInstance', 'AuthService', 'sameTimeReservations', - function ($scope, $uibModalInstance, AuthService, sameTimeReservations) { +Application.Controllers.controller('ReserveSlotSameTimeController', ['$scope', '$uibModalInstance', 'AuthService', 'sameTimeReservations', 'bookOverlappingSlotsPromise', + function ($scope, $uibModalInstance, AuthService, sameTimeReservations, bookOverlappingSlotsPromise) { $scope.sameTimeReservations = sameTimeReservations; - $scope.bookSlotAtSameTime = Fablab.bookSlotAtSameTime; + $scope.bookSlotAtSameTime = (bookOverlappingSlotsPromise.setting.value === 'true'); $scope.isAuthorized = AuthService.isAuthorized; /** * Confirmation callback diff --git a/app/views/application/index.html.erb b/app/views/application/index.html.erb index 278c69b54..21e4ffc75 100644 --- a/app/views/application/index.html.erb +++ b/app/views/application/index.html.erb @@ -29,7 +29,6 @@ Fablab.withoutInvoices = ('<%= Rails.application.secrets.fablab_without_invoices %>' === 'true'); Fablab.phoneRequired = ('<%= Setting.get('phone_required') %>' === 'true'); Fablab.fablabWithoutWallet = ('<%= Rails.application.secrets.fablab_without_wallet %>' === 'true'); - Fablab.bookSlotAtSameTime = ('<%= Setting.get('book_overlapping_slots') %>' === 'true'); Fablab.eventsInCalendar = ('<%= Rails.application.secrets.events_in_calendar %>' === 'true'); Fablab.featureTourDisplay = "<%= Rails.application.secrets.feature_tour_display %>"; Fablab.disqusShortname = "<%= Rails.application.secrets.disqus_shortname %>";