Revert "Update dashboard for apps (bug 693855)"
This reverts commit e2b79ef541
.
This commit is contained in:
Родитель
e8d867d01b
Коммит
8f2b7c17de
|
@ -74,8 +74,6 @@ def global_settings(request):
|
||||||
'href': reverse('devhub.submit.1')})
|
'href': reverse('devhub.submit.1')})
|
||||||
|
|
||||||
if waffle.flag_is_active(request, 'accept-webapps'):
|
if waffle.flag_is_active(request, 'accept-webapps'):
|
||||||
tools_links.append({'text': _('Manage My Apps'),
|
|
||||||
'href': reverse('devhub.apps')})
|
|
||||||
tools_links.append({'text': _('Submit a New App'),
|
tools_links.append({'text': _('Submit a New App'),
|
||||||
'href': reverse('devhub.submit_apps.1')})
|
'href': reverse('devhub.submit_apps.1')})
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ class TestHome(amo.tests.TestCase):
|
||||||
eq_(request.amo_user.is_developer, True)
|
eq_(request.amo_user.is_developer, True)
|
||||||
|
|
||||||
eq_(nav.find('.tools').length, 1)
|
eq_(nav.find('.tools').length, 1)
|
||||||
eq_(nav.find('.tools li').length, 5)
|
eq_(nav.find('.tools li').length, 4)
|
||||||
eq_(nav.find('.tools > a').length, 1)
|
eq_(nav.find('.tools > a').length, 1)
|
||||||
eq_(nav.find('.tools > a').text(), "Developer")
|
eq_(nav.find('.tools > a').text(), "Developer")
|
||||||
|
|
||||||
|
@ -124,15 +124,7 @@ class TestHome(amo.tests.TestCase):
|
||||||
eq_(item.text(), "Submit a New Add-on")
|
eq_(item.text(), "Submit a New Add-on")
|
||||||
eq_(item.attr('href'), reverse('devhub.submit.1'))
|
eq_(item.attr('href'), reverse('devhub.submit.1'))
|
||||||
|
|
||||||
item = nav.find('.tools ul li a').eq(2)
|
|
||||||
eq_(item.text(), "Manage My Apps")
|
|
||||||
eq_(item.attr('href'), reverse('devhub.apps'))
|
|
||||||
|
|
||||||
item = nav.find('.tools ul li a').eq(3)
|
item = nav.find('.tools ul li a').eq(3)
|
||||||
eq_(item.text(), "Submit a New App")
|
|
||||||
eq_(item.attr('href'), reverse('devhub.submit_apps.1'))
|
|
||||||
|
|
||||||
item = nav.find('.tools ul li a').eq(4)
|
|
||||||
eq_(item.text(), "Developer Hub")
|
eq_(item.text(), "Developer Hub")
|
||||||
eq_(item.attr('href'), reverse('devhub.index'))
|
eq_(item.attr('href'), reverse('devhub.index'))
|
||||||
|
|
||||||
|
@ -155,7 +147,7 @@ class TestHome(amo.tests.TestCase):
|
||||||
eq_(acl.action_allowed(request, 'Editors', '%'), True)
|
eq_(acl.action_allowed(request, 'Editors', '%'), True)
|
||||||
|
|
||||||
eq_(nav.find('li.tools').length, 1)
|
eq_(nav.find('li.tools').length, 1)
|
||||||
eq_(nav.find('li.tools li').length, 6)
|
eq_(nav.find('li.tools li').length, 5)
|
||||||
eq_(nav.find('li.tools > a').length, 1)
|
eq_(nav.find('li.tools > a').length, 1)
|
||||||
eq_(nav.find('li.tools > a').text(), "Tools")
|
eq_(nav.find('li.tools > a').text(), "Tools")
|
||||||
|
|
||||||
|
@ -167,19 +159,11 @@ class TestHome(amo.tests.TestCase):
|
||||||
eq_(item.text(), "Submit a New Add-on")
|
eq_(item.text(), "Submit a New Add-on")
|
||||||
eq_(item.attr('href'), reverse('devhub.submit.1'))
|
eq_(item.attr('href'), reverse('devhub.submit.1'))
|
||||||
|
|
||||||
item = nav.find('.tools ul li a').eq(2)
|
|
||||||
eq_(item.text(), "Manage My Apps")
|
|
||||||
eq_(item.attr('href'), reverse('devhub.apps'))
|
|
||||||
|
|
||||||
item = nav.find('.tools ul li a').eq(3)
|
item = nav.find('.tools ul li a').eq(3)
|
||||||
eq_(item.text(), "Submit a New App")
|
|
||||||
eq_(item.attr('href'), reverse('devhub.submit_apps.1'))
|
|
||||||
|
|
||||||
item = nav.find('.tools ul li a').eq(4)
|
|
||||||
eq_(item.text(), "Developer Hub")
|
eq_(item.text(), "Developer Hub")
|
||||||
eq_(item.attr('href'), reverse('devhub.index'))
|
eq_(item.attr('href'), reverse('devhub.index'))
|
||||||
|
|
||||||
item = nav.find('.tools ul li a').eq(5)
|
item = nav.find('.tools ul li a').eq(4)
|
||||||
eq_(item.text(), "Editor Tools")
|
eq_(item.text(), "Editor Tools")
|
||||||
eq_(item.attr('href'), reverse('editors.home'))
|
eq_(item.attr('href'), reverse('editors.home'))
|
||||||
|
|
||||||
|
@ -274,8 +258,9 @@ class TestStuff(amo.tests.TestCase):
|
||||||
eq_(nav.find('.tools a').eq(0).text(), "Developer Hub")
|
eq_(nav.find('.tools a').eq(0).text(), "Developer Hub")
|
||||||
eq_(nav.find('.tools a').eq(0).attr('href'), reverse('devhub.index'))
|
eq_(nav.find('.tools a').eq(0).attr('href'), reverse('devhub.index'))
|
||||||
|
|
||||||
def test_tools_developer(self):
|
@mock.patch.object(waffle, 'flag_is_active')
|
||||||
waffle.models.Flag.objects.create(name='accept-webapps', everyone=True)
|
def test_tools_developer(self, fia):
|
||||||
|
fia.return_value = True
|
||||||
|
|
||||||
# Make them a developer
|
# Make them a developer
|
||||||
user = UserProfile.objects.get(email='regular@mozilla.com')
|
user = UserProfile.objects.get(email='regular@mozilla.com')
|
||||||
|
@ -292,7 +277,7 @@ class TestStuff(amo.tests.TestCase):
|
||||||
|
|
||||||
eq_(nav.find('li.tools').length, 1)
|
eq_(nav.find('li.tools').length, 1)
|
||||||
eq_(nav.find('li.tools > a').text(), "Developer")
|
eq_(nav.find('li.tools > a').text(), "Developer")
|
||||||
eq_(nav.find('li.tools li').length, 5)
|
eq_(nav.find('li.tools li').length, 4)
|
||||||
|
|
||||||
item = nav.find('li.tools ul li a').eq(0)
|
item = nav.find('li.tools ul li a').eq(0)
|
||||||
eq_(item.text(), "Manage My Add-ons")
|
eq_(item.text(), "Manage My Add-ons")
|
||||||
|
@ -302,20 +287,13 @@ class TestStuff(amo.tests.TestCase):
|
||||||
eq_(item.text(), "Submit a New Add-on")
|
eq_(item.text(), "Submit a New Add-on")
|
||||||
eq_(item.attr('href'), reverse('devhub.submit.1'))
|
eq_(item.attr('href'), reverse('devhub.submit.1'))
|
||||||
|
|
||||||
item = nav.find('li.tools ul li a').eq(2)
|
|
||||||
eq_(item.text(), "Manage My Apps")
|
|
||||||
eq_(item.attr('href'), reverse('devhub.apps'))
|
|
||||||
|
|
||||||
item = nav.find('li.tools ul li a').eq(3)
|
item = nav.find('li.tools ul li a').eq(3)
|
||||||
eq_(item.text(), "Submit a New App")
|
|
||||||
eq_(item.attr('href'), reverse('devhub.submit_apps.1'))
|
|
||||||
|
|
||||||
item = nav.find('li.tools ul li a').eq(4)
|
|
||||||
eq_(item.text(), "Developer Hub")
|
eq_(item.text(), "Developer Hub")
|
||||||
eq_(item.attr('href'), reverse('devhub.index'))
|
eq_(item.attr('href'), reverse('devhub.index'))
|
||||||
|
|
||||||
def test_tools_developer_and_editor(self):
|
@mock.patch.object(waffle, 'flag_is_active')
|
||||||
waffle.models.Flag.objects.create(name='accept-webapps', everyone=True)
|
def test_tools_developer_and_editor(self, fia):
|
||||||
|
fia.return_value = True
|
||||||
|
|
||||||
# Make them a developer
|
# Make them a developer
|
||||||
user = UserProfile.objects.get(email='editor@mozilla.com')
|
user = UserProfile.objects.get(email='editor@mozilla.com')
|
||||||
|
@ -332,7 +310,7 @@ class TestStuff(amo.tests.TestCase):
|
||||||
eq_(acl.action_allowed(request, 'Editors', '%'), True)
|
eq_(acl.action_allowed(request, 'Editors', '%'), True)
|
||||||
|
|
||||||
eq_(nav.find('li.tools').length, 1)
|
eq_(nav.find('li.tools').length, 1)
|
||||||
eq_(nav.find('li.tools li').length, 6)
|
eq_(nav.find('li.tools li').length, 5)
|
||||||
|
|
||||||
item = nav.find('li.tools ul li a').eq(0)
|
item = nav.find('li.tools ul li a').eq(0)
|
||||||
eq_(item.text(), "Manage My Add-ons")
|
eq_(item.text(), "Manage My Add-ons")
|
||||||
|
@ -343,18 +321,14 @@ class TestStuff(amo.tests.TestCase):
|
||||||
eq_(item.attr('href'), reverse('devhub.submit.1'))
|
eq_(item.attr('href'), reverse('devhub.submit.1'))
|
||||||
|
|
||||||
item = nav.find('li.tools ul li a').eq(2)
|
item = nav.find('li.tools ul li a').eq(2)
|
||||||
eq_(item.text(), "Manage My Apps")
|
|
||||||
eq_(item.attr('href'), reverse('devhub.apps'))
|
|
||||||
|
|
||||||
item = nav.find('li.tools ul li a').eq(3)
|
|
||||||
eq_(item.text(), "Submit a New App")
|
eq_(item.text(), "Submit a New App")
|
||||||
eq_(item.attr('href'), reverse('devhub.submit_apps.1'))
|
eq_(item.attr('href'), reverse('devhub.submit_apps.1'))
|
||||||
|
|
||||||
item = nav.find('li.tools ul li a').eq(4)
|
item = nav.find('li.tools ul li a').eq(3)
|
||||||
eq_(item.text(), "Developer Hub")
|
eq_(item.text(), "Developer Hub")
|
||||||
eq_(item.attr('href'), reverse('devhub.index'))
|
eq_(item.attr('href'), reverse('devhub.index'))
|
||||||
|
|
||||||
item = nav.find('li.tools ul li a').eq(5)
|
item = nav.find('li.tools ul li a').eq(4)
|
||||||
eq_(item.text(), "Editor Tools")
|
eq_(item.text(), "Editor Tools")
|
||||||
eq_(item.attr('href'), reverse('editors.home'))
|
eq_(item.attr('href'), reverse('editors.home'))
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ from tower import ugettext as _, ungettext as ngettext
|
||||||
|
|
||||||
import amo
|
import amo
|
||||||
from amo.urlresolvers import reverse
|
from amo.urlresolvers import reverse
|
||||||
from amo.helpers import breadcrumbs, impala_breadcrumbs, page_title
|
from amo.helpers import breadcrumbs, page_title
|
||||||
from access import acl
|
from access import acl
|
||||||
from addons.helpers import new_context
|
from addons.helpers import new_context
|
||||||
|
|
||||||
|
@ -46,8 +46,7 @@ def docs_page_title(context, title=None):
|
||||||
|
|
||||||
@register.function
|
@register.function
|
||||||
@jinja2.contextfunction
|
@jinja2.contextfunction
|
||||||
def dev_breadcrumbs(context, addon=None, items=None, add_default=False,
|
def dev_breadcrumbs(context, addon=None, items=None, add_default=False):
|
||||||
impala=False):
|
|
||||||
"""
|
"""
|
||||||
Wrapper function for ``breadcrumbs``. Prepends 'Developer Hub'
|
Wrapper function for ``breadcrumbs``. Prepends 'Developer Hub'
|
||||||
breadcrumbs.
|
breadcrumbs.
|
||||||
|
@ -59,12 +58,10 @@ def dev_breadcrumbs(context, addon=None, items=None, add_default=False,
|
||||||
specified then the Add-on will be linked.
|
specified then the Add-on will be linked.
|
||||||
**add_default**
|
**add_default**
|
||||||
Prepends trail back to home when True. Default is False.
|
Prepends trail back to home when True. Default is False.
|
||||||
**impala**
|
|
||||||
Whether to use the impala_breadcrumbs helper. Default is False.
|
|
||||||
"""
|
"""
|
||||||
crumbs = [(reverse('devhub.index'), _('Developer Hub'))]
|
crumbs = [(reverse('devhub.index'), _('Developer Hub'))]
|
||||||
|
|
||||||
if context.get('webapp'):
|
if context.get('WEBAPPS'):
|
||||||
title = _('My Apps')
|
title = _('My Apps')
|
||||||
else:
|
else:
|
||||||
title = _('My Add-ons')
|
title = _('My Add-ons')
|
||||||
|
@ -83,9 +80,6 @@ def dev_breadcrumbs(context, addon=None, items=None, add_default=False,
|
||||||
crumbs.append((url, addon.name))
|
crumbs.append((url, addon.name))
|
||||||
if items:
|
if items:
|
||||||
crumbs.extend(items)
|
crumbs.extend(items)
|
||||||
if impala:
|
|
||||||
return impala_breadcrumbs(context, crumbs, add_default)
|
|
||||||
else:
|
|
||||||
return breadcrumbs(context, crumbs, add_default)
|
return breadcrumbs(context, crumbs, add_default)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,48 +1,26 @@
|
||||||
{% extends "devhub/base_impala.html" %}
|
{% extends "devhub/base.html" %}
|
||||||
|
|
||||||
{% if webapp %}
|
{% block bodyclass %}{{ super() }} inverse{% endblock %}
|
||||||
{% set title = _('Manage My Apps') %}
|
|
||||||
{% else %}
|
|
||||||
{% set title = _('Manage My Add-ons') %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% block title %}{{ dev_page_title(title) }}{% endblock %}
|
{% block title %}{{ dev_page_title(_('Manage My Add-ons')) }}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<section class="primary">
|
<header>
|
||||||
<header class="hero">
|
{{ dev_breadcrumbs() }}
|
||||||
{{ dev_breadcrumbs(impala=True) }}
|
<hgroup>
|
||||||
<h1>{{ title }}</h1>
|
<h2>{{ _('Manage My Add-ons') }}</h2>
|
||||||
|
|
||||||
{% if addons %}
|
{% if addons %}
|
||||||
{% set cnt = addons.paginator.count %}
|
{% set cnt = addons.paginator.count %}
|
||||||
{% if webapp %}
|
|
||||||
{# L10n: {0} is an integer. #}
|
{# L10n: {0} is an integer. #}
|
||||||
<h2>{{ ngettext('<b>{0}</b> app', '<b>{0}</b> apps', cnt)|f(cnt|numberfmt)|safe }}</h2>
|
<h3>{{ ngettext('<b>{0}</b> add-on', '<b>{0}</b> add-ons',cnt)|f(cnt|numberfmt)|safe }}</h3>
|
||||||
{% else %}
|
|
||||||
{# L10n: {0} is an integer. #}
|
|
||||||
<h2>{{ ngettext('<b>{0}</b> add-on', '<b>{0}</b> add-ons', cnt)|f(cnt|numberfmt)|safe }}</h2>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
</hgroup>
|
||||||
</header>
|
</header>
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
{% if not addons %}
|
{% if not addons %}
|
||||||
<div class="action-needed">
|
<div class="action-needed">
|
||||||
<h3>{{ _('Welcome to the Developer Dashboard') }}</h3>
|
<h3>{{ _('Welcome to the Developer Dashboard') }}</h3>
|
||||||
{% if webapp %}
|
|
||||||
<p>
|
|
||||||
{% trans %}
|
|
||||||
You don't currently have any apps hosted on Mozilla Marketplace. To
|
|
||||||
learn how the process works and submit your first app, click Get
|
|
||||||
Started below.
|
|
||||||
{% endtrans %}
|
|
||||||
</p>
|
|
||||||
<p class="button-wrapper">
|
|
||||||
<a href="{{ url('devhub.submit_apps.1') }}"
|
|
||||||
class="action-button rounded">{{ _('Get Started') }}</a>
|
|
||||||
</p>
|
|
||||||
{% else %}
|
|
||||||
<p>
|
<p>
|
||||||
{% trans %}
|
{% trans %}
|
||||||
You don't currently have any add-ons hosted on Mozilla Add-ons. To learn
|
You don't currently have any add-ons hosted on Mozilla Add-ons. To learn
|
||||||
|
@ -54,18 +32,31 @@
|
||||||
<a href="{{ url('devhub.submit.1') }}"
|
<a href="{{ url('devhub.submit.1') }}"
|
||||||
class="action-button rounded">{{ _('Get Started') }}</a>
|
class="action-button rounded">{{ _('Get Started') }}</a>
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<aside id="devhub-sidebar" class="secondary" role="complementary">
|
<section id="dashboard" class="primary" role="main">
|
||||||
|
<div class="featured listing">
|
||||||
|
<div class="featured-inner">
|
||||||
|
{% set url_base = url('devhub.addons') %}
|
||||||
|
{% if addons.paginator.num_pages > 1 %}
|
||||||
|
{{ addon_listing_header(url_base, sort_opts, sorting) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{{ dev_addon_listing_items(addons.object_list) }}
|
||||||
|
|
||||||
|
{% if addons.paginator.num_pages > 1 %}
|
||||||
|
<div class="listing-footer">
|
||||||
|
{{ addons|paginator }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>{# /featured-inner #}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="dashboard-sidebar" class="secondary" role="complementary">
|
||||||
<p id="submit-addon" class="cta">
|
<p id="submit-addon" class="cta">
|
||||||
{% if webapp %}
|
|
||||||
<a href="{{ url('devhub.submit_apps.1') }}"
|
|
||||||
class="button prominent">{{ _('Submit a New App') }}</a>
|
|
||||||
{% else %}
|
|
||||||
<a href="{{ url('devhub.submit.1') }}"
|
<a href="{{ url('devhub.submit.1') }}"
|
||||||
class="button prominent">{{ _('Submit a New Add-on') }}</a>
|
class="button prominent">{{ _('Submit a New Add-on') }}</a>
|
||||||
{% endif %}
|
|
||||||
</p>
|
</p>
|
||||||
<div class="recent-activity">
|
<div class="recent-activity">
|
||||||
<h3>
|
<h3>
|
||||||
|
@ -87,34 +78,11 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if webapp %}
|
|
||||||
<p class="older-activity"><a href="{{ url('devhub.feed_all') }}">
|
|
||||||
{{ _('Older activity for My Apps') }} ►</a></p>
|
|
||||||
{% else %}
|
|
||||||
<p class="older-activity"><a href="{{ url('devhub.feed_all') }}">
|
<p class="older-activity"><a href="{{ url('devhub.feed_all') }}">
|
||||||
{{ _('Older activity for My Add-ons') }} ►</a></p>
|
{{ _('Older activity for My Add-ons') }} ►</a></p>
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if not webapp %}
|
|
||||||
{% include "devhub/includes/blog_posts.html" %}
|
{% include "devhub/includes/blog_posts.html" %}
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</aside>
|
|
||||||
<section id="dashboard" class="primary" role="main">
|
|
||||||
<div class="listing island hero c">
|
|
||||||
{% set url_base = url('devhub.apps') if webapp else url('devhub.addons') %}
|
|
||||||
{% if addons.paginator.num_pages > 1 %}
|
|
||||||
{{ impala_addon_listing_header(url_base, sort_opts, sorting) }}
|
|
||||||
{% endif %}
|
|
||||||
<div class="items">
|
|
||||||
{{ dev_addon_listing_items(addons.object_list) }}
|
|
||||||
</div>{# /items #}
|
|
||||||
{% if addons.paginator.num_pages > 1 %}
|
|
||||||
{{ addons|impala_paginator }}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
<h5>{{ _('Actions') }}</h5>
|
|
||||||
<ul>
|
|
||||||
{% if addon.is_incomplete() %}
|
|
||||||
{% if check_addon_ownership(request, addon, dev=True) %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ url('devhub.submit.resume', addon.slug) }}" class="tooltip"
|
|
||||||
title="{{ _("Resume the submission process for this app.")}}">
|
|
||||||
{{ _('Resume') }}</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% if check_addon_ownership(request, addon) %}
|
|
||||||
<li>
|
|
||||||
<a href="#" class="delete-addon tooltip"
|
|
||||||
title="{{ _('Delete this app.') }}">{{ _('Delete') }}</a>
|
|
||||||
<div class="modal-delete modal hidden">
|
|
||||||
{% include "devhub/addons/listing/delete_form.html" %}
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
|
||||||
{% if check_addon_ownership(request, addon, dev=True) %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ url('devhub.addons.edit', addon.slug) }}" class="tooltip"
|
|
||||||
title="{{ _("Edit details about this app's listing.") }}">
|
|
||||||
{{ _('Edit Listing') }}</a>
|
|
||||||
</li>
|
|
||||||
{% if addon.accepts_compatible_apps() and addon.current_version %}
|
|
||||||
<li class="compat"
|
|
||||||
data-src="{{ url('devhub.ajax.compat.status', addon.slug) }}">
|
|
||||||
{% include "devhub/addons/ajax_compat_status.html" %}
|
|
||||||
<div class="compat-error-popup popup error hidden"></div>
|
|
||||||
<div class="compat-update-modal modal hidden"></div>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% if not addon.disabled_by_user %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ locale_url('/statistics/addon/{0}')|f(addon.id) }}" class="tooltip"
|
|
||||||
{# <a href="{{ url('stats.overview', addon.slug) }}" class="tooltip" #}
|
|
||||||
title="{{ _('Daily statistics on downloads and users.') }}">
|
|
||||||
{{ _('Statistics') }}</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
<li>
|
|
||||||
<a href="#" class="more-actions">{{ _('More') }}</a>
|
|
||||||
<div class="more-actions-popup popup hidden">
|
|
||||||
{% set manage_urls = (
|
|
||||||
(url('devhub.addons.owner', addon.slug), _('Manage Authors & License')),
|
|
||||||
(url('devhub.addons.profile', addon.slug), _('Manage Developer Profile')),
|
|
||||||
(url('devhub.addons.payments', addon.slug), _('Manage Payments')),
|
|
||||||
(url('devhub.versions', addon.slug), _('Manage Status'))) %}
|
|
||||||
<ul>
|
|
||||||
{% for url, title in manage_urls %}
|
|
||||||
<li><a href="{{ url }}">{{ title }}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% set view_urls = ((addon.get_url_path(), _('View App Listing')),
|
|
||||||
(url('devhub.feed', addon.slug), _('View Recent Changes'))) %}
|
|
||||||
<ul>
|
|
||||||
{% for url, title in view_urls %}
|
|
||||||
<li><a href="{{ url }}">{{ title }}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
|
@ -2,14 +2,13 @@
|
||||||
{% set collection = collection or None %}
|
{% set collection = collection or None %}
|
||||||
{% set username = request.amo_user.username if request.user.is_authenticated() else '' %}
|
{% set username = request.amo_user.username if request.user.is_authenticated() else '' %}
|
||||||
{% for addon in addons %}
|
{% for addon in addons %}
|
||||||
<div class="item addon ignore-compatibility" data-addonid="{{ addon.id }}">
|
<div class="item" data-addonid="{{ addon.id }}">
|
||||||
<div class="info">
|
|
||||||
{{ dev_heading(addon, amo) }}
|
{{ dev_heading(addon, amo) }}
|
||||||
{% if addon.is_incomplete() %}
|
{% if addon.is_incomplete() %}
|
||||||
<p>
|
<p>
|
||||||
{% trans %}
|
{% trans %}
|
||||||
This submission will be deleted automatically after a few days if
|
This add-on will be deleted automatically after a few days if the
|
||||||
the submission process is not completed.
|
submission process is not completed.
|
||||||
{% endtrans %}
|
{% endtrans %}
|
||||||
</p>
|
</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -17,7 +16,6 @@
|
||||||
{{ dev_item_info(addon, amo) }}
|
{{ dev_item_info(addon, amo) }}
|
||||||
</div>
|
</div>
|
||||||
<ul class="item-details">
|
<ul class="item-details">
|
||||||
{% if not webapp %}
|
|
||||||
{% if addon.current_version %}
|
{% if addon.current_version %}
|
||||||
{% set link = url('devhub.versions.edit', addon.slug, addon.current_version.id) %}
|
{% set link = url('devhub.versions.edit', addon.slug, addon.current_version.id) %}
|
||||||
{# L10n: {0} is a version number. #}
|
{# L10n: {0} is a version number. #}
|
||||||
|
@ -27,7 +25,6 @@
|
||||||
{# L10n: {0} is a date. #}
|
{# L10n: {0} is a date. #}
|
||||||
<li>{{ _('<strong>Last updated:</strong> {0}'|
|
<li>{{ _('<strong>Last updated:</strong> {0}'|
|
||||||
f(addon.last_updated|datetime))|safe }}</li>
|
f(addon.last_updated|datetime))|safe }}</li>
|
||||||
{% endif %}
|
|
||||||
<li id="version-status-item">
|
<li id="version-status-item">
|
||||||
<strong>{{ _('Status:') }}</strong>
|
<strong>{{ _('Status:') }}</strong>
|
||||||
<a href="{{ url('devhub.versions', addon.slug) }}">
|
<a href="{{ url('devhub.versions', addon.slug) }}">
|
||||||
|
@ -42,12 +39,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="item-actions">
|
<div class="item-actions">
|
||||||
{% if webapp %}
|
|
||||||
{% include "devhub/addons/listing/item_actions_app.html" %}
|
|
||||||
{% else %}
|
|
||||||
{% include "devhub/addons/listing/item_actions.html" %}
|
{% include "devhub/addons/listing/item_actions.html" %}
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{% macro dev_heading(addon, amo) %}
|
{% macro dev_heading(addon, amo) %}
|
||||||
<h3>
|
<h4>
|
||||||
{% set is_complete = not addon.is_incomplete() %}
|
{% set is_complete = not addon.is_incomplete() %}
|
||||||
{% if is_complete %}<a href="{{ addon.get_url_path() }}">{% endif %}
|
{% if is_complete %}<a href="{{ addon.get_url_path() }}">{% endif %}
|
||||||
<img class="icon" src="{{ addon.get_icon_url(64) }}">
|
<img class="icon" src="{{ addon.get_icon_url(64) }}">
|
||||||
{{ addon.name }}{% if is_complete %}</a>{% endif %}
|
{{ addon.name }}{% if is_complete %}</a>{% endif %}
|
||||||
</h3>
|
</h4>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro dev_item_info(addon, amo) %}
|
{% macro dev_item_info(addon, amo) %}
|
||||||
|
|
|
@ -37,31 +37,11 @@
|
||||||
<nav id="site-nav" class="menu-nav no-img c">
|
<nav id="site-nav" class="menu-nav no-img c">
|
||||||
<ul>
|
<ul>
|
||||||
{% if request.user.is_authenticated() and request.amo_user.is_developer %}
|
{% if request.user.is_authenticated() and request.amo_user.is_developer %}
|
||||||
{% if webapp %}
|
|
||||||
<li class="top">
|
|
||||||
<a href="{{ url('devhub.apps') }}" class="controller">
|
|
||||||
{{ _('My Apps') }}</a>
|
|
||||||
<ul>
|
|
||||||
{% set my_apps = request.amo_user.my_apps() %}
|
|
||||||
{% for addon in my_apps %}
|
|
||||||
{% if loop.index == 8 %}
|
|
||||||
<li><a href="{{ url('devhub.apps') }}">
|
|
||||||
{{ _('more apps...') }}</a></li>
|
|
||||||
{% else %}
|
|
||||||
<li><a href="{{ url('devhub.addons.edit', addon.slug) }}">
|
|
||||||
{{ addon.name }}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
<li><em><a href="{{ url('devhub.submit_apps.1') }}">
|
|
||||||
{{ _('Submit a New App') }}</a></em></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
{% else %}
|
|
||||||
<li class="top">
|
<li class="top">
|
||||||
<a href="{{ url('devhub.addons') }}" class="controller">
|
<a href="{{ url('devhub.addons') }}" class="controller">
|
||||||
{{ _('My Add-ons') }}</a>
|
{{ _('My Add-ons') }}</a>
|
||||||
<ul>
|
<ul>
|
||||||
{% set my_addons = request.amo_user.my_addons() %}
|
{% set my_addons = request.amo_user.addons.all()[:8] %}
|
||||||
{% for addon in my_addons %}
|
{% for addon in my_addons %}
|
||||||
{% if loop.index == 8 %}
|
{% if loop.index == 8 %}
|
||||||
<li><a href="{{ url('devhub.addons') }}">
|
<li><a href="{{ url('devhub.addons') }}">
|
||||||
|
@ -76,7 +56,6 @@
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
|
||||||
<li>
|
<li>
|
||||||
<a href="#" class="controller">{{ _('Documentation') }}</a>
|
<a href="#" class="controller">{{ _('Documentation') }}</a>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -16,56 +16,27 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block aux_nav %}
|
{% block aux_nav %}
|
||||||
<li class="nomenu">
|
<li class="nomenu"><a class="return" href="{{ url('home') }}">
|
||||||
{% if webapp %}
|
{{ _('Back to Add-ons') }}</a></li>
|
||||||
<a class="return" href="{{ url('apps.home') }}">{{ _('Back to Apps') }}</a>
|
|
||||||
{% else %}
|
|
||||||
<a class="return" href="{{ url('home') }}">{{ _('Back to Add-ons') }}</a>
|
|
||||||
{% endif %}
|
|
||||||
</li>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block site_header_title %}
|
{% block site_header_title %}
|
||||||
<h1 class="site-title prominent">
|
<h1 class="site-title prominent">
|
||||||
<a href="{{ url('devhub.index') }}" title="{{ _('Return to the DevHub homepage')|f(request.APP.pretty) }}">
|
<a href="{{ url('devhub.index') }}" title="{{ _('Return to the DevHub homepage')|f(request.APP.pretty) }}">
|
||||||
{% if webapp %}
|
{# L10n: Text in small tag is smaller and on it's own line #}
|
||||||
{% trans %}App Developer Preview{% endtrans %}
|
|
||||||
{% else %}
|
|
||||||
{# L10n: Text in small tag is smaller and on its own line #}
|
|
||||||
{% trans %}
|
{% trans %}
|
||||||
<small>Add-on</small> Developer Hub
|
<small>Add-on</small> Developer Hub
|
||||||
{% endtrans %}
|
{% endtrans %}
|
||||||
{% endif %}
|
|
||||||
</a>
|
</a>
|
||||||
</h1>
|
</h1>
|
||||||
<nav id="site-nav" class="menu-nav no-img c">
|
<nav id="site-nav" class="menu-nav no-img c">
|
||||||
<ul>
|
<ul>
|
||||||
{% if request.user.is_authenticated() and request.amo_user.is_developer %}
|
{% if request.user.is_authenticated() and request.amo_user.is_developer %}
|
||||||
{% if webapp %}
|
|
||||||
<li class="top">
|
|
||||||
<a href="{{ url('devhub.apps') }}" class="controller">
|
|
||||||
{{ _('My Apps') }}</a>
|
|
||||||
<ul>
|
|
||||||
{% set my_addons = request.amo_user.my_apps() %}
|
|
||||||
{% for addon in my_addons %}
|
|
||||||
{% if loop.index == 8 %}
|
|
||||||
<li><a href="{{ url('devhub.apps') }}">
|
|
||||||
{{ _('more apps...') }}</a></li>
|
|
||||||
{% else %}
|
|
||||||
<li><a href="{{ url('devhub.addons.edit', addon.slug) }}">
|
|
||||||
{{ addon.name }}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
<li><em><a href="{{ url('devhub.submit_apps.1') }}">
|
|
||||||
{{ _('Submit a New App') }}</a></em></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
{% else %}
|
|
||||||
<li class="top">
|
<li class="top">
|
||||||
<a href="{{ url('devhub.addons') }}" class="controller">
|
<a href="{{ url('devhub.addons') }}" class="controller">
|
||||||
{{ _('My Add-ons') }}</a>
|
{{ _('My Add-ons') }}</a>
|
||||||
<ul>
|
<ul>
|
||||||
{% set my_addons = request.amo_user.my_addons() %}
|
{% set my_addons = request.amo_user.addons.all()[:8] %}
|
||||||
{% for addon in my_addons %}
|
{% for addon in my_addons %}
|
||||||
{% if loop.index == 8 %}
|
{% if loop.index == 8 %}
|
||||||
<li><a href="{{ url('devhub.addons') }}">
|
<li><a href="{{ url('devhub.addons') }}">
|
||||||
|
@ -80,7 +51,6 @@
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
|
||||||
<li>
|
<li>
|
||||||
<a href="#" class="controller">{{ _('Documentation') }}</a>
|
<a href="#" class="controller">{{ _('Documentation') }}</a>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -55,8 +55,7 @@ class MetaTests(amo.tests.TestCase):
|
||||||
|
|
||||||
|
|
||||||
class HubTest(amo.tests.TestCase):
|
class HubTest(amo.tests.TestCase):
|
||||||
fixtures = ['browse/nameless-addon', 'base/users',
|
fixtures = ['browse/nameless-addon', 'base/users']
|
||||||
'webapps/337141-steamcube']
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.url = reverse('devhub.index')
|
self.url = reverse('devhub.index')
|
||||||
|
@ -69,11 +68,13 @@ class HubTest(amo.tests.TestCase):
|
||||||
ids = []
|
ids = []
|
||||||
for i in range(num):
|
for i in range(num):
|
||||||
addon = Addon.objects.get(id=addon_id)
|
addon = Addon.objects.get(id=addon_id)
|
||||||
data = dict(type=addon.type, status=addon.status,
|
addon.id = addon.guid = None
|
||||||
name='cloned-addon-%s-%s' % (addon_id, i))
|
addon.save()
|
||||||
new_addon = Addon.objects.create(**data)
|
AddonUser.objects.create(user=self.user_profile, addon=addon)
|
||||||
AddonUser.objects.create(user=self.user_profile, addon=new_addon)
|
new_addon = Addon.objects.get(id=addon.id)
|
||||||
ids.append(new_addon.id)
|
new_addon.name = str(addon.id)
|
||||||
|
new_addon.save()
|
||||||
|
ids.append(addon.id)
|
||||||
return ids
|
return ids
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,8 +97,6 @@ class TestNav(HubTest):
|
||||||
"""Check that the correct items are listed for the My Add-ons menu."""
|
"""Check that the correct items are listed for the My Add-ons menu."""
|
||||||
# Assign this add-on to the current user profile.
|
# Assign this add-on to the current user profile.
|
||||||
addon = Addon.objects.get(id=57132)
|
addon = Addon.objects.get(id=57132)
|
||||||
addon.name = 'Test'
|
|
||||||
addon.save()
|
|
||||||
AddonUser.objects.create(user=self.user_profile, addon=addon)
|
AddonUser.objects.create(user=self.user_profile, addon=addon)
|
||||||
|
|
||||||
r = self.client.get(self.url)
|
r = self.client.get(self.url)
|
||||||
|
@ -176,14 +175,16 @@ class TestDashboard(HubTest):
|
||||||
r = self.client.get(self.url)
|
r = self.client.get(self.url)
|
||||||
doc = pq(r.content)
|
doc = pq(r.content)
|
||||||
eq_(len(doc('.item .item-info')), 10)
|
eq_(len(doc('.item .item-info')), 10)
|
||||||
eq_(doc('nav.paginator').length, 0)
|
eq_(doc('#addon-list-options').length, 0)
|
||||||
|
eq_(doc('.listing-footer .pagination').length, 0)
|
||||||
|
|
||||||
# Create 5 add-ons.
|
# Create 5 add-ons.
|
||||||
self.clone_addon(5)
|
self.clone_addon(5)
|
||||||
r = self.client.get(self.url + '?page=2')
|
r = self.client.get(self.url + '?page=2')
|
||||||
doc = pq(r.content)
|
doc = pq(r.content)
|
||||||
eq_(len(doc('.item .item-info')), 5)
|
eq_(len(doc('.item .item-info')), 5)
|
||||||
eq_(doc('nav.paginator').length, 1)
|
eq_(doc('#addon-list-options').length, 1)
|
||||||
|
eq_(doc('.listing-footer .pagination').length, 1)
|
||||||
|
|
||||||
def test_show_hide_statistics(self):
|
def test_show_hide_statistics(self):
|
||||||
a_pk = self.clone_addon(1)[0]
|
a_pk = self.clone_addon(1)[0]
|
||||||
|
@ -207,8 +208,8 @@ class TestDashboard(HubTest):
|
||||||
doc = pq(r.content)
|
doc = pq(r.content)
|
||||||
eq_(a.status, amo.STATUS_PUBLIC)
|
eq_(a.status, amo.STATUS_PUBLIC)
|
||||||
assert doc('.item[data-addonid=%s] ul.item-details' % a_pk)
|
assert doc('.item[data-addonid=%s] ul.item-details' % a_pk)
|
||||||
assert doc('.item[data-addonid=%s] h3 a' % a_pk)
|
assert doc('.item[data-addonid=%s] h4 a' % a_pk)
|
||||||
assert not doc('.item[data-addonid=%s] > div.info > p' % a_pk)
|
assert not doc('.item[data-addonid=%s] > p' % a_pk)
|
||||||
|
|
||||||
def test_incomplete_addon_item(self):
|
def test_incomplete_addon_item(self):
|
||||||
a_pk = self.clone_addon(1)[0]
|
a_pk = self.clone_addon(1)[0]
|
||||||
|
@ -216,8 +217,8 @@ class TestDashboard(HubTest):
|
||||||
r = self.client.get(self.url)
|
r = self.client.get(self.url)
|
||||||
doc = pq(r.content)
|
doc = pq(r.content)
|
||||||
assert not doc('.item[data-addonid=%s] ul.item-details' % a_pk)
|
assert not doc('.item[data-addonid=%s] ul.item-details' % a_pk)
|
||||||
assert not doc('.item[data-addonid=%s] h3 a' % a_pk)
|
assert not doc('.item[data-addonid=%s] h4 a' % a_pk)
|
||||||
assert doc('.item[data-addonid=%s] > div.info > p' % a_pk)
|
assert doc('.item[data-addonid=%s] > p' % a_pk)
|
||||||
|
|
||||||
def test_dev_news(self):
|
def test_dev_news(self):
|
||||||
self.clone_addon(1) # We need one to see this module
|
self.clone_addon(1) # We need one to see this module
|
||||||
|
@ -234,43 +235,6 @@ class TestDashboard(HubTest):
|
||||||
eq_(doc('.blog-posts li a').eq(4).text(), "hi 4")
|
eq_(doc('.blog-posts li a').eq(4).text(), "hi 4")
|
||||||
|
|
||||||
|
|
||||||
class TestAppDashboard(HubTest):
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
super(TestAppDashboard, self).setUp()
|
|
||||||
self.url = reverse('devhub.apps')
|
|
||||||
waffle.models.Flag.objects.create(name='accept-webapps', everyone=True)
|
|
||||||
|
|
||||||
def test_app_dashboard(self):
|
|
||||||
eq_(self.client.get(self.url).status_code, 200)
|
|
||||||
|
|
||||||
def test_no_apps(self):
|
|
||||||
"""Check that no apps are displayed for this user."""
|
|
||||||
r = self.client.get(self.url)
|
|
||||||
doc = pq(r.content)
|
|
||||||
eq_(doc('.items .item').length, 0)
|
|
||||||
|
|
||||||
def test_app_pagination(self):
|
|
||||||
"""Check that the correct info. is displayed for each app:
|
|
||||||
namely, that apps are paginated at 10 items per page, and that
|
|
||||||
when there is more than one page, the 'Sort by' header and pagination
|
|
||||||
footer appear.
|
|
||||||
"""
|
|
||||||
# Create 10 add-ons.
|
|
||||||
self.clone_addon(10, addon_id=337141)
|
|
||||||
r = self.client.get(self.url)
|
|
||||||
doc = pq(r.content)
|
|
||||||
eq_(len(doc('.item .item-info')), 10)
|
|
||||||
eq_(doc('nav.paginator').length, 0)
|
|
||||||
|
|
||||||
# Create 5 add-ons.
|
|
||||||
self.clone_addon(5, addon_id=337141)
|
|
||||||
r = self.client.get(self.url + '?page=2')
|
|
||||||
doc = pq(r.content)
|
|
||||||
eq_(len(doc('.item .item-info')), 5)
|
|
||||||
eq_(doc('nav.paginator').length, 1)
|
|
||||||
|
|
||||||
|
|
||||||
class TestUpdateCompatibility(amo.tests.TestCase):
|
class TestUpdateCompatibility(amo.tests.TestCase):
|
||||||
fixtures = ['base/apps', 'base/users', 'base/addon_4594_a9',
|
fixtures = ['base/apps', 'base/users', 'base/addon_4594_a9',
|
||||||
'base/addon_3615']
|
'base/addon_3615']
|
||||||
|
|
|
@ -178,7 +178,6 @@ urlpatterns = decorate(write, patterns('',
|
||||||
# Redirect to /addons/ at the base.
|
# Redirect to /addons/ at the base.
|
||||||
url('^addon$', lambda r: redirect('devhub.addons', permanent=True)),
|
url('^addon$', lambda r: redirect('devhub.addons', permanent=True)),
|
||||||
url('^addons$', views.dashboard, name='devhub.addons'),
|
url('^addons$', views.dashboard, name='devhub.addons'),
|
||||||
url('^apps$', use_apps(views.dashboard), name='devhub.apps'),
|
|
||||||
url('^feed$', views.feed, name='devhub.feed_all'),
|
url('^feed$', views.feed, name='devhub.feed_all'),
|
||||||
# TODO: not necessary when devhub homepage is moved out of remora
|
# TODO: not necessary when devhub homepage is moved out of remora
|
||||||
url('^feed/all$', lambda r: redirect('devhub.feed_all', permanent=True)),
|
url('^feed/all$', lambda r: redirect('devhub.feed_all', permanent=True)),
|
||||||
|
|
|
@ -51,12 +51,11 @@ from files.models import File, FileUpload, Platform
|
||||||
from files.utils import parse_addon
|
from files.utils import parse_addon
|
||||||
from market.models import AddonPremium
|
from market.models import AddonPremium
|
||||||
import paypal
|
import paypal
|
||||||
from product_details import product_details
|
|
||||||
from search.views import BaseAjaxSearch
|
from search.views import BaseAjaxSearch
|
||||||
from translations.models import delete_translation
|
from translations.models import delete_translation
|
||||||
from users.models import UserProfile
|
from users.models import UserProfile
|
||||||
from versions.models import Version
|
from versions.models import Version
|
||||||
from webapps.views import AppFilter
|
from product_details import product_details
|
||||||
from zadmin.models import ValidationResult
|
from zadmin.models import ValidationResult
|
||||||
|
|
||||||
from . import forms, tasks, feeds, signals
|
from . import forms, tasks, feeds, signals
|
||||||
|
@ -77,14 +76,10 @@ class AddonFilter(BaseFilter):
|
||||||
('rating', _lazy(u'Rating')))
|
('rating', _lazy(u'Rating')))
|
||||||
|
|
||||||
|
|
||||||
def addon_listing(request, default='name', webapp=False):
|
def addon_listing(request, addon_type, default='name'):
|
||||||
"""Set up the queryset and filtering for addon listing for Dashboard."""
|
"""Set up the queryset and filtering for addon listing for Dashboard."""
|
||||||
Filter = AppFilter if webapp else AddonFilter
|
qs = request.amo_user.addons.all()
|
||||||
if webapp:
|
filter = AddonFilter(request, qs, 'sort', default)
|
||||||
qs = request.amo_user.addons.filter(type=amo.ADDON_WEBAPP)
|
|
||||||
else:
|
|
||||||
qs = request.amo_user.addons.exclude(type=amo.ADDON_WEBAPP)
|
|
||||||
filter = Filter(request, qs, 'sort', default)
|
|
||||||
return filter.qs, filter
|
return filter.qs, filter
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,16 +89,14 @@ def index(request):
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def dashboard(request, webapp=False):
|
def dashboard(request):
|
||||||
addon_type = amo.ADDON_WEBAPP if webapp else amo.ADDON_ANY
|
addons, filter = addon_listing(request, addon_type=amo.ADDON_ANY)
|
||||||
addons, filter = addon_listing(request, webapp=webapp)
|
|
||||||
addons = amo.utils.paginate(request, addons, per_page=10)
|
addons = amo.utils.paginate(request, addons, per_page=10)
|
||||||
blog_posts = _get_posts()
|
blog_posts = _get_posts()
|
||||||
data = dict(addons=addons, sorting=filter.field,
|
data = dict(addons=addons, sorting=filter.field,
|
||||||
items=_get_items(None, request.amo_user.addons.all())[:4],
|
items=_get_items(None, request.amo_user.addons.all())[:4],
|
||||||
sort_opts=filter.opts, rss=_get_rss_feed(request),
|
sort_opts=filter.opts, rss=_get_rss_feed(request),
|
||||||
blog_posts=blog_posts, timestamp=int(time.time()),
|
blog_posts=blog_posts, timestamp=int(time.time()))
|
||||||
webapp=webapp)
|
|
||||||
return jingo.render(request, 'devhub/addons/dashboard.html', data)
|
return jingo.render(request, 'devhub/addons/dashboard.html', data)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ import amo
|
||||||
import amo.models
|
import amo.models
|
||||||
from amo.urlresolvers import reverse
|
from amo.urlresolvers import reverse
|
||||||
from translations.fields import PurifiedField
|
from translations.fields import PurifiedField
|
||||||
from translations.query import order_by_translation
|
|
||||||
|
|
||||||
log = commonware.log.getLogger('z.users')
|
log = commonware.log.getLogger('z.users')
|
||||||
|
|
||||||
|
@ -149,18 +148,6 @@ class UserProfile(amo.models.OnChangeMixin, amo.models.ModelBase):
|
||||||
return self.addons.reviewed().filter(addonuser__user=self,
|
return self.addons.reviewed().filter(addonuser__user=self,
|
||||||
addonuser__listed=True)
|
addonuser__listed=True)
|
||||||
|
|
||||||
def my_addons(self, n=8):
|
|
||||||
"""Returns n addons (anything not a webapp)"""
|
|
||||||
qs = self.addons.exclude(type=amo.ADDON_WEBAPP)
|
|
||||||
qs = order_by_translation(qs, 'name')
|
|
||||||
return qs[:n]
|
|
||||||
|
|
||||||
def my_apps(self, n=8):
|
|
||||||
"""Returns n apps"""
|
|
||||||
qs = self.addons.filter(type=amo.ADDON_WEBAPP)
|
|
||||||
qs = order_by_translation(qs, 'name')
|
|
||||||
return qs[:n]
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def picture_dir(self):
|
def picture_dir(self):
|
||||||
split_id = re.match(r'((\d*?)(\d{0,3}?))\d{1,3}$', str(self.id))
|
split_id = re.match(r'((\d*?)(\d{0,3}?))\d{1,3}$', str(self.id))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import datetime
|
from datetime import date
|
||||||
import hashlib
|
import hashlib
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
|
|
||||||
|
@ -82,11 +82,11 @@ class TestUserProfile(amo.tests.TestCase):
|
||||||
Test for a preview URL if image is set, or default image otherwise.
|
Test for a preview URL if image is set, or default image otherwise.
|
||||||
"""
|
"""
|
||||||
u = UserProfile(id=1234, picture_type='image/png',
|
u = UserProfile(id=1234, picture_type='image/png',
|
||||||
modified=datetime.date.today())
|
modified=date.today())
|
||||||
u.picture_url.index('/userpics/0/1/1234.png?modified=')
|
u.picture_url.index('/userpics/0/1/1234.png?modified=')
|
||||||
|
|
||||||
u = UserProfile(id=1234567890, picture_type='image/png',
|
u = UserProfile(id=1234567890, picture_type='image/png',
|
||||||
modified=datetime.date.today())
|
modified=date.today())
|
||||||
u.picture_url.index('/userpics/1234/1234567/1234567890.png?modified=')
|
u.picture_url.index('/userpics/1234/1234567/1234567890.png?modified=')
|
||||||
|
|
||||||
u = UserProfile(id=1234, picture_type=None)
|
u = UserProfile(id=1234, picture_type=None)
|
||||||
|
@ -130,28 +130,6 @@ class TestUserProfile(amo.tests.TestCase):
|
||||||
addons = u.addons_listed.values_list('id', flat=True)
|
addons = u.addons_listed.values_list('id', flat=True)
|
||||||
assert 3615 not in addons
|
assert 3615 not in addons
|
||||||
|
|
||||||
def test_my_addons(self):
|
|
||||||
"""Test helper method to get N addons."""
|
|
||||||
addon1 = Addon.objects.create(name='test-1', type=amo.ADDON_EXTENSION)
|
|
||||||
AddonUser.objects.create(addon_id=addon1.id, user_id=2519, listed=True)
|
|
||||||
addon2 = Addon.objects.create(name='test-2', type=amo.ADDON_EXTENSION)
|
|
||||||
AddonUser.objects.create(addon_id=addon2.id, user_id=2519, listed=True)
|
|
||||||
u = UserProfile.objects.get(id=2519)
|
|
||||||
addons = u.my_addons()
|
|
||||||
self.assertTrue(sorted([a.name for a in addons]) == [addon1.name,
|
|
||||||
addon2.name])
|
|
||||||
|
|
||||||
def test_my_apps(self):
|
|
||||||
"""Test helper method to get N apps."""
|
|
||||||
addon1 = Addon.objects.create(name='test-1', type=amo.ADDON_WEBAPP)
|
|
||||||
AddonUser.objects.create(addon_id=addon1.id, user_id=2519, listed=True)
|
|
||||||
addon2 = Addon.objects.create(name='test-2', type=amo.ADDON_WEBAPP)
|
|
||||||
AddonUser.objects.create(addon_id=addon2.id, user_id=2519, listed=True)
|
|
||||||
u = UserProfile.objects.get(id=2519)
|
|
||||||
addons = u.my_apps()
|
|
||||||
self.assertTrue(sorted([a.name for a in addons]) == [addon1.name,
|
|
||||||
addon2.name])
|
|
||||||
|
|
||||||
def test_mobile_collection(self):
|
def test_mobile_collection(self):
|
||||||
u = UserProfile.objects.get(id='4043307')
|
u = UserProfile.objects.get(id='4043307')
|
||||||
assert not Collection.objects.filter(author=u)
|
assert not Collection.objects.filter(author=u)
|
||||||
|
|
|
@ -1,135 +0,0 @@
|
||||||
[
|
|
||||||
{
|
|
||||||
"pk": 337141,
|
|
||||||
"model": "addons.addon",
|
|
||||||
"fields": {
|
|
||||||
"dev_agreement": false,
|
|
||||||
"eula": null,
|
|
||||||
"last_updated": "2011-10-18 16:28:24",
|
|
||||||
"view_source": true,
|
|
||||||
"enable_thankyou": false,
|
|
||||||
"total_downloads": 0,
|
|
||||||
"premium_type": 0,
|
|
||||||
"app_slug": "something-something",
|
|
||||||
"developer_comments": null,
|
|
||||||
"_current_version": 1268829,
|
|
||||||
"average_daily_downloads": 0,
|
|
||||||
"_backup_version": null,
|
|
||||||
"manifest_url": "http://micropipes.com/temp/steamcube.webapp",
|
|
||||||
"admin_review_type": 1,
|
|
||||||
"the_future": null,
|
|
||||||
"trusted": false,
|
|
||||||
"total_contributions": null,
|
|
||||||
"locale_disambiguation": null,
|
|
||||||
"binary": false,
|
|
||||||
"guid": null,
|
|
||||||
"weekly_downloads": 0,
|
|
||||||
"support_url": null,
|
|
||||||
"disabled_by_user": false,
|
|
||||||
"paypal_id": "",
|
|
||||||
"average_rating": 0.0,
|
|
||||||
"wants_contributions": false,
|
|
||||||
"average_daily_users": 0,
|
|
||||||
"bayesian_rating": 0.0,
|
|
||||||
"share_count": 0,
|
|
||||||
"ts_slowness": null,
|
|
||||||
"homepage": null,
|
|
||||||
"support_email": null,
|
|
||||||
"public_stats": false,
|
|
||||||
"status": 4,
|
|
||||||
"privacy_policy": null,
|
|
||||||
"description": null,
|
|
||||||
"default_locale": "en-US",
|
|
||||||
"target_locale": null,
|
|
||||||
"suggested_amount": null,
|
|
||||||
"get_satisfaction_product": null,
|
|
||||||
"prerelease": false,
|
|
||||||
"thankyou_note": null,
|
|
||||||
"admin_review": false,
|
|
||||||
"auto_repackage": true,
|
|
||||||
"slug": "app-337141",
|
|
||||||
"external_software": false,
|
|
||||||
"highest_status": 4,
|
|
||||||
"get_satisfaction_company": null,
|
|
||||||
"name": null,
|
|
||||||
"created": "2011-10-18 16:28:24",
|
|
||||||
"type": 11,
|
|
||||||
"icon_type": "icon/games",
|
|
||||||
"annoying": 0,
|
|
||||||
"modified": "2011-10-18 16:29:46",
|
|
||||||
"summary": null,
|
|
||||||
"nomination_message": null,
|
|
||||||
"site_specific": false,
|
|
||||||
"charity": null,
|
|
||||||
"total_reviews": 0,
|
|
||||||
"the_reason": null,
|
|
||||||
"hotness": 0.0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pk": 1268829,
|
|
||||||
"model": "versions.version",
|
|
||||||
"fields": {
|
|
||||||
"has_info_request": false,
|
|
||||||
"license": null,
|
|
||||||
"created": "2011-10-18 16:28:24",
|
|
||||||
"has_editor_comment": false,
|
|
||||||
"releasenotes": null,
|
|
||||||
"approvalnotes": "",
|
|
||||||
"modified": "2011-10-18 16:28:24",
|
|
||||||
"version": "1.0",
|
|
||||||
"version_int": 1000000200100,
|
|
||||||
"reviewed": null,
|
|
||||||
"nomination": null,
|
|
||||||
"addon": 337141
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pk": 2527085,
|
|
||||||
"model": "translations.translation",
|
|
||||||
"fields": {
|
|
||||||
"localized_string_clean": null,
|
|
||||||
"created": "2011-10-18 16:28:24",
|
|
||||||
"locale": "en-us",
|
|
||||||
"modified": "2011-10-18 16:28:57",
|
|
||||||
"id": 2425897,
|
|
||||||
"localized_string": "Something Something!"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pk": 2527086,
|
|
||||||
"model": "translations.translation",
|
|
||||||
"fields": {
|
|
||||||
"localized_string_clean": "A simple 2.5D brain teaser block puzzle game. Find out how far can you get before time runs out?",
|
|
||||||
"created": "2011-10-18 16:28:24",
|
|
||||||
"locale": "en-US",
|
|
||||||
"modified": "2011-10-18 16:28:57",
|
|
||||||
"id": 2425898,
|
|
||||||
"localized_string": "A simple 2.5D brain teaser block puzzle game. Find out how far can you get before time runs out?"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pk": 2527087,
|
|
||||||
"model": "translations.translation",
|
|
||||||
"fields": {
|
|
||||||
"localized_string_clean": "",
|
|
||||||
"created": "2011-10-18 16:28:57",
|
|
||||||
"locale": "en-us",
|
|
||||||
"modified": "2011-10-18 16:28:57",
|
|
||||||
"id": 2425899,
|
|
||||||
"localized_string": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pk": 2425898,
|
|
||||||
"model": "translations.translation",
|
|
||||||
"fields": {
|
|
||||||
"localized_string_clean": "",
|
|
||||||
"created": "2011-07-26 14:16:26",
|
|
||||||
"locale": "en-us",
|
|
||||||
"modified": "2011-07-26 14:16:26",
|
|
||||||
"id": 2326782,
|
|
||||||
"localized_string": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -325,6 +325,3 @@
|
||||||
margin: .5em 0 .25em;
|
margin: .5em 0 .25em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#dashboard .island {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
@import 'lib';
|
|
||||||
|
|
||||||
.listing .item {
|
|
||||||
.item-info {
|
|
||||||
border-left: 1px dotted @border-blue;
|
|
||||||
float: right;
|
|
||||||
margin-left: 2%;
|
|
||||||
padding-left: 2%;
|
|
||||||
width: 15em;
|
|
||||||
}
|
|
||||||
.item-info > .downloads,
|
|
||||||
.item-info > .users {
|
|
||||||
color: @green;
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
.item-actions {
|
|
||||||
float: none;
|
|
||||||
a {
|
|
||||||
color: @note-gray;
|
|
||||||
&.more-actions {
|
|
||||||
display: block;
|
|
||||||
position: relative;
|
|
||||||
&:after {
|
|
||||||
border-color: @note-gray transparent transparent;
|
|
||||||
border-style: solid;
|
|
||||||
border-width: 3px 3px 0;
|
|
||||||
content: "";
|
|
||||||
margin: 5px 0 0 4px;
|
|
||||||
position: absolute;
|
|
||||||
height: 0;
|
|
||||||
top: 0;
|
|
||||||
width: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
h5 {
|
|
||||||
font-size: 1em;
|
|
||||||
margin-right: 4px;
|
|
||||||
}
|
|
||||||
h5, > ul, > ul > li {
|
|
||||||
color: @note-gray;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
h5:after {
|
|
||||||
content: ":";
|
|
||||||
}
|
|
||||||
> ul > li {
|
|
||||||
display: inline-block;
|
|
||||||
&:not(:last-child):after {
|
|
||||||
background-color: @note-gray;
|
|
||||||
border-radius: 5em 5em 5em 5em;
|
|
||||||
content: "";
|
|
||||||
display: inline-block;
|
|
||||||
height: 2px;
|
|
||||||
margin: 0 0 4px 1px;
|
|
||||||
width: 2px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&:hover {
|
|
||||||
a {
|
|
||||||
color: @link;
|
|
||||||
}
|
|
||||||
h5 {
|
|
||||||
color: @dark-gray;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.secondary .recent-activity li a {
|
|
||||||
display: inline;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
|
@ -199,9 +199,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&:first-child .info {
|
|
||||||
border: 0;
|
|
||||||
}
|
|
||||||
h3 {
|
h3 {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -314,7 +311,6 @@
|
||||||
.items + .paginator,
|
.items + .paginator,
|
||||||
#sorter + .paginator,
|
#sorter + .paginator,
|
||||||
#sorter + .listing-grid,
|
#sorter + .listing-grid,
|
||||||
#sorter + .items,
|
|
||||||
#themes-listing .items {
|
#themes-listing .items {
|
||||||
border-top: 1px dotted @border-blue;
|
border-top: 1px dotted @border-blue;
|
||||||
padding-top: 1em;
|
padding-top: 1em;
|
||||||
|
|
|
@ -21,7 +21,6 @@ body {
|
||||||
.bump {
|
.bump {
|
||||||
min-height: 123px;
|
min-height: 123px;
|
||||||
}
|
}
|
||||||
header h2,
|
|
||||||
> header h3 {
|
> header h3 {
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -507,7 +507,6 @@ MINIFY_BUNDLES = {
|
||||||
),
|
),
|
||||||
'zamboni/devhub_impala': (
|
'zamboni/devhub_impala': (
|
||||||
'css/impala/developers.less',
|
'css/impala/developers.less',
|
||||||
'css/impala/devhub-listing.less',
|
|
||||||
),
|
),
|
||||||
'zamboni/editors': (
|
'zamboni/editors': (
|
||||||
'css/zamboni/editors.css',
|
'css/zamboni/editors.css',
|
||||||
|
|
Загрузка…
Ссылка в новой задаче