1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00
fab-manager/app/assets/javascripts/router.js.erb

1116 lines
50 KiB
Plaintext
Raw Normal View History

/* eslint-disable
no-return-assign,
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
*/
angular.module('application.router', ['ui.router'])
.config(['$stateProvider', '$urlRouterProvider', '$locationProvider', function ($stateProvider, $urlRouterProvider, $locationProvider) {
2018-11-21 11:08:53 +01:00
$locationProvider.hashPrefix('!');
$urlRouterProvider.otherwise('/');
2016-03-23 18:39:41 +01:00
// abstract root parents states
// these states controls the access rights to the various routes inherited from them
return $stateProvider
.state('app', {
abstract: true,
views: {
'header': {
2016-03-23 18:39:41 +01:00
templateUrl: '<%= asset_path "shared/header.html" %>'
},
'leftnav': {
templateUrl: '<%= asset_path "shared/leftnav.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'MainNavController'
},
2016-03-23 18:39:41 +01:00
'main': {}
},
resolve: {
2018-11-21 11:08:53 +01:00
logoFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'logo-file' }).$promise; }],
logoBlackFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'logo-black-file' }).$promise; }],
2018-11-21 11:32:50 +01:00
commonTranslations: ['Translations', function (Translations) { return Translations.query(['app.public.common', 'app.shared.buttons', 'app.shared.elements']).$promise; }]
},
onEnter: ['$rootScope', 'logoFile', 'logoBlackFile', function ($rootScope, logoFile, logoBlackFile) {
2018-11-19 16:17:49 +01:00
// Application logo
2018-11-21 11:08:53 +01:00
$rootScope.logo = logoFile.custom_asset;
return $rootScope.logoBlack = logoBlackFile.custom_asset;
2018-11-20 12:57:10 +01:00
}]
})
.state('app.public', {
abstract: true
})
.state('app.logged', {
abstract: true,
data: {
2016-03-23 18:39:41 +01:00
authorizedRoles: ['member', 'admin']
},
resolve: {
2018-11-21 11:08:53 +01:00
currentUser: ['Auth', function (Auth) { return Auth.currentUser(); }]
},
2018-11-20 12:57:10 +01:00
onEnter: ['$state', '$timeout', 'currentUser', '$rootScope', function ($state, $timeout, currentUser, $rootScope) {
2018-11-21 11:08:53 +01:00
$rootScope.currentUser = currentUser;
2018-11-20 12:57:10 +01:00
}]
})
.state('app.admin', {
abstract: true,
data: {
2016-03-23 18:39:41 +01:00
authorizedRoles: ['admin']
},
resolve: {
2018-11-21 11:08:53 +01:00
currentUser: ['Auth', function (Auth) { return Auth.currentUser(); }]
},
2018-11-20 12:57:10 +01:00
onEnter: ['$state', '$timeout', 'currentUser', '$rootScope', function ($state, $timeout, currentUser, $rootScope) {
2018-11-21 11:08:53 +01:00
$rootScope.currentUser = currentUser;
2018-11-20 12:57:10 +01:00
}]
})
2016-03-23 18:39:41 +01:00
// main pages
.state('app.public.about', {
url: '/about',
views: {
'content@': {
templateUrl: '<%= asset_path "shared/about.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'AboutController'
}
},
resolve: {
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.public.about').$promise; }]
}
})
.state('app.public.home', {
url: '/?reset_password_token',
views: {
'main@': {
templateUrl: '<%= asset_path "home.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'HomeController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
lastMembersPromise: ['Member', function (Member) { return Member.lastSubscribed({ limit: 4 }).$promise; }],
lastProjectsPromise: ['Project', function (Project) { return Project.lastPublished().$promise; }],
upcomingEventsPromise: ['Event', function (Event) { return Event.upcoming({ limit: 3 }).$promise; }],
homeBlogpostPromise: ['Setting', function (Setting) { return Setting.get({ name: 'home_blogpost' }).$promise; }],
twitterNamePromise: ['Setting', function (Setting) { return Setting.get({ name: 'twitter_name' }).$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.public.home').$promise; }]
}
})
2019-04-18 12:00:57 +02:00
.state('app.public.privacy', {
url: '/privacy-policy',
views: {
'content@': {
templateUrl: '<%= asset_path "shared/privacy.html" %>',
controller: 'PrivacyController'
}
},
resolve: {
translations: ['Translations', function (Translations) { return Translations.query('app.public.privacy').$promise; }]
}
})
2016-03-23 18:39:41 +01:00
// profile completion (SSO import passage point)
.state('app.logged.profileCompletion', {
url: '/profile_completion',
views: {
'main@': {
templateUrl: '<%= asset_path "profile/complete.html"%>',
2016-03-23 18:39:41 +01:00
controller: 'CompleteProfileController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['fablab_name', 'name_genre']" }).$promise; }],
activeProviderPromise: ['AuthProvider', function (AuthProvider) { return AuthProvider.active().$promise; }],
groupsPromise: ['Group', function (Group) { return Group.query().$promise; }],
cguFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'cgu-file' }).$promise; }],
memberPromise: ['Member', 'currentUser', function (Member, currentUser) { return Member.get({ id: currentUser.id }).$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.logged.profileCompletion', 'app.shared.user']).$promise; }]
}
})
2016-03-23 18:39:41 +01:00
// dashboard
.state('app.logged.dashboard', {
abstract: true,
url: '/dashboard',
resolve: {
2018-11-21 11:08:53 +01:00
memberPromise: ['Member', 'currentUser', function (Member, currentUser) { return Member.get({ id: currentUser.id }).$promise; }]
}
})
.state('app.logged.dashboard.profile', {
url: '/profile',
views: {
'main@': {
templateUrl: '<%= asset_path "dashboard/profile.html" %>',
controller: 'DashboardController'
}
},
resolve: {
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.logged.dashboard.profile', 'app.shared.public_profile']).$promise; }]
}
})
.state('app.logged.dashboard.settings', {
url: '/settings',
views: {
'main@': {
templateUrl: '<%= asset_path "dashboard/settings.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'EditProfileController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
groups: ['Group', function (Group) { return Group.query().$promise; }],
activeProviderPromise: ['AuthProvider', function (AuthProvider) { return AuthProvider.active().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.logged.dashboard.settings', 'app.shared.user']).$promise; }]
}
})
.state('app.logged.dashboard.projects', {
url: '/projects',
views: {
'main@': {
templateUrl: '<%= asset_path "dashboard/projects.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'DashboardController'
}
},
resolve: {
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.logged.dashboard.projects').$promise; }]
}
})
.state('app.logged.dashboard.trainings', {
url: '/trainings',
views: {
'main@': {
templateUrl: '<%= asset_path "dashboard/trainings.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'DashboardController'
}
},
resolve: {
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.logged.dashboard.trainings').$promise; }]
}
})
.state('app.logged.dashboard.events', {
url: '/events',
views: {
'main@': {
templateUrl: '<%= asset_path "dashboard/events.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'DashboardController'
}
},
resolve: {
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.logged.dashboard.events').$promise; }]
}
})
.state('app.logged.dashboard.invoices', {
url: '/invoices',
views: {
'main@': {
templateUrl: '<%= asset_path "dashboard/invoices.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'DashboardController'
}
},
resolve: {
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.logged.dashboard.invoices').$promise; }]
}
})
.state('app.logged.dashboard.wallet', {
url: '/wallet',
views: {
'main@': {
templateUrl: '<%= asset_path "dashboard/wallet.html" %>',
2016-07-18 18:16:54 +02:00
controller: 'WalletController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
walletPromise: ['Wallet', 'currentUser', function (Wallet, currentUser) { return Wallet.getWalletByUser({ user_id: currentUser.id }).$promise; }],
transactionsPromise: ['Wallet', 'walletPromise', function (Wallet, walletPromise) { return Wallet.transactions({ id: walletPromise.id }).$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.shared.wallet']).$promise; }]
}
})
2016-03-23 18:39:41 +01:00
// members
.state('app.logged.members_show', {
url: '/members/:id',
views: {
'main@': {
templateUrl: '<%= asset_path "members/show.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'ShowProfileController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
memberPromise: ['$stateParams', 'Member', function ($stateParams, Member) { return Member.get({ id: $stateParams.id }).$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.logged.members_show', 'app.shared.public_profile']).$promise; }]
}
})
.state('app.logged.members', {
url: '/members',
views: {
'main@': {
templateUrl: '<%= asset_path "members/index.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'MembersController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
membersPromise: ['Member', function (Member) { return Member.query({ requested_attributes: '[profile]', page: 1, size: 10 }).$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.logged.members').$promise; }]
}
})
2016-03-23 18:39:41 +01:00
// projects
.state('app.public.projects_list', {
url: '/projects?q&page&theme_id&component_id&machine_id&from&whole_network',
views: {
'main@': {
templateUrl: '<%= asset_path "projects/index.html.erb" %>',
2016-03-23 18:39:41 +01:00
controller: 'ProjectsController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
themesPromise: ['Theme', function (Theme) { return Theme.query().$promise; }],
componentsPromise: ['Component', function (Component) { return Component.query().$promise; }],
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.public.projects_list').$promise; }]
}
})
.state('app.logged.projects_new', {
url: '/projects/new',
views: {
'main@': {
templateUrl: '<%= asset_path "projects/new.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'NewProjectController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
allowedExtensions: ['Project', function (Project) { return Project.allowedExtensions().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.logged.projects_new', 'app.shared.project']).$promise; }]
}
})
.state('app.public.projects_show', {
url: '/projects/:id',
views: {
'main@': {
templateUrl: '<%= asset_path "projects/show.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'ShowProjectController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
projectPromise: ['$stateParams', 'Project', function ($stateParams, Project) { return Project.get({ id: $stateParams.id }).$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.public.projects_show').$promise; }]
}
})
.state('app.logged.projects_edit', {
url: '/projects/:id/edit',
views: {
'main@': {
templateUrl: '<%= asset_path "projects/edit.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'EditProjectController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
projectPromise: ['$stateParams', 'Project', function ($stateParams, Project) { return Project.get({ id: $stateParams.id }).$promise; }],
allowedExtensions: ['Project', function (Project) { return Project.allowedExtensions().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.logged.projects_edit', 'app.shared.project']).$promise; }]
}
})
2016-03-23 18:39:41 +01:00
// machines
.state('app.public.machines_list', {
url: '/machines',
views: {
'main@': {
templateUrl: '<%= asset_path "machines/index.html.erb" %>',
2016-03-23 18:39:41 +01:00
controller: 'MachinesController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.public.machines_list', 'app.shared.training_reservation_modal', 'app.shared.request_training_modal']).$promise; }]
}
})
.state('app.admin.machines_new', {
url: '/machines/new',
views: {
'main@': {
templateUrl: '<%= asset_path "machines/new.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'NewMachineController'
}
},
resolve: {
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.machines_new', 'app.shared.machine']).$promise; }]
}
})
.state('app.public.machines_show', {
url: '/machines/:id',
views: {
'main@': {
templateUrl: '<%= asset_path "machines/show.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'ShowMachineController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
machinePromise: ['Machine', '$stateParams', function (Machine, $stateParams) { return Machine.get({ id: $stateParams.id }).$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.public.machines_show', 'app.shared.training_reservation_modal', 'app.shared.request_training_modal']).$promise; }]
}
})
.state('app.logged.machines_reserve', {
url: '/machines/:id/reserve',
views: {
'main@': {
templateUrl: '<%= asset_path "machines/reserve.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'ReserveMachineController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
plansPromise: ['Plan', function (Plan) { return Plan.query().$promise; }],
groupsPromise: ['Group', function (Group) { return Group.query().$promise; }],
machinePromise: ['Machine', '$stateParams', function (Machine, $stateParams) { return Machine.get({ id: $stateParams.id }).$promise; }],
2018-11-20 12:57:10 +01:00
settingsPromise: ['Setting', function (Setting) {
return Setting.query({
names: `['machine_explications_alert', \
'booking_window_start', \
'booking_window_end', \
'booking_move_enable', \
'booking_move_delay', \
'booking_cancel_enable', \
'booking_cancel_delay', \
'subscription_explications_alert']`
2018-11-21 11:08:53 +01:00
}).$promise;
2018-11-20 12:57:10 +01:00
}],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) {
2018-11-20 12:57:10 +01:00
return Translations.query(['app.logged.machines_reserve', 'app.shared.plan_subscribe', 'app.shared.member_select',
2016-08-09 10:22:01 +02:00
'app.shared.stripe', 'app.shared.valid_reservation_modal', 'app.shared.confirm_modify_slot_modal',
2018-11-21 11:08:53 +01:00
'app.shared.wallet', 'app.shared.coupon_input', 'app.shared.cart']).$promise;
2018-11-20 12:57:10 +01:00
}]
}
})
.state('app.admin.machines_edit', {
url: '/machines/:id/edit',
views: {
'main@': {
templateUrl: '<%= asset_path "machines/edit.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'EditMachineController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
machinePromise: ['Machine', '$stateParams', function (Machine, $stateParams) { return Machine.get({ id: $stateParams.id }).$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.machines_edit', 'app.shared.machine']).$promise; }]
}
})
// spaces
.state('app.public.spaces_list', {
url: '/spaces',
abstract: Fablab.withoutSpaces,
views: {
'main@': {
templateUrl: '<%= asset_path "spaces/index.html" %>',
controller: 'SpacesController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
spacesPromise: ['Space', function (Space) { return Space.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.public.spaces_list']).$promise; }]
}
})
.state('app.admin.space_new', {
url: '/spaces/new',
abstract: Fablab.withoutSpaces,
views: {
'main@': {
templateUrl: '<%= asset_path "spaces/new.html" %>',
controller: 'NewSpaceController'
}
},
resolve: {
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.space_new', 'app.shared.space']).$promise; }]
}
})
.state('app.public.space_show', {
url: '/spaces/:id',
abstract: Fablab.withoutSpaces,
views: {
'main@': {
templateUrl: '<%= asset_path "spaces/show.html" %>',
2017-02-14 12:41:51 +01:00
controller: 'ShowSpaceController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
spacePromise: ['Space', '$stateParams', function (Space, $stateParams) { return Space.get({ id: $stateParams.id }).$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.public.space_show']).$promise; }]
}
})
.state('app.admin.space_edit', {
url: '/spaces/:id/edit',
abstract: Fablab.withoutSpaces,
views: {
'main@': {
templateUrl: '<%= asset_path "spaces/edit.html" %>',
2017-02-14 13:36:10 +01:00
controller: 'EditSpaceController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
spacePromise: ['Space', '$stateParams', function (Space, $stateParams) { return Space.get({ id: $stateParams.id }).$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.space_edit', 'app.shared.space']).$promise; }]
}
})
.state('app.logged.space_reserve', {
url: '/spaces/:id/reserve',
abstract: Fablab.withoutSpaces,
views: {
'main@': {
templateUrl: '<%= asset_path "spaces/reserve.html" %>',
2017-02-23 17:45:55 +01:00
controller: 'ReserveSpaceController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
spacePromise: ['Space', '$stateParams', function (Space, $stateParams) { return Space.get({ id: $stateParams.id }).$promise; }],
availabilitySpacesPromise: ['Availability', '$stateParams', function (Availability, $stateParams) { return Availability.spaces({ spaceId: $stateParams.id }).$promise; }],
plansPromise: ['Plan', function (Plan) { return Plan.query().$promise; }],
groupsPromise: ['Group', function (Group) { return Group.query().$promise; }],
2018-11-20 12:57:10 +01:00
settingsPromise: ['Setting', function (Setting) {
return Setting.query({
names: `['booking_window_start', \
'booking_window_end', \
'booking_move_enable', \
'booking_move_delay', \
'booking_cancel_enable', \
'booking_cancel_delay', \
'subscription_explications_alert', \
2018-11-21 11:08:53 +01:00
'space_explications_alert']` }).$promise;
2018-11-20 12:57:10 +01:00
}],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) {
2018-11-20 12:57:10 +01:00
return Translations.query(['app.logged.space_reserve', 'app.shared.plan_subscribe', 'app.shared.member_select',
2017-02-23 17:45:55 +01:00
'app.shared.stripe', 'app.shared.valid_reservation_modal', 'app.shared.confirm_modify_slot_modal',
2018-11-21 11:08:53 +01:00
'app.shared.wallet', 'app.shared.coupon_input', 'app.shared.cart']).$promise;
2018-11-20 12:57:10 +01:00
}]
}
})
// trainings
.state('app.public.trainings_list', {
url: '/trainings',
views: {
'main@': {
templateUrl: '<%= asset_path "trainings/index.html.erb" %>',
2016-07-13 18:15:14 +02:00
controller: 'TrainingsController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
trainingsPromise: ['Training', function (Training) { return Training.query({ public_page: true }).$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.public.trainings_list']).$promise; }]
}
})
.state('app.public.training_show', {
url: '/trainings/:id',
views: {
'main@': {
templateUrl: '<%= asset_path "trainings/show.html" %>',
2016-07-13 18:15:14 +02:00
controller: 'ShowTrainingController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
trainingPromise: ['Training', '$stateParams', function (Training, $stateParams) { return Training.get({ id: $stateParams.id }).$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.public.training_show']).$promise; }]
}
})
.state('app.logged.trainings_reserve', {
url: '/trainings/:id/reserve',
views: {
'main@': {
templateUrl: '<%= asset_path "trainings/reserve.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'ReserveTrainingController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
explicationAlertPromise: ['Setting', function (Setting) { return Setting.get({ name: 'training_explications_alert' }).$promise; }],
plansPromise: ['Plan', function (Plan) { return Plan.query().$promise; }],
groupsPromise: ['Group', function (Group) { return Group.query().$promise; }],
availabilityTrainingsPromise: ['Availability', '$stateParams', function (Availability, $stateParams) { return Availability.trainings({ trainingId: $stateParams.id }).$promise; }],
trainingPromise: ['Training', '$stateParams', function (Training, $stateParams) {
2018-11-21 11:08:53 +01:00
if ($stateParams.id !== 'all') { return Training.get({ id: $stateParams.id }).$promise; }
2018-11-20 12:57:10 +01:00
}],
settingsPromise: ['Setting', function (Setting) {
2018-11-21 10:59:07 +01:00
return Setting.query({
2018-11-20 12:57:10 +01:00
names: `['booking_window_start', \
'booking_window_end', \
'booking_move_enable', \
'booking_move_delay', \
'booking_cancel_enable', \
'booking_cancel_delay', \
'subscription_explications_alert', \
'training_explications_alert', \
2018-11-21 11:08:53 +01:00
'training_information_message']` }).$promise;
2018-11-20 12:57:10 +01:00
}],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) {
2018-11-20 12:57:10 +01:00
return Translations.query(['app.logged.trainings_reserve', 'app.shared.plan_subscribe', 'app.shared.member_select',
2016-08-10 16:53:40 +02:00
'app.shared.stripe', 'app.shared.valid_reservation_modal', 'app.shared.confirm_modify_slot_modal',
2018-11-21 11:08:53 +01:00
'app.shared.wallet', 'app.shared.coupon_input', 'app.shared.cart']).$promise;
2018-11-20 12:57:10 +01:00
}]
}
})
// notifications
.state('app.logged.notifications', {
url: '/notifications',
views: {
'main@': {
templateUrl: '<%= asset_path "notifications/index.html.erb" %>',
2016-03-23 18:39:41 +01:00
controller: 'NotificationsController'
}
},
resolve: {
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.logged.notifications').$promise; }]
}
})
2016-03-23 18:39:41 +01:00
// pricing
.state('app.public.plans', {
url: '/plans',
abstract: Fablab.withoutPlans,
views: {
'main@': {
templateUrl: '<%= asset_path "plans/index.html.erb" %>',
2016-03-23 18:39:41 +01:00
controller: 'PlansIndexController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
subscriptionExplicationsPromise: ['Setting', function (Setting) { return Setting.get({ name: 'subscription_explications_alert' }).$promise; }],
plansPromise: ['Plan', function (Plan) { return Plan.query().$promise; }],
groupsPromise: ['Group', function (Group) { return Group.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) {
2018-11-20 12:57:10 +01:00
return Translations.query(['app.public.plans', 'app.shared.member_select', 'app.shared.stripe', 'app.shared.wallet',
2018-11-21 11:08:53 +01:00
'app.shared.coupon_input']).$promise;
2018-11-20 12:57:10 +01:00
}]
}
})
2016-03-23 18:39:41 +01:00
// events
.state('app.public.events_list', {
url: '/events',
views: {
'main@': {
templateUrl: '<%= asset_path "events/index.html.erb" %>',
2016-03-23 18:39:41 +01:00
controller: 'EventsController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
categoriesPromise: ['Category', function (Category) { return Category.query().$promise; }],
themesPromise: ['EventTheme', function (EventTheme) { return EventTheme.query().$promise; }],
ageRangesPromise: ['AgeRange', function (AgeRange) { return AgeRange.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.public.events_list').$promise; }]
}
})
.state('app.public.events_show', {
url: '/events/:id',
views: {
'main@': {
templateUrl: '<%= asset_path "events/show.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'ShowEventController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
eventPromise: ['Event', '$stateParams', function (Event, $stateParams) { return Event.get({ id: $stateParams.id }).$promise; }],
priceCategoriesPromise: ['PriceCategory', function (PriceCategory) { return PriceCategory.query().$promise; }],
settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['booking_move_enable', 'booking_move_delay', 'event_explications_alert']" }).$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) {
2018-11-20 12:57:10 +01:00
return Translations.query(['app.public.events_show', 'app.shared.member_select', 'app.shared.stripe',
2018-11-21 11:08:53 +01:00
'app.shared.valid_reservation_modal', 'app.shared.wallet', 'app.shared.coupon_input']).$promise;
2018-11-20 12:57:10 +01:00
}]
}
})
2016-03-23 18:39:41 +01:00
// global calendar (trainings, machines and events)
.state('app.public.calendar', {
url: '/calendar',
views: {
'main@': {
templateUrl: '<%= asset_path "calendar/calendar.html" %>',
controller: 'CalendarController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
bookingWindowStart: ['Setting', function (Setting) { return Setting.get({ name: 'booking_window_start' }).$promise; }],
bookingWindowEnd: ['Setting', function (Setting) { return Setting.get({ name: 'booking_window_end' }).$promise; }],
trainingsPromise: ['Training', function (Training) { return Training.query().$promise; }],
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
spacesPromise: ['Space', function (Space) { return Space.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.public.calendar']).$promise; }]
}
})
// --- namespace /admin/... ---
// calendar
.state('app.admin.calendar', {
url: '/admin/calendar',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/calendar/calendar.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'AdminCalendarController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
bookingWindowStart: ['Setting', function (Setting) { return Setting.get({ name: 'booking_window_start' }).$promise; }],
bookingWindowEnd: ['Setting', function (Setting) { return Setting.get({ name: 'booking_window_end' }).$promise; }],
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.admin.calendar').$promise; }]
}
})
2016-03-23 18:39:41 +01:00
// project's elements
.state('app.admin.project_elements', {
url: '/admin/project_elements',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/project_elements/index.html.erb" %>',
2016-03-23 18:39:41 +01:00
controller: 'ProjectElementsController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
componentsPromise: ['Component', function (Component) { return Component.query().$promise; }],
licencesPromise: ['Licence', function (Licence) { return Licence.query().$promise; }],
themesPromise: ['Theme', function (Theme) { return Theme.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.admin.project_elements').$promise; }]
}
})
.state('app.admin.manage_abuses', {
url: '/admin/abuses',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/abuses/index.html" %>',
controller: 'AbusesController'
}
},
resolve: {
abusesPromise: ['Abuse', function(Abuse) { return Abuse.query().$promise; }],
translations: ['Translations', function(Translations) { return Translations.query('app.admin.manage_abuses').$promise; }]
}
})
2016-03-23 18:39:41 +01:00
// trainings
.state('app.admin.trainings', {
url: '/admin/trainings',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/trainings/index.html.erb" %>',
2016-07-13 18:15:14 +02:00
controller: 'TrainingsAdminController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
trainingsPromise: ['Training', function (Training) { return Training.query().$promise; }],
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.trainings', 'app.shared.trainings']).$promise; }]
}
})
.state('app.admin.trainings_new', {
url: '/admin/trainings/new',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/trainings/new.html" %>',
2016-07-13 18:15:14 +02:00
controller: 'NewTrainingController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.trainings_new', 'app.shared.trainings']).$promise; }]
}
})
.state('app.admin.trainings_edit', {
url: '/admin/trainings/:id/edit',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/trainings/edit.html" %>',
2016-07-13 18:15:14 +02:00
controller: 'EditTrainingController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
trainingPromise: ['Training', '$stateParams', function (Training, $stateParams) { return Training.get({ id: $stateParams.id }).$promise; }],
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.shared.trainings').$promise; }]
}
})
// events
.state('app.admin.events', {
url: '/admin/events',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/events/index.html.erb" %>',
2016-03-23 18:39:41 +01:00
controller: 'AdminEventsController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
eventsPromise: ['Event', function (Event) { return Event.query({ page: 1 }).$promise; }],
categoriesPromise: ['Category', function (Category) { return Category.query().$promise; }],
themesPromise: ['EventTheme', function (EventTheme) { return EventTheme.query().$promise; }],
ageRangesPromise: ['AgeRange', function (AgeRange) { return AgeRange.query().$promise; }],
priceCategoriesPromise: ['PriceCategory', function (PriceCategory) { return PriceCategory.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.admin.events').$promise; }]
}
})
.state('app.admin.events_new', {
url: '/admin/events/new',
views: {
'main@': {
templateUrl: '<%= asset_path "events/new.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'NewEventController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
categoriesPromise: ['Category', function (Category) { return Category.query().$promise; }],
themesPromise: ['EventTheme', function (EventTheme) { return EventTheme.query().$promise; }],
ageRangesPromise: ['AgeRange', function (AgeRange) { return AgeRange.query().$promise; }],
priceCategoriesPromise: ['PriceCategory', function (PriceCategory) { return PriceCategory.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.events_new', 'app.shared.event']).$promise; }]
}
})
.state('app.admin.events_edit', {
url: '/admin/events/:id/edit',
views: {
'main@': {
templateUrl: '<%= asset_path "events/edit.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'EditEventController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
eventPromise: ['Event', '$stateParams', function (Event, $stateParams) { return Event.get({ id: $stateParams.id }).$promise; }],
categoriesPromise: ['Category', function (Category) { return Category.query().$promise; }],
themesPromise: ['EventTheme', function (EventTheme) { return EventTheme.query().$promise; }],
ageRangesPromise: ['AgeRange', function (AgeRange) { return AgeRange.query().$promise; }],
priceCategoriesPromise: ['PriceCategory', function (PriceCategory) { return PriceCategory.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.events_edit', 'app.shared.event']).$promise; }]
}
})
.state('app.admin.event_reservations', {
url: '/admin/events/:id/reservations',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/events/reservations.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'ShowEventReservationsController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
eventPromise: ['Event', '$stateParams', function (Event, $stateParams) { return Event.get({ id: $stateParams.id }).$promise; }],
reservationsPromise: ['Reservation', '$stateParams', function (Reservation, $stateParams) { return Reservation.query({ reservable_id: $stateParams.id, reservable_type: 'Event' }).$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.admin.event_reservations').$promise; }]
}
})
2016-03-23 18:39:41 +01:00
// pricing
.state('app.admin.pricing', {
url: '/admin/pricing',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/pricing/index.html.erb" %>',
2016-03-23 18:39:41 +01:00
controller: 'EditPricingController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
plans: ['Plan', function (Plan) { return Plan.query().$promise; }],
groups: ['Group', function (Group) { return Group.query().$promise; }],
machinesPricesPromise: ['Price', function (Price) { return Price.query({ priceable_type: 'Machine', plan_id: 'null' }).$promise; }],
trainingsPricingsPromise: ['TrainingsPricing', function (TrainingsPricing) { return TrainingsPricing.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.pricing', 'app.shared.member_select', 'app.shared.coupon']).$promise; }],
2018-11-21 11:08:53 +01:00
trainingsPromise: ['Training', function (Training) { return Training.query().$promise; }],
machineCreditsPromise: ['Credit', function (Credit) { return Credit.query({ creditable_type: 'Machine' }).$promise; }],
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
trainingCreditsPromise: ['Credit', function (Credit) { return Credit.query({ creditable_type: 'Training' }).$promise; }],
2019-04-04 18:00:19 +02:00
couponsPromise: ['Coupon', function (Coupon) { return Coupon.query({ page: 1, filter: 'all' }).$promise; }],
2018-11-21 11:08:53 +01:00
spacesPromise: ['Space', function (Space) { return Space.query().$promise; }],
spacesPricesPromise: ['Price', function (Price) { return Price.query({ priceable_type: 'Space', plan_id: 'null' }).$promise; }],
spacesCreditsPromise: ['Credit', function (Credit) { return Credit.query({ creditable_type: 'Space' }).$promise; }]
}
})
2016-03-23 18:39:41 +01:00
// plans
.state('app.admin.plans', {
abstract: true,
resolve: {
2018-11-21 11:08:53 +01:00
prices: ['Pricing', function (Pricing) { return Pricing.query().$promise; }],
groups: ['Group', function (Group) { return Group.query().$promise; }],
partners: ['User', function (User) { return User.query({ role: 'partner' }).$promise; }]
}
})
.state('app.admin.plans.new', {
url: '/admin/plans/new',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/plans/new.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'NewPlanController'
}
},
resolve: {
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.plans.new', 'app.shared.plan']).$promise; }]
}
})
.state('app.admin.plans.edit', {
url: '/admin/plans/:id/edit',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/plans/edit.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'EditPlanController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
spaces: ['Space', function (Space) { return Space.query().$promise; }],
machines: ['Machine', function (Machine) { return Machine.query().$promise; }],
plans: ['Plan', function (Plan) { return Plan.query().$promise; }],
planPromise: ['Plan', '$stateParams', function (Plan, $stateParams) { return Plan.get({ id: $stateParams.id }).$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.plans.edit', 'app.shared.plan']).$promise; }]
}
})
2016-03-23 18:39:41 +01:00
// coupons
.state('app.admin.coupons_new', {
url: '/admin/coupons/new',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/coupons/new.html" %>',
2016-08-04 14:26:07 +02:00
controller: 'NewCouponController'
}
},
resolve: {
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.coupons_new', 'app.shared.coupon']).$promise; }]
}
})
.state('app.admin.coupons_edit', {
url: '/admin/coupons/:id/edit',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/coupons/edit.html" %>',
2016-08-04 14:26:07 +02:00
controller: 'EditCouponController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
couponPromise: ['Coupon', '$stateParams', function (Coupon, $stateParams) { return Coupon.get({ id: $stateParams.id }).$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.coupons_edit', 'app.shared.coupon']).$promise; }]
}
})
2016-03-23 18:39:41 +01:00
// invoices
.state('app.admin.invoices', {
url: '/admin/invoices',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/invoices/index.html.erb" %>',
2016-03-23 18:39:41 +01:00
controller: 'InvoicesController'
}
},
resolve: {
2018-11-20 12:57:10 +01:00
settings: ['Setting', function (Setting) {
return Setting.query({
names: `['invoice_legals', \
'invoice_text', \
'invoice_VAT-rate', \
'invoice_VAT-active', \
'invoice_order-nb', \
'invoice_code-value', \
'invoice_code-active', \
'invoice_reference', \
2018-11-21 11:08:53 +01:00
'invoice_logo']` }).$promise;
2018-11-20 12:57:10 +01:00
}],
invoices: [ 'Invoice', function (Invoice) {
return Invoice.list({
query: { number: '', customer: '', date: null, order_by: '-reference', page: 1, size: 20 }
2018-11-21 11:08:53 +01:00
}).$promise;
2018-11-20 12:57:10 +01:00
}],
closedPeriods: [ 'AccountingPeriod', function(AccountingPeriod) { return AccountingPeriod.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.admin.invoices').$promise; }]
}
})
2016-03-23 18:39:41 +01:00
// members
.state('app.admin.members', {
url: '/admin/members',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/members/index.html.erb" %>',
2016-03-23 18:39:41 +01:00
controller: 'AdminMembersController'
},
'groups@app.admin.members': {
templateUrl: '<%= asset_path "admin/groups/index.html.erb" %>',
2016-03-23 18:39:41 +01:00
controller: 'GroupsController'
},
'tags@app.admin.members': {
templateUrl: '<%= asset_path "admin/tags/index.html.erb" %>',
2016-03-23 18:39:41 +01:00
controller: 'TagsController'
},
'authentification@app.admin.members': {
templateUrl: '<%= asset_path "admin/authentications/index.html.erb" %>',
2016-03-23 18:39:41 +01:00
controller: 'AuthentificationController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
membersPromise: ['Member', function (Member) { return Member.list({ query: { search: '', order_by: 'id', page: 1, size: 20 } }).$promise; }],
adminsPromise: ['Admin', function (Admin) { return Admin.query().$promise; }],
groupsPromise: ['Group', function (Group) { return Group.query().$promise; }],
tagsPromise: ['Tag', function (Tag) { return Tag.query().$promise; }],
authProvidersPromise: ['AuthProvider', function (AuthProvider) { return AuthProvider.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.admin.members').$promise; }]
}
})
.state('app.admin.members_new', {
url: '/admin/members/new',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/members/new.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'NewMemberController'
}
},
resolve: {
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.members_new', 'app.shared.user', 'app.shared.user_admin']).$promise; }]
}
})
.state('app.admin.members_edit', {
url: '/admin/members/:id/edit',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/members/edit.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'EditMemberController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
memberPromise: ['Member', '$stateParams', function (Member, $stateParams) { return Member.get({ id: $stateParams.id }).$promise; }],
activeProviderPromise: ['AuthProvider', function (AuthProvider) { return AuthProvider.active().$promise; }],
walletPromise: ['Wallet', '$stateParams', function (Wallet, $stateParams) { return Wallet.getWalletByUser({ user_id: $stateParams.id }).$promise; }],
transactionsPromise: ['Wallet', 'walletPromise', function (Wallet, walletPromise) { return Wallet.transactions({ id: walletPromise.id }).$promise; }],
tagsPromise: ['Tag', function (Tag) { return Tag.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.members_edit', 'app.shared.user', 'app.shared.user_admin', 'app.shared.wallet']).$promise; }]
}
})
.state('app.admin.admins_new', {
url: '/admin/admins/new',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/admins/new.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'NewAdminController'
}
},
resolve: {
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.admin.admins_new').$promise; }]
}
})
2016-03-23 18:39:41 +01:00
// authentification providers
.state('app.admin.authentication_new', {
url: '/admin/authentications/new',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/authentications/new.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'NewAuthenticationController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
mappingFieldsPromise: ['AuthProvider', function (AuthProvider) { return AuthProvider.mapping_fields().$promise; }],
authProvidersPromise: ['AuthProvider', function (AuthProvider) { return AuthProvider.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.authentication_new', 'app.shared.authentication', 'app.shared.oauth2']).$promise; }]
}
})
.state('app.admin.authentication_edit', {
url: '/admin/authentications/:id/edit',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/authentications/edit.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'EditAuthenticationController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
providerPromise: ['AuthProvider', '$stateParams', function (AuthProvider, $stateParams) { return AuthProvider.get({ id: $stateParams.id }).$promise; }],
mappingFieldsPromise: ['AuthProvider', function (AuthProvider) { return AuthProvider.mapping_fields().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query(['app.admin.authentication_edit', 'app.shared.authentication', 'app.shared.oauth2']).$promise; }]
}
})
2016-03-23 18:39:41 +01:00
// statistics
.state('app.admin.statistics', {
url: '/admin/statistics',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/statistics/index.html.erb" %>',
2016-03-23 18:39:41 +01:00
controller: 'StatisticsController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
membersPromise: ['Member', function (Member) { return Member.mapping().$promise; }],
statisticsPromise: ['Statistics', function (Statistics) { return Statistics.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.admin.statistics').$promise; }]
}
})
.state('app.admin.stats_graphs', {
url: '/admin/statistics/evolution',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/statistics/graphs.html" %>',
2016-03-23 18:39:41 +01:00
controller: 'GraphsController'
}
},
resolve: {
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.admin.stats_graphs').$promise; }]
}
})
2016-03-23 18:39:41 +01:00
// configurations
.state('app.admin.settings', {
url: '/admin/settings',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/settings/index.html.erb" %>',
2016-03-23 18:39:41 +01:00
controller: 'SettingsController'
}
},
resolve: {
2018-11-20 12:57:10 +01:00
settingsPromise: ['Setting', function (Setting) {
return Setting.query({
names: `['twitter_name', \
'about_title', \
'about_body', \
'privacy_body', \
'privacy_dpo', \
2018-11-20 12:57:10 +01:00
'about_contacts', \
'home_blogpost', \
'machine_explications_alert', \
'training_explications_alert', \
'training_information_message', \
'subscription_explications_alert', \
'event_explications_alert', \
'space_explications_alert', \
'booking_window_start', \
'booking_window_end', \
'booking_move_enable', \
'booking_move_delay', \
'booking_cancel_enable', \
'booking_cancel_delay', \
'main_color', \
'secondary_color', \
'fablab_name', \
'name_genre', \
'reminder_enable', \
'reminder_delay', \
'visibility_yearly', \
'visibility_others', \
'display_name_enable', \
2018-11-21 11:08:53 +01:00
'machines_sort_by']` }).$promise;
2018-11-20 12:57:10 +01:00
}],
2019-04-18 15:57:56 +02:00
privacyDraftsPromise: ['Setting', function (Setting) { return Setting.get({ name: 'privacy_draft', history: true }).$promise; }],
2018-11-21 11:08:53 +01:00
cguFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'cgu-file' }).$promise; }],
cgvFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'cgv-file' }).$promise; }],
faviconFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'favicon-file' }).$promise; }],
profileImageFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'profile-image-file' }).$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.admin.settings').$promise; }]
}
})
2015-05-05 03:10:25 +02:00
// OpenAPI Clients
.state('app.admin.open_api_clients', {
url: '/open_api_clients',
views: {
'main@': {
templateUrl: '<%= asset_path "admin/open_api_clients/index.html.erb" %>',
2016-05-09 18:15:04 +02:00
controller: 'OpenAPIClientsController'
}
},
resolve: {
2018-11-21 11:08:53 +01:00
clientsPromise: ['OpenAPIClient', function (OpenAPIClient) { return OpenAPIClient.query().$promise; }],
2018-11-21 11:32:50 +01:00
translations: ['Translations', function (Translations) { return Translations.query('app.admin.open_api_clients').$promise; }]
}
2018-11-21 11:08:53 +01:00
});
}
2015-05-05 03:10:25 +02:00
2018-11-21 11:08:53 +01:00
]);