1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00

help tour for managers

This commit is contained in:
Sylvain 2020-04-29 15:20:39 +02:00
parent 59a20d71bd
commit ff9636e12f
12 changed files with 153 additions and 141 deletions

View File

@ -18,8 +18,8 @@
* Controller used in the calendar management page
*/
Application.Controllers.controller('AdminCalendarController', ['$scope', '$state', '$uibModal', 'moment', 'Availability', 'Slot', 'Setting', 'Export', 'growl', 'dialogs', 'bookingWindowStart', 'bookingWindowEnd', 'machinesPromise', 'plansPromise', 'groupsPromise', '_t', 'uiCalendarConfig', 'CalendarConfig', 'Member', 'uiTourService',
function ($scope, $state, $uibModal, moment, Availability, Slot, Setting, Export, growl, dialogs, bookingWindowStart, bookingWindowEnd, machinesPromise, plansPromise, groupsPromise, _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', '_t', 'uiCalendarConfig', 'CalendarConfig', 'Member', 'uiTourService',
function ($scope, $state, $uibModal, moment, AuthService, Availability, Slot, Setting, Export, growl, dialogs, bookingWindowStart, bookingWindowEnd, machinesPromise, plansPromise, groupsPromise, _t, uiCalendarConfig, CalendarConfig, Member, uiTourService) {
/* PRIVATE STATIC CONSTANTS */
// The calendar is divided in slots of 30 minutes
@ -313,14 +313,16 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
placement: 'right',
popupClass: 'width-350'
});
uitour.createStep({
selector: '.admin-calendar .export-xls-button',
stepId: 'export',
order: 2,
title: _t('app.admin.tour.calendar.export.title'),
content: _t('app.admin.tour.calendar.export.content'),
placement: 'left'
});
if (AuthService.isAuthorized('admin')) {
uitour.createStep({
selector: '.admin-calendar .export-xls-button',
stepId: 'export',
order: 2,
title: _t('app.admin.tour.calendar.export.title'),
content: _t('app.admin.tour.calendar.export.content'),
placement: 'left'
});
}
uitour.createStep({
selector: '.heading .import-ics-button',
stepId: 'import',

View File

@ -153,8 +153,8 @@ class EventsController {
/**
* Controller used in the events listing page (admin view)
*/
Application.Controllers.controller('AdminEventsController', ['$scope', '$state', 'dialogs', '$uibModal', 'growl', 'Event', 'Category', 'EventTheme', 'AgeRange', 'PriceCategory', 'eventsPromise', 'categoriesPromise', 'themesPromise', 'ageRangesPromise', 'priceCategoriesPromise', '_t', 'Member', 'uiTourService',
function ($scope, $state, dialogs, $uibModal, growl, Event, Category, EventTheme, AgeRange, PriceCategory, eventsPromise, categoriesPromise, themesPromise, ageRangesPromise, priceCategoriesPromise, _t, Member, uiTourService) {
Application.Controllers.controller('AdminEventsController', ['$scope', '$state', 'dialogs', '$uibModal', 'growl', 'AuthService', 'Event', 'Category', 'EventTheme', 'AgeRange', 'PriceCategory', 'eventsPromise', 'categoriesPromise', 'themesPromise', 'ageRangesPromise', 'priceCategoriesPromise', '_t', 'Member', 'uiTourService',
function ($scope, $state, dialogs, $uibModal, growl, AuthService, Event, Category, EventTheme, AgeRange, PriceCategory, eventsPromise, categoriesPromise, themesPromise, ageRangesPromise, priceCategoriesPromise, _t, Member, uiTourService) {
/* PUBLIC SCOPE */
// By default, the pagination mode is activated to limit the page size
@ -407,38 +407,40 @@ Application.Controllers.controller('AdminEventsController', ['$scope', '$state',
content: _t('app.admin.tour.events.filter.content'),
placement: 'bottom'
});
uitour.createStep({
selector: '.events-management .events-categories',
stepId: 'categories',
order: 3,
title: _t('app.admin.tour.events.categories.title'),
content: _t('app.admin.tour.events.categories.content'),
placement: 'bottom'
});
uitour.createStep({
selector: '.events-management .events-themes',
stepId: 'themes',
order: 4,
title: _t('app.admin.tour.events.themes.title'),
content: _t('app.admin.tour.events.themes.content'),
placement: 'top'
});
uitour.createStep({
selector: '.events-management .events-age-ranges',
stepId: 'ages',
order: 5,
title: _t('app.admin.tour.events.ages.title'),
content: _t('app.admin.tour.events.ages.content'),
placement: 'top'
});
uitour.createStep({
selector: '.events-management .prices-tab',
stepId: 'prices',
order: 6,
title: _t('app.admin.tour.events.prices.title'),
content: _t('app.admin.tour.events.prices.content'),
placement: 'bottom'
});
if (AuthService.isAuthorized('admin')) {
uitour.createStep({
selector: '.events-management .events-categories',
stepId: 'categories',
order: 3,
title: _t('app.admin.tour.events.categories.title'),
content: _t('app.admin.tour.events.categories.content'),
placement: 'bottom'
});
uitour.createStep({
selector: '.events-management .events-themes',
stepId: 'themes',
order: 4,
title: _t('app.admin.tour.events.themes.title'),
content: _t('app.admin.tour.events.themes.content'),
placement: 'top'
});
uitour.createStep({
selector: '.events-management .events-age-ranges',
stepId: 'ages',
order: 5,
title: _t('app.admin.tour.events.ages.title'),
content: _t('app.admin.tour.events.ages.content'),
placement: 'top'
});
uitour.createStep({
selector: '.events-management .prices-tab',
stepId: 'prices',
order: 6,
title: _t('app.admin.tour.events.prices.title'),
content: _t('app.admin.tour.events.prices.content'),
placement: 'bottom'
});
}
uitour.createStep({
selector: 'body',
stepId: 'conclusion',

View File

@ -17,8 +17,8 @@
/**
* Controller used in the admin invoices listing page
*/
Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'Invoice', 'AccountingPeriod', 'invoices', 'closedPeriods', '$uibModal', 'growl', '$filter', 'Setting', 'settings', '_t', 'Member', 'uiTourService',
function ($scope, $state, Invoice, AccountingPeriod, invoices, closedPeriods, $uibModal, growl, $filter, Setting, settings, _t, Member, uiTourService) {
Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'Invoice', 'AccountingPeriod', 'AuthService', 'invoices', 'closedPeriods', '$uibModal', 'growl', '$filter', 'Setting', 'settings', '_t', 'Member', 'uiTourService',
function ($scope, $state, Invoice, AccountingPeriod, AuthService, invoices, closedPeriods, $uibModal, growl, $filter, Setting, settings, _t, Member, uiTourService) {
/* PRIVATE STATIC CONSTANTS */
// number of invoices loaded each time we click on 'load more...'
@ -625,39 +625,41 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
placement: 'left'
});
}
uitour.createStep({
selector: '.invoices-management .invoices-settings',
stepId: 'settings',
order: 5,
title: _t('app.admin.tour.invoices.settings.title'),
content: _t('app.admin.tour.invoices.settings.content'),
placement: 'bottom'
});
uitour.createStep({
selector: '.invoices-management .accounting-codes-tab',
stepId: 'codes',
order: 6,
title: _t('app.admin.tour.invoices.codes.title'),
content: _t('app.admin.tour.invoices.codes.content'),
placement: 'bottom'
});
uitour.createStep({
selector: '.heading .export-accounting-button',
stepId: 'export',
order: 7,
title: _t('app.admin.tour.invoices.export.title'),
content: _t('app.admin.tour.invoices.export.content'),
placement: 'bottom'
});
uitour.createStep({
selector: '.heading .close-accounting-periods-button',
stepId: 'periods',
order: 8,
title: _t('app.admin.tour.invoices.periods.title'),
content: _t('app.admin.tour.invoices.periods.content'),
placement: 'bottom',
popupClass: 'shift-left-50'
});
if (AuthService.isAuthorized('admin')) {
uitour.createStep({
selector: '.invoices-management .invoices-settings',
stepId: 'settings',
order: 5,
title: _t('app.admin.tour.invoices.settings.title'),
content: _t('app.admin.tour.invoices.settings.content'),
placement: 'bottom'
});
uitour.createStep({
selector: '.invoices-management .accounting-codes-tab',
stepId: 'codes',
order: 6,
title: _t('app.admin.tour.invoices.codes.title'),
content: _t('app.admin.tour.invoices.codes.content'),
placement: 'bottom'
});
uitour.createStep({
selector: '.heading .export-accounting-button',
stepId: 'export',
order: 7,
title: _t('app.admin.tour.invoices.export.title'),
content: _t('app.admin.tour.invoices.export.content'),
placement: 'bottom'
});
uitour.createStep({
selector: '.heading .close-accounting-periods-button',
stepId: 'periods',
order: 8,
title: _t('app.admin.tour.invoices.periods.title'),
content: _t('app.admin.tour.invoices.periods.content'),
placement: 'bottom',
popupClass: 'shift-left-50'
});
}
uitour.createStep({
selector: 'body',
stepId: 'conclusion',

View File

@ -126,8 +126,8 @@ class MembersController {
/**
* Controller used in the members/groups management page
*/
Application.Controllers.controller('AdminMembersController', ['$scope', '$sce', '$uibModal', 'membersPromise', 'adminsPromise', 'partnersPromise', 'managersPromise', 'growl', 'Admin', 'dialogs', '_t', 'Member', 'Export', 'User', 'uiTourService',
function ($scope, $sce, $uibModal, membersPromise, adminsPromise, partnersPromise, managersPromise, growl, Admin, dialogs, _t, Member, Export, User, uiTourService) {
Application.Controllers.controller('AdminMembersController', ['$scope', '$sce', '$uibModal', 'membersPromise', 'adminsPromise', 'partnersPromise', 'managersPromise', 'growl', 'Admin', 'AuthService', 'dialogs', '_t', 'Member', 'Export', 'User', 'uiTourService',
function ($scope, $sce, $uibModal, membersPromise, adminsPromise, partnersPromise, managersPromise, growl, Admin, AuthService, dialogs, _t, Member, Export, User, uiTourService) {
/* PRIVATE STATIC CONSTANTS */
// number of users loaded each time we click on 'load more...'
@ -476,22 +476,24 @@ Application.Controllers.controller('AdminMembersController', ['$scope', '$sce',
placement: 'left'
});
}
uitour.createStep({
selector: '.members-management .exports-buttons',
stepId: 'exports',
order: 5,
title: _t('app.admin.tour.members.exports.title'),
content: _t('app.admin.tour.members.exports.content'),
placement: 'bottom'
});
uitour.createStep({
selector: '.heading .import-members',
stepId: 'import',
order: 6,
title: _t('app.admin.tour.members.import.title'),
content: _t('app.admin.tour.members.import.content'),
placement: 'left'
});
if (AuthService.isAuthorized('admin')) {
uitour.createStep({
selector: '.members-management .exports-buttons',
stepId: 'exports',
order: 5,
title: _t('app.admin.tour.members.exports.title'),
content: _t('app.admin.tour.members.exports.content'),
placement: 'bottom'
});
uitour.createStep({
selector: '.heading .import-members',
stepId: 'import',
order: 6,
title: _t('app.admin.tour.members.import.title'),
content: _t('app.admin.tour.members.import.content'),
placement: 'left'
});
}
uitour.createStep({
selector: '.members-management .admins-tab',
stepId: 'admins',
@ -500,31 +502,33 @@ Application.Controllers.controller('AdminMembersController', ['$scope', '$sce',
content: _t('app.admin.tour.members.admins.content'),
placement: 'bottom'
});
uitour.createStep({
selector: '.members-management .groups-tab',
stepId: 'groups',
order: 8,
title: _t('app.admin.tour.members.groups.title'),
content: _t('app.admin.tour.members.groups.content'),
placement: 'bottom'
});
uitour.createStep({
selector: '.members-management .labels-tab',
stepId: 'labels',
order: 9,
title: _t('app.admin.tour.members.labels.title'),
content: _t('app.admin.tour.members.labels.content'),
placement: 'bottom'
});
uitour.createStep({
selector: '.members-management .sso-tab',
stepId: 'sso',
order: 10,
title: _t('app.admin.tour.members.sso.title'),
content: _t('app.admin.tour.members.sso.content'),
placement: 'bottom',
popupClass: 'shift-left-50'
});
if (AuthService.isAuthorized('admin')) {
uitour.createStep({
selector: '.members-management .groups-tab',
stepId: 'groups',
order: 8,
title: _t('app.admin.tour.members.groups.title'),
content: _t('app.admin.tour.members.groups.content'),
placement: 'bottom'
});
uitour.createStep({
selector: '.members-management .labels-tab',
stepId: 'labels',
order: 9,
title: _t('app.admin.tour.members.labels.title'),
content: _t('app.admin.tour.members.labels.content'),
placement: 'bottom'
});
uitour.createStep({
selector: '.members-management .sso-tab',
stepId: 'sso',
order: 10,
title: _t('app.admin.tour.members.sso.title'),
content: _t('app.admin.tour.members.sso.content'),
placement: 'bottom',
popupClass: 'shift-left-50'
});
}
uitour.createStep({
selector: 'body',
stepId: 'conclusion',

View File

@ -22,8 +22,10 @@ Application.Controllers.controller('HomeController', ['$scope', '$stateParams',
*/
$scope.setupHomeTour = function () {
if (AuthService.isAuthorized(['admin', 'manager'])) {
// this is an ugly hack, but we can't do better for now because angular-ui-tour does not support removing steps
// and we can't use promises with _t's translations (needs a very big refactoring)
// Workaround for the following bug: as a manager, when the feature tour is shown, the translations keys are not
// interpreted. This is an ugly hack, but we can't do better for now because angular-ui-tour does not support
// removing steps (this would allow us to recreate the steps when the translations are loaded), and we can't use
// promises with _t's translations (this would be a very big refactoring)
setTimeout(setupWelcomeTour, 1000);
}
};
@ -184,7 +186,7 @@ Application.Controllers.controller('HomeController', ['$scope', '$stateParams',
selector: '.nav-primary .admin-section',
stepId: 'admin',
order: 9,
title: _t('app.public.tour.welcome.admin.title'),
title: _t('app.public.tour.welcome.admin.title', { ROLE: _t(`app.public.common.${$scope.currentUser.role}`) }),
content: _t('app.public.tour.welcome.admin.content'),
placement: 'right'
});

View File

@ -180,8 +180,8 @@ const _reserveMachine = function (machine, e) {
/**
* Controller used in the public listing page, allowing everyone to see the list of machines
*/
Application.Controllers.controller('MachinesController', ['$scope', '$state', '_t', 'Machine', '$uibModal', 'machinesPromise', 'Member', 'uiTourService',
function ($scope, $state, _t, Machine, $uibModal, machinesPromise, Member, uiTourService) {
Application.Controllers.controller('MachinesController', ['$scope', '$state', '_t', 'AuthService', 'Machine', '$uibModal', 'machinesPromise', 'Member', 'uiTourService',
function ($scope, $state, _t, AuthService, Machine, $uibModal, machinesPromise, Member, uiTourService) {
/* PUBLIC SCOPE */
// Retrieve the list of machines
@ -219,7 +219,7 @@ Application.Controllers.controller('MachinesController', ['$scope', '$state', '_
*/
$scope.setupMachinesTour = function () {
// setup the tour for admins only
if ($scope.currentUser && $scope.currentUser.role === 'admin') {
if (AuthService.isAuthorized(['admin', 'manager'])) {
// get the tour defined by the ui-tour directive
const uitour = uiTourService.getTourByName('machines');
uitour.createStep({

View File

@ -98,8 +98,8 @@ class SpacesController {
/**
* Controller used in the public listing page, allowing everyone to see the list of spaces
*/
Application.Controllers.controller('SpacesController', ['$scope', '$state', 'spacesPromise', '_t', 'Member', 'uiTourService',
function ($scope, $state, spacesPromise, _t, Member, uiTourService) {
Application.Controllers.controller('SpacesController', ['$scope', '$state', 'spacesPromise', 'AuthService', '_t', 'Member', 'uiTourService',
function ($scope, $state, spacesPromise, AuthService, _t, Member, uiTourService) {
/* PUBLIC SCOPE */
// Retrieve the list of spaces
@ -131,7 +131,7 @@ Application.Controllers.controller('SpacesController', ['$scope', '$state', 'spa
*/
$scope.setupSpacesTour = function () {
// setup the tour for admins only
if ($scope.currentUser && $scope.currentUser.role === 'admin') {
if (AuthService.isAuthorized(['admin', 'manager'])) {
// get the tour defined by the ui-tour directive
const uitour = uiTourService.getTourByName('spaces');
uitour.createStep({

View File

@ -26,7 +26,7 @@
ui-tour-scroll-parent-id="content-main"
post-render="setupEventsTour">
<div class="row">
<div class="col-md-12" ng-show="isAuthorized('admin')">
<div class="col-md-12" ng-if="isAuthorized('admin')">
<uib-tabset justified="true" active="tabs.active">
<uib-tab heading="{{ 'app.admin.events.events_monitoring' | translate }}" index="0">
<ng-include src="'<%= asset_path "admin/events/monitoring.html" %>'"></ng-include>
@ -41,7 +41,7 @@
</uib-tab>
</uib-tabset>
</div>
<div class="col-md-12" ng-show="isAuthorized('manager')">
<div class="col-md-12" ng-if="isAuthorized('manager')">
<ng-include src="'<%= asset_path "admin/events/monitoring.html" %>'"></ng-include>
</div>
</div>

View File

@ -28,7 +28,7 @@
ui-tour-scroll-parent-id="content-main"
post-render="setupInvoicesTour">
<div class="row">
<div class="col-md-12" ng-show="isAuthorized('admin')">
<div class="col-md-12" ng-if="isAuthorized('admin')">
<uib-tabset justified="true" active="tabs.active">
<uib-tab heading="{{ 'app.admin.invoices.invoices_list' | translate }}" ng-hide="fablabWithoutInvoices" index="0">
<ng-include src="'<%= asset_path "admin/invoices/list.html" %>'"></ng-include>
@ -44,7 +44,7 @@
</uib-tabset>
</div>
<div class="col-md-12" ng-show="isAuthorized('manager')">
<div class="col-md-12" ng-if="isAuthorized('manager')">
<ng-include src="'<%= asset_path "admin/invoices/list.html" %>'"></ng-include>
</div>
</div>

View File

@ -30,7 +30,7 @@
post-render="setupMembersTour">
<div class="row">
<div class="col-md-12">
<uib-tabset justified="true" active="tabs.active" ng-show="isAuthorized('admin')">
<uib-tabset justified="true" active="tabs.active" ng-if="isAuthorized('admin')">
<uib-tab heading="{{ 'app.admin.members.users' | translate }}" index="0">
<ng-include src="'<%= asset_path "admin/members/users.html" %>'"></ng-include>
@ -49,7 +49,7 @@
</uib-tab>
</uib-tabset>
<div ng-show="isAuthorized('manager')">
<div ng-if="isAuthorized('manager')">
<ng-include src="'<%= asset_path "admin/members/users.html" %>'"></ng-include>
</div>
</div>

View File

@ -388,8 +388,8 @@ en:
title: "Subscriptions"
content: "Subscriptions provide a way to segment your prices and provide benefits to regular users."
admin:
title: "Administrator section"
content: "<p>All of the elements below are only accessible to administrators. They allow you to manage and configure Fab-manager.</p><p>At the end of this visit, click on one of them to find out more.</p>"
title: "{ROLE} section"
content: "<p>All of the elements below are only accessible to administrators and managers. They allow you to manage and configure Fab-manager.</p><p>At the end of this visit, click on one of them to find out more.</p>"
about:
title: "About"
content: "A page that you can fully customize, to present your activity and your structure."

View File

@ -388,8 +388,8 @@ fr:
title: "Abonnements"
content: "Les abonnements offrent un moyen de segmenter vos tarifs et d'accorder des avantages aux utilisateurs réguliers."
admin:
title: "Section administrateur"
content: "<p>L'ensemble des éléments ci-dessous ne sont accessibles qu'aux administrateurs. Ils permettent de gérer et de configurer Fab-manager.</p><p>À la fin de cette visite, cliquez sur l'un d'entre eux pour en savoir plus.</p>"
title: "Section {ROLE}"
content: "<p>L'ensemble des éléments ci-dessous ne sont accessibles qu'aux administrateurs et aux gestionnaires. Ils permettent de gérer et de configurer Fab-manager.</p><p>À la fin de cette visite, cliquez sur l'un d'entre eux pour en savoir plus.</p>"
about:
title: "À propos"
content: "Une page que vous pouvez entièrement personnaliser, pour y présenter votre activité et votre structure."