recipes: preserve search keyword when switching between branches

If you want to check what the same search returns on a different branch
it makes things easier if you don't have to re-type the search after
selecting the branch.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2014-03-09 21:16:08 +00:00
parent cd26148eed
commit 4c08b28387
3 changed files with 6 additions and 4 deletions

1
TODO
View File

@ -5,7 +5,6 @@ Bugs
* PROVIDES column appears to be too short for some recipes
Other
* Preserve search keyword when switching branches on recipe page
* Collect interesting news (layer add/delete, recipe add/delete/upgrade) and provide RSS feed
* "Split layer" tool for when a layer is split out of another? (Saves time adding records everywhere)
* Search for bbclasses?

View File

@ -1,6 +1,6 @@
# layerindex-web - view definitions
#
# Copyright (C) 2013 Intel Corporation
# Copyright (C) 2013-2014 Intel Corporation
#
# Licensed under the MIT license, see COPYING.MIT for details
@ -388,9 +388,12 @@ class RecipeSearchView(ListView):
def get_context_data(self, **kwargs):
context = super(RecipeSearchView, self).get_context_data(**kwargs)
context['search_keyword'] = self.request.GET.get('q', '')
searchval = self.request.GET.get('q', '')
context['search_keyword'] = searchval
context['url_branch'] = self.kwargs['branch']
context['this_url_name'] = resolve(self.request.path_info).url_name
if searchval:
context['extra_url_param'] = '?q=%s' % searchval
return context
class DuplicatesView(TemplateView):

View File

@ -27,7 +27,7 @@
</a>
<ul class="dropdown-menu">
{% for branch in all_branches %}
<li><a href="{% url this_url_name branch.name %}">
<li><a href="{% url this_url_name branch.name %}{{ extra_url_param }}">
{% if branch.name = url_branch %}<b>{% endif %}
{{ branch.name }}
{% if branch.short_description %}