summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorwn_ <invalid@email.com>2025-01-06 14:17:35 +0000
committerwn_ <invalid@email.com>2025-01-06 14:17:38 +0000
commit0da9ef81bd6ed41bfdbd736290778c3d19df0647 (patch)
tree80dfbf227fa7365fc6664ba40cf76664cc8a3c43 /js
parent91496a0d24d58621503ae86ee217b0ce27d256f2 (diff)
Prompt for the new filter name when only copying one.
This also reworks 'Pref_Filters' a bit so it's easier to retrieve filter titles.
Diffstat (limited to 'js')
-rw-r--r--js/PrefFilterTree.js22
1 files changed, 16 insertions, 6 deletions
diff --git a/js/PrefFilterTree.js b/js/PrefFilterTree.js
index 10c4d7de3..e94542a16 100644
--- a/js/PrefFilterTree.js
+++ b/js/PrefFilterTree.js
@@ -171,13 +171,23 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
const sel_rows = this.getSelectedFilters();
if (sel_rows.length > 0) {
- if (confirm(__("Copy selected filters?"))) {
- Notify.progress("Copying selected filters...");
+ const query = {op: "Pref_Filters", method: "copy", ids: sel_rows.toString()};
+ let proceed = false;
+
+ if (sel_rows.length === 1) {
+ const selected_filter = this.model.getCheckedItems()[0];
+ const new_title = prompt(__("Name for copied filter:"), 'Copy - ' + this.model.store.getValue(selected_filter, "bare_name"));
+
+ if (new_title) {
+ query.new_title = new_title;
+ proceed = true;
+ }
+ } else if (sel_rows.length > 1) {
+ proceed = confirm(__("Copy selected filters?"));
+ }
- const query = {
- op: "Pref_Filters", method: "copy",
- ids: sel_rows.toString()
- };
+ if (proceed) {
+ Notify.progress("Copying selected filters...");
xhr.post("backend.php", query, () => {
this.reload();