add wip UI/backend stuff to filter feed tree
This commit is contained in:
@@ -1270,6 +1270,9 @@ const App = {
|
||||
case "qmcSearch":
|
||||
Feeds.search();
|
||||
break;
|
||||
case "qmcFilterFeeds":
|
||||
Feeds.filter();
|
||||
break;
|
||||
case "qmcAddFeed":
|
||||
CommonDialogs.subscribeToFeed();
|
||||
break;
|
||||
|
||||
55
js/Feeds.js
55
js/Feeds.js
@@ -23,6 +23,7 @@ const Feeds = {
|
||||
infscroll_in_progress: 0,
|
||||
infscroll_disabled: 0,
|
||||
_infscroll_timeout: false,
|
||||
_filter_query: false, // TODO: figure out the UI for this
|
||||
_search_query: false,
|
||||
last_search_query: [],
|
||||
_viewfeed_wait_timeout: false,
|
||||
@@ -154,6 +155,10 @@ const Feeds = {
|
||||
toggle: function() {
|
||||
Element.toggle("feeds-holder");
|
||||
},
|
||||
cancelFilter: function() {
|
||||
this._filter_query = "";
|
||||
this.reload();
|
||||
},
|
||||
cancelSearch: function() {
|
||||
this._search_query = "";
|
||||
this.reloadCurrent();
|
||||
@@ -178,8 +183,14 @@ const Feeds = {
|
||||
dijit.byId("feedTree").destroyRecursive();
|
||||
}
|
||||
|
||||
let query = {op: 'Pref_Feeds', method: 'getfeedtree', mode: 2};
|
||||
|
||||
if (this._filter_query) {
|
||||
query = Object.assign(query, this._filter_query);
|
||||
}
|
||||
|
||||
const store = new dojo.data.ItemFileWriteStore({
|
||||
url: "backend.php?op=Pref_Feeds&method=getfeedtree&mode=2"
|
||||
url: "backend.php?" + dojo.objectToQuery(query)
|
||||
});
|
||||
|
||||
// noinspection JSUnresolvedFunction
|
||||
@@ -682,6 +693,48 @@ const Feeds = {
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
filter: function() {
|
||||
const dialog = new fox.SingleUseDialog({
|
||||
content: `
|
||||
<form onsubmit='return false'>
|
||||
<section>
|
||||
<fieldset>
|
||||
<input dojoType='dijit.form.ValidationTextBox' id='filter_query'
|
||||
style='font-size : 16px; width : 540px;'
|
||||
placeHolder="${__("Show feeds matching...")}"
|
||||
name='search' type='search' value=''>
|
||||
</fieldset>
|
||||
</section>
|
||||
|
||||
<footer>
|
||||
${App.FormFields.submit_tag(App.FormFields.icon("search") + " " + __('Search'), {onclick: "App.dialogOf(this).execute()"})}
|
||||
${App.FormFields.cancel_dialog_tag(__('Cancel'))}
|
||||
</footer>
|
||||
</form>
|
||||
`,
|
||||
title: __("Search feeds"),
|
||||
execute: function () {
|
||||
if (this.validate()) {
|
||||
Feeds._filter_query = this.attr('value');
|
||||
|
||||
this.hide();
|
||||
Feeds.reload();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const tmph = dojo.connect(dialog, 'onShow', function () {
|
||||
dojo.disconnect(tmph);
|
||||
|
||||
if (Feeds._filter_query && Feeds._filter_query.search) {
|
||||
dijit.byId('filter_query')
|
||||
.attr('value', Feeds._filter_query.search);
|
||||
}
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
},
|
||||
updateRandom: function() {
|
||||
console.log("in update_random_feed");
|
||||
|
||||
Reference in New Issue
Block a user