Initial commit

This commit is contained in:
jendib
2013-07-27 18:33:20 +02:00
parent 41cb6dd9ae
commit 9b74bd8194
156 changed files with 72879 additions and 0 deletions
@@ -0,0 +1,37 @@
'use strict';
/**
* Document edition controller.
*/
App.controller('DocumentEdit', function($scope, $state, $stateParams, Restangular) {
/**
* Returns true if in edit mode (false in add mode).
*/
$scope.isEdit = function() {
return $stateParams.id;
};
/**
* Edit a document.
*/
$scope.edit = function() {
if ($scope.isEdit()) {
// TODO
} else {
Restangular
.one('document')
.put($scope.document)
.then(function() {
$scope.document = {};
$scope.loadDocuments();
});
}
};
/**
* Cancel edition.
*/
$scope.cancel = function() {
$state.transitionTo('document');
};
});