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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user