pref-filters: add a button to hide or show rules in the filter list

This commit is contained in:
Andrew Dolgov 2022-06-05 11:41:28 +03:00
parent 185234bc67
commit fc84712135
9 changed files with 45 additions and 2 deletions

View File

@ -684,10 +684,12 @@ class Pref_Filters extends Handler_Protected {
<?= __('Create filter') ?></button> <?= __('Create filter') ?></button>
<button dojoType="dijit.form.Button" onclick="return dijit.byId('filterTree').joinSelectedFilters()"> <button dojoType="dijit.form.Button" onclick="return dijit.byId('filterTree').joinSelectedFilters()">
<?= __('Combine') ?></button> <?= __('Combine') ?></button>
<button dojoType="dijit.form.Button" onclick="return dijit.byId('filterTree').resetFilterOrder()">
<?= __('Reset sort order') ?></button>
<button dojoType="dijit.form.Button" onclick="return dijit.byId('filterTree').removeSelectedFilters()"> <button dojoType="dijit.form.Button" onclick="return dijit.byId('filterTree').removeSelectedFilters()">
<?= __('Remove') ?></button> <?= __('Remove') ?></button>
<button dojoType="dijit.form.Button" onclick="return dijit.byId('filterTree').resetFilterOrder()">
<?= __('Reset sort order') ?></button>
<button dojoType="dijit.form.Button" onclick="return dijit.byId('filterTree').toggleRules()">
<?= __('Toggle rule display') ?></button>
</div> </div>
</div> </div>

View File

@ -4,6 +4,13 @@
define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare, domConstruct) { define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare, domConstruct) {
return declare("fox.PrefFilterTree", lib.CheckBoxTree, { return declare("fox.PrefFilterTree", lib.CheckBoxTree, {
postCreate: function() {
this.inherited(arguments);
dijit.byId('filterTree').hideOrShowFilterRules(
parseInt(localStorage.getItem("ttrss:hide-filter-rules"))
);
},
_createTreeNode: function(args) { _createTreeNode: function(args) {
const tnode = this.inherited(arguments); const tnode = this.inherited(arguments);
@ -96,6 +103,16 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
Notify.close(); Notify.close();
}); });
}, },
hideOrShowFilterRules(hide) {
App.findAll("body")[0].setAttribute("hide-filter-rules", !!hide);
},
toggleRules: function() {
const hide = !parseInt(localStorage.getItem("ttrss:hide-filter-rules"));
this.hideOrShowFilterRules(hide);
localStorage.setItem("ttrss:hide-filter-rules", hide ? 1 : 0);
},
resetFilterOrder: function() { resetFilterOrder: function() {
Notify.progress("Loading, please wait..."); Notify.progress("Loading, please wait...");

View File

@ -1728,6 +1728,9 @@ body.ttrss_utility fieldset > label.checkbox {
display: inline; display: inline;
font-weight: normal; font-weight: normal;
} }
body.ttrss_prefs[hide-filter-rules="true"] ul.filterRules {
display: none;
}
body.ttrss_utility.sanity_failed { body.ttrss_utility.sanity_failed {
background: #900; background: #900;
} }

View File

@ -1728,6 +1728,9 @@ body.ttrss_utility fieldset > label.checkbox {
display: inline; display: inline;
font-weight: normal; font-weight: normal;
} }
body.ttrss_prefs[hide-filter-rules="true"] ul.filterRules {
display: none;
}
.flat { .flat {
/*#feedTree { /*#feedTree {
.dijitTreeContent .dijitInline { .dijitTreeContent .dijitInline {

View File

@ -1728,6 +1728,9 @@ body.ttrss_utility fieldset > label.checkbox {
display: inline; display: inline;
font-weight: normal; font-weight: normal;
} }
body.ttrss_prefs[hide-filter-rules="true"] ul.filterRules {
display: none;
}
body.ttrss_utility.sanity_failed { body.ttrss_utility.sanity_failed {
background: #900; background: #900;
} }

View File

@ -1728,6 +1728,9 @@ body.ttrss_utility fieldset > label.checkbox {
display: inline; display: inline;
font-weight: normal; font-weight: normal;
} }
body.ttrss_prefs[hide-filter-rules="true"] ul.filterRules {
display: none;
}
body.ttrss_utility.sanity_failed { body.ttrss_utility.sanity_failed {
background: #900; background: #900;
} }

View File

@ -300,3 +300,9 @@ body.ttrss_utility {
font-weight : normal; font-weight : normal;
} }
} }
body.ttrss_prefs[hide-filter-rules="true"] {
ul.filterRules {
display : none;
}
}

View File

@ -1729,6 +1729,9 @@ body.ttrss_utility fieldset > label.checkbox {
display: inline; display: inline;
font-weight: normal; font-weight: normal;
} }
body.ttrss_prefs[hide-filter-rules="true"] ul.filterRules {
display: none;
}
.flat { .flat {
/*#feedTree { /*#feedTree {
.dijitTreeContent .dijitInline { .dijitTreeContent .dijitInline {

View File

@ -1729,6 +1729,9 @@ body.ttrss_utility fieldset > label.checkbox {
display: inline; display: inline;
font-weight: normal; font-weight: normal;
} }
body.ttrss_prefs[hide-filter-rules="true"] ul.filterRules {
display: none;
}
.flat { .flat {
/*#feedTree { /*#feedTree {
.dijitTreeContent .dijitInline { .dijitTreeContent .dijitInline {