From 905f0386101512822cb145b6c9dfec5658565ff9 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 20 May 2019 07:59:53 +0300 Subject: [PATCH] search dialog: display active query if searching already --- classes/feeds.php | 4 ++-- js/Feeds.js | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/classes/feeds.php b/classes/feeds.php index 815673491..86fa45ea7 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -730,10 +730,10 @@ class Feeds extends Handler_Protected { print "
"; print "
"; - print "getFeedTitle($active_feed_id, $is_cat))."\" - required='1' name='query' type='search' value=''>"; + name='query' type='search' value=''>"; print "
"; if (DB_TYPE == "pgsql") { diff --git a/js/Feeds.js b/js/Feeds.js index cb3cc3612..459ccc4dd 100644 --- a/js/Feeds.js +++ b/js/Feeds.js @@ -552,6 +552,11 @@ define(["dojo/_base/declare"], function (declare) { execute: function () { if (this.validate()) { Feeds._search_query = this.attr('value'); + + // disallow empty queries + if (!Feeds._search_query.query) + Feeds._search_query = false; + this.hide(); Feeds.reloadCurrent(); } @@ -559,6 +564,23 @@ define(["dojo/_base/declare"], function (declare) { 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(); }, updateRandom: function() {