aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/assets/js/admin/tabs/files.js27
1 files changed, 26 insertions, 1 deletions
diff --git a/data/assets/js/admin/tabs/files.js b/data/assets/js/admin/tabs/files.js
index 0e26b2f..56fb6c9 100644
--- a/data/assets/js/admin/tabs/files.js
+++ b/data/assets/js/admin/tabs/files.js
@@ -57,6 +57,10 @@ jQuery(function($) {
"</div><!-- btn-group -->",
],
+ move_prompt: [
+ "Enter destination path for \"%{name|h}\":",
+ ],
+
delete_confirm: [
"Are you sure you want to delete \"%{name|h}\"?",
],
@@ -176,7 +180,28 @@ jQuery(function($) {
if (data.url)
location.href = url;
} else if (action_id == 'move') {
- alert('TODO: move file');
+ var dst_path = prompt(TEMPLATES.run('move_prompt', data), data.path);
+ if (dst_path) {
+ send('file/move', {
+ src_path: data.path,
+ dst_path: dst_path,
+ }).always(function() {
+ // TODO: need loading handler
+ }).fail(function(r) {
+ var error = r.responseText;
+
+ try {
+ var data = $.parseJSON(r.responseText);
+ if (data.error)
+ error = data.error;
+ } catch (e) {}
+
+ alert("Error: " + error);
+ }).done(function() {
+ // reload file list
+ reload();
+ });
+ }
} else if (action_id == 'delete') {
if (confirm(TEMPLATES.run('delete_confirm', data))) {
send('file/delete', {