Semaphore/public/js/controllers/playbook/edit.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

30 lines
715 B
JavaScript

define([
'app',
'factories/playbook',
'services/playbooks',
'services/identities'
], function(app) {
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) {
})
}
}]);
});