1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

ability to disable the public agenda

This commit is contained in:
Sylvain 2021-06-15 11:57:43 +02:00
parent 5f598b7a60
commit 11579fede4
12 changed files with 40 additions and 11 deletions

View File

@ -1,11 +1,13 @@
# Changelog Fab-manager
- Ability to disable the public agenda
- Display the category in the plans list
- Do not display the type in the plans list
- Updated medium-editor to v5 and angular-medium-editor accordingly
- Fix a bug: a message tells that creating a new plan fails, but it worked
- Fix a bug: unable to select no category in plan creation/edition after a category selection
- Fix a bug: the training validation modal shows cancelled trainings
- [TODO DEPLOY] `rails db:seed`
## v5.0.3 2021 June 14

View File

@ -23,12 +23,6 @@ Application.Controllers.controller('MainNavController', ['$scope', function ($sc
class: 'home-link'
},
{ class: 'menu-spacer' },
{
state: 'app.public.calendar',
linkText: 'app.public.common.public_calendar',
linkIcon: 'calendar',
class: 'public-calendar-link'
},
{
state: 'app.public.machines_list',
linkText: 'app.public.common.reserve_a_machine',
@ -79,6 +73,15 @@ Application.Controllers.controller('MainNavController', ['$scope', function ($sc
});
}
if ($scope.$root.modules.publicAgenda) {
$scope.navLinks.splice(2, 0, {
state: 'app.public.calendar',
linkText: 'app.public.common.public_calendar',
linkIcon: 'calendar',
class: 'public-calendar-link'
});
}
Fablab.adminNavLinks = Fablab.adminNavLinks || [];
const adminNavLinks = [
{

View File

@ -107,7 +107,8 @@ export enum SettingName {
PayZenEndpoint = 'payzen_endpoint',
PayZenPublicKey = 'payzen_public_key',
PayZenHmacKey = 'payzen_hmac',
PayZenCurrency = 'payzen_currency'
PayZenCurrency = 'payzen_currency',
PublicAgendaModule = 'public_agenda_module'
}
export interface Setting {

View File

@ -38,7 +38,7 @@ angular.module('application.router', ['ui.router'])
logoFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'logo-file' }).$promise; }],
logoBlackFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'logo-black-file' }).$promise; }],
sharedTranslations: ['Translations', function (Translations) { return Translations.query(['app.shared', 'app.public.common']).$promise; }],
modulesPromise: ['Setting', function (Setting) { return Setting.query({ names: "['spaces_module', 'plans_module', 'invoicing_module', 'wallet_module', 'statistics_module', 'trainings_module']" }).$promise; }]
modulesPromise: ['Setting', function (Setting) { return Setting.query({ names: "['spaces_module', 'plans_module', 'invoicing_module', 'wallet_module', 'statistics_module', 'trainings_module', 'public_agenda_module']" }).$promise; }]
},
onEnter: ['$rootScope', 'logoFile', 'logoBlackFile', 'modulesPromise', 'CSRF', function ($rootScope, logoFile, logoBlackFile, modulesPromise, CSRF) {
// Retrieve Anti-CSRF tokens from cookies
@ -52,6 +52,7 @@ angular.module('application.router', ['ui.router'])
trainings: (modulesPromise.trainings_module === 'true'),
invoicing: (modulesPromise.invoicing_module === 'true'),
wallet: (modulesPromise.wallet_module === 'true'),
publicAgenda: (modulesPromise.public_agenda_module === 'true'),
statistics: (modulesPromise.statistics_module === 'true')
};
}]
@ -570,6 +571,7 @@ angular.module('application.router', ['ui.router'])
// global calendar (trainings, machines and events)
.state('app.public.calendar', {
url: '/calendar',
abstract: !Fablab.publicAgendaModule,
views: {
'main@': {
templateUrl: '/calendar/calendar.html',
@ -1078,7 +1080,7 @@ angular.module('application.router', ['ui.router'])
"'fablab_name', 'name_genre', 'reminder_enable', 'plans_module', 'confirmation_required', " +
"'reminder_delay', 'visibility_yearly', 'visibility_others', 'wallet_module', 'trainings_module', " +
"'display_name_enable', 'machines_sort_by', 'fab_analytics', 'statistics_module', 'address_required', " +
"'link_name', 'home_content', 'home_css', 'phone_required', 'upcoming_events_shown']"
"'link_name', 'home_content', 'home_css', 'phone_required', 'upcoming_events_shown', 'public_agenda_module']"
}).$promise;
}],
privacyDraftsPromise: ['Setting', function (Setting) { return Setting.get({ name: 'privacy_draft', history: true }).$promise; }],

View File

@ -517,6 +517,14 @@
label="app.admin.settings.general.enable_wallet"
classes="m-l"></boolean-setting>
</div>
<div class="row">
<h3 class="m-l" translate>{{ 'app.admin.settings.general.public_agenda' }}</h3>
<p class="alert alert-warning m-h-md" ng-bind-html="'app.admin.settings.general.public_agenda_info_html' | translate"></p>
<boolean-setting name="public_agenda_module"
settings="allSettings"
label="app.admin.settings.general.enable_public_agenda"
classes="m-l"></boolean-setting>
</div>
<div class="row">
<h3 class="m-l" translate>{{ 'app.admin.settings.general.statistics' }}</h3>
<p class="alert alert-warning m-h-md" ng-bind-html="'app.admin.settings.general.statistics_info_html' | translate"></p>

