mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-25 16:19:59 +08:00
Added view, deletion and permissions for files
This commit is contained in:
@ -575,9 +575,9 @@ module.exports = function (ngApp, events) {
|
||||
*/
|
||||
function getFiles() {
|
||||
let url = window.baseUrl(`/files/get/page/${pageId}`)
|
||||
$http.get(url).then(responseData => {
|
||||
$scope.files = responseData.data;
|
||||
currentOrder = responseData.data.map(file => {return file.id}).join(':');
|
||||
$http.get(url).then(resp => {
|
||||
$scope.files = resp.data;
|
||||
currentOrder = resp.data.map(file => {return file.id}).join(':');
|
||||
});
|
||||
}
|
||||
getFiles();
|
||||
@ -595,6 +595,17 @@ module.exports = function (ngApp, events) {
|
||||
events.emit('success', 'File uploaded');
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete a file from the server and, on success, the local listing.
|
||||
* @param file
|
||||
*/
|
||||
$scope.deleteFile = function(file) {
|
||||
$http.delete(`/files/${file.id}`).then(resp => {
|
||||
events.emit('success', resp.data.message);
|
||||
$scope.files.splice($scope.files.indexOf(file), 1);
|
||||
});
|
||||
};
|
||||
|
||||
}]);
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user