Only show Localize Article tab when the document is localizable [bug 608286]

This commit is contained in:
Ricky Rosario 2010-11-03 17:03:09 -04:00
Родитель 061bd6746a
Коммит fe63410b04
2 изменённых файлов: 13 добавлений и 12 удалений

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

@ -31,15 +31,16 @@
{% endif %}
</li>
{% endif %}
<li{% if active == 'localize' %} class="active"{% elif not document.is_localizable %} class="disabled"{% endif %}>
{% if active == 'localize' %}
<span>{{ _('Localize Article') }}</span>
{% else %}
{# TODO: Create page to select localization? Show link to all authenticated? #}
{# TODO: Remember to take into account non-localizable documents #}
<a href="#">{{ _('Localize Article') }}</a>
{% endif %}
</li>
{% if document.is_localizable %}
<li{% if active == 'localize' %} class="active"{% endif %}>
{% if active == 'localize' %}
<span>{{ _('Localize Article') }}</span>
{% else %}
{# TODO: Create page to select localization? Show link to all authenticated? #}
<a href="#">{{ _('Localize Article') }}</a>
{% endif %}
</li>
{% endif %}
<li{% if active == 'history' %} class="active"{% endif %}>
{% if active == 'history' %}
<span>{{ _('Show History') }}</span>

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

@ -72,20 +72,20 @@ class DocumentTests(TestCaseBase):
assert doc('#doc-watch input[type=hidden]')
def test_non_localizable_translate_disabled(self):
"""Non localizable document shows disabled tab for 'Localize'."""
"""Non localizable document doesn't show tab for 'Localize'."""
self.client.login(username='jsocol', password='testpass')
d = document(is_localizable=True)
d.save()
resp = self.client.get(d.get_absolute_url())
doc = pq(resp.content)
assert 'Localize' not in (doc('#doc-tabs li.disabled').text() or '')
assert 'Localize' in doc('#doc-tabs li').text()
# Make it non-localizable
d.is_localizable = False
d.save()
resp = self.client.get(d.get_absolute_url())
doc = pq(resp.content)
assert 'Localize' in doc('#doc-tabs li.disabled').text()
assert 'Localize' not in doc('#doc-tabs li').text()
class RevisionTests(TestCaseBase):