diff --git a/app/assets/javascripts/app.js b/app/assets/javascripts/app.js
index 38d12a332..7cfc13358 100644
--- a/app/assets/javascripts/app.js
+++ b/app/assets/javascripts/app.js
@@ -89,11 +89,9 @@ angular.module('application', ['ngCookies', 'ngResource', 'ngSanitize', 'ui.rout
$rootScope.fablabWithoutOnlinePayment = Fablab.withoutOnlinePayment;
// Global config: if true, no invoices will be generated
$rootScope.fablabWithoutInvoices = Fablab.withoutInvoices;
- // Global config: if true, the events are shown in the admin calendar
- $rootScope.eventsInCalendar = Fablab.eventsInCalendar;
// Global config: if true, user must confirm his email to sign in
$rootScope.userConfirmationNeededToSignIn = Fablab.userConfirmationNeededToSignIn;
- // Global config: if true, wallet will be disable
+ // Global config: if true, wallet will be disabled
$rootScope.fablabWithoutWallet = Fablab.fablabWithoutWallet;
// Global function to allow the user to navigate to the previous screen (ie. $state).
diff --git a/app/assets/javascripts/controllers/admin/calendar.js.erb b/app/assets/javascripts/controllers/admin/calendar.js.erb
index 5cb947ce5..e0313118b 100644
--- a/app/assets/javascripts/controllers/admin/calendar.js.erb
+++ b/app/assets/javascripts/controllers/admin/calendar.js.erb
@@ -18,8 +18,8 @@
* Controller used in the calendar management page
*/
-Application.Controllers.controller('AdminCalendarController', ['$scope', '$state', '$uibModal', 'moment', 'AuthService', 'Availability', 'Slot', 'Setting', 'Export', 'growl', 'dialogs', 'bookingWindowStart', 'bookingWindowEnd', 'machinesPromise', 'plansPromise', 'groupsPromise', 'slotDurationPromise', '_t', 'uiCalendarConfig', 'CalendarConfig', 'Member', 'uiTourService',
- function ($scope, $state, $uibModal, moment, AuthService, Availability, Slot, Setting, Export, growl, dialogs, bookingWindowStart, bookingWindowEnd, machinesPromise, plansPromise, groupsPromise, slotDurationPromise, _t, uiCalendarConfig, CalendarConfig, Member, uiTourService) {
+Application.Controllers.controller('AdminCalendarController', ['$scope', '$state', '$uibModal', 'moment', 'AuthService', 'Availability', 'Slot', 'Setting', 'Export', 'growl', 'dialogs', 'bookingWindowStart', 'bookingWindowEnd', 'machinesPromise', 'plansPromise', 'groupsPromise', 'slotDurationPromise', 'eventsInCalendarPromise', '_t', 'uiCalendarConfig', 'CalendarConfig', 'Member', 'uiTourService',
+ function ($scope, $state, $uibModal, moment, AuthService, Availability, Slot, Setting, Export, growl, dialogs, bookingWindowStart, bookingWindowEnd, machinesPromise, plansPromise, groupsPromise, slotDurationPromise, eventsInCalendarPromise, _t, uiCalendarConfig, CalendarConfig, Member, uiTourService) {
/* PRIVATE STATIC CONSTANTS */
// The calendar is divided in slots of 30 minutes
@@ -29,7 +29,7 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
const BOOKING_SNAP = '00:30:00';
// We do not allow the creation of slots that are not a multiple of 60 minutes
- const SLOT_MULTIPLE = slotDurationPromise.setting.value;
+ const SLOT_MULTIPLE = parseInt(slotDurationPromise.setting.value, 10);
/* PUBLIC SCOPE */
@@ -42,6 +42,9 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
// corresponding fullCalendar item in the DOM
$scope.availabilityDom = null;
+ // Should we show the scheduled events in the calendar?
+ $scope.eventsInCalendar = (eventsInCalendarPromise.setting.value === 'true');
+
// bind the availabilities slots with full-Calendar events
$scope.eventSources = [];
$scope.eventSources.push({
diff --git a/app/assets/javascripts/router.js.erb b/app/assets/javascripts/router.js.erb
index b85583103..a93aada18 100644
--- a/app/assets/javascripts/router.js.erb
+++ b/app/assets/javascripts/router.js.erb
@@ -589,7 +589,8 @@ angular.module('application.router', ['ui.router'])
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
plansPromise: ['Plan', function (Plan) { return Plan.query().$promise; }],
groupsPromise: ['Group', function (Group) { return Group.query().$promise; }],
- slotDurationPromise: ['Setting', function (Setting) { return Setting.get({ name: 'slot_duration' }).$promise; }]
+ slotDurationPromise: ['Setting', function (Setting) { return Setting.get({ name: 'slot_duration' }).$promise; }],
+ eventsInCalendarPromise: ['Setting', function (Setting) { return Setting.get({ name: 'events_in_calendar' }).$promise; }]
}
})
.state('app.admin.calendar.icalendar', {
@@ -1021,7 +1022,7 @@ angular.module('application.router', ['ui.router'])
'privacy_body', 'privacy_dpo', 'about_contacts', 'book_overlapping_slots', \
'home_blogpost', 'machine_explications_alert', 'training_explications_alert', 'slot_duration', \
'training_information_message', 'subscription_explications_alert', 'event_explications_alert', \
- 'space_explications_alert', 'booking_window_start', 'booking_window_end', \
+ 'space_explications_alert', 'booking_window_start', 'booking_window_end', 'events_in_calendar', \
'booking_move_enable', 'booking_move_delay', 'booking_cancel_enable', \
'booking_cancel_delay', 'main_color', 'secondary_color', \
'fablab_name', 'name_genre', 'reminder_enable', \
diff --git a/app/assets/templates/admin/settings/reservations.html b/app/assets/templates/admin/settings/reservations.html
index 4019f47e7..8c563af28 100644
--- a/app/assets/templates/admin/settings/reservations.html
+++ b/app/assets/templates/admin/settings/reservations.html
@@ -131,5 +131,10 @@
+
+
{{ 'app.admin.settings.events_in_calendar' }}
+
{{ 'app.admin.settings.events_in_calendar_info' }}
+
+
diff --git a/app/controllers/api/availabilities_controller.rb b/app/controllers/api/availabilities_controller.rb
index 76ff02bbd..8ca8f82cb 100644
--- a/app/controllers/api/availabilities_controller.rb
+++ b/app/controllers/api/availabilities_controller.rb
@@ -16,7 +16,7 @@ class API::AvailabilitiesController < API::ApiController
@availabilities = Availability.includes(:machines, :tags, :trainings, :spaces)
.where('start_at >= ? AND end_at <= ?', start_date, end_date)
- @availabilities = @availabilities.where.not(available_type: 'event') unless Rails.application.secrets.events_in_calendar
+ @availabilities = @availabilities.where.not(available_type: 'event') unless Setting.get('events_in_calendar')
@availabilities = @availabilities.where.not(available_type: 'space') if fablab_spaces_deactivated?
end
diff --git a/app/models/setting.rb b/app/models/setting.rb
index aa24093bd..5f4a61fe1 100644
--- a/app/models/setting.rb
+++ b/app/models/setting.rb
@@ -79,7 +79,8 @@ class Setting < ApplicationRecord
phone_required
tracking_id
book_overlapping_slots
- slot_duration] }
+ slot_duration
+ events_in_calendar] }
def value
last_value = history_values.order(HistoryValue.arel_table['created_at'].desc).first
last_value&.value
diff --git a/app/views/application/index.html.erb b/app/views/application/index.html.erb
index 21d39ebce..97ffaad1b 100644
--- a/app/views/application/index.html.erb
+++ b/app/views/application/index.html.erb
@@ -28,7 +28,6 @@
Fablab.withoutOnlinePayment = ('<%= Rails.application.secrets.fablab_without_online_payments %>' === 'true');
Fablab.withoutInvoices = ('<%= Rails.application.secrets.fablab_without_invoices %>' === 'true');
Fablab.fablabWithoutWallet = ('<%= Rails.application.secrets.fablab_without_wallet %>' === '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 %>";
Fablab.defaultHost = "<%= Rails.application.secrets.default_host %>";
diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml
index 0b53e14b3..ad284326d 100644
--- a/config/locales/app.admin.en.yml
+++ b/config/locales/app.admin.en.yml
@@ -1018,6 +1018,10 @@ en:
display_machine_reservation_user_name: "Display the full name of the user who booked a machine slot"
display_name: "Display the name"
display_name_enable: "name display"
+ events_in_the_calendar: "Display the events in the calendar"
+ events_in_calendar_info: "When enabled, the admin calendar will display the scheduled events, as read-only items."
+ show_event: "Show the events"
+ events_in_calendar: "events display in the calendar"
machines_sort_by: "machines display order"
fab_analytics: "Fab Analytics"
phone_required: "phone required"
diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml
index 64ebcbdef..fa9bbb37e 100644
--- a/config/locales/app.admin.fr.yml
+++ b/config/locales/app.admin.fr.yml
@@ -1018,6 +1018,10 @@ fr:
display_machine_reservation_user_name: "Afficher le nom de l'utilisateur ayant réservé une machine"
display_name: "Afficher le nom"
display_name_enable: "l'affichage du nom"
+ events_in_the_calendar: "Afficher les évènements dans l'agenda"
+ events_in_calendar_info: "Si cette option est activée, l'agenda administrateur affichera les évènements planifiés en lecture seule."
+ show_event: "Afficher les évènements"
+ events_in_calendar: "l'affichage des évènements dans l'agenda"
machines_sort_by: "l'ordre d'affichage des machines"
fab_analytics: "Fab Analytics"
phone_required: "téléphone requis"
diff --git a/config/secrets.yml b/config/secrets.yml
index 1eea9e04d..ece1cda1e 100644
--- a/config/secrets.yml
+++ b/config/secrets.yml
@@ -22,8 +22,6 @@ development:
fablab_without_invoices: <%= ENV["FABLAB_WITHOUT_INVOICES"] %>
fablab_without_wallet: <%= ENV["FABLAB_WITHOUT_WALLET"] %>
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>
- events_in_calendar: <%= ENV["EVENTS_IN_CALENDAR"] %>
- slot_duration: <%= ENV["SLOT_DURATION"] %>
feature_tour_display: <%= ENV["FEATURE_TOUR_DISPLAY"] %>
default_host: <%= ENV["DEFAULT_HOST"] %>
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
@@ -68,8 +66,6 @@ test:
fablab_without_invoices: false
fablab_without_wallet: false
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>
- events_in_calendar: false
- slot_duration: 60
feature_tour_display: <%= ENV["FEATURE_TOUR_DISPLAY"] %>
default_host: <%= ENV["DEFAULT_HOST"] %>
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
@@ -114,8 +110,6 @@ staging:
fablab_without_invoices: <%= ENV["FABLAB_WITHOUT_INVOICES"] %>
fablab_without_wallet: <%= ENV["FABLAB_WITHOUT_WALLET"] %>
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>
- events_in_calendar: <%= ENV["EVENTS_IN_CALENDAR"] %>
- slot_duration: <%= ENV["SLOT_DURATION"] %>
feature_tour_display: <%= ENV["FEATURE_TOUR_DISPLAY"] %>
default_host: <%= ENV["DEFAULT_HOST"] %>
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
@@ -171,8 +165,6 @@ production:
fablab_without_invoices: <%= ENV["FABLAB_WITHOUT_INVOICES"] %>
fablab_without_wallet: <%= ENV["FABLAB_WITHOUT_WALLET"] %>
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>
- events_in_calendar: <%= ENV["EVENTS_IN_CALENDAR"] %>
- slot_duration: <%= ENV["SLOT_DURATION"] %>
feature_tour_display: <%= ENV["FEATURE_TOUR_DISPLAY"] %>
default_host: <%= ENV["DEFAULT_HOST"] %>
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
diff --git a/doc/environment.md b/doc/environment.md
index 5786a0418..64e0116da 100644
--- a/doc/environment.md
+++ b/doc/environment.md
@@ -118,11 +118,6 @@ This is useful if you won't use wallet system.
If set to 'true' the users will need to confirm their email address to be able to sign in.
Set to 'false' if you don't want this behaviour.
-
-
- EVENTS_IN_CALENDAR
-
-If set to 'true', the admin calendar will display the scheduled events in the current view, as read-only items.
DEFAULT_MAIL_FROM
diff --git a/env.example b/env.example
index 0801b6356..5e3f8c3be 100644
--- a/env.example
+++ b/env.example
@@ -25,8 +25,6 @@ FABLAB_WITHOUT_WALLET=false
USER_CONFIRMATION_NEEDED_TO_SIGN_IN=false
-EVENTS_IN_CALENDAR=false
-SLOT_DURATION=60
FEATURE_TOUR_DISPLAY=once
DEFAULT_MAIL_FROM=Fab-manager Demo
diff --git a/lib/tasks/fablab/setup.rake b/lib/tasks/fablab/setup.rake
index d7d96dcad..426b34877 100644
--- a/lib/tasks/fablab/setup.rake
+++ b/lib/tasks/fablab/setup.rake
@@ -107,7 +107,8 @@ namespace :fablab do
%w[PHONE_REQUIRED phone_required true],
%w[GA_ID tracking_id],
%w[BOOK_SLOT_AT_SAME_TIME book_overlapping_slots true],
- %w[SLOT_DURATION slot_duration 60]
+ %w[SLOT_DURATION slot_duration 60],
+ %w[EVENTS_IN_CALENDAR events_in_calendar false]
]
mapping.each do |m|
diff --git a/setup/env.example b/setup/env.example
index 015959f21..43271037b 100644
--- a/setup/env.example
+++ b/setup/env.example
@@ -16,7 +16,6 @@ FABLAB_WITHOUT_INVOICES=false
PHONE_REQUIRED=false
FABLAB_WITHOUT_WALLET=false
-EVENTS_IN_CALENDAR=true
SLOT_DURATION=60
FEATURE_TOUR_DISPLAY=once
diff --git a/setup/setup.sh b/setup/setup.sh
index 63f9955c7..a9be714d3 100755
--- a/setup/setup.sh
+++ b/setup/setup.sh
@@ -235,7 +235,7 @@ configure_env_file()
local doc variables secret
doc=$(\curl -sSL https://raw.githubusercontent.com/sleede/fab-manager/master/doc/environment.md)
variables=(STRIPE_API_KEY STRIPE_PUBLISHABLE_KEY STRIPE_CURRENCY INVOICE_PREFIX FABLAB_WITHOUT_PLANS FABLAB_WITHOUT_SPACES FABLAB_WITHOUT_ONLINE_PAYMENT FABLAB_WITHOUT_INVOICES FABLAB_WITHOUT_WALLET \
- USER_CONFIRMATION_NEEDED_TO_SIGN_IN EVENTS_IN_CALENDAR SLOT_DURATION DEFAULT_MAIL_FROM DELIVERY_METHOD DEFAULT_HOST DEFAULT_PROTOCOL SMTP_ADDRESS SMTP_PORT SMTP_USER_NAME SMTP_PASSWORD SMTP_AUTHENTICATION \
+ USER_CONFIRMATION_NEEDED_TO_SIGN_IN DEFAULT_MAIL_FROM DELIVERY_METHOD DEFAULT_HOST DEFAULT_PROTOCOL SMTP_ADDRESS SMTP_PORT SMTP_USER_NAME SMTP_PASSWORD SMTP_AUTHENTICATION \
SMTP_ENABLE_STARTTLS_AUTO SMTP_OPENSSL_VERIFY_MODE SMTP_TLS RECAPTCHA_SITE_KEY RECAPTCHA_SECRET_KEY DISQUS_SHORTNAME TWITTER_NAME \
FACEBOOK_APP_ID LOG_LEVEL ALLOWED_EXTENSIONS ALLOWED_MIME_TYPES MAX_IMAGE_SIZE MAX_CAO_SIZE MAX_IMPORT_SIZE DISK_SPACE_MB_ALERT FEATURE_TOUR_DISPLAY \
SUPERADMIN_EMAIL APP_LOCALE RAILS_LOCALE MOMENT_LOCALE SUMMERNOTE_LOCALE ANGULAR_LOCALE FULLCALENDAR_LOCALE ELASTICSEARCH_LANGUAGE_ANALYZER TIME_ZONE \
diff --git a/test/fixtures/history_values.yml b/test/fixtures/history_values.yml
index d149519a4..37eeac774 100644
--- a/test/fixtures/history_values.yml
+++ b/test/fixtures/history_values.yml
@@ -584,3 +584,12 @@ value_history_60:
created_at: 2020-03-25 09:24:09.016676894 Z
updated_at: 2020-03-25 09:24:09.016676894 Z
footprint:
+
+history_value_61:
+ id: 61
+ setting_id: 61
+ invoicing_profile_id: 1
+ value: '60'
+ created_at: 2020-05-22 15:22:08.254410000 Z
+ updated_at: 2020-05-22 15:22:08.254410000 Z
+ footprint:
diff --git a/test/fixtures/settings.yml b/test/fixtures/settings.yml
index 0264f52e5..0fa1d1296 100644
--- a/test/fixtures/settings.yml
+++ b/test/fixtures/settings.yml
@@ -351,4 +351,10 @@ setting_60:
id: 60
name: home_content
created_at: 2020-03-25 09:21:35.200795784 Z
- updated_at: 2020-03-25 09:21:35.200795784 Z
\ No newline at end of file
+ updated_at: 2020-03-25 09:21:35.200795784 Z
+
+setting_61:
+ id: 61
+ name: slot_duration
+ created_at: 2020-05-22 15:20:25.254250000 Z
+ updated_at: 2020-05-22 15:20:25.254250000 Z