1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-29 18:52:22 +01:00

configure events_in_calendar form the UI panel

This commit is contained in:
Sylvain 2020-05-25 17:36:53 +02:00
parent 57ceeec2e7
commit acefc325f6
17 changed files with 45 additions and 30 deletions

View File

@ -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).

View File

@ -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({

View File

@ -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', \

View File

@ -131,5 +131,10 @@
<p class="alert alert-warning m-h-md" ng-bind-html="'app.admin.settings.display_name_info_html' | translate"></p>
<boolean-setting name="display_name_enable" settings="allSettings" label="app.admin.settings.display_name" classes="m-l"></boolean-setting>
</div>
<div class="row">
<h3 class="m-l" translate>{{ 'app.admin.settings.events_in_calendar' }}</h3>
<p class="alert alert-warning m-h-md" translate>{{ 'app.admin.settings.events_in_calendar_info' }}</p>
<boolean-setting name="events_in_calendar" settings="allSettings" label="app.admin.settings.show_event" classes="m-l"></boolean-setting>
</div>
</div>
</div>

View File

@ -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

View File

@ -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

View File

@ -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 %>";

View File

@ -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"

View File

@ -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"

View File

@ -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"] %>

View File

@ -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.
<a name="EVENTS_IN_CALENDAR"></a>
EVENTS_IN_CALENDAR
If set to 'true', the admin calendar will display the scheduled events in the current view, as read-only items.
<a name="DEFAULT_MAIL_FROM"></a>
DEFAULT_MAIL_FROM

View File

@ -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 <noreply@fab-manager.com>

View File

@ -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|

View File

@ -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

View File

@ -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 \

View File

@ -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:

View File

@ -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
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