View File

@ -117,7 +117,8 @@ class Setting < ApplicationRecord
payzen_endpoint
payzen_public_key
payzen_hmac
payzen_currency] }
payzen_currency
public_agenda_module] }
# WARNING: when adding a new key, you may also want to add it in app/policies/setting_policy.rb#public_whitelist
def value

View File

@ -39,7 +39,7 @@ class SettingPolicy < ApplicationPolicy
tracking_id book_overlapping_slots slot_duration events_in_calendar spaces_module plans_module invoicing_module
recaptcha_site_key feature_tour_display disqus_shortname allowed_cad_extensions openlab_app_id openlab_default
online_payment_module stripe_public_key confirmation_required wallet_module trainings_module address_required
payment_gateway payzen_endpoint payzen_public_key]
payment_gateway payzen_endpoint payzen_public_key public_agenda_module]
end
##

View File

@ -36,6 +36,7 @@
Fablab.spacesModule = ('<%= Setting.get('spaces_module') %>' === 'true');
Fablab.trainingsModule = ('<%= Setting.get('trainings_module') %>' === 'true');
Fablab.walletModule = ('<%= Setting.get('wallet_module') %>' === 'true');
Fablab.publicAgendaModule = ('<%= Setting.get('public_agenda_module') %>' === 'true');
Fablab.statisticsModule = ('<%= Setting.get('statistics_module') %>' === 'true');
Fablab.defaultHost = "<%= Rails.application.secrets.default_host %>";
Fablab.trackingId = "<%= Setting.get('tracking_id') %>";

View File

@ -1167,6 +1167,7 @@ en:
confirmation_required_info: "Optionally, you can force the users to confirm their email address before being able to access Fab-manager."
confirmation_is_required: "Confirmation required"
wallet_module: "wallet module"
public_agenda_module: "public agenda module"
statistics_module: "statistics module"
upcoming_events_shown: "display limit for upcoming events"
general:
@ -1205,6 +1206,9 @@ en:
wallet: "Wallet"
wallet_info_html: "<p>The virtual wallet allows you to allocate a sum of money to users. Then, can spend this money as they wish, in Fab-manager.</p><p>Members cannot credit their wallet themselves, it's a privilege of managers and administrators.</p>"
enable_wallet: "Enable wallet"
public_agenda: "Public agenda"
public_agenda_info_html: "<p>The public agenda offers to members and visitors a general overview of the Fablab's planning.</p><p>Please note that, even logged, users won't be able to book a reservation or modify anything from this agenda: this is a read-only page.</p>"
enable_public_agenda: "Enable public agenda"
statistics: "Statistics"
statistics_info_html: "<p>Enable or disable the statistics module.</p><p>If enabled, every nights, the data of the day just passed will be consolidated in the database of a powerful analysis engine. Then, every administrators will be able to browse statistical charts and tables in the corresponding section.</p>"
enable_statistics: "Enable statistics"

View File

@ -1167,6 +1167,7 @@ fr:
confirmation_required_info: "De manière optionnelle, vous pouvez forcer les utilisateurs à confirmer leur adresse électronique avant de pouvoir accéder à Fab-manager."
confirmation_is_required: "Confirmation requise"
wallet_module: "module porte-monnaie"
public_agenda_module: "module d'agenda public"
statistics_module: "module de statistiques"
upcoming_events_shown: "la limite d'affichage des événements à venir"
general:
@ -1205,6 +1206,9 @@ fr:
wallet: "Porte-monnaie"
wallet_info_html: "<p>Le porte-monnaie virtuel vous permet d'allouer une certaine somme d'argent aux utilisateurs. Ils peuvent ensuite dépenser cet argent comment bon leur semble, dans Fab-manager.</p><p>Les membres ne peuvent pas créditer leur porte-monnaie eux-même, c'est un privilège des gestionnaires et des administrateurs.</p>"
enable_wallet: "Activer le porte-monnaie"
public_agenda: "Agenda public"
public_agenda_info_html: "<p>L'agenda public aux membres et aux visiteurs une vue générale du planning du FabLab.</p><p>Veuillez noter que, même connectés, les utilisateurs ne pourront ni réserver ni modifier quoi que ce soit depuis cet agenda : c'est une page en lecture seule.</p>"
enable_public_agenda: "Activer l'agenda public"
statistics: "Statistiques"
statistics_info_html: "<p>Activer ou désactiver le module de statistiques.</p><p>Si activé, chaque nuit, les données de la journée qui vient de s'écouler seront consolidées dans la base de données d'un puissant moteur d'analyse. Ensuite, chaque administrateur pourra parcourir les tableaux et graphiques statistiques dans la section correspondante.</p>"
enable_statistics: "Activer les statistiques"

View File

@ -525,3 +525,4 @@ en:
payzen_public_key: "PayZen client public key"
payzen_hmac: "PayZen HMAC-SHA-256 key"
payzen_currency: "PayZen currency"
public_agenda_module: "Public agenda module"

View File

@ -895,6 +895,8 @@ Setting.set('upcoming_events_shown', 'until_start') unless Setting.find_by(name:
Setting.set('trainings_module', true) unless Setting.find_by(name: 'trainings_module').try(:value)
Setting.set('public_agenda_module', true) unless Setting.find_by(name: 'public_agenda_module').try(:value)
if StatisticCustomAggregation.count.zero?
# available reservations hours for machines
machine_hours = StatisticType.find_by(key: 'hour', statistic_index_id: 2)