Skip to content

Commit

Permalink
cleanup collection search results (bug 590590)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Balogh committed Aug 27, 2010
1 parent e14b456 commit a592cea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 57 deletions.
52 changes: 8 additions & 44 deletions apps/search/templates/search/collections.html
Expand Up @@ -8,19 +8,18 @@
{% endif %}
{% endblock %}

{% block bodyclass %}inverse{% endblock %}

{% block content %}
<div class="primary" role="main">
<h2>{{ _('Collection Search Results') }}</h2>
<header class="results-head">
{{ breadcrumbs([(None, _('Search'))]) }}
<h2>{{ _('Collection Search Results') }}</h2>
<h3 class="results-count">{{ showing(query, tag, pager) }}</h3>
</header>
<div class="featured listing">
{% if pager.object_list %}
<div class="featured-inner">
<div class="listing-header">
<div class="num-results">
{{ pagination_result_count(pager) }}
</div>
<form class="item-sort go" action="" method="get">
<form class="item-sort go" action="">
<div>
{{ form['q']|safe }}
{{ form['cat']|safe }}
Expand Down Expand Up @@ -69,48 +68,13 @@ <h3>
</div>
<div class="listing-footer">{{ pager|paginator }}</div>
{% else %}
{% include 'search/no_results.html' %}
{% include 'search/no_results.html' %}
{% endif %}
</div>
</div> {# /primary #}

<div class="secondary" role="complementary">
<div class="highlight">
<h3>{{ _('What are Collections?') }}</h3>
<p>
{{ _('Collections are groups of related add-ons assembled for easy sharing.') }}
</p>
<p>
<a class="more-info" href="{{ remora_url('collections/add') }}">
{{ _('Create a Collection', 'collections_index_a_create') }}
</a>
</p>
</div>

<div class="highlight">
<h3>{{ _('Add-on Collector', 'collections_index_header_collector') }}</h3>

<p class="teaser-img">
<a href="{{ remora_url('pages/collector') }}">
<img alt="" src="{{ MEDIA_URL }}img/amo2009/illustrations/logo-collections-download-146x159.png">
</a>
</p>
<p>
{{ _("There's a new way to manage and find favorite add-ons. Comment, share and sync collections, all from your browser.") }}
</p>
<p>
<a class="more-info" href="{{ remora_url('pages/collector') }}">
{{ _('Check out Add-on Collector') }}
</a>
</p>
</div>
</div> {# /secondary #}

{# TODO(davedash): parcel this out into a jinja function. #}
<div class="secondary">
<div id="recently-viewed" class="collections-add">
<h3 class="compact-bottom">{{ _('Recently Viewed') }}</h3>
</div>
{% include 'bandwagon/includes/collection_sidebar.html' %}
</div>

{% endblock %}
18 changes: 5 additions & 13 deletions apps/search/views.py
Expand Up @@ -9,6 +9,7 @@
from tower import ugettext as _

import amo
import bandwagon.views
from amo.decorators import json_view
from amo.helpers import urlparams
from amo import urlresolvers
Expand Down Expand Up @@ -184,12 +185,7 @@ def _personas(request):

pager = amo.utils.paginate(request, results, search_opts['limit'])

c = {
'pager': pager,
'form': form,
'categories': categories,
}

c = dict(pager=pager, form=form, categories=categories)
return jingo.render(request, 'search/personas.html', c)


Expand All @@ -207,20 +203,16 @@ def _collections(request):
search_opts['offset'] = (page - 1) * search_opts['limit']
search_opts['sort'] = form.cleaned_data.get('sortby')

client = CollectionsClient()

try:
results = client.query(query, **search_opts)
results = CollectionsClient().query(query, **search_opts)
except SearchError:
return jingo.render(request, 'search/down.html', {}, status=503)

pager = amo.utils.paginate(request, results, search_opts['limit'])

c = {
'pager': pager,
'form': form,
}

c = dict(pager=pager, form=form, query=query,
filter=bandwagon.views.get_filter(request))
return jingo.render(request, 'search/collections.html', c)


Expand Down

0 comments on commit a592cea

Please sign in to comment.