mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 15:09:14 +00:00
[dir view] mv/cp multi dirents: add feedback msg
This commit is contained in:
@@ -1223,7 +1223,9 @@ define([
|
||||
} else {
|
||||
// when mv/cp to another lib, files/dirs should be handled one by one, and need to show progress
|
||||
var op_objs = dirents.where({'selected':true}),
|
||||
i = 0;
|
||||
i = 0,
|
||||
success_num = 0,
|
||||
first_item;
|
||||
// progress popup
|
||||
var mv_progress_popup = $(_this.mvProgressTemplate());
|
||||
var details = $('#mv-details', mv_progress_popup),
|
||||
@@ -1267,6 +1269,10 @@ define([
|
||||
if (op == 'mv') {
|
||||
dirents.remove(op_obj);
|
||||
}
|
||||
success_num += 1;
|
||||
if (success_num == 1) {
|
||||
first_item = obj_name;
|
||||
}
|
||||
endOrContinue();
|
||||
} else { // failed or canceled
|
||||
if (data['failed']) {
|
||||
@@ -1333,6 +1339,28 @@ define([
|
||||
if (op == 'mv') {
|
||||
_this.updateMagnificPopupOptions();
|
||||
}
|
||||
if (success_num > 0) {
|
||||
var msg_s;
|
||||
if (op == 'mv') {
|
||||
if (success_num == 1) {
|
||||
msg_s = gettext("Successfully moved %(name)s.");
|
||||
} else if (success_num == 2) {
|
||||
msg_s = gettext("Successfully moved %(name)s and 1 other item.");
|
||||
} else {
|
||||
msg_s = gettext("Successfully moved %(name)s and %(amount)s other items.");
|
||||
}
|
||||
} else { // cp
|
||||
if (success_num == 1) {
|
||||
msg_s = gettext("Successfully copied %(name)s.");
|
||||
} else if (success_num == 2) {
|
||||
msg_s = gettext("Successfully copied %(name)s and 1 other item.");
|
||||
} else {
|
||||
msg_s = gettext("Successfully copied %(name)s and %(amount)s other items.");
|
||||
}
|
||||
}
|
||||
msg_s = msg_s.replace('%(name)s', first_item).replace('%(amount)s', success_num - 1);
|
||||
setTimeout(function() { Common.feedback(msg_s, 'success'); }, 600);
|
||||
}
|
||||
} else {
|
||||
mvcpDirent(++i);
|
||||
}
|
||||
|
Reference in New Issue
Block a user