hide tools and account links from anonymous users
This commit is contained in:
Родитель
f937ea2ab0
Коммит
6d5c3f2650
|
@ -38,3 +38,15 @@ class TestStuff(test_utils.TestCase):
|
|||
check('1')
|
||||
self.client.login(username='admin@mozilla.com', password='password')
|
||||
check('0')
|
||||
|
||||
def test_my_account_menu(self):
|
||||
def check(expected):
|
||||
response = self.client.get('/', follow=True)
|
||||
account = PyQuery(response.content)('ul.account')
|
||||
tools = PyQuery(response.content)('ul.tools')
|
||||
eq_(account.size(), expected)
|
||||
eq_(tools.size(), expected)
|
||||
|
||||
check(0)
|
||||
self.client.login(username='admin@mozilla.com', password='password')
|
||||
check(1)
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
<ul class="tools">
|
||||
<li>
|
||||
<a href="#" class="controller">{{ _('Tools') }}</a>
|
||||
<ul>
|
||||
{% for link in tools_links %}
|
||||
<li><a href="{{ link.href }}">{{ link.text }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
{% if user.is_authenticated() %}
|
||||
{% if tools_links %}
|
||||
<ul class="tools">
|
||||
<li>
|
||||
<a href="#" class="controller">{{ _('Tools') }}</a>
|
||||
<ul>
|
||||
{% for link in tools_links %}
|
||||
<li><a href="{{ link.href }}">{{ link.text }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
<ul class="account">
|
||||
<li>
|
||||
<a href="#" class="controller" title="{{ user.email }}">
|
||||
|
@ -21,6 +24,7 @@
|
|||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<p class="context">
|
||||
{% if user.is_authenticated() %}
|
||||
|
|
Загрузка…
Ссылка в новой задаче