1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-04 15:24:23 +01:00
fab-manager/app/assets/javascripts/controllers/main_nav.js

165 lines
4.4 KiB
JavaScript
Raw Normal View History

/* eslint-disable
no-undef,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
2018-11-21 11:08:53 +01:00
'use strict';
2015-05-05 03:10:25 +02:00
/**
* Navigation controller. List the links availables in the left navigation pane and their icon.
*/
2018-11-27 13:57:41 +01:00
Application.Controllers.controller('MainNavController', ['$scope', function ($scope) {
// Common links (public application)
2015-05-05 03:10:25 +02:00
$scope.navLinks = [
{
state: 'app.public.home',
2019-12-16 16:54:40 +01:00
linkText: 'app.public.common.home',
2020-01-28 18:15:11 +01:00
linkIcon: 'home',
class: 'home-link'
},
2020-02-26 18:05:09 +01:00
{ class: 'menu-spacer' },
{
state: 'app.public.calendar',
linkText: 'app.public.common.public_calendar',
linkIcon: 'calendar',
class: 'public-calendar-link'
},
2015-05-05 03:10:25 +02:00
{
state: 'app.public.machines_list',
2019-12-16 16:54:40 +01:00
linkText: 'app.public.common.reserve_a_machine',
2020-01-28 18:15:11 +01:00
linkIcon: 'cogs',
class: 'reserve-machine-link'
},
2016-03-23 18:39:41 +01:00
{
state: 'app.public.trainings_list',
2019-12-16 16:54:40 +01:00
linkText: 'app.public.common.trainings_registrations',
2020-01-28 18:15:11 +01:00
linkIcon: 'graduation-cap',
class: 'reserve-training-link'
},
2015-05-05 03:10:25 +02:00
{
state: 'app.public.events_list',
2019-12-16 16:54:40 +01:00
linkText: 'app.public.common.events_registrations',
2020-01-28 18:15:11 +01:00
linkIcon: 'tags',
class: 'reserve-event-link'
},
2020-02-26 18:05:09 +01:00
{ class: 'menu-spacer' },
2015-05-05 03:10:25 +02:00
{
state: 'app.public.projects_list',
2019-12-16 16:54:40 +01:00
linkText: 'app.public.common.projects_gallery',
2020-01-28 18:15:11 +01:00
linkIcon: 'th',
class: 'projects-gallery-link'
2020-02-26 18:05:09 +01:00
},
{ class: 'menu-spacer' }
2016-03-23 18:39:41 +01:00
2018-11-21 11:08:53 +01:00
];
2015-05-05 03:10:25 +02:00
if ($scope.modules.plans) {
2016-03-23 18:39:41 +01:00
$scope.navLinks.push({
state: 'app.public.plans',
2019-12-16 16:54:40 +01:00
linkText: 'app.public.common.subscriptions',
2020-01-28 18:15:11 +01:00
linkIcon: 'credit-card',
class: 'plans-link'
2018-11-21 11:08:53 +01:00
});
}
2016-03-23 18:39:41 +01:00
if ($scope.modules.spaces) {
2020-02-26 18:05:09 +01:00
$scope.navLinks.splice(4, 0, {
state: 'app.public.spaces_list',
2019-12-16 16:54:40 +01:00
linkText: 'app.public.common.reserve_a_space',
2020-01-28 18:15:11 +01:00
linkIcon: 'rocket',
class: 'reserve-space-link'
2018-11-21 11:08:53 +01:00
});
}
2018-11-21 11:08:53 +01:00
Fablab.adminNavLinks = Fablab.adminNavLinks || [];
const adminNavLinks = [
2020-02-26 18:05:09 +01:00
{
state: 'app.admin.calendar',
linkText: 'app.public.common.manage_the_calendar',
2020-04-22 12:31:44 +02:00
linkIcon: 'calendar',
authorizedRoles: ['admin', 'manager']
2020-02-26 18:05:09 +01:00
},
{
state: 'app.public.machines_list',
linkText: 'app.public.common.manage_the_machines',
2020-04-22 12:31:44 +02:00
linkIcon: 'cogs',
authorizedRoles: ['admin', 'manager']
2020-02-26 18:05:09 +01:00
},
2016-03-23 18:39:41 +01:00
{
state: 'app.admin.trainings',
2019-12-16 16:54:40 +01:00
linkText: 'app.public.common.trainings_monitoring',
2020-04-22 12:31:44 +02:00
linkIcon: 'graduation-cap',
authorizedRoles: ['admin', 'manager']
},
2016-03-23 18:39:41 +01:00
{
2020-02-26 18:05:09 +01:00
state: 'app.admin.events',
linkText: 'app.public.common.manage_the_events',
2020-04-22 12:31:44 +02:00
linkIcon: 'tags',
authorizedRoles: ['admin', 'manager']
},
2020-02-26 18:05:09 +01:00
{ class: 'menu-spacer' },
2015-05-05 03:10:25 +02:00
{
state: 'app.admin.members',
2019-12-16 16:54:40 +01:00
linkText: 'app.public.common.manage_the_users',
2020-04-22 12:31:44 +02:00
linkIcon: 'users',
authorizedRoles: ['admin', 'manager']
},
2016-03-23 18:39:41 +01:00
{
state: 'app.admin.pricing',
2019-12-16 16:54:40 +01:00
linkText: 'app.public.common.subscriptions_and_prices',
2020-04-22 12:31:44 +02:00
linkIcon: 'money',
authorizedRoles: ['admin']
},
2015-05-05 03:10:25 +02:00
{
2020-02-26 18:05:09 +01:00
state: 'app.admin.invoices',
linkText: 'app.public.common.manage_the_invoices',
2020-04-22 12:31:44 +02:00
linkIcon: 'file-pdf-o',
authorizedRoles: ['admin', 'manager']
},
2016-03-23 18:39:41 +01:00
{
state: 'app.admin.statistics',
2019-12-16 16:54:40 +01:00
linkText: 'app.public.common.statistics',
2020-04-22 12:31:44 +02:00
linkIcon: 'bar-chart-o',
authorizedRoles: ['admin']
},
{
class: 'menu-spacer',
authorizedRoles: ['admin']
},
2016-03-23 18:39:41 +01:00
{
state: 'app.admin.settings',
2019-12-16 16:54:40 +01:00
linkText: 'app.public.common.customization',
2020-04-22 12:31:44 +02:00
linkIcon: 'gear',
authorizedRoles: ['admin']
},
2020-02-26 18:05:09 +01:00
{
state: 'app.admin.projects',
linkText: 'app.public.common.projects',
2020-04-22 12:31:44 +02:00
linkIcon: 'tasks',
authorizedRoles: ['admin']
2020-02-26 18:05:09 +01:00
},
2016-05-09 18:15:04 +02:00
{
state: 'app.admin.open_api_clients',
2019-12-16 16:54:40 +01:00
linkText: 'app.public.common.open_api_clients',
2020-04-22 12:31:44 +02:00
linkIcon: 'cloud',
authorizedRoles: ['admin']
2016-05-09 18:15:04 +02:00
}
2018-11-21 11:08:53 +01:00
].concat(Fablab.adminNavLinks);
2016-05-10 16:50:01 +02:00
2018-11-21 11:08:53 +01:00
$scope.adminNavLinks = adminNavLinks;
if ($scope.modules.spaces) {
return $scope.adminNavLinks.splice(3, 0, {
state: 'app.public.spaces_list',
2019-12-16 16:54:40 +01:00
linkText: 'app.public.common.manage_the_spaces',
linkIcon: 'rocket'
2018-11-21 11:08:53 +01:00
});
}
}
2018-11-21 11:08:53 +01:00
]);