Don't show search box to anyone but firefox. bug 610485

This commit is contained in:
Wil Clouser 2010-11-08 17:07:12 -08:00
Родитель ff0718d298
Коммит a8419db966
2 изменённых файлов: 35 добавлений и 27 удалений

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

@ -56,35 +56,37 @@
</div>
<div class="secondary" role="complementary">
<div id="search-tools-sidebar" class="other-categories highlight">
<hgroup>
<h3>{{ _('Search Extensions') }}</h3>
<h4>{{ _('Add search-related functionality to Firefox') }}</h4>
</hgroup>
<ul>
{% for key, title_ in search_extensions_filter.opts_dict.items() %}
<li id="p-{{ key }}">
<a href="{{ url('browse.extensions', category='search-tools')|urlparams(sort=key) }}">
{{ title_ }}</a>
{% if APP == amo.FIREFOX %}
<div id="search-tools-sidebar" class="other-categories highlight">
<hgroup>
<h3>{{ _('Search Extensions') }}</h3>
<h4>{{ _('Add search-related functionality to Firefox') }}</h4>
</hgroup>
<ul>
{% for key, title_ in search_extensions_filter.opts_dict.items() %}
<li id="p-{{ key }}">
<a href="{{ url('browse.extensions', category='search-tools')|urlparams(sort=key) }}">
{{ title_ }}</a>
</li>
{% endfor %}
</ul>
<div class="divider"></div>
<hgroup>
<h3>{{ _('Search Providers') }}</h3>
<h4>{{ _('Find new providers for your search bar') }}</h4>
</hgroup>
<ul>
{% cache categories %}
{% for cat in categories %}
<li id="p-{{ cat.id }}">
<a href="{{ url('browse.search-tools', cat.slug) }}">
{{ cat.name }}</a>
</li>
{% endfor %}
</ul>
<div class="divider"></div>
<hgroup>
<h3>{{ _('Search Providers') }}</h3>
<h4>{{ _('Find new providers for your search bar') }}</h4>
</hgroup>
<ul>
{% cache categories %}
{% for cat in categories %}
<li id="p-{{ cat.id }}">
<a href="{{ url('browse.search-tools', cat.slug) }}">
{{ cat.name }}</a>
</li>
{% endfor %}
{% endcache %}
</ul>
</div>
{% endcache %}
</ul>
</div>
{% endif %}
<div class="highlight">
<h3>{{ _('Additional Resources') }}</h3>
<ul class="xoxo">

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

@ -339,6 +339,12 @@ class TestSearchToolsPages(BaseSearchToolsTest):
eq_(urlparse(links[0].attrib['href']).path, search_ext_url.path)
eq_(urlparse(links[1].attrib['href']).path, search_ext_url.path)
def test_search_tools_arent_friends_with_everyone(self):
# Search tools only show up for Firefox
response = self.client.get('/en-US/thunderbird/search-tools/')
doc = pq(response.content)
assert not doc('#search-tools-sidebar')
def test_other_pages_exclude_extensions(self):
# pretend all Add-ons are search-related:
Addon.objects.update(type=amo.ADDON_SEARCH)