mirror of
https://github.com/sismics/docs.git
synced 2025-12-21 05:31:42 +00:00
Server side tag system
This commit is contained in:
@@ -37,6 +37,26 @@ App.controller('DocumentView', function($rootScope, $scope, $state, $stateParams
|
||||
$state.transitionTo('document.view.file', { id: $stateParams.id, fileId: file.id })
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete a document.
|
||||
*/
|
||||
$scope.deleteDocument = function(document) {
|
||||
var title = 'Delete document';
|
||||
var msg = 'Do you really want to delete this document?';
|
||||
var btns = [{result:'cancel', label: 'Cancel'}, {result:'ok', label: 'OK', cssClass: 'btn-primary'}];
|
||||
|
||||
$dialog.messageBox(title, msg, btns)
|
||||
.open()
|
||||
.then(function(result) {
|
||||
if (result == 'ok') {
|
||||
Restangular.one('document', document.id).remove().then(function() {
|
||||
$scope.loadDocuments();
|
||||
$state.transitionTo('document.default');
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete a file.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<div class="text-right">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-danger" ng-click="deleteDocument(document)"><span class="icon-trash icon-white"></span> Delete</button>
|
||||
<button class="btn btn-primary" ng-click="editDocument(document.id)"><span class="icon-pencil icon-white"></span> Edit</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user