pref helpers: move some methods to their own sections

This commit is contained in:
Andrew Dolgov 2021-02-12 21:51:32 +03:00
parent 6af83e3881
commit 481bd76100
3 changed files with 145 additions and 139 deletions

View File

@ -1394,7 +1394,7 @@ class Pref_Feeds extends Handler_Protected {
print "<button dojoType='dijit.form.Button' class='alt-primary'
onclick='CommonDialogs.generatedFeed(-2, false, \"$rss_url\", \"".__("Published articles")."\")'>".
__('Display URL')."</button>
<button class='alt-danger' dojoType='dijit.form.Button' onclick='return Helpers.clearFeedAccessKeys()'>".
<button class='alt-danger' dojoType='dijit.form.Button' onclick='return Helpers.Feeds.clearFeedAccessKeys()'>".
__('Clear all generated URLs')."</button> ";
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION, "prefFeedsPublishedGenerated");

View File

@ -715,7 +715,7 @@ class Pref_Prefs extends Handler_Protected {
print "</select>";
print " <button dojoType=\"dijit.form.Button\" class='alt-info'
onclick=\"Helpers.customizeCSS()\">" . __('Customize') . "</button>";
onclick=\"Helpers.Prefs.customizeCSS()\">" . __('Customize') . "</button>";
print " <button dojoType='dijit.form.Button' onclick='window.open(\"https://tt-rss.org/wiki/Themes\")'>
<i class='material-icons'>open_in_new</i> ".__("More themes...")."</button>";
@ -830,10 +830,10 @@ class Pref_Prefs extends Handler_Protected {
</div>
</div>";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return Helpers.editProfiles()\">".
print "<button dojoType=\"dijit.form.Button\" onclick=\"return Helpers.Profiles.edit()\">".
__('Manage profiles')."</button> ";
print "<button dojoType=\"dijit.form.Button\" class=\"alt-danger\" onclick=\"return Helpers.confirmReset()\">".
print "<button dojoType=\"dijit.form.Button\" class=\"alt-danger\" onclick=\"return Helpers.Prefs.confirmReset()\">".
__('Reset to defaults')."</button>";
print "&nbsp;";
@ -968,7 +968,7 @@ class Pref_Prefs extends Handler_Protected {
if (count($tmppluginhost->get_all($plugin)) > 0) {
if (in_array($name, $system_enabled) || in_array($name, $user_enabled)) {
print " <button dojoType='dijit.form.Button'
onclick=\"Helpers.clearPluginData('$name')\">
onclick=\"Helpers.Prefs.clearPluginData('$name')\">
<i class='material-icons'>clear</i> ".__("Clear data")."</button>";
}
}

View File

@ -40,6 +40,7 @@ const Helpers = {
}
},
},
Feeds: {
clearFeedAccessKeys: function() {
if (confirm(__("This will invalidate all previously generated feed URLs. Continue?"))) {
Notify.progress("Clearing URLs...");
@ -51,6 +52,7 @@ const Helpers = {
return false;
},
},
System: {
getPHPInfo: function(widget) {
xhrPost("backend.php", {op: 'pref-system', method: 'getphpinfo'}, (transport) => {
@ -90,7 +92,8 @@ const Helpers = {
}
},
},
editProfiles: function() {
Profiles: {
edit: function() {
const dialog = new fox.SingleUseDialog({
id: "profileEditDlg",
title: __("Settings Profiles"),
@ -159,6 +162,8 @@ const Helpers = {
dialog.refresh();
dialog.show();
},
},
Prefs: {
customizeCSS: function() {
xhrJson("backend.php", {op: "pref-prefs", method: "customizeCSS"}, (reply) => {
@ -216,7 +221,7 @@ const Helpers = {
confirmReset: function() {
if (confirm(__("Reset to defaults?"))) {
xhrPost("backend.php", {op: "pref-prefs", method: "resetconfig"}, (transport) => {
Helpers.refresh();
Helpers.Prefs.refresh();
Notify.info(transport.responseText);
});
}
@ -226,7 +231,7 @@ const Helpers = {
Notify.progress("Loading, please wait...");
xhrPost("backend.php", {op: "pref-prefs", method: "clearplugindata", name: name}, () => {
Helpers.refresh();
Helpers.Prefs.refresh();
});
}
},
@ -236,6 +241,7 @@ const Helpers = {
Notify.close();
});
},
},
OPML: {
import: function() {
const opml_file = $("opml_file");