show correct search placeholders on sphinx search pages (bug 712638, bug 712634)
This commit is contained in:
Родитель
ee2a3829d9
Коммит
62bf0d1715
|
@ -75,6 +75,24 @@ class TestAdminDisabledAddons(SphinxTestCase):
|
|||
super(TestAdminDisabledAddons, self).setUp()
|
||||
|
||||
|
||||
class TestSphinxSearchboxTarget(SphinxTestCase):
|
||||
fixtures = ['base/addon_3615']
|
||||
|
||||
def check(self, cat):
|
||||
url = reverse('search.search')
|
||||
r = self.client.get(url, dict(cat=cat))
|
||||
form = pq(r.content)('#search')
|
||||
eq_(form.attr('action'), url)
|
||||
eq_(form('input[name=q]').attr('placeholder'), 'search for %s' % cat)
|
||||
eq_(form('input[name=cat]').val(), cat)
|
||||
|
||||
def test_collections(self):
|
||||
self.check('collections')
|
||||
|
||||
def test_personas(self):
|
||||
self.check('personas')
|
||||
|
||||
|
||||
class TestSearchboxTarget(amo.tests.ESTestCase):
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -220,7 +220,7 @@ def _personas(request):
|
|||
pager = amo.utils.paginate(request, results, search_opts['limit'])
|
||||
categories, filter, _, _ = browse.views.personas_listing(request)
|
||||
c = dict(pager=pager, form=form, categories=categories, query=query,
|
||||
filter=filter)
|
||||
filter=filter, search_placeholder='personas')
|
||||
return jingo.render(request, 'search/personas.html', c)
|
||||
|
||||
|
||||
|
@ -244,7 +244,8 @@ def _collections(request):
|
|||
|
||||
pager = amo.utils.paginate(request, results, search_opts['limit'])
|
||||
c = dict(pager=pager, form=form, query=query, opts=search_opts,
|
||||
filter=bandwagon.views.get_filter(request))
|
||||
filter=bandwagon.views.get_filter(request),
|
||||
search_placeholder='collections')
|
||||
return jingo.render(request, 'search/collections.html', c)
|
||||
|
||||
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
<span class="wrap">
|
||||
<input id="search-q" type="text" name="q" autocomplete="off" title=""
|
||||
class="text {% if not search_form.q.data %}placeholder{% endif %}"
|
||||
placeholder="{{ search_form.placeholder() }}"
|
||||
value="{{ search_form.q.data or '' }}">
|
||||
placeholder="{{ search_form.placeholder(search_placeholder) }}"
|
||||
value="{{ query.q if query else '' }}">
|
||||
{% if search_form.cat.value() %}
|
||||
{{ search_form.cat }}
|
||||
{% endif %}
|
||||
{{ search_form.appver }}
|
||||
{{ search_form.platform }}
|
||||
</span>
|
||||
|
|
Загрузка…
Ссылка в новой задаче