get rid of pretty apps devhub landing page (bug 705976)
This commit is contained in:
Родитель
f99685e975
Коммит
31889c3ac1
|
@ -75,7 +75,7 @@ def global_settings(request):
|
|||
'href': reverse('devhub.submit.1')})
|
||||
|
||||
if waffle.flag_is_active(request, 'accept-webapps'):
|
||||
if request.amo_user.is_developer:
|
||||
if settings.APP_PREVIEW or request.amo_user.is_developer:
|
||||
tools_links.append({'text': _('Manage My Apps'),
|
||||
'href': reverse('devhub.apps')})
|
||||
tools_links.append({'text': _('Submit a New App'),
|
||||
|
@ -86,8 +86,9 @@ def global_settings(request):
|
|||
tools_links.append({'text': 'Submit a New Persona',
|
||||
'href': reverse('devhub.personas.submit')})
|
||||
|
||||
tools_links.append({'text': _('Developer Hub'),
|
||||
'href': reverse('devhub.index')})
|
||||
if not settings.APP_PREVIEW:
|
||||
tools_links.append({'text': _('Developer Hub'),
|
||||
'href': reverse('devhub.index')})
|
||||
|
||||
if acl.action_allowed(request, 'Editors', '%'):
|
||||
tools_links.append({'text': _('Editor Tools'),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% if breadcrumbs %}
|
||||
<ol class="breadcrumbs">
|
||||
<ol id="breadcrumbs" class="breadcrumbs">
|
||||
{% for target, label in breadcrumbs %}
|
||||
{% if target %}
|
||||
<li><a href="{{ target }}">{{ label }}</a></li>
|
||||
|
|
|
@ -84,11 +84,16 @@ def check_links(expected, elements, verify=True):
|
|||
"""
|
||||
for idx, element in enumerate(elements):
|
||||
e = pq(element)
|
||||
text, href = expected[idx]
|
||||
eq_(e.text(), text)
|
||||
eq_(e.attr('href'), href)
|
||||
if verify and href != '#':
|
||||
eq_(Client().head(href, follow=True).status_code, 200)
|
||||
text, link = expected[idx]
|
||||
if text is not None:
|
||||
eq_(e.text(), text)
|
||||
if link is not None:
|
||||
# If we passed an <li>, try to find an <a>.
|
||||
if not e.filter('a'):
|
||||
e = e.find('a')
|
||||
eq_(e.attr('href'), link)
|
||||
if verify and link != '#':
|
||||
eq_(Client().head(link, follow=True).status_code, 200)
|
||||
|
||||
|
||||
class RedisTest(object):
|
||||
|
|
|
@ -62,12 +62,12 @@ def dev_breadcrumbs(context, addon=None, items=None, add_default=False,
|
|||
**impala**
|
||||
Whether to use the impala_breadcrumbs helper. Default is False.
|
||||
"""
|
||||
crumbs = [(reverse('devhub.index'), _('Developer Hub'))]
|
||||
|
||||
if context.get('webapp'):
|
||||
crumbs = []
|
||||
title = _('My Apps')
|
||||
link = reverse('devhub.apps')
|
||||
else:
|
||||
crumbs = [(reverse('devhub.index'), _('Developer Hub'))]
|
||||
title = _('My Add-ons')
|
||||
link = reverse('devhub.addons')
|
||||
|
||||
|
@ -85,6 +85,10 @@ def dev_breadcrumbs(context, addon=None, items=None, add_default=False,
|
|||
crumbs.append((url, addon.name))
|
||||
if items:
|
||||
crumbs.extend(items)
|
||||
|
||||
if len(crumbs) == 1:
|
||||
crumbs = []
|
||||
|
||||
if impala:
|
||||
return impala_breadcrumbs(context, crumbs, add_default)
|
||||
else:
|
||||
|
|
|
@ -1,5 +1,21 @@
|
|||
{% extends "devhub/base_impala.html" %}
|
||||
|
||||
{% macro docs_ul(docs) %}
|
||||
<ul class="listing-list">
|
||||
{% for icon, link, heading, desc in docs %}
|
||||
<li class="devhub-icon-{{ icon }}">
|
||||
<a href="{{ link }}">
|
||||
<div class="icon"></div>
|
||||
<div class="summary">
|
||||
<h3>{{ heading }}</h3>
|
||||
<p class="desc">{{ desc }}</p>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endmacro %}
|
||||
|
||||
{% block content %}
|
||||
<section class="secondary devhub-sidebar">
|
||||
<div class="item">
|
||||
|
|
|
@ -1,156 +0,0 @@
|
|||
{% extends 'devhub/base_impala.html' %}
|
||||
|
||||
{% macro docs_ul(docs) %}
|
||||
<ul class="listing-list">
|
||||
{% for icon, link, heading, desc in docs %}
|
||||
<li class="devhub-icon-{{ icon }}">
|
||||
<a href="{{ link }}">
|
||||
<div class="icon"></div>
|
||||
<div class="summary">
|
||||
<h3>{{ heading }}</h3>
|
||||
<p class="desc">{{ desc }}</p>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endmacro %}
|
||||
|
||||
{% block content %}
|
||||
<section id="homepage" class="primary full">
|
||||
<div id="apps-promo" class="island">
|
||||
<h2>{{ loc('What Are Apps?') }}</h2>
|
||||
<p class="intro">
|
||||
{{ loc('Apps are websites that users can install and run from
|
||||
Web-enabled devices. They are built using standard Web
|
||||
technologies with additional metadata that allows the User
|
||||
Agent to discover, install, launch, and grant them additional
|
||||
privileges.') }}
|
||||
</p>
|
||||
<p><a href="{{ url('devhub.submit_apps.1') }}" class="button prominent">
|
||||
{{ loc('Submit an App') }}</a></p>
|
||||
</div>
|
||||
|
||||
<div class="cols">
|
||||
<div class="col-3">
|
||||
<div class="island">
|
||||
<h2>{{ loc('Creating Apps') }}</h2>
|
||||
{# TODO(cvan): I'll change the URLs when the MDN locale redirects are fixed (bug 702479). #}
|
||||
{%
|
||||
|
||||
set docs = (
|
||||
('docs',
|
||||
'https://developer.mozilla.org/en/Apps/Getting_Started',
|
||||
loc('Getting Started'),
|
||||
loc('This walk-through can quickly give you an understanding of what it
|
||||
takes to turn an ordinary site into an app.'),
|
||||
),
|
||||
('docs',
|
||||
'https://developer.mozilla.org/en/Apps/For_mobile_app_developers',
|
||||
loc('For Mobile App Developers'),
|
||||
loc("If you already develop mobile applications, here's how to make
|
||||
Web-based apps."),
|
||||
),
|
||||
('docs',
|
||||
'https://developer.mozilla.org/en/Apps/For_Web_developers',
|
||||
loc('For Web Developers'),
|
||||
loc("If you already develop Web sites or applications, here's how to make
|
||||
them into installable apps."),
|
||||
),
|
||||
('docs',
|
||||
'https://developer.mozilla.org/en/Apps/Platform-specific_details',
|
||||
loc('App Installation'),
|
||||
loc("Platform-specific notes about how apps are installed and run on the
|
||||
user's device or system."),
|
||||
),
|
||||
('docs',
|
||||
'https://developer.mozilla.org/en/Apps/Using_apps_offline',
|
||||
loc('Using Apps Offline'),
|
||||
loc('How to design apps so that they can be cached and used without an
|
||||
Internet connection.'),
|
||||
),
|
||||
)
|
||||
|
||||
%}
|
||||
{{ docs_ul(docs) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="island">
|
||||
<h2>{{ loc('Create & Connect')|safe }}</h2>
|
||||
{%
|
||||
|
||||
set docs = (
|
||||
('discuss',
|
||||
'irc://irc.mozilla.org#openwebapps',
|
||||
loc('IRC Channel: #openwebapps on irc.mozilla.org'),
|
||||
loc('Discuss development, brainstorm ideas, and make connections
|
||||
in the world of apps.'),
|
||||
),
|
||||
('discuss',
|
||||
'https://developer.mozilla.org/en/Apps/FAQs',
|
||||
loc('Frequently Asked Questions'),
|
||||
loc('What is the difference between an app and a website? How can I
|
||||
promote my app? How will I get paid? Such questions are answered in
|
||||
the FAQ.'),
|
||||
),
|
||||
('tools',
|
||||
'https://developer.mozilla.org/en/Apps#section_3',
|
||||
loc('Reference Information'),
|
||||
loc('Learn about the structure and content of the app manifest,
|
||||
the app start-up library, device APIs (geolocation,
|
||||
orientation, camera), and apps JavaScript API.'),
|
||||
),
|
||||
)
|
||||
|
||||
%}
|
||||
{{ docs_ul(docs) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="island">
|
||||
<h2>{{ loc('Firefox Marketplace') }}</h2>
|
||||
{%
|
||||
|
||||
set docs = (
|
||||
('docs',
|
||||
'https://developer.mozilla.org/en/Apps/Submitting_an_app',
|
||||
loc('Submitting an App'),
|
||||
loc('Step-by-step instructions, including setting a price and setting up a
|
||||
PayPal refund token.'),
|
||||
),
|
||||
('docs',
|
||||
'https://developer.mozilla.org/en/Apps/Giving_refunds',
|
||||
loc('Giving Refunds'),
|
||||
loc('Keeping both your customers and PayPal happy.'),
|
||||
),
|
||||
)
|
||||
|
||||
%}
|
||||
{{ docs_ul(docs) }}
|
||||
</div>
|
||||
<div class="island">
|
||||
<h2>{{ loc('Game Apps') }}</h2>
|
||||
{%
|
||||
|
||||
set docs = (
|
||||
('docs',
|
||||
'https://developer.mozilla.org/en/Apps/Developing_game_apps',
|
||||
loc('Developing Game Apps'),
|
||||
loc('Considerations for game apps, such as identity, multi-player, offline
|
||||
use, and purchases.'),
|
||||
),
|
||||
('docs',
|
||||
'https://developer.mozilla.org/en/Apps/Game_engines_and_libraries',
|
||||
loc('Game Engines and Libraries'),
|
||||
loc('Engines and libraries that are useful for developing game apps.'),
|
||||
),
|
||||
)
|
||||
|
||||
%}
|
||||
{{ docs_ul(docs) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
|
@ -55,7 +55,7 @@
|
|||
{% endif %}
|
||||
{% if webapp %}
|
||||
<li class="slim">
|
||||
<a href="http://developer.mozilla.org/apps" class="controller">
|
||||
<a href="http://developer.mozilla.org/en/apps" class="controller">
|
||||
{{ _('Documentation') }}</a>
|
||||
</li>
|
||||
{% else %}
|
||||
|
|
|
@ -82,6 +82,46 @@ class HubTest(amo.tests.TestCase):
|
|||
return ids
|
||||
|
||||
|
||||
class TestHome(HubTest):
|
||||
|
||||
def test_addons(self):
|
||||
r = self.client.get(self.url)
|
||||
eq_(r.status_code, 200)
|
||||
self.assertTemplateUsed(r, 'devhub/index.html')
|
||||
|
||||
@mock.patch.object(settings, 'APP_PREVIEW', True)
|
||||
def test_apps(self):
|
||||
waffle.models.Flag.objects.create(name='accept-webapps', everyone=True)
|
||||
r = self.client.get(self.url, follow=True)
|
||||
self.assertRedirects(r, reverse('devhub.apps'), 302)
|
||||
self.assertTemplateUsed(r, 'devhub/addons/dashboard.html')
|
||||
|
||||
|
||||
class TestBreadcrumbs(HubTest):
|
||||
|
||||
def setUp(self):
|
||||
super(TestBreadcrumbs, self).setUp()
|
||||
waffle.models.Flag.objects.create(name='accept-webapps', everyone=True)
|
||||
|
||||
@mock.patch.object(settings, 'APP_PREVIEW', True)
|
||||
def test_impala_breadcrumbs(self):
|
||||
r = self.client.get(reverse('devhub.apps'))
|
||||
eq_(r.status_code, 200)
|
||||
eq_(pq(r.content)('#breadcrumbs').length, 0)
|
||||
|
||||
@mock.patch.object(settings, 'APP_PREVIEW', True)
|
||||
def test_legacy_breadcrumbs(self):
|
||||
webapp = Webapp.objects.get(id=337141)
|
||||
AddonUser.objects.create(user=self.user_profile, addon=webapp)
|
||||
r = self.client.get(webapp.get_dev_url('edit'))
|
||||
eq_(r.status_code, 200)
|
||||
expected = [
|
||||
('My Apps', reverse('devhub.apps')),
|
||||
(unicode(webapp.name), None),
|
||||
]
|
||||
amo.tests.check_links(expected, pq(r.content)('#breadcrumbs li'))
|
||||
|
||||
|
||||
class TestNav(HubTest):
|
||||
|
||||
def test_navbar(self):
|
||||
|
@ -1312,10 +1352,8 @@ class TestActivityFeed(amo.tests.TestCase):
|
|||
r = self.client.get(reverse('devhub.feed_all'))
|
||||
eq_(r.status_code, 200)
|
||||
doc = pq(r.content)
|
||||
eq_(doc('header h2').text(),
|
||||
'Recent Activity for My Add-ons')
|
||||
eq_(doc('.breadcrumbs li:eq(2)').text(),
|
||||
'Recent Activity')
|
||||
eq_(doc('header h2').text(), 'Recent Activity for My Add-ons')
|
||||
eq_(doc('#breadcrumbs li:eq(2)').text(), 'Recent Activity')
|
||||
|
||||
def test_feed_for_addon(self):
|
||||
addon = Addon.objects.no_cache().get(id=3615)
|
||||
|
@ -1324,7 +1362,7 @@ class TestActivityFeed(amo.tests.TestCase):
|
|||
doc = pq(r.content)
|
||||
eq_(doc('header h2').text(),
|
||||
'Recent Activity for %s' % addon.name)
|
||||
eq_(doc('.breadcrumbs li:eq(3)').text(),
|
||||
eq_(doc('#breadcrumbs li:eq(3)').text(),
|
||||
addon.slug)
|
||||
|
||||
def test_feed_disabled(self):
|
||||
|
@ -1562,7 +1600,7 @@ class TestSubmitStep1(TestSubmitBase):
|
|||
response = self.client.get(reverse('devhub.submit.1'))
|
||||
eq_(response.status_code, 200)
|
||||
doc = pq(response.content)
|
||||
eq_(doc('.breadcrumbs li a').eq(1).attr('href'),
|
||||
eq_(doc('#breadcrumbs li a').eq(1).attr('href'),
|
||||
reverse('devhub.addons'))
|
||||
links = doc('#agreement-container a')
|
||||
assert len(links)
|
||||
|
@ -1579,7 +1617,7 @@ class TestSubmitStep1(TestSubmitBase):
|
|||
response = self.client.get(reverse('devhub.submit_apps.1'))
|
||||
eq_(response.status_code, 200)
|
||||
doc = pq(response.content)
|
||||
eq_(doc('.breadcrumbs li a').eq(1).attr('href'),
|
||||
eq_(doc('#breadcrumbs li a').eq(1).attr('href'),
|
||||
reverse('devhub.apps'))
|
||||
links = doc('#agreement-container a')
|
||||
assert len(links)
|
||||
|
@ -3113,7 +3151,6 @@ class BaseWebAppTest(BaseUploadTest, UploadAddon, amo.tests.TestCase):
|
|||
|
||||
class TestCreateWebApp(BaseWebAppTest):
|
||||
|
||||
@mock.patch.object(settings, 'APP_PREVIEW', False)
|
||||
def test_page_title(self):
|
||||
eq_(pq(self.client.get(self.url).content)('title').text(),
|
||||
'Step 2 :: Developer Hub :: Apps Marketplace')
|
||||
|
|
|
@ -118,12 +118,13 @@ class TestFileValidation(amo.tests.TestCase):
|
|||
|
||||
@mock.patch.object(settings, 'APP_PREVIEW', True)
|
||||
def test_app_results_page(self):
|
||||
waffle.models.Flag.objects.create(name='accept-webapps', everyone=True)
|
||||
r = self.client.get(self.url, follow=True)
|
||||
eq_(r.status_code, 200)
|
||||
eq_(r.context['addon'], self.addon)
|
||||
doc = pq(r.content)
|
||||
assert doc('#site-nav').hasClass('app-nav'), 'Expected apps devhub nav'
|
||||
eq_(doc('.breadcrumbs a').eq(1).attr('href'), reverse('devhub.apps'))
|
||||
eq_(doc('#breadcrumbs a').eq(0).attr('href'), reverse('devhub.apps'))
|
||||
|
||||
def test_only_dev_can_see_results(self):
|
||||
self.client.logout()
|
||||
|
|
|
@ -93,14 +93,11 @@ def addon_listing(request, default='name', webapp=False):
|
|||
|
||||
|
||||
def index(request):
|
||||
webapp = settings.APP_PREVIEW
|
||||
ctx = {}
|
||||
if webapp:
|
||||
ctx.update(webapp=webapp)
|
||||
else:
|
||||
ctx.update(blog_posts=_get_posts())
|
||||
template = 'devhub/index%s.html' % ('_apps' if webapp else '')
|
||||
return jingo.render(request, template, ctx)
|
||||
if settings.APP_PREVIEW:
|
||||
# This can be a permanent redirect when we finalize devhub for apps.
|
||||
return redirect('devhub.apps')
|
||||
return jingo.render(request, 'devhub/index.html',
|
||||
{'blog_posts': _get_posts()})
|
||||
|
||||
|
||||
@login_required
|
||||
|
|
|
@ -581,7 +581,7 @@ class TestLogin(UserViewBase):
|
|||
audience='fakeamo.org'))
|
||||
eq_(res.status_code, 401)
|
||||
_m = ('Sorry, no more registrations are allowed. '
|
||||
'<a href="https://developer.mozilla.org/apps">Learn more</a>')
|
||||
'<a href="https://developer.mozilla.org/en/apps">Learn more</a>')
|
||||
eq_(res.content, _m)
|
||||
|
||||
profile_count = UserProfile.objects.count()
|
||||
|
|
|
@ -295,7 +295,7 @@ def browserid_authenticate(request, assertion):
|
|||
if (settings.REGISTER_USER_LIMIT and
|
||||
UserProfile.objects.count() > settings.REGISTER_USER_LIMIT):
|
||||
_m = ('Sorry, no more registrations are allowed. '
|
||||
'<a href="https://developer.mozilla.org/apps">Learn more</a>')
|
||||
'<a href="https://developer.mozilla.org/en/apps">Learn more</a>')
|
||||
return (None, _m)
|
||||
profile = UserProfile.objects.create(username=username, email=email)
|
||||
profile.create_django_user()
|
||||
|
@ -509,7 +509,7 @@ def register(request):
|
|||
elif (settings.REGISTER_USER_LIMIT and
|
||||
UserProfile.objects.count() > settings.REGISTER_USER_LIMIT):
|
||||
_m = ('Sorry, no more registrations are allowed. '
|
||||
'<a href="https://developer.mozilla.org/apps">Learn more</a>')
|
||||
'<a href="https://developer.mozilla.org/en/apps">Learn more</a>')
|
||||
messages.error(request, _m)
|
||||
form = None
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
{% endif %}
|
||||
|
||||
{% if user.is_authenticated() %}
|
||||
{% if tools_links and tools_links|count > 1 %}
|
||||
{% if tools_links|count > 1 %}
|
||||
<li class="tools">
|
||||
<a href="#">{{ tools_title }}</a>
|
||||
<ul>
|
||||
|
@ -44,7 +44,7 @@
|
|||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
{% else %}
|
||||
{% elif tools_links %}
|
||||
<li class="context tools nomenu">
|
||||
<a href="{{ tools_links[0].href }}">{{ tools_links[0].text }}</a>
|
||||
</li>
|
||||
|
|
Загрузка…
Ссылка в новой задаче