add more snazz to login roadblock for developers (bug 792204)

This commit is contained in:
Chris Van 2012-09-19 15:08:07 -07:00
Родитель 8fff345aa0
Коммит a14734dec2
17 изменённых файлов: 137 добавлений и 51 удалений

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

@ -167,3 +167,25 @@
text-align: right;
padding-right: 120px;
}
.overlay#login {
font-family: @open-stack;
a {
display: inline;
&.button {
display: inline-block;
padding: 10px 15px;
}
}
h2 {
color: @teal;
font-weight: 600;
text-align: center;
}
p {
color: @medium-gray;
}
footer {
margin-top: 5px;
}
}

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

@ -34,11 +34,18 @@
margin-bottom: 24px;
}
h1 {
font-size: 32px;
line-height: 34px;
font-size: 24px;
line-height: 26px;
margin-top: 30px;
}
.prose {
overflow: hidden;
}
.still-open a {
display: block;
font-weight: bold;
}
#welcome {
margin-top: 20px;
min-height: 210px;
position: relative;
&:before {
@ -57,7 +64,6 @@
width: 40%;
z-index: 1;
.proceed {
margin: 0;
}
.forgot {
margin: 5px 0 0;
@ -207,7 +213,6 @@
}
#welcome {
min-height: 230px;
// margin: 0 10px;
padding: 0 15px;
&:before {
content: none;

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

@ -60,7 +60,6 @@
footer {
margin-top: 10px;
backround-color: #ccc;
.grain;
width: 100%;
display: block;
button {
@ -69,6 +68,18 @@
}
}
}
form {
margin: 0;
}
h2, .char-count {
margin-bottom: 10px;
}
.req-error {
float: left;
font-size: 13px;
line-height: 18px;
margin-top: 5px;
}
}
@media (max-width: @4col) {

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

@ -142,21 +142,6 @@ section.replies .review.reply {
}
}
.overlay {
form {
margin: 0;
}
h2, .char-count {
margin-bottom: 10px;
}
.req-error {
float: left;
font-size: 13px;
line-height: 18px;
margin-top: 5px;
}
}
header.product {
margin-bottom: 15px;
position: relative;

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

@ -13,6 +13,11 @@
display: none;
}
.emaillink-wrapper {
/* Necessary when emaillink is in a paragraph. */
display: inline-block;
}
span.emaillink {
direction: rtl;
unicode-bidi: bidi-override;

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

@ -12,6 +12,12 @@ var z = {
canInstallApps: true,
};
var data_user = $('body').data('user');
_.extend(z, {
anonymous: data_user.anonymous,
pre_auth: data_user.pre_auth
});
(function() {
_.extend(z, {'nav': BrowserUtils()});
if (!z.nav.browser.firefox || z.nav.browser.mobile ||

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

@ -41,6 +41,17 @@
$(document).ready(function() {
// Anonymous users can view the Developer Agreement page,
// and then we prompt for log in.
if (z.anonymous && $('#submit-terms').length) {
var $login = $('#login');
$login.addClass('show');
$('form').on('click', 'button', _pd(function() {
$login.addClass('show');
}));
}
// Icon previews.
imageStatus.start(true, false);
$('#submit-media').bind('click', function() {

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

@ -61,6 +61,7 @@ CSS = {
# Developer Log In / Registration.
'css/devreg/login.less',
'css/mkt/login.less',
# Footer.
'css/devreg/footer.less',
@ -195,7 +196,7 @@ JS = {
# New stuff.
'js/devreg/devhub.js',
'js/devreg/submit-details.js',
'js/devreg/submit.js',
'js/devreg/edit.js',
# Specific stuff for making payments nicer.

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

@ -17,14 +17,18 @@
<section id="welcome">
<div>
<div class="prose">
<h1>Mozillian Preview</h1>
<h1>Check back soon!</h1>
<p>
Our doors are now open for invited Mozillians to help test an early
preview of the Marketplace. We'll open for wider testing in just a
few months.
The Marketplace is currently only available to invited Mozillians.
If you're an active Mozilla contributor and would like access, please
send your vouched
<a href="https://mozillians.org/" target="_blank">mozillians.org</a>
profile link to <span class="emaillink-wrapper">{{ emaillink('marketplace-testing@mozilla.org') }}</span>.
</p>
<p>
If you've received an invitation, please log in below.
<h1>Have an app to submit?</h1>
<p class="still-open">
The Marketplace Developers site is still open.
<a href="{{ url('ecosystem.landing') }}">Upload your app &raquo;</a>
</p>
</div>
<p class="proceed">

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

@ -136,6 +136,18 @@
{% if not logged %}
<div id="login" class="overlay">
<section>
<div class="new">
<h2>{{ _('Please sign in') }}</h2>
<p>
{% trans url='https://persona.org/' %}
Just log in or register with your
<a href="{{ url }}">Persona</a> account below.
{% endtrans %}
</p>
<footer>
<a class="button browserid" href="#">{{ _('Log in / Register') }}</a>
</footer>
</div>
<div class="old">
<h2>Additional authorization required</h2>
<form method="post" action="{{ get_login_link() }}"

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

@ -35,16 +35,9 @@
{% else %}
<li class="account anonymous nomenu login{{ ' legacy' if not waffle.switch('browserid-login') }}">
{% if waffle.switch('browserid-login') %}
<a contextmenu="login" href="{{ login_link() }}"
class="browserid-login browserid"
<a href="{{ login_link() }}" class="browserid-login browserid"
data-url="{{ url('users.browserid_login') }}">
{{ _('Log in / Register') }}</a>
<menu type="context" id="login">
<menuitem data-url="{{ login_link() }}#open"
label="{{ _('Admin / Editor Log in') }}"
id="admin-login"></menuitem>
</menu>
{% else %}
{% trans reg=url('users.register'), login=login_link() %}
<a href="{{ reg }}">Register</a> or <a href="{{ login }}">Log in</a>

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

@ -13,13 +13,7 @@
{% endtrans -%}
</p>
<div class="button-wrapper">
{%- if request.user.is_authenticated() %}
<a href="{{ url('submit.app') }}" class="button prominent">
{% else %}
<a href="{{ get_login_link(url('submit.app')) }}"
class="button prominent browserid">
{%- endif -%}
{{ _('Submit an App') }}</a>
<a href="{{ url('submit.app') }}" class="button prominent">{{ _('Submit an App') }}</a>
</div>
</div>
<div class="panel">

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

@ -12,9 +12,9 @@
profile link to <a href="mailto:marketplace-testing@mozilla.org">marketplace-testing@mozilla.org</a>.
</p>
<h1>Have an app to submit?</h1>
<p id="access-devhub">
<p id="access-devhub" class="still-open">
The Marketplace Developers site is still open.
<a href="{{ url('submit.app') }}">Upload your app &raquo;</a>
<a href="{{ url('ecosystem.landing') }}">Upload your app &raquo;</a>
</p>
</div>
</section>

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

@ -72,6 +72,27 @@ class TestSubmit(amo.tests.TestCase):
unicode(mkt.APP_STEPS_TITLE[current]))
class TestProceed(TestSubmit):
fixtures = ['base/users']
def setUp(self):
super(TestProceed, self).setUp()
self.user.update(read_dev_agreement=None)
self.url = reverse('submit.app')
def test_is_authenticated(self):
# Redirect user to Terms.
r = self.client.get(self.url)
self.assert3xx(r, reverse('submit.app.terms'))
def test_is_anonymous(self):
# Show user to Terms page but with the login prompt.
self.client.logout()
r = self.client.get(self.url)
eq_(r.status_code, 200)
eq_(r.context['proceed'], True)
class TestTerms(TestSubmit):
fixtures = ['base/users']

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

@ -20,6 +20,7 @@ submit_apps_patterns = patterns('',
urlpatterns = decorate(write, patterns('',
# App submission.
url('^$', views.submit, name='submit.app'),
url('^proceed$', views.proceed, name='submit.app.proceed'),
url('^terms$', views.terms, name='submit.app.terms'),
url('^choose$', views.choose, name='submit.app.choose'),
url('^manifest$', views.manifest, name='submit.app.manifest'),

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

@ -28,9 +28,10 @@ from .decorators import read_dev_agreement_required, submit_step
log = commonware.log.getLogger('z.submit')
@login_required
def submit(request):
"""Determine which step to redirect user to."""
if not request.user.is_authenticated():
return proceed(request)
# If dev has already agreed, continue to next step.
user = UserProfile.objects.get(pk=request.user.id)
if user.read_dev_agreement:
@ -41,11 +42,28 @@ def submit(request):
return redirect('submit.app.terms')
def proceed(request):
"""
This is a fake "Terms" view that we overlay the login.
We link here from the Developer Hub landing page.
"""
if request.user.is_authenticated():
return submit(request)
agreement_form = forms.DevAgreementForm({'read_dev_agreement': True},
instance=None)
return jingo.render(request, 'submit/terms.html', {
'step': 'terms',
'agreement_form': agreement_form,
'proceed': True,
})
@login_required
@submit_step('terms')
def terms(request):
# If dev has already agreed, continue to next step.
if request.amo_user.read_dev_agreement:
if (getattr(request, 'amo_user', None) and
request.amo_user.read_dev_agreement):
if waffle.switch_is_active('allow-packaged-app-uploads'):
return redirect('submit.app.choose')
return redirect('submit.app.manifest')

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

@ -18,13 +18,10 @@
{% else %}
<li class="account anonymous nomenu login{{ ' legacy' if not waffle.switch('browserid-login') }}">
{% if waffle.switch('browserid-login') %}
<a contextmenu="login" href="{{ login_link() }}" class="browserid-login browserid"
<a href="{{ login_link() }}" class="browserid-login browserid"
data-url="{{ url('users.browserid_login') }}">
{{ _('Log in / Register') }}</a>
<menu type="context" id="login">
<menuitem data-url="{{ login_link() }}#open" label="{{ _('Admin / Editor Log in') }}" id="admin-login"></menuitem>
</menu>
{% else %}
{% trans reg=url('users.register'), login=login_link() %}
<a href="{{ reg }}">Register</a> or <a href="{{ login }}">Log in</a>