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

configure the slots duration with an environment variable

This commit is contained in:
Sylvain 2019-10-29 16:52:52 +01:00
parent 12b9155b43
commit cdc30e0da2
7 changed files with 17 additions and 2 deletions

View File

@ -30,7 +30,7 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
const BOOKING_SNAP = '00:30:00'; const BOOKING_SNAP = '00:30:00';
// We do not allow the creation of slots that are not a multiple of 60 minutes // We do not allow the creation of slots that are not a multiple of 60 minutes
const SLOT_MULTIPLE = 60; const SLOT_MULTIPLE = Fablab.slotDuration;
/* PUBLIC SCOPE */ /* PUBLIC SCOPE */

View File

@ -7,7 +7,7 @@ module ApplicationHelper
require 'message_format' require 'message_format'
## machine/spaces availabilities are divided in multiple slots of 60 minutes ## machine/spaces availabilities are divided in multiple slots of 60 minutes
SLOT_DURATION ||= 60 SLOT_DURATION ||= Rails.application.secrets.slot_duration || 60
## ##
# Verify if the provided attribute is in the provided attributes array, whatever it exists or not # Verify if the provided attribute is in the provided attributes array, whatever it exists or not

View File

@ -20,6 +20,7 @@
Fablab.withoutSpaces = ('<%= Rails.application.secrets.fablab_without_spaces %>' !== 'false'); Fablab.withoutSpaces = ('<%= Rails.application.secrets.fablab_without_spaces %>' !== 'false');
Fablab.withoutOnlinePayment = ('<%= Rails.application.secrets.fablab_without_online_payments %>' === 'true'); Fablab.withoutOnlinePayment = ('<%= Rails.application.secrets.fablab_without_online_payments %>' === 'true');
Fablab.withoutInvoices = ('<%= Rails.application.secrets.fablab_without_invoices %>' === 'true'); Fablab.withoutInvoices = ('<%= Rails.application.secrets.fablab_without_invoices %>' === 'true');
Fablab.slotDuration = parseInt("<%= ApplicationHelper::SLOT_DURATION %>", 10);
Fablab.disqusShortname = "<%= Rails.application.secrets.disqus_shortname %>"; Fablab.disqusShortname = "<%= Rails.application.secrets.disqus_shortname %>";
Fablab.defaultHost = "<%= Rails.application.secrets.default_host %>"; Fablab.defaultHost = "<%= Rails.application.secrets.default_host %>";
Fablab.gaId = "<%= Rails.application.secrets.google_analytics_id %>"; Fablab.gaId = "<%= Rails.application.secrets.google_analytics_id %>";

View File

@ -21,6 +21,8 @@ FABLAB_WITHOUT_SPACES: 'true'
FABLAB_WITHOUT_ONLINE_PAYMENT: 'false' FABLAB_WITHOUT_ONLINE_PAYMENT: 'false'
FABLAB_WITHOUT_INVOICES: 'false' FABLAB_WITHOUT_INVOICES: 'false'
SLOT_DURATION: '60'
DEFAULT_MAIL_FROM: Fab Manager Demo <noreply@fab-manager.com> DEFAULT_MAIL_FROM: Fab Manager Demo <noreply@fab-manager.com>
# Configure carefully! # Configure carefully!

View File

