From 1adb9bb6b643736706b746629b849df9cdf45e50 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 18 Feb 2021 11:54:22 +0300 Subject: profiles: use client dialog; move related methods to pref-prefs --- js/App.js | 6 ++++++ js/PrefHelpers.js | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 63 insertions(+), 5 deletions(-) (limited to 'js') diff --git a/js/App.js b/js/App.js index 9d8f6c275..ccfeb9024 100644 --- a/js/App.js +++ b/js/App.js @@ -42,6 +42,12 @@ const App = { cancel_dialog_tag: function(value, attributes = {}) { return this.button_tag(value, "", {...{onclick: "App.dialogOf(this).hide()"}, ...attributes}); }, + checkbox_tag: function(name, checked = false, value = "", attributes = {}, id = "") { + return `` + }, select_tag: function(name, value, values = [], attributes = {}, id = "") { return ` + ${App.FormFields.button_tag(__('Create profile'), "", {onclick: 'App.dialogOf(this).addProfile()'})} + + + +
+ +
+ + + ${reply.map((profile) => ` + + + + + `).join("")} +
+ ${App.FormFields.checkbox_tag("", false, "", {onclick: 'Tables.onRowChecked(this)'})} + + ${profile.id > 0 ? + `${profile.title} + + ` : `${profile.title}`} + ${profile.active ? __("(active)") : ""} +
+
+ +
+ `); }); }, execute: function () { @@ -143,7 +195,7 @@ const Helpers = { if (confirm(__("Activate selected profile?"))) { Notify.progress("Loading, please wait..."); - xhrPost("backend.php", {op: "rpc", method: "setprofile", id: sel_rows.toString()}, () => { + xhrPost("backend.php", {op: "pref-prefs", method: "activateprofile", id: sel_rows.toString()}, () => { window.location.reload(); }); } -- cgit v1.2.3-54-g00ecf