get rid of singletons in the More popup on "Manage My Submissions" page

This commit is contained in:
Chris Van 2012-11-19 17:08:35 -08:00
Родитель 976e1f1859
Коммит 4d2100cda2
2 изменённых файлов: 23 добавлений и 20 удалений

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

@ -41,9 +41,25 @@
{{ _('Manage Payments') }}</a>
</li>
{% endif %}
{% if waffle.switch('disabled-payments') %}
{% set manage_urls = [(addon.get_dev_url('versions'), _('Manage Status'))] %}
{% if waffle.switch('allow-refund') and addon.needs_paypal() and
check_addon_ownership(request, addon, support=True) %}
{% do manage_urls.insert(1,
(addon.get_dev_url('refunds'), _('Manage Refunds'))
) %}
{% endif %}
{% if addon.is_webapp() and addon.premium_type in amo.ADDON_INAPPS
and waffle.switch('in-app-payments') %}
{% do manage_urls.insert(1,
(addon.get_dev_url('in_app_config'), _('Manage In-App Payments'))
) %}
{% endif %}
{% if waffle.switch('disabled-payments') or manage_urls|length == 1 %}
<li>
<a class="action-link status-link" href="{{ addon.get_dev_url('versions') }}">{% if addon.is_packaged %}{{ _('Manage Status &amp; Versions') }}{% else %}{{ _('Manage Status') }}{% endif %}</a>
<a class="action-link status-link" href="{{ addon.get_dev_url('versions') }}">
{{ _('Manage Status &amp; Versions') if addon.is_packaged else _('Manage Status') }}</a>
</li>
{% endif %}
{% if request.can_view_consumer %}
@ -56,23 +72,10 @@
<a class="action-link stats-link" href="{{ addon.get_stats_url() }}">{{ _('View Statistics') }}</a>
</li>
{% endif %}
{% if not waffle.switch('disabled-payments') %}
{% if not waffle.switch('disabled-payments') and manage_urls|length > 1 %}
<li>
<a href="#" class="more-actions">{{ _('More') }}</a>
<div class="more-actions-popup popup hidden">
{% set manage_urls = [(addon.get_dev_url('versions'), _('Manage Status'))] %}
{% if waffle.switch('allow-refund') and addon.needs_paypal() and
check_addon_ownership(request, addon, support=True) %}
{% do manage_urls.insert(1,
(addon.get_dev_url('refunds'), _('Manage Refunds'))
) %}
{% endif %}
{% if addon.is_webapp() and addon.premium_type in amo.ADDON_INAPPS
and waffle.switch('in-app-payments') %}
{% do manage_urls.insert(1,
(addon.get_dev_url('in_app_config'), _('Manage In-App Payments'))
) %}
{% endif %}
<ul>
{% for url, title in manage_urls %}
<li><a href="{{ url }}">{{ title }}</a></li>

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

@ -168,10 +168,8 @@ class TestAppDashboard(AppHubTest):
assert item.find('.item-details'), 'Expected item details'
assert not item.find('p.incomplete'), (
'Unexpected message about incomplete add-on')
expected = [
('Manage Status', app.get_dev_url('versions')),
]
amo.tests.check_links(expected, doc('.more-actions-popup a'))
eq_(doc('.status-link').length, 1)
eq_(doc('.more-actions-popup').length, 0)
def test_incomplete_app(self):
app = self.get_app()
@ -215,6 +213,7 @@ class TestAppDashboard(AppHubTest):
('Edit Listing', app.get_dev_url()),
('Manage Authors', app.get_dev_url('owner')),
('Manage Payments', app.get_dev_url('payments')),
('Manage Status', app.get_dev_url('versions')),
('View Listing', app.get_url_path()),
]
amo.tests.check_links(expected, doc('a.action-link'))
@ -232,6 +231,7 @@ class TestAppDashboard(AppHubTest):
('Add New Version', app.get_dev_url('versions')),
('Manage Authors', app.get_dev_url('owner')),
('Manage Payments', app.get_dev_url('payments')),
('Manage Status & Versions', app.get_dev_url('versions')),
('View Listing', app.get_url_path()),
]
amo.tests.check_links(expected, doc('a.action-link'))