@ -20,6 +20,7 @@ development:
fablab_without_spaces: <%= ENV["FABLAB_WITHOUT_SPACES"] %> fablab_without_spaces: <%= ENV["FABLAB_WITHOUT_SPACES"] %>
fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %> fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %>
fablab_without_invoices: <%= ENV["FABLAB_WITHOUT_INVOICES"] %> fablab_without_invoices: <%= ENV["FABLAB_WITHOUT_INVOICES"] %>
slot_duration: <%= ENV["SLOT_DURATION"] %>
default_host: <%= ENV["DEFAULT_HOST"] %> default_host: <%= ENV["DEFAULT_HOST"] %>
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %> default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
time_zone: <%= ENV["TIME_ZONE"] %> time_zone: <%= ENV["TIME_ZONE"] %>
@ -62,6 +63,7 @@ test:
fablab_without_spaces: false fablab_without_spaces: false
fablab_without_online_payments: false fablab_without_online_payments: false
fablab_without_invoices: false fablab_without_invoices: false
slot_duration: <%= ENV["SLOT_DURATION"] %>
default_host: <%= ENV["DEFAULT_HOST"] %> default_host: <%= ENV["DEFAULT_HOST"] %>
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %> default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
time_zone: Paris time_zone: Paris
@ -104,6 +106,7 @@ staging:
fablab_without_spaces: <%= ENV["FABLAB_WITHOUT_SPACES"] %> fablab_without_spaces: <%= ENV["FABLAB_WITHOUT_SPACES"] %>
fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %> fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %>
fablab_without_invoices: <%= ENV["FABLAB_WITHOUT_INVOICES"] %> fablab_without_invoices: <%= ENV["FABLAB_WITHOUT_INVOICES"] %>
slot_duration: <%= ENV["SLOT_DURATION"] %>
default_host: <%= ENV["DEFAULT_HOST"] %> default_host: <%= ENV["DEFAULT_HOST"] %>
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %> default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
delivery_method: <%= ENV['DELIVERY_METHOD'] %> delivery_method: <%= ENV['DELIVERY_METHOD'] %>
@ -157,6 +160,7 @@ production:
fablab_without_spaces: <%= ENV["FABLAB_WITHOUT_SPACES"] %> fablab_without_spaces: <%= ENV["FABLAB_WITHOUT_SPACES"] %>
fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %> fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %>
fablab_without_invoices: <%= ENV["FABLAB_WITHOUT_INVOICES"] %> fablab_without_invoices: <%= ENV["FABLAB_WITHOUT_INVOICES"] %>
slot_duration: <%= ENV["SLOT_DURATION"] %>
default_host: <%= ENV["DEFAULT_HOST"] %> default_host: <%= ENV["DEFAULT_HOST"] %>
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %> default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
delivery_method: <%= ENV['DELIVERY_METHOD'] %> delivery_method: <%= ENV['DELIVERY_METHOD'] %>

View File

@ -102,6 +102,12 @@ Valid stripe API keys are still required, even if you don't require online payme
If set to 'true', the invoices will be disabled. If set to 'true', the invoices will be disabled.
This is useful if you have your own invoicing system and you want to prevent Fab-manager from generating and sending invoices to members. This is useful if you have your own invoicing system and you want to prevent Fab-manager from generating and sending invoices to members.
**Very important**: if you disable invoices, you still have to configure VAT in the interface to prevent errors in accounting and prices. **Very important**: if you disable invoices, you still have to configure VAT in the interface to prevent errors in accounting and prices.
<a name="SLOT_DURATION"></a>
SLOT_DURATION
Machine and space availabilities are divided in multiple slots of the duration set by this variable.
Default value is 60 minutes (1 hour).
<a name="DEFAULT_MAIL_FROM"></a> <a name="DEFAULT_MAIL_FROM"></a>
DEFAULT_MAIL_FROM DEFAULT_MAIL_FROM

View File

@ -14,6 +14,8 @@ FABLAB_WITHOUT_SPACES=true
FABLAB_WITHOUT_ONLINE_PAYMENT=true FABLAB_WITHOUT_ONLINE_PAYMENT=true
FABLAB_WITHOUT_INVOICES=false FABLAB_WITHOUT_INVOICES=false
SLOT_DURATION=60
DEFAULT_MAIL_FROM=Fab Manager Demo <noreply@fab-manager.com> DEFAULT_MAIL_FROM=Fab Manager Demo <noreply@fab-manager.com>
DEFAULT_HOST=demo.fab-manager.com DEFAULT_HOST=demo.fab-manager.com
DEFAULT_PROTOCOL=http DEFAULT_PROTOCOL=http