clean up users sidebar navigation on My Purchases page (bug 705052)
This commit is contained in:
Родитель
3fba39bc73
Коммит
f99685e975
|
@ -1,14 +1,23 @@
|
|||
<div class="secondary">
|
||||
{% set links = [
|
||||
(_('My Profile'), amo_user.get_url_path()),
|
||||
(_('Account Settings'), url('users.edit')),
|
||||
] %}
|
||||
{% if not webapp %}
|
||||
{% do links.append((_('My Collections'), url('collections.mine'))) %}
|
||||
{% if amo_user.favorite_addons %}
|
||||
{% do links.append((_('My Favorites'),
|
||||
url('collections.mine', 'favorites'))) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if waffle.switch('marketplace') %}
|
||||
{% do links.append((_('My Purchases'), url('users.purchases'))) %}
|
||||
{% endif %}
|
||||
<div id="secondary-nav" class="secondary">
|
||||
<h2>{{ _('My Account') }}</h2>
|
||||
<ul>
|
||||
<li><a href="{{ request.user.get_profile().get_url_path() }}">{{ _('My Profile') }}</a></li>
|
||||
<li><a href="{{ url('users.edit') }}">{{ _('Account Settings') }}</a></li>
|
||||
<li><a href="{{ url('collections.user', amo_user.username) }}">{{ _('My Collections') }}</a></li>
|
||||
{% if amo_user.favorite_addons %}
|
||||
<li><a href="{{ url('collections.detail', amo_user.username, 'favorites') }}">{{ _('My Favorites') }}</a></li>
|
||||
{% endif %}
|
||||
{% if waffle.switch('marketplace') %}
|
||||
<li><a href="{{ url('users.purchases') }}">{{ _('My Purchases') }}</a></li>
|
||||
{% endif %}
|
||||
{% for title, link in links %}
|
||||
<li><a href="{{ link }}"{% if request.path == link %} class="selected"{% endif %}>
|
||||
{{ title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -23,7 +23,7 @@ from addons.models import Addon, AddonUser, AddonPremium
|
|||
from amo.helpers import urlparams
|
||||
from amo.pyquery_wrapper import PyQuery as pq
|
||||
from amo.urlresolvers import reverse
|
||||
from bandwagon.models import Collection, CollectionWatcher
|
||||
from bandwagon.models import Collection, CollectionAddon, CollectionWatcher
|
||||
from devhub.models import ActivityLog
|
||||
from market.models import Price
|
||||
from reviews.models import Review
|
||||
|
@ -611,7 +611,7 @@ class TestFailedCount(UserViewBase):
|
|||
self.data = {'username': 'jbalogh@mozilla.com', 'password': 'foo'}
|
||||
|
||||
def log_calls(self, obj):
|
||||
return [ call[0][1] for call in obj.call_args_list ]
|
||||
return [call[0][1] for call in obj.call_args_list]
|
||||
|
||||
def test_login_passes(self, log_login_attempt):
|
||||
self.client.post(self.url, data=self.data)
|
||||
|
@ -1058,10 +1058,38 @@ class TestPurchases(amo.tests.TestCase):
|
|||
doc = pq(self.client.get(self.url).content)
|
||||
assert 'My Purchases' in doc('li.account li').text()
|
||||
|
||||
def test_in_side_menu(self):
|
||||
raise SkipTest
|
||||
doc = pq(self.client.get(self.url).content)
|
||||
assert 'My Purchases' in doc('div.secondary li').text()
|
||||
def check_sidebar_links(self, expected):
|
||||
r = self.client.get(self.url)
|
||||
eq_(r.status_code, 200)
|
||||
links = pq(r.content)('#secondary-nav ul a')
|
||||
amo.tests.check_links(expected, links)
|
||||
eq_(links.filter('.selected').attr('href'), self.url,
|
||||
'"My Purchases" link should be selected.')
|
||||
|
||||
def test_in_sidebar(self):
|
||||
# Populate this user's favorites.
|
||||
c = Collection.objects.create(type=amo.COLLECTION_FAVORITES,
|
||||
author=self.user.get_profile())
|
||||
CollectionAddon.objects.create(addon=Addon.objects.all()[0],
|
||||
collection=c)
|
||||
|
||||
expected = [
|
||||
('My Profile', self.user.get_profile().get_url_path()),
|
||||
('Account Settings', reverse('users.edit')),
|
||||
('My Collections', reverse('collections.mine')),
|
||||
('My Favorites', reverse('collections.mine', args=['favorites'])),
|
||||
('My Purchases', self.url),
|
||||
]
|
||||
self.check_sidebar_links(expected)
|
||||
|
||||
@patch.object(settings, 'APP_PREVIEW', True)
|
||||
def test_in_apps_sidebar(self):
|
||||
expected = [
|
||||
('My Profile', self.user.get_profile().get_url_path()),
|
||||
('Account Settings', reverse('users.edit')),
|
||||
('My Purchases', self.url),
|
||||
]
|
||||
self.check_sidebar_links(expected)
|
||||
|
||||
def test_not_purchase(self):
|
||||
self.client.logout()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% if webapp or settings.APP_PREVIEW %}
|
||||
{% set WEBAPPS = True %}
|
||||
{% set webapp, WEBAPPS = True, True %}
|
||||
{% endif %}
|
||||
{% extends "webapps/base.html" if WEBAPPS else "impala/base.html" %}
|
||||
|
|
Загрузка…
Ссылка в новой задаче