diff --git a/app/assets/javascripts/controllers/admin/trainings.coffee.erb b/app/assets/javascripts/controllers/admin/trainings.coffee.erb index c782cd33e..f5d9d7cce 100644 --- a/app/assets/javascripts/controllers/admin/trainings.coffee.erb +++ b/app/assets/javascripts/controllers/admin/trainings.coffee.erb @@ -16,6 +16,17 @@ Application.Controllers.controller "NewTrainingController", [ '$scope', ($scope) ## API URL where the form will be posted $scope.actionUrl = '/api/trainings' + + ## + # For use with 'ng-class', returns the CSS class name for the uploads previews. + # The preview may show a placeholder or the content of the file depending on the upload state. + # @param v {*} any attribute, will be tested for truthiness (see JS evaluation rules) + ## + $scope.fileinputClass = (v)-> + if v + 'fileinput-exists' + else + 'fileinput-new' ] @@ -37,6 +48,17 @@ Application.Controllers.controller "EditTrainingController", [ '$scope', '$state ## Details of the training to edit (id in URL) $scope.training = trainingPromise + + ## + # For use with 'ng-class', returns the CSS class name for the uploads previews. + # The preview may show a placeholder or the content of the file depending on the upload state. + # @param v {*} any attribute, will be tested for truthiness (see JS evaluation rules) + ## + $scope.fileinputClass = (v)-> + if v + 'fileinput-exists' + else + 'fileinput-new' ] diff --git a/app/assets/javascripts/router.coffee.erb b/app/assets/javascripts/router.coffee.erb index e088f9cea..5c9db9555 100644 --- a/app/assets/javascripts/router.coffee.erb +++ b/app/assets/javascripts/router.coffee.erb @@ -521,7 +521,7 @@ angular.module('application.router', ['ui.router']). Machine.query().$promise ] translations: [ 'Translations', (Translations) -> - Translations.query('app.admin.trainings').$promise + Translations.query(['app.admin.trainings', 'app.shared.trainings']).$promise ] .state 'app.admin.trainings_new', url: '/admin/trainings/new' @@ -544,7 +544,7 @@ angular.module('application.router', ['ui.router']). Training.get(id: $stateParams.id).$promise ] translations: [ 'Translations', (Translations) -> - Translations.query(['app.admin.trainings_edit', 'app.shared.trainings']).$promise + Translations.query('app.shared.trainings').$promise ] # events .state 'app.admin.events', diff --git a/app/assets/templates/admin/plans/new.html.erb b/app/assets/templates/admin/plans/new.html.erb index bd5621fb8..f8c3d3a19 100644 --- a/app/assets/templates/admin/plans/new.html.erb +++ b/app/assets/templates/admin/plans/new.html.erb @@ -23,7 +23,7 @@ diff --git a/app/assets/templates/admin/trainings/new.html.erb b/app/assets/templates/admin/trainings/new.html.erb index c5a8f8aa8..41dd344f8 100644 --- a/app/assets/templates/admin/trainings/new.html.erb +++ b/app/assets/templates/admin/trainings/new.html.erb @@ -21,7 +21,7 @@
-