2014-08-25 01:02:34 +02:00
|
|
|
define([
|
|
|
|
'app',
|
2014-08-25 12:35:49 +02:00
|
|
|
'factories/playbook',
|
2014-08-25 21:41:05 +02:00
|
|
|
'services/playbooks',
|
2015-01-30 16:41:49 +01:00
|
|
|
'services/identities'
|
2014-08-25 01:02:34 +02:00
|
|
|
], function(app) {
|
2015-01-30 16:41:49 +01:00
|
|
|
app.registerController('AddPlaybookCtrl', ['$scope', 'Playbook', 'playbooks', '$state', 'identities', function($scope, Playbook, playbooks, $state, identities) {
|
2014-08-25 01:02:34 +02:00
|
|
|
$scope.playbook = new Playbook();
|
2015-01-30 16:41:49 +01:00
|
|
|
|
|
|
|
identities.getIdentities(function () {
|
|
|
|
$scope.identities = identities.identities;
|
|
|
|
if (!$scope.$$phase) {
|
|
|
|
$scope.$digest();
|
|
|
|
}
|
2014-08-25 21:41:05 +02:00
|
|
|
});
|
2014-08-25 12:35:49 +02:00
|
|
|
|
|
|
|
$scope.add = function () {
|
|
|
|
$scope.playbook.add()
|
|
|
|
.success(function (data) {
|
|
|
|
playbooks.getPlaybooks(function () {
|
2015-03-24 18:45:44 +01:00
|
|
|
$state.transitionTo('playbook.tasks', {
|
2014-08-25 12:35:49 +02:00
|
|
|
playbook_id: data._id
|
|
|
|
});
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.error(function (data) {
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
2014-08-25 01:02:34 +02:00
|
|
|
}]);
|
|
|
|
});
|