From 046f2a2e0406651f7d8082cd7d389fd204c2ae91 Mon Sep 17 00:00:00 2001 From: Chris Van Date: Wed, 14 Nov 2012 17:38:08 -0800 Subject: [PATCH] add an option to delay publishing to submission flow (bug 810009) --- apps/amo/helpers.py | 3 +-- mkt/site/helpers.py | 4 +-- .../templates/site/helpers/simple_field.html | 9 +++---- mkt/submit/forms.py | 8 ++++++ mkt/submit/templates/submit/details.html | 3 +++ mkt/submit/templates/submit/done.html | 18 ++++++++++--- mkt/submit/tests/test_views.py | 26 ++++++++++++++++--- mkt/submit/views.py | 8 +++++- 8 files changed, 62 insertions(+), 17 deletions(-) diff --git a/apps/amo/helpers.py b/apps/amo/helpers.py index 81f809f12f..ef4f688227 100644 --- a/apps/amo/helpers.py +++ b/apps/amo/helpers.py @@ -423,8 +423,7 @@ def recaptcha(context, form): @register.filter def is_choice_field(value): try: - return (hasattr(value.field, 'choices') and - isinstance(value.field.widget, CheckboxInput)) + return isinstance(value.field.widget, CheckboxInput) except AttributeError: pass diff --git a/mkt/site/helpers.py b/mkt/site/helpers.py index 6499df38be..a286761135 100644 --- a/mkt/site/helpers.py +++ b/mkt/site/helpers.py @@ -324,10 +324,10 @@ def mkt_breadcrumbs(context, product=None, items=None, crumb_size=40, @register.function def form_field(field, label=None, tag='div', req=None, opt=False, hint=False, - some_html=False, cc_startswith=None, cc_for=None, + tooltip=False, some_html=False, cc_startswith=None, cc_for=None, cc_maxlength=None, grid=False, cls=None, **attrs): c = dict(field=field, label=label or field.label, tag=tag, req=req, - opt=opt, hint=hint, some_html=some_html, + opt=opt, hint=hint, tooltip=tooltip, some_html=some_html, cc_startswith=cc_startswith, cc_for=cc_for, cc_maxlength=cc_maxlength, grid=grid, cls=cls, attrs=attrs) t = env.get_template('site/helpers/simple_field.html').render(**c) diff --git a/mkt/site/templates/site/helpers/simple_field.html b/mkt/site/templates/site/helpers/simple_field.html index d2e3beacda..b9fd567a0c 100644 --- a/mkt/site/templates/site/helpers/simple_field.html +++ b/mkt/site/templates/site/helpers/simple_field.html @@ -1,21 +1,19 @@ {% from 'includes/forms.html' import required, optional, tip %} {% from 'developers/includes/macros.html' import some_html_tip %} -{% macro simple_label(field, label, opt, req, tooltip, hint) %} +{% macro simple_label(field, label, opt, req, hint) %} {% if field.field.required and req != False %}{{ required() -}}{% endif %} {% if opt %}{{ optional() -}}{% endif %} - {% endmacro %} {% if tag %} <{{ tag }} class="brform simple-field c {{ cls }}{{ ' error' if field.errors }}"> {% endif %} {% set choice = field|is_choice_field %} - {% if not tooltip %}{% set tooltip = field.help_text %}{% endif %} {% if grid %}
@@ -23,7 +21,8 @@ {% if choice %}{{ field.as_widget() }}{% endif %} {% endif %} - {{ simple_label(field, label, opt, req, tooltip, hint) }} + {{ simple_label(field, label, opt, req, hint) }} + {% if tooltip %}{{ tip(None, field.help_text) }}{% endif %} {% if grid %}
@@ -38,7 +37,7 @@ {{ field.as_widget(attrs=attrs) }} {% endif %} - {% if hint and tooltip %} + {% if hint %} {{ field.help_text }} {% endif %} diff --git a/mkt/submit/forms.py b/mkt/submit/forms.py index 9862163f40..f90ce7a13e 100644 --- a/mkt/submit/forms.py +++ b/mkt/submit/forms.py @@ -316,6 +316,14 @@ class AppDetailsBasicForm(AddonFormBasic): (0, _lazy(u'No')), ), widget=forms.RadioSelect) + publish = forms.BooleanField(required=False, initial=1, + label=_lazy(u"Publish my app in the Firefox Marketplace as soon as " + "it's reviewed."), + help_text=_lazy(u"If selected your app will be published immediately " + "following its approval by reviewers. If you don't " + "select this option you will be notified via email " + "about your app's approval and you will need to log " + "in and manually publish it.")) class Meta: model = Addon diff --git a/mkt/submit/templates/submit/details.html b/mkt/submit/templates/submit/details.html index 5bf1c01a00..c460f18957 100644 --- a/mkt/submit/templates/submit/details.html +++ b/mkt/submit/templates/submit/details.html @@ -190,6 +190,9 @@ + + {{ form_field(form_basic.publish, tooltip=True) }} + diff --git a/mkt/submit/templates/submit/done.html b/mkt/submit/templates/submit/done.html index 15088291b0..e242565079 100644 --- a/mkt/submit/templates/submit/done.html +++ b/mkt/submit/templates/submit/done.html @@ -15,9 +15,21 @@

{{ _('Success! What happens now?') }}

-

{{ _("We've got your app saved and ready to go! Your app is currently - awaiting review, and will show up on listing pages and in search once it is reviewed. - Until then, feel free to tweak your app's details and settings.") }}

+ {% if addon.make_public == amo.PUBLIC_WAIT %} +

+ {% trans url=addon.get_dev_url('versions') %} + We've got your app saved and ready to go! Your app is currently + awaiting review, and once it is reviewed you will need to be manually + enable your app from the Manage Status page + for it to show up on listing pages and in search. Until then, feel + free to tweak your app's details and settings. + {% endtrans %} +

+ {% else %} +

{{ _("We've got your app saved and ready to go! Your app is currently + awaiting review, and will show up on listing pages and in search once it is reviewed. + Until then, feel free to tweak your app's details and settings.") }}

+ {% endif %}