1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-12 23:09:03 +01:00
fab-manager/app/assets/javascripts/router.coffee.erb
2016-06-29 17:05:42 +02:00

930 lines
34 KiB
Plaintext

angular.module('application.router', ['ui.router']).
config ['$stateProvider', '$urlRouterProvider', '$locationProvider', ($stateProvider, $urlRouterProvider, $locationProvider) ->
$locationProvider.hashPrefix('!')
$urlRouterProvider.otherwise("/")
# abstract root parents states
# these states controls the access rights to the various routes inherited from them
$stateProvider
.state 'app',
abstract: true
views:
'header':
templateUrl: '<%= asset_path "shared/header.html" %>'
'leftnav':
templateUrl: '<%= asset_path "shared/leftnav.html" %>'
controller: 'MainNavController'
'main': {}
resolve:
logoFile: ['CustomAsset', (CustomAsset) ->
CustomAsset.get({name: 'logo-file'}).$promise
]
logoBlackFile: ['CustomAsset', (CustomAsset) ->
CustomAsset.get({name: 'logo-black-file'}).$promise
]
commonTranslations: [ 'Translations', (Translations) ->
Translations.query(['app.public.common', 'app.shared.buttons', 'app.shared.elements']).$promise
]
onEnter: ['$rootScope', 'logoFile', 'logoBlackFile', ($rootScope, logoFile, logoBlackFile) ->
## Application logo
$rootScope.logo = logoFile.custom_asset
$rootScope.logoBlack = logoBlackFile.custom_asset
]
.state 'app.public',
abstract: true
.state 'app.logged',
abstract: true
data:
authorizedRoles: ['member', 'admin']
resolve:
currentUser: ['Auth', (Auth)->
Auth.currentUser()
]
onEnter: ["$state", "$timeout", "currentUser", "$rootScope", ($state, $timeout, currentUser, $rootScope)->
$rootScope.currentUser = currentUser
]
.state 'app.admin',
abstract: true
data:
authorizedRoles: ['admin']
resolve:
currentUser: ['Auth', (Auth)->
Auth.currentUser()
]
onEnter: ["$state", "$timeout", "currentUser", "$rootScope", ($state, $timeout, currentUser, $rootScope)->
$rootScope.currentUser = currentUser
]
# main pages
.state 'app.public.about',
url: '/about'
views:
'content@':
templateUrl: '<%= asset_path "shared/about.html" %>'
controller: 'AboutController'
resolve:
translations: [ 'Translations', (Translations) ->
Translations.query('app.public.about').$promise
]
.state 'app.public.home',
url: '/?reset_password_token'
views:
'main@':
templateUrl: '<%= asset_path "home.html" %>'
controller: 'HomeController'
resolve:
lastMembersPromise: ['Member', (Member)->
Member.lastSubscribed(limit: 4).$promise
]
lastProjectsPromise: ['Project', (Project)->
Project.lastPublished().$promise
]
upcomingEventsPromise: ['Event', (Event)->
Event.upcoming(limit: 3).$promise
]
homeBlogpostPromise: ['Setting', (Setting)->
Setting.get(name: 'home_blogpost').$promise
]
twitterNamePromise: ['Setting', (Setting)->
Setting.get(name: 'twitter_name').$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query('app.public.home').$promise
]
# profile completion (SSO import passage point)
.state 'app.logged.profileCompletion',
url: '/profile_completion'
views:
'main@':
templateUrl: '<%= asset_path "profile/complete.html"%>'
controller: 'CompleteProfileController'
resolve:
settingsPromise: ['Setting', (Setting)->
Setting.query(names: "['fablab_name', 'name_genre']").$promise
]
activeProviderPromise: ['AuthProvider', (AuthProvider) ->
AuthProvider.active().$promise
]
groupsPromise: ['Group', (Group)->
Group.query().$promise
]
cguFile: ['CustomAsset', (CustomAsset) ->
CustomAsset.get({name: 'cgu-file'}).$promise
]
memberPromise: ['Member', 'currentUser', (Member, currentUser)->
Member.get(id: currentUser.id).$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query(['app.logged.profileCompletion', 'app.shared.user']).$promise
]
# dashboard
.state 'app.logged.dashboard',
abstract: true
url: '/dashboard'
resolve:
memberPromise: ['Member', 'currentUser', (Member, currentUser)->
Member.get(id: currentUser.id).$promise
]
.state 'app.logged.dashboard.profile',
url: '/profile'
views:
'main@':
templateUrl: '<%= asset_path "dashboard/profile.html" %>'
controller: 'DashboardController'
resolve:
translations: [ 'Translations', (Translations) ->
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" %>'
controller: 'EditProfileController'
resolve:
groups: ['Group', (Group)->
Group.query().$promise
]
activeProviderPromise: ['AuthProvider', (AuthProvider) ->
AuthProvider.active().$promise
]
translations: [ 'Translations', (Translations) ->
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" %>'
controller: 'DashboardController'
resolve:
translations: [ 'Translations', (Translations) ->
Translations.query('app.logged.dashboard.projects').$promise
]
.state 'app.logged.dashboard.trainings',
url: '/trainings'
views:
'main@':
templateUrl: '<%= asset_path "dashboard/trainings.html" %>'
controller: 'DashboardController'
resolve:
translations: [ 'Translations', (Translations) ->
Translations.query('app.logged.dashboard.trainings').$promise
]
.state 'app.logged.dashboard.events',
url: '/events'
views:
'main@':
templateUrl: '<%= asset_path "dashboard/events.html" %>'
controller: 'DashboardController'
resolve:
translations: [ 'Translations', (Translations) ->
Translations.query('app.logged.dashboard.events').$promise
]
.state 'app.logged.dashboard.invoices',
url: '/invoices'
views:
'main@':
templateUrl: '<%= asset_path "dashboard/invoices.html" %>'
controller: 'DashboardController'
resolve:
translations: [ 'Translations', (Translations) ->
Translations.query('app.logged.dashboard.invoices').$promise
]
# members
.state 'app.logged.members_show',
url: '/members/:id'
views:
'main@':
templateUrl: '<%= asset_path "members/show.html" %>'
controller: 'ShowProfileController'
resolve:
memberPromise: ['$stateParams', 'Member', ($stateParams, Member)->
Member.get(id: $stateParams.id).$promise
]
translations: [ 'Translations', (Translations) ->
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" %>'
controller: 'MembersController'
resolve:
membersPromise: ['Member', (Member)->
Member.query({requested_attributes:'[profile]', page: 1, size: 10}).$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query('app.logged.members').$promise
]
# 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" %>'
controller: 'ProjectsController'
resolve:
themesPromise: ['Theme', (Theme)->
Theme.query().$promise
]
componentsPromise: ['Component', (Component)->
Component.query().$promise
]
machinesPromise: ['Machine', (Machine)->
Machine.query().$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query('app.public.projects_list').$promise
]
.state 'app.logged.projects_new',
url: '/projects/new'
views:
'main@':
templateUrl: '<%= asset_path "projects/new.html" %>'
controller: 'NewProjectController'
resolve:
translations: [ 'Translations', (Translations) ->
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" %>'
controller: 'ShowProjectController'
resolve:
projectPromise: ['$stateParams', 'Project', ($stateParams, Project)->
Project.get(id: $stateParams.id).$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query('app.public.projects_show').$promise
]
.state 'app.logged.projects_edit',
url: '/projects/:id/edit'
views:
'main@':
templateUrl: '<%= asset_path "projects/edit.html" %>'
controller: 'EditProjectController'
resolve:
projectPromise: ['$stateParams', 'Project', ($stateParams, Project)->
Project.get(id: $stateParams.id).$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query(['app.logged.projects_edit', 'app.shared.project']).$promise
]
# machines
.state 'app.public.machines_list',
url: '/machines'
views:
'main@':
templateUrl: '<%= asset_path "machines/index.html" %>'
controller: 'MachinesController'
resolve:
machinesPromise: ['Machine', (Machine)->
Machine.query().$promise
]
translations: [ 'Translations', (Translations) ->
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" %>'
controller: 'NewMachineController'
resolve:
translations: [ 'Translations', (Translations) ->
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" %>'
controller: 'ShowMachineController'
resolve:
machinePromise: ['Machine', '$stateParams', (Machine, $stateParams)->
Machine.get(id: $stateParams.id).$promise
]
translations: [ 'Translations', (Translations) ->
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" %>'
controller: 'ReserveMachineController'
resolve:
plansPromise: ['Plan', (Plan)->
Plan.query().$promise
]
groupsPromise: ['Group', (Group)->
Group.query().$promise
]
settingsPromise: ['Setting', (Setting)->
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']").$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query(['app.logged.machines_reserve', 'app.shared.plan_subscribe', 'app.shared.member_select',
'app.shared.stripe', 'app.shared.valid_reservation_modal', 'app.shared.confirm_modify_slot_modal']).$promise
]
.state 'app.admin.machines_edit',
url: '/machines/:id/edit'
views:
'main@':
templateUrl: '<%= asset_path "machines/edit.html" %>'
controller: 'EditMachineController'
resolve:
machinePromise: ['Machine', '$stateParams', (Machine, $stateParams)->
Machine.get(id: $stateParams.id).$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query(['app.admin.machines_edit', 'app.shared.machine']).$promise
]
# trainings
.state 'app.logged.trainings_reserve',
url: '/trainings/reserve'
views:
'main@':
templateUrl: '<%= asset_path "trainings/reserve.html" %>'
controller: 'ReserveTrainingController'
resolve:
explicationAlertPromise: ['Setting', (Setting)->
Setting.get(name: 'training_explications_alert').$promise
]
plansPromise: ['Plan', (Plan)->
Plan.query().$promise
]
groupsPromise: ['Group', (Group)->
Group.query().$promise
]
availabilityTrainingsPromise: ['Availability', (Availability)->
Availability.trainings().$promise
]
settingsPromise: ['Setting', (Setting)->
Setting.query(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',
'training_information_message']").$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query(['app.logged.trainings_reserve', 'app.shared.plan_subscribe', 'app.shared.member_select',
'app.shared.stripe', 'app.shared.valid_reservation_modal', 'app.shared.confirm_modify_slot_modal']).$promise
]
# notifications
.state 'app.logged.notifications',
url: '/notifications'
views:
'main@':
templateUrl: '<%= asset_path "notifications/index.html" %>'
controller: 'NotificationsController'
resolve:
translations: [ 'Translations', (Translations) ->
Translations.query('app.logged.notifications').$promise
]
# pricing
.state 'app.public.plans',
url: '/plans'
abstract: Fablab.withoutPlans
views:
'main@':
templateUrl: '<%= asset_path "plans/index.html" %>'
controller: 'PlansIndexController'
resolve:
subscriptionExplicationsPromise: ['Setting', (Setting)->
Setting.get(name: 'subscription_explications_alert').$promise
]
plansPromise: ['Plan', (Plan)->
Plan.query().$promise
]
groupsPromise: ['Group', (Group)->
Group.query().$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query(['app.public.plans', 'app.shared.member_select', 'app.shared.stripe']).$promise
]
# events
.state 'app.public.events_list',
url: '/events'
views:
'main@':
templateUrl: '<%= asset_path "events/index.html" %>'
controller: 'EventsController'
resolve:
categoriesPromise: ['Category', (Category) ->
Category.query().$promise
]
themesPromise: ['EventTheme', (EventTheme) ->
EventTheme.query().$promise
]
ageRangesPromise: ['AgeRange', (AgeRange) ->
AgeRange.query().$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query('app.public.events_list').$promise
]
.state 'app.public.events_show',
url: '/events/:id'
views:
'main@':
templateUrl: '<%= asset_path "events/show.html" %>'
controller: 'ShowEventController'
resolve:
eventPromise: ['Event', '$stateParams', (Event, $stateParams)->
Event.get(id: $stateParams.id).$promise
]
reducedAmountAlert: ['Setting', (Setting)->
Setting.get(name: 'event_reduced_amount_alert').$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query(['app.public.events_show', 'app.shared.member_select', 'app.shared.stripe', 'app.shared.valid_reservation_modal']).$promise
]
# --- namespace /admin/... ---
# calendar
.state 'app.admin.calendar',
url: '/admin/calendar'
views:
'main@':
templateUrl: '<%= asset_path "admin/calendar/calendar.html" %>'
controller: 'AdminCalendarController'
resolve:
availabilitiesPromise: ['Availability', (Availability)->
Availability.query().$promise
]
bookingWindowStart: ['Setting', (Setting)->
Setting.get(name: 'booking_window_start').$promise
]
bookingWindowEnd: ['Setting', (Setting)->
Setting.get(name: 'booking_window_end').$promise
]
machinesPromise: ['Machine', (Machine) ->
Machine.query().$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query('app.admin.calendar').$promise
]
# project's elements
.state 'app.admin.project_elements',
url: '/admin/project_elements'
views:
'main@':
templateUrl: '<%= asset_path "admin/project_elements/index.html" %>'
controller: 'ProjectElementsController'
resolve:
componentsPromise: ['Component', (Component)->
Component.query().$promise
]
licencesPromise: ['Licence', (Licence)->
Licence.query().$promise
]
themesPromise: ['Theme', (Theme)->
Theme.query().$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query('app.admin.project_elements').$promise
]
# trainings
.state 'app.admin.trainings',
url: '/admin/trainings'
views:
'main@':
templateUrl: '<%= asset_path "admin/trainings/index.html" %>'
controller: 'TrainingsController'
resolve:
trainingsPromise: ['Training', (Training)->
Training.query().$promise
]
machinesPromise: ['Machine', (Machine)->
Machine.query().$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query('app.admin.trainings').$promise
]
# events
.state 'app.admin.events',
url: '/admin/events'
views:
'main@':
templateUrl: '<%= asset_path "admin/events/index.html" %>'
controller: 'AdminEventsController'
resolve:
eventsPromise: ['Event', (Event)->
Event.query(page: 1).$promise
]
categoriesPromise: ['Category', (Category) ->
Category.query().$promise
]
themesPromise: ['EventTheme', (EventTheme) ->
EventTheme.query().$promise
]
ageRangesPromise: ['AgeRange', (AgeRange) ->
AgeRange.query().$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query('app.admin.events').$promise
]
.state 'app.admin.events_new',
url: '/admin/events/new'
views:
'main@':
templateUrl: '<%= asset_path "events/new.html" %>'
controller: 'NewEventController'
resolve:
categoriesPromise: ['Category', (Category) ->
Category.query().$promise
]
themesPromise: ['EventTheme', (EventTheme) ->
EventTheme.query().$promise
]
ageRangesPromise: ['AgeRange', (AgeRange) ->
AgeRange.query().$promise
]
translations: [ 'Translations', (Translations) ->
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" %>'
controller: 'EditEventController'
resolve:
eventPromise: ['Event', '$stateParams', (Event, $stateParams)->
Event.get(id: $stateParams.id).$promise
]
categoriesPromise: ['Category', (Category) ->
Category.query().$promise
]
themesPromise: ['EventTheme', (EventTheme) ->
EventTheme.query().$promise
]
ageRangesPromise: ['AgeRange', (AgeRange) ->
AgeRange.query().$promise
]
translations: [ 'Translations', (Translations) ->
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" %>'
controller: 'ShowEventReservationsController'
resolve:
eventPromise: ['Event', '$stateParams', (Event, $stateParams)->
Event.get(id: $stateParams.id).$promise
]
reservationsPromise: ['Reservation', '$stateParams', (Reservation, $stateParams)->
Reservation.query(reservable_id: $stateParams.id, reservable_type: 'Event').$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query('app.admin.event_reservations').$promise
]
# pricing
.state 'app.admin.pricing',
url: '/admin/pricing'
views:
'main@':
templateUrl: '<%= asset_path "admin/pricing/index.html" %>'
controller: 'EditPricingController'
resolve:
plans: ['Plan', (Plan) ->
Plan.query().$promise
]
groups: ['Group', (Group) ->
Group.query().$promise
]
machinesPricesPromise: ['Price', (Price)->
Price.query(priceable_type: 'Machine', plan_id: 'null').$promise
]
trainingsPricingsPromise: ['TrainingsPricing', (TrainingsPricing)->
TrainingsPricing.query().$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query('app.admin.pricing').$promise
]
trainingsPromise: ['Training', (Training) ->
Training.query().$promise
]
machineCreditsPromise: ['Credit', (Credit) ->
Credit.query({creditable_type: 'Machine'}).$promise
]
machinesPromise: ['Machine', (Machine) ->
Machine.query().$promise
]
trainingCreditsPromise: ['Credit', (Credit) ->
Credit.query({creditable_type: 'Training'}).$promise
]
# plans
.state 'app.admin.plans',
abstract: true
resolve:
prices: ['Pricing', (Pricing) ->
Pricing.query().$promise
]
machines: ['Machine', (Machine) ->
Machine.query().$promise
]
groups: ['Group', (Group) ->
Group.query().$promise
]
plans: ['Plan', (Plan) ->
Plan.query().$promise
]
partners: ['User', (User) ->
User.query({role: 'partner'}).$promise
]
.state 'app.admin.plans.new',
url: '/admin/plans/new'
views:
'main@':
templateUrl: '<%= asset_path "admin/plans/new.html" %>'
controller: 'NewPlanController'
resolve:
translations: [ 'Translations', (Translations) ->
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" %>'
controller: 'EditPlanController'
resolve:
planPromise: ['Plan', '$stateParams', (Plan, $stateParams) ->
Plan.get({id: $stateParams.id}).$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query(['app.admin.plans.edit', 'app.shared.plan']).$promise
]
# invoices
.state 'app.admin.invoices',
url: '/admin/invoices'
views:
'main@':
templateUrl: '<%= asset_path "admin/invoices/index.html" %>'
controller: 'InvoicesController'
resolve:
settings: ['Setting', (Setting)->
Setting.query(names: "[
'invoice_legals',
'invoice_text',
'invoice_VAT-rate',
'invoice_VAT-active',
'invoice_order-nb',
'invoice_code-value',
'invoice_code-active',
'invoice_reference',
'invoice_logo'
]").$promise
]
invoices: [ 'Invoice', (Invoice) ->
Invoice.list({
query: { number: '', customer: '', date: null, order_by: '-reference', page: 1, size: 20 }
}).$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query('app.admin.invoices').$promise
]
# members
.state 'app.admin.members',
url: '/admin/members'
views:
'main@':
templateUrl: '<%= asset_path "admin/members/index.html" %>'
controller: 'AdminMembersController'
'groups@app.admin.members':
templateUrl: '<%= asset_path "admin/groups/index.html" %>'
controller: 'GroupsController'
'tags@app.admin.members':
templateUrl: '<%= asset_path "admin/tags/index.html" %>'
controller: 'TagsController'
'authentification@app.admin.members':
templateUrl: '<%= asset_path "admin/authentications/index.html" %>'
controller: 'AuthentificationController'
resolve:
membersPromise: ['Member', (Member)->
Member.list({ query: { search: '', order_by: 'id', page: 1, size: 20 } }).$promise
]
adminsPromise: ['Admin', (Admin)->
Admin.query().$promise
]
groupsPromise: ['Group', (Group)->
Group.query().$promise
]
tagsPromise: ['Tag', (Tag)->
Tag.query().$promise
]
authProvidersPromise: ['AuthProvider', (AuthProvider)->
AuthProvider.query().$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query('app.admin.members').$promise
]
.state 'app.admin.members_new',
url: '/admin/members/new'
views:
'main@':
templateUrl: '<%= asset_path "admin/members/new.html" %>'
controller: 'NewMemberController'
resolve:
translations: [ 'Translations', (Translations) ->
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" %>'
controller: 'EditMemberController'
resolve:
memberPromise: ['Member', '$stateParams', (Member, $stateParams)->
Member.get(id: $stateParams.id).$promise
]
tagsPromise: ['Tag', (Tag)->
Tag.query().$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query(['app.admin.members_edit', 'app.shared.user', 'app.shared.user_admin']).$promise
]
.state 'app.admin.admins_new',
url: '/admin/admins/new'
views:
'main@':
templateUrl: '<%= asset_path "admin/admins/new.html" %>'
controller: 'NewAdminController'
resolve:
translations: [ 'Translations', (Translations) ->
Translations.query('app.admin.admins_new').$promise
]
# authentification providers
.state 'app.admin.authentication_new',
url: '/admin/authentications/new'
views:
'main@':
templateUrl: '<%= asset_path "admin/authentications/new.html" %>'
controller: 'NewAuthenticationController'
resolve:
mappingFieldsPromise: ['AuthProvider', (AuthProvider)->
AuthProvider.mapping_fields().$promise
]
authProvidersPromise: ['AuthProvider', (AuthProvider)->
AuthProvider.query().$promise
]
translations: [ 'Translations', (Translations) ->
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" %>'
controller: 'EditAuthenticationController'
resolve:
providerPromise: ['AuthProvider', '$stateParams', (AuthProvider, $stateParams)->
AuthProvider.get(id: $stateParams.id).$promise
]
mappingFieldsPromise: ['AuthProvider', (AuthProvider)->
AuthProvider.mapping_fields().$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query(['app.admin.authentication_edit', 'app.shared.authentication', 'app.shared.oauth2']).$promise
]
# statistics
.state 'app.admin.statistics',
url: '/admin/statistics'
views:
'main@':
templateUrl: '<%= asset_path "admin/statistics/index.html" %>'
controller: 'StatisticsController'
resolve:
membersPromise: ['Member', (Member) ->
Member.mapping().$promise
]
statisticsPromise: ['Statistics', (Statistics)->
Statistics.query().$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query('app.admin.statistics').$promise
]
.state 'app.admin.stats_graphs',
url: '/admin/statistics/evolution'
views:
'main@':
templateUrl: '<%= asset_path "admin/statistics/graphs.html" %>'
controller: 'GraphsController'
resolve:
translations: [ 'Translations', (Translations) ->
Translations.query('app.admin.stats_graphs').$promise
]
# configurations
.state 'app.admin.settings',
url: '/admin/settings'
views:
'main@':
templateUrl: '<%= asset_path "admin/settings/index.html" %>'
controller: 'SettingsController'
resolve:
settingsPromise: ['Setting', (Setting)->
Setting.query(names: "[
'twitter_name',
'about_title',
'about_body',
'about_contacts',
'home_blogpost',
'machine_explications_alert',
'training_explications_alert',
'training_information_message',
'subscription_explications_alert',
'event_reduced_amount_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'
]").$promise
]
cguFile: ['CustomAsset', (CustomAsset) ->
CustomAsset.get({name: 'cgu-file'}).$promise
]
cgvFile: ['CustomAsset', (CustomAsset) ->
CustomAsset.get({name: 'cgv-file'}).$promise
]
faviconFile: ['CustomAsset', (CustomAsset) ->
CustomAsset.get({name: 'favicon-file'}).$promise
]
profileImageFile: ['CustomAsset', (CustomAsset) ->
CustomAsset.get({name: 'profile-image-file'}).$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query('app.admin.settings').$promise
]
# OpenAPI Clients
.state 'app.admin.open_api_clients',
url: '/open_api_clients'
views:
'main@':
templateUrl: '<%= asset_path "admin/open_api_clients/index.html" %>'
controller: 'OpenAPIClientsController'
resolve:
clientsPromise: ['OpenAPIClient', (OpenAPIClient)->
OpenAPIClient.query().$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query('app.admin.open_api_clients').$promise
]
]