Semaphore/public/js/controllers/playbook/add.js
Matej Kramny dc2dac98ad Edit playbooks, help texts
- Remove 'credential' in favour of Identity
- Add help texts for playbooks, identities.
- Fix adding Playbooks (identities)
- Editing playbooks now possible
- Improves Vagrantfile to accomodate development (suitable for production also)
2015-01-30 15:41:49 +00:00

31 lines
720 B
JavaScript

define([
'app',
'factories/playbook',
'services/playbooks',
'services/identities'
], function(app) {
app.registerController('AddPlaybookCtrl', ['$scope', 'Playbook', 'playbooks', '$state', 'identities', function($scope, Playbook, playbooks, $state, identities) {
$scope.playbook = new Playbook();
identities.getIdentities(function () {
$scope.identities = identities.identities;
if (!$scope.$$phase) {
$scope.$digest();
}
});
$scope.add = function () {
$scope.playbook.add()
.success(function (data) {
playbooks.getPlaybooks(function () {
$state.transitionTo('playbook.view', {
playbook_id: data._id
});
});
})
.error(function (data) {
})
}
}]);
});