@@ -224,6 +224,11 @@
$("#btn-upload").change(function() {
$("#form-upload").submit();
});
+ $(document).ready(function() {
+ var inp = $('#query').first()
+ var val = inp.val()
+ inp.val('').blur().focus().val(val)
+ });
});
{% block js %}{% endblock %}
diff --git a/cps/templates/search.html b/cps/templates/search.html
index 07f3a42b..c67e77bb 100644
--- a/cps/templates/search.html
+++ b/cps/templates/search.html
@@ -2,10 +2,10 @@
{% block body %}
{% if entries|length < 1 %}
-
{{_('No Results Found')}} {{searchterm}}
-
{{_('Search Term:')}} {{searchterm}}
+
{{_('No Results Found')}} {{adv_searchterm}}
+
{{_('Search Term:')}} {{adv_searchterm}}
{% else %}
-
{{entries|length}} {{_('Results for:')}} {{searchterm}}
+
{{entries|length}} {{_('Results for:')}} {{adv_searchterm}}
{% if g.user.is_authenticated %}
{% if g.user.shelf.all() or g.shelves_access %}
diff --git a/cps/web.py b/cps/web.py
index c99cfeb9..a5af8cb8 100644
--- a/cps/web.py
+++ b/cps/web.py
@@ -893,9 +893,17 @@ def search():
for element in entries:
ids.append(element.id)
searched_ids[current_user.id] = ids
- return render_title_template('search.html', searchterm=term, entries=entries, title=_(u"Search"), page="search")
+ return render_title_template('search.html',
+ searchterm=term,
+ adv_searchterm=term,
+ entries=entries,
+ title=_(u"Search"),
+ page="search")
else:
- return render_title_template('search.html', searchterm="", title=_(u"Search"), page="search")
+ return render_title_template('search.html',
+ searchterm="",
+ title=_(u"Search"),
+ page="search")
@web.route("/advanced_search", methods=['GET'])
@@ -1033,7 +1041,7 @@ def advanced_search():
for element in q:
ids.append(element.id)
searched_ids[current_user.id] = ids
- return render_title_template('search.html', searchterm=searchterm,
+ return render_title_template('search.html', adv_searchterm=searchterm,
entries=q, title=_(u"search"), page="search")
# prepare data for search-form
tags = db.session.query(db.Tags).join(db.books_tags_link).join(db.Books).filter(common_filters()) \