Merge "Make Search query ignore current category"
This commit is contained in:
commit
377fdd0313
|
@ -112,11 +112,12 @@ class IndexView(list.ListView):
|
|||
def get_queryset(self):
|
||||
category = self.kwargs.get('category', ALL_CATEGORY_NAME)
|
||||
query_params = {'type': 'Application'}
|
||||
if category != ALL_CATEGORY_NAME:
|
||||
query_params['category'] = category
|
||||
search = self.request.GET.get('search')
|
||||
if search:
|
||||
query_params['search'] = search
|
||||
else:
|
||||
if category != ALL_CATEGORY_NAME:
|
||||
query_params['category'] = category
|
||||
|
||||
pkgs = []
|
||||
with api.handled_exceptions(self.request):
|
||||
|
@ -142,6 +143,10 @@ class IndexView(list.ListView):
|
|||
context['categories'] = categories
|
||||
context['current_category'] = current_category
|
||||
|
||||
search = self.request.GET.get('search')
|
||||
if search:
|
||||
context['search'] = search
|
||||
|
||||
context.update(get_environments_context(self.request))
|
||||
|
||||
return context
|
||||
|
|
|
@ -71,12 +71,11 @@
|
|||
<div class="btn-toolbar centering">
|
||||
<div class="btn-group">
|
||||
{% if page_obj.has_previous %}
|
||||
<a class="btn btn-default"
|
||||
href="
|
||||
{% url 'horizon:murano:catalog:index' current_category page_obj.previous_page_number %}">
|
||||
Previous</a>
|
||||
{% with page_number=page_obj.previous_page_number link_text="Previous" %}
|
||||
{% include 'catalog/page_link.html' %}
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
<a class="btn btn-default disabled" href="#">Previous</a>
|
||||
<a class="btn btn-default disabled" href="#">Previous</a>
|
||||
{% endif %}
|
||||
|
||||
<a class="btn btn-default disabled"
|
||||
|
@ -85,12 +84,11 @@
|
|||
{{ page_obj.number }}</a>
|
||||
|
||||
{% if page_obj.has_next %}
|
||||
<a class="btn btn-default"
|
||||
href="
|
||||
{% url 'horizon:murano:catalog:index' current_category page_obj.next_page_number %}">
|
||||
Next</a>
|
||||
{% with page_number=page_obj.next_page_number link_text="Next" %}
|
||||
{% include 'catalog/page_link.html' %}
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
<a class="btn btn-default disabled" href="#">Next</a>
|
||||
<a class="btn btn-default disabled" href="#">Next</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -108,7 +106,7 @@
|
|||
|
||||
<div class="murano-side-panel" id="MuranoSearchPanel">
|
||||
<h3>Search</h3>
|
||||
<form class="search" method="GET" action="{% url 'horizon:murano:catalog:index' current_category 1 %}">
|
||||
<form class="search" method="GET" action="{% url 'horizon:murano:catalog:index' %}">
|
||||
<input name="search" class="text input-medium search-query"/>
|
||||
<button class="btn_search btn">Go</button>
|
||||
</form>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<a class="btn btn-default"
|
||||
href="{% url 'horizon:murano:catalog:index' current_category page_number %}{% if search %}?search={{ search|urlencode }}{% endif %}">
|
||||
{{ link_text }}</a>
|
Loading…
Reference in New Issue