Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

PUBLIC / surfer-okd

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Settings
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit 9138d7d4 authored 9 years ago by Johannes Zellner's avatar Johannes Zellner
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

Implement file deletion

1 parent 537bfb04
Show whitespace changes
Inline Side-by-side
Showing with 45 additions and 2 deletions
  • app/index.html
  • app/js/app.js
app/index.html
View file @9138d7d
...@@ -31,6 +31,24 @@ ...@@ -31,6 +31,24 @@
</div> </div>
</nav> </nav>
<div class="modal fade" tabindex="-1" role="dialog" id="modalDelete">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div>
<div class="modal-body">
<h5 v-show="deleteData.isFile">Really delete <span style="font-weight: bold;">{{ deleteData.filePath }}</span>?</h5>
<h5 v-show="deleteData.isDirectory">Really delete directory <span style="font-weight: bold;">{{ deleteData.filePath }}</span> and all its content?</h5>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
<button type="button" class="btn btn-danger" v-on:click="del(deleteData)">Yes</button>
</div>
</div>
</div>
</div>
<div class="container" v-show="busy" v-cloak> <div class="container" v-show="busy" v-cloak>
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
...@@ -102,7 +120,7 @@ ...@@ -102,7 +120,7 @@
<th>{{ entry.filePath }}</th> <th>{{ entry.filePath }}</th>
<th>{{ entry.size }}</th> <th>{{ entry.size }}</th>
<th>{{ entry.mtime }}</th> <th>{{ entry.mtime }}</th>
<th style="text-align: right;"><button class="btn btn-sm btn-danger"><i class="fa fa-trash"></i></button></th> <th style="text-align: right;"><button class="btn btn-sm btn-danger" v-on:click.stop="delAsk(entry)"><i class="fa fa-trash"></i></button></th>
</tr> </tr>
</tbody> </tbody>
</table> </table>
......
This diff is collapsed. Click to expand it.
app/js/app.js
View file @9138d7d
...@@ -101,6 +101,28 @@ function upload() { ...@@ -101,6 +101,28 @@ function upload() {
app.$els.upload.click(); app.$els.upload.click();
} }
function delAsk(entry) {
$('#modalDelete').modal('show');
app.deleteData = entry;
}
function del(entry) {
app.busy = true;
var path = encode(sanitize(app.path + '/' + entry.filePath));
superagent.del('/api/files' + path).query({ username: app.session.username, password: app.session.password, recursive: true }).end(function (error, result) {
app.busy = false;
if (error) return console.error(error);
if (result.statusCode !== 200) return console.error('Error deleting file: ', result.statusCode);
refresh();
$('#modalDelete').modal('hide');
});
}
var app = new Vue({ var app = new Vue({
el: '#app', el: '#app',
data: { data: {
...@@ -111,6 +133,7 @@ var app = new Vue({ ...@@ -111,6 +133,7 @@ var app = new Vue({
valid: false valid: false
}, },
loginData: {}, loginData: {},
deleteData: {},
entries: [] entries: []
}, },
methods: { methods: {
...@@ -119,7 +142,9 @@ var app = new Vue({ ...@@ -119,7 +142,9 @@ var app = new Vue({
loadDirectory: loadDirectory, loadDirectory: loadDirectory,
open: open, open: open,
up: up, up: up,
upload: upload upload: upload,
delAsk: delAsk,
del: del
} }
}); });
......
This diff is collapsed. Click to expand it.
  • Write
  • Preview
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
  • Please register or sign in to post a comment