Basic node management in admin panel.
This commit is contained in:
parent
6cab6371d1
commit
d5c69fa78f
10 changed files with 180 additions and 38 deletions
admin/js/views
42
admin/js/views/taskActionButton.js
Normal file
42
admin/js/views/taskActionButton.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('ffffngAdmin')
|
||||
.directive('faTaskActionButton', function (Restangular, $state, notification) {
|
||||
var link = function (scope) {
|
||||
scope.label = scope.label || 'ACTION';
|
||||
scope.icon = scope.icon || 'play';
|
||||
scope.button = scope.button || 'default';
|
||||
|
||||
scope.perform = function () {
|
||||
var task = scope.task();
|
||||
|
||||
Restangular
|
||||
.one('/internal/api/tasks/' + scope.action, task.values.id).put()
|
||||
.then(function () { $state.reload() })
|
||||
.then(function () { notification.log('Done', { addnCls: 'humane-flatty-success' }); })
|
||||
.catch(function (e) {
|
||||
notification.log('Error: ' + e.data, { addnCls: 'humane-flatty-error' });
|
||||
console.error(e)
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
return {
|
||||
'link': link,
|
||||
'restrict': 'E',
|
||||
'scope': {
|
||||
'action': '@',
|
||||
'icon': '@',
|
||||
'task': '&',
|
||||
'size': '@',
|
||||
'label': '@',
|
||||
'button': '@',
|
||||
'disabled': '='
|
||||
},
|
||||
|
||||
'template':
|
||||
'<button class="btn btn-{{ button }}" ng-disabled="disabled" ng-class="size ? \'btn-\' + size : \'\'" ng-click="perform()">' +
|
||||
'<span class="glyphicon glyphicon-{{ icon }}" aria-hidden="true"></span> <span class="hidden-xs">{{ label }}</span>' +
|
||||
'</button>'
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue