2015-01-30 16:41:49 +01:00
|
|
|
define([
|
|
|
|
'factories/playbook',
|
|
|
|
'services/playbooks',
|
|
|
|
'services/identities'
|
2016-03-18 23:03:28 +01:00
|
|
|
], function () {
|
2015-01-30 16:41:49 +01:00
|
|
|
app.registerController('EditPlaybookCtrl', ['$scope', 'playbook', 'playbooks', '$state', 'identities', function($scope, playbook, playbooks, $state, identities) {
|
|
|
|
$scope.playbook = playbook;
|
|
|
|
|
|
|
|
identities.getIdentities(function () {
|
|
|
|
$scope.identities = identities.identities;
|
|
|
|
if (!$scope.$$phase) {
|
|
|
|
$scope.$digest();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$scope.add = function () {
|
|
|
|
$scope.playbook.save()
|
|
|
|
.success(function (data) {
|
|
|
|
playbooks.getPlaybooks(function () {
|
|
|
|
$state.transitionTo('playbook.view', {
|
|
|
|
playbook_id: data._id
|
|
|
|
});
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.error(function (data) {
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}]);
|
|
|
|
});
|