Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

improve the devhub versions page (bug 750914) #1795

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/devhub/helpers.py
Expand Up @@ -222,3 +222,11 @@ def display_url(url):
def get_compat_counts(addon):
"""Get counts for add-on compatibility reports."""
return CompatReport.get_counts(addon.guid)


@register.function
def version_disabled(version):
"""Return True if all the files are disabled."""
disabled = [status == amo.STATUS_DISABLED
for _id, status in version.statuses]
return all(disabled)
2 changes: 1 addition & 1 deletion apps/devhub/templates/devhub/addons/edit.html
Expand Up @@ -19,7 +19,7 @@
<header>
{{ dev_breadcrumbs(addon) }}
{{ l10n_menu(addon.default_locale) }}
<h2>{{ title }}</h2>
<h2>{{ addon.name }}</h2>
</header>

<section class="primary" role="main">
Expand Down
44 changes: 20 additions & 24 deletions apps/devhub/templates/devhub/addons/listing/items.html
@@ -1,4 +1,4 @@
{% from "devhub/addons/listing/macros.html" import dev_heading, dev_item_info, dev_item_actions %}
{% from "devhub/addons/listing/macros.html" import dev_heading, dev_item_info %}
{% set collection = collection or None %}
{% set username = request.amo_user.username if request.user.is_authenticated() else '' %}
{% for addon in addons %}
Expand All @@ -17,7 +17,7 @@
{{ dev_item_info(addon, amo) }}
</div>
<ul class="item-details">
{% if not webapp %}
{% if addon.is_persona() %}
{% if addon.current_version %}
{% set link = url('devhub.versions.edit', addon.slug, addon.current_version.id) %}
{# L10n: {1} is a version number. #}
Expand All @@ -33,38 +33,34 @@
<li class="date-updated">{{ _('<strong>Last updated:</strong> {0}'|
f(addon.last_updated|datetime)) }}</li>
{% endif %}
{% endif %}
<li id="version-status-item">
<strong>{{ _('Status:') }}</strong>
<a{% if not addon.is_persona() %} href="{{ addon.get_dev_url('versions') }}"{% endif %}>
<li id="version-status-item">
<strong>{{ _('Status:') }}</strong>
{% if addon.disabled_by_user %}
<span class="{{ status_class(addon) }}"><b>{{ _('Disabled') }}</b></span>
{% else %}
<span class="{{ status_class(addon) }}">
<b>{{ amo.STATUS_CHOICES[addon.status] }}</b></span>
{% endif %}
</a>
</li>
{% with position = get_position(addon) %}
{% if position.pos and position.total %}
<li class="queue-position">
{% trans pos=position.pos|numberfmt, total=position.total|numberfmt %}
<b>Queue position:</b> {{ pos }} of {{ total }}
{% endtrans %}
</li>
{% endif %}
{% endwith %}
</li>
{% with position = get_position(addon) %}
{% if position.pos and position.total %}
<li class="queue-position">
{% trans pos=position.pos|numberfmt, total=position.total|numberfmt %}
<b>Queue position:</b> {{ pos }} of {{ total }}
{% endtrans %}
</li>
{% endif %}
{% endwith %}
{% else %}
{% include "devhub/includes/addon_details.html" %}
{% endif %}
</ul>
{% endif %}
<div class="item-actions">
{% if webapp %}
{% include "devhub/addons/listing/item_actions_app.html" %}
{% if addon.is_persona() %}
{% include "devhub/addons/listing/item_actions_theme.html" %}
{% else %}
{% if addon.is_persona() %}
{% include "devhub/addons/listing/item_actions_theme.html" %}
{% else %}
{% include "devhub/addons/listing/item_actions.html" %}
{% endif %}
{% include "devhub/addons/listing/item_actions.html" %}
{% endif %}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/devhub/templates/devhub/addons/owner.html
Expand Up @@ -22,7 +22,7 @@
{% if not webapp %}
{{ l10n_menu(addon.default_locale) }}
{% endif %}
<h2>{{ title }}</h2>
<h2>{{ addon.name }}</h2>
</header>
<section id="edit-addon" class="primary devhub-form" role="main">
<form method="post" class="item" action="">
Expand Down
2 changes: 1 addition & 1 deletion apps/devhub/templates/devhub/addons/profile.html
Expand Up @@ -7,7 +7,7 @@
<header>
{{ dev_breadcrumbs(addon, items=[(None, title)]) }}
{{ l10n_menu(addon.default_locale) }}
<h2>{{ title }}</h2>
<h2>{{ addon.name }}</h2>
</header>
<section class="primary" role="main">
{% set remove_url = addon.get_dev_url('profile.remove') %}
Expand Down
119 changes: 119 additions & 0 deletions apps/devhub/templates/devhub/includes/addon_details.html
@@ -0,0 +1,119 @@
{% from "includes/forms.html" import tip %}

{% macro status_and_tip(addon, tip) %}
<span class="{{ status_class(addon) }}"><b>{{ amo.STATUS_CHOICES[addon.status] }}</b></span>
<span class="tip tooltip" title="{{ tip }}">?</span>
{% endmacro %}

<li>
<strong>
{{ _('Status:') }}

{% if addon.disabled_by_user and addon.status != amo.STATUS_DISABLED %}
<a href="{{ addon.get_dev_url('versions') }}">
{{ status_and_tip(addon,
_("Your add-on's listing is disabled and is not showing
anywhere in our gallery or update service.")) }}
</a>
{% elif addon.status == amo.STATUS_NULL %}
<a href="{{ url('devhub.submit.resume', addon.slug) }}">
{{ status_and_tip(addon, _('Please complete your add-on.')) }}
</a>
{% elif addon.status == amo.STATUS_PENDING %}
<a href="{{ addon.get_dev_url('versions') }}">
{{ status_and_tip(addon, _('You will receive an email when the review is complete.')) }}
</a>
{% elif addon.status == amo.STATUS_UNREVIEWED %}
<a href="{{ addon.get_dev_url('versions') }}">
{{ status_and_tip(addon,
_("You will receive an email when the review is complete. Until
then, your add-on is not listed in our gallery but can be
accessed directly from its details page.")) }}
</a>
{% elif addon.status == amo.STATUS_NOMINATED %}
<a href="{{ addon.get_dev_url('versions') }}">
{{ status_and_tip(addon,
_("You will receive an email when the review is complete. Until
then, your add-on is not listed in our gallery but can be
accessed directly from its details page. ")) }}
</a>
{% elif addon.status == amo.STATUS_PUBLIC %}
<a href="{{ addon.get_dev_url('versions') }}">
{{ status_and_tip(addon,
_("Your add-on is displayed in our gallery and users are
receiving automatic updates.")) }}
</a>
{% elif addon.status == amo.STATUS_DISABLED %}
<a href="{{ addon.get_dev_url('versions') }}#version-upload" class="version-upload">
{{ status_and_tip(addon,
_("Your add-on was disabled by a site administrator and is no
longer shown in our gallery. If you have any questions,
please email marketplace-staff@mozilla.org.")) }}
</a>
{% elif addon.status == amo.STATUS_LITE %}
<a href="{{ addon.get_dev_url('versions') }}">
{{ status_and_tip(addon,
_("Your add-on is displayed in our gallery as experimental
and users are receiving automatic updates. Some features
are unavailable to your add-on.")) }}
</a>
{% elif addon.status == amo.STATUS_LITE_AND_NOMINATED %}
<a href="{{ addon.get_dev_url('versions') }}">
{{ status_and_tip(addon,
_("You will receive an email when the full review is complete.
Until then, your add-on is displayed in our gallery as
experimental and users are receiving automatic updates.
Some features are unavailable to your add-on.")) }}
</a>
{% elif addon.status == amo.STATUS_PURGATORY %}
<a href="{{ addon.get_dev_url('versions') }}">
{{ status_and_tip(addon,
_("All add-ons hosted in our gallery must now be reviewed by an
editor. If you wish to continue hosting your add-on, please
click to select a review process.")) }}
</a>
{% endif %}
</strong>
</li>
{% if addon.current_version %}
<li>
<strong>{{ _('Current Version:') }}</strong>
<a href="{{ addon.current_version.get_url_path() }}">
{{ addon.current_version }}
<span class="tip tooltip" title="{{ _('This is the version of your add-on that will
be installed if someone clicks the Install
button on addons.mozilla.org.') }}">?</span>
</a>
</li>
{% endif %}
<li>
{% if sorting == 'created' %}
{# L10n: {0} is a date. #}
<strong>{{ _('Created:') }}</strong>
{{ addon.created|datetime(_('%b %e, %Y')) }}
{% else %}
<strong>{{ _('Last Updated:') }}</strong>
{{ addon.last_updated|datetime(_('%b %e, %Y')) }}
{% endif %}
</li>
{% if addon.latest_version and addon.latest_version != addon.current_version %}
<li>
<strong>{{ _('Next Version:') }}</strong>
<a href="{{ addon.latest_version.get_url_path() }}">
{{ addon.latest_version.version }}
<span class="tip tooltip" title="{{ _('This is the newest uploaded version, however
it isn’t live on the site yet.') }}">?</span>
</a>
</li>
{% endif %}
{% with position = get_position(addon) %}
{% if position and position.pos and position.total %}
<li>
<strong>{{ _('Queue Position:') }}</strong>
{% trans position=position.pos|numberfmt,
total=position.total|numberfmt %}
{{ position }} of {{ total }}
{% endtrans %}
</li>
{% endif %}
{% endwith %}
40 changes: 30 additions & 10 deletions apps/devhub/templates/devhub/includes/addons_edit_nav.html
@@ -1,29 +1,49 @@
{% set urls = [
(addon.get_dev_url(), _('Edit Listing')),
(addon.get_dev_url('owner'), _('Manage Authors') if webapp
else _('Manage Authors & License')),
(addon.get_dev_url('owner'), _('Manage Authors & License')),
(addon.get_dev_url('profile'), _('Manage Developer Profile')),
(addon.get_dev_url('payments'), _('Manage Payments')),
(addon.get_dev_url('versions'), _('Manage App Status') if webapp
else _('Manage Status & Versions')),
(addon.get_dev_url('versions'), _('Manage Status & Versions')),
] %}

{% if addon.is_premium() and waffle.switch('allow-refund') %}
{% do urls.insert(4, (addon.get_dev_url('refunds'), loc('Manage Refunds'))) %}
{% endif %}
{% if addon.is_webapp() %}
{% do urls.insert(4,
(addon.get_dev_url('in_app_config'), _('Manage In-App Payments'))
) %}
{% endif %}

<section class="secondary" role="complementary">
<div class="addon-status">
<img class="addon-icon" src="{{ addon.icon_url }}">
<ul class="addon-details">
{% include "devhub/includes/addon_details.html" %}
</ul>
<p class="addon-upload">
{% if not addon.is_incomplete() and not addon.is_disabled %}
<strong>
<a href="{{ addon.get_dev_url('versions') }}#version-upload" class="version-upload">{{ _('Upload New Version') }}</a>
</strong>
&middot;
{% endif %}
<a href="{{ addon.get_dev_url('versions') }}">{{ _('View All' ) }}</a>
</p>
</div>
<div class="highlight" id="edit-addon-nav">
<h3>{{ addon.name }}</h3>
<ul class="refinements">
{% for url, title in urls %}
<li {% if url in request.path %}class="selected"{% endif %}>
<a href="{{ url }}">{{ title }}</a></li>
{% endfor %}
<li class="addon-manage">
{% if check_addon_ownership(request, addon, dev=True) %}
{% if addon.disabled_by_user and addon.status != amo.STATUS_DISABLED %}
<a href="{{ addon.get_dev_url('enable') }}" class="enable-addon">{{ _('Enable Add-on') }}</a>
{% elif not addon.is_disabled %}
<a href="{{ addon.get_dev_url('versions') }}#disable-addon" class="disable-addon">{{ _('Disable Add-on') }}</a>
{% endif %}
{% endif %}
{% if check_addon_ownership(request, addon) and addon.can_be_deleted() %}
<a href="{{ addon.get_dev_url('versions') }}#delete-addon" class="delete-addon">{{ _('Delete Add-on') }}</a>
{% endif %}
</li>
</ul>
<ul class="refinements">
<li><a href="{{ addon.get_url_path() }}">
Expand Down
2 changes: 1 addition & 1 deletion apps/devhub/templates/devhub/payments/payments.html
Expand Up @@ -11,7 +11,7 @@
{% block content %}
<header>
{{ dev_breadcrumbs(addon, items=[(None, title)]) }}
<h2>{{ title }}</h2>
<h2>{{ addon.name }}</h2>
</header>
<section class="primary payments devhub-form" role="main">
{% set contrib = addon.takes_contributions and addon.has_full_profile() or errors %}
Expand Down