search dialog: display active query if searching already

This commit is contained in:
Andrew Dolgov 2019-05-20 07:59:53 +03:00
parent 09f520eda2
commit 905f038610
2 changed files with 24 additions and 2 deletions

View File

@ -730,10 +730,10 @@ class Feeds extends Handler_Protected {
print "<section>"; print "<section>";
print "<fieldset>"; print "<fieldset>";
print "<input dojoType='dijit.form.ValidationTextBox' print "<input dojoType='dijit.form.ValidationTextBox' id='search_query'
style='font-size : 16px; width : 540px;' style='font-size : 16px; width : 540px;'
placeHolder=\"".T_sprintf("Search %s...", $this->getFeedTitle($active_feed_id, $is_cat))."\" placeHolder=\"".T_sprintf("Search %s...", $this->getFeedTitle($active_feed_id, $is_cat))."\"
required='1' name='query' type='search' value=''>"; name='query' type='search' value=''>";
print "</fieldset>"; print "</fieldset>";
if (DB_TYPE == "pgsql") { if (DB_TYPE == "pgsql") {

View File

@ -552,6 +552,11 @@ define(["dojo/_base/declare"], function (declare) {
execute: function () { execute: function () {
if (this.validate()) { if (this.validate()) {
Feeds._search_query = this.attr('value'); Feeds._search_query = this.attr('value');
// disallow empty queries
if (!Feeds._search_query.query)
Feeds._search_query = false;
this.hide(); this.hide();
Feeds.reloadCurrent(); Feeds.reloadCurrent();
} }
@ -559,6 +564,23 @@ define(["dojo/_base/declare"], function (declare) {
href: query href: query
}); });
const tmph = dojo.connect(dialog, 'onLoad', function () {
dojo.disconnect(tmph);
console.log('S_onload');
if (Feeds._search_query) {
if (Feeds._search_query.query)
dijit.byId('search_query')
.attr('value', Feeds._search_query.query);
if (Feeds._search_query.search_language)
dijit.byId('search_language')
.attr('value', Feeds._search_query.search_language);
}
});
dialog.show(); dialog.show();
}, },
updateRandom: function() { updateRandom: function() {