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.
This commit is contained in:
wn_
2025-01-06 14:17:35 +00:00
parent 91496a0d24
commit 0da9ef81bd
2 changed files with 29 additions and 13 deletions

View File

@@ -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;
const query = {
op: "Pref_Filters", method: "copy",
ids: sel_rows.toString()
};
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?"));
}
if (proceed) {
Notify.progress("Copying selected filters...");
xhr.post("backend.php", query, () => {
this.reload();