Fix: Update of ng-admin broke buttons in admin panel.

This commit is contained in:
baldo 2017-05-13 12:47:52 +02:00
parent aca1fd520a
commit 2519cf1030
2 changed files with 4 additions and 8 deletions

View file

@ -1,9 +1,7 @@
'use strict'; 'use strict';
angular.module('ffffngAdmin') angular.module('ffffngAdmin')
.directive('faMailActionButton', function (Restangular, $state, notification, config) { .directive('faMailActionButton', function (Restangular, $state, notification) {
var pathPrefix = config.rootPath === '/' ? '' : config.rootPath;
var link = function (scope) { var link = function (scope) {
scope.label = scope.label || 'ACTION'; scope.label = scope.label || 'ACTION';
scope.icon = scope.icon || 'envelope'; scope.icon = scope.icon || 'envelope';
@ -13,7 +11,7 @@ angular.module('ffffngAdmin')
var mail = scope.mail(); var mail = scope.mail();
Restangular Restangular
.one(pathPrefix + '/internal/api/mails/' + scope.action, mail.values.id).put() .one('mails/' + scope.action, mail.values.id).put()
.then(function () { $state.reload() }) .then(function () { $state.reload() })
.then(function () { notification.log('Done', { addnCls: 'humane-flatty-success' }); }) .then(function () { notification.log('Done', { addnCls: 'humane-flatty-success' }); })
.catch(function (e) { .catch(function (e) {

View file

@ -1,9 +1,7 @@
'use strict'; 'use strict';
angular.module('ffffngAdmin') angular.module('ffffngAdmin')
.directive('faTaskActionButton', function (Restangular, $state, notification, config) { .directive('faTaskActionButton', function (Restangular, $state, notification) {
var pathPrefix = config.rootPath === '/' ? '' : config.rootPath;
var link = function (scope) { var link = function (scope) {
scope.label = scope.label || 'ACTION'; scope.label = scope.label || 'ACTION';
scope.icon = scope.icon || 'play'; scope.icon = scope.icon || 'play';
@ -13,7 +11,7 @@ angular.module('ffffngAdmin')
var task = scope.task(); var task = scope.task();
Restangular Restangular
.one(pathPrefix + '/internal/api/tasks/' + scope.action, task.values.id).put() .one('tasks/' + scope.action, task.values.id).put()
.then(function () { $state.reload() }) .then(function () { $state.reload() })
.then(function () { notification.log('Done', { addnCls: 'humane-flatty-success' }); }) .then(function () { notification.log('Done', { addnCls: 'humane-flatty-success' }); })
.catch(function (e) { .catch(function (e) {