Move menuitem/refinement code out of search.

This commit is contained in:
Dave Dash 2010-11-05 14:14:40 -07:00
Родитель e39f5b7a1e
Коммит 99a9bd6037
4 изменённых файлов: 12 добавлений и 10 удалений

Просмотреть файл

@ -252,3 +252,8 @@ def resize_image(src, dst, size):
im = processors.scale_and_crop(im, size)
im.save(dst)
os.remove(src)
class MenuItem():
"""Refinement item with nestable children for use in menus."""
url, text, selected, children = ('', '', False, [])

Просмотреть файл

@ -32,7 +32,7 @@
<div class="listing-header">
<ul title="{{ _('Sort results by&hellip;')|safe }}">
{% for item in sort_tabs %}
{% include 'search/includes/refinement.html' %}
{% include 'includes/refinement.html' %}
{% endfor %}
</ul>
</div>
@ -60,7 +60,7 @@
<ul class="refinements">
{% for item in versions %}
{% include 'search/includes/refinement.html' %}
{% include 'includes/refinement.html' %}
{% endfor %}
</ul>
</div>
@ -70,7 +70,7 @@
<ul class="refinements">
{% for item in categories %}
{% include 'search/includes/refinement.html' %}
{% include 'includes/refinement.html' %}
{% endfor %}
</ul>
</div>
@ -80,7 +80,7 @@
<ul class="refinements addon-tags">
{% for item in tags %}
{% include 'search/includes/refinement.html' %}
{% include 'includes/refinement.html' %}
{% endfor %}
</ul>
</div>

Просмотреть файл

@ -11,9 +11,10 @@ from tower import ugettext as _
import amo
import bandwagon.views
import browse.views
from amo import urlresolvers
from amo.decorators import json_view
from amo.helpers import urlparams
from amo import urlresolvers
from amo.utils import MenuItem
from versions.compare import dict_from_int, version_int
from search import forms
from search.client import (Client as SearchClient, SearchError,
@ -25,10 +26,6 @@ DEFAULT_NUM_RESULTS = 20
log = commonware.log.getLogger('z.search')
class MenuItem():
url, text, selected, children = ('', '', False, [])
def _get_versions(request, versions, version):
compats = []
url = request.get_full_path()
@ -305,7 +302,7 @@ def search(request, tag_name=None):
try:
results = client.query(query, **search_opts)
except SearchError, e:
log.error('Sphinx Error: %s' %e)
log.error('Sphinx Error: %s' % e)
return jingo.render(request, 'search/down.html', locals(), status=503)
version_filters = client.meta['versions']