Bug 604156 - [editpage] Technical Details
This commit is contained in:
Родитель
24ba494791
Коммит
9ebb79bc18
|
@ -31,7 +31,7 @@ class AddonFormDetails(happyforms.ModelForm):
|
|||
homepage = forms.URLField(widget=TranslationTextInput)
|
||||
|
||||
class Meta:
|
||||
mode = Addon
|
||||
model = Addon
|
||||
fields = ('description', 'default_locale', 'homepage')
|
||||
|
||||
|
||||
|
@ -58,10 +58,19 @@ class AddonFormSupport(happyforms.ModelForm):
|
|||
return super(AddonFormSupport, self).save()
|
||||
|
||||
class Meta:
|
||||
mode = Addon
|
||||
model = Addon
|
||||
fields = ('support_email', 'support_url')
|
||||
|
||||
|
||||
class AddonFormTechnical(forms.ModelForm):
|
||||
developer_comments = forms.CharField(widget=TranslationTextarea)
|
||||
|
||||
class Meta:
|
||||
model = Addon
|
||||
fields = ('developer_comments', 'view_source', 'site_specific',
|
||||
'external_software', 'binary')
|
||||
|
||||
|
||||
class AddonForm(happyforms.ModelForm):
|
||||
name = forms.CharField(widget=TranslationTextInput,)
|
||||
homepage = forms.CharField(widget=TranslationTextInput,)
|
||||
|
|
|
@ -41,6 +41,10 @@
|
|||
{% include 'devhub/includes/addon_edit_support.html' %}
|
||||
</div>
|
||||
|
||||
<div class="edit-addon-section" id="edit-addon-technical">
|
||||
{% include 'devhub/includes/addon_edit_technical.html' %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
{% from "devhub/includes/macros.html" import tip, empty_unless, flags %}
|
||||
|
||||
<form method="post" action="{{ url('devhub.addons.section', addon.id, 'technical', 'edit') }}">
|
||||
<h3>
|
||||
{{ _('Technical Details') }}
|
||||
{% if not editable %}
|
||||
<a href="{{ url('devhub.addons.section', addon.id, 'technical', 'edit') }}" class="button">
|
||||
{{ _('Edit') }}</a>
|
||||
{% endif %}
|
||||
</h3>
|
||||
<div class="item">
|
||||
<div class="item_wrapper">
|
||||
<table>
|
||||
{# L10n: {0} is an addon name #}
|
||||
<caption>{{ _('Technical Details for {0}')|f(addon.name) }}</caption>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
{{ tip(_("Developer Comments"),
|
||||
_("Any information end users may want to know that isn't
|
||||
necessarily applicable to the add-on summary or description.
|
||||
Common uses include listing known major bugs, information on
|
||||
how to report bugs, anticipated release date of a new version,
|
||||
etc.")) }}
|
||||
</th>
|
||||
<td>
|
||||
{% if editable %}
|
||||
{{ form.developer_comments|safe }}
|
||||
{{ form.developer_comments.errors|safe }}
|
||||
{% else %}
|
||||
{% call empty_unless(addon.developer_comments) %}
|
||||
{{ addon.developer_comments|nl2br }}
|
||||
{% endcall %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ _('Required Add-ons') }}</th>
|
||||
<td>
|
||||
{# TODO(cvan) #}
|
||||
<strong>{{ _('Coming Soon') }}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
{{ tip(_("Add-on flags"),
|
||||
_("These flags are used to classify add-ons.")) }}
|
||||
</th>
|
||||
<td>
|
||||
{{ flags(_("This is a site-specific add-on."),
|
||||
form.site_specific if editable else addon.site_specific, editable) }}
|
||||
|
||||
{{ flags(_("This add-on requres external software."),
|
||||
form.external_software if editable else addon.external_software,
|
||||
editable) }}
|
||||
|
||||
{{ flags(_("This add-on contains binary components."),
|
||||
form.binary if editable else addon.binary, editable) }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
{{ tip(_("View source?"),
|
||||
_("Whether the source of your add-on can be displayed in our
|
||||
online viewer.")) }}
|
||||
</th>
|
||||
<td>
|
||||
{{ flags(_("This add-on's source code is publicly viewable."),
|
||||
addon.view_source if not editable else form.view_source, editable,
|
||||
_("No, this add-on's source code is not publicly viewable.")) }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<abbr title="{{ _('Universally unique identifier') }}" class="label">
|
||||
{{ _('UUID') }}
|
||||
</abbr>
|
||||
<span class="help tooltip" title="{% trans -%}The UUID of your
|
||||
add-on is specified in its install manifest and uniquely
|
||||
identifies it. You cannot change your UUID once it has been
|
||||
submitted.{%- endtrans %}">?</span>
|
||||
</th>
|
||||
<td>
|
||||
{{ addon.guid }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% if editable %}
|
||||
<div class="listing-footer">
|
||||
<button>{{ _('Save Changes') }}</button> {{ _('or') }}
|
||||
<a href="{{ url('devhub.addons.section', addon.id, 'technical') }}"
|
||||
class="addon-edit-cancel">
|
||||
{{ _('Cancel') }}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
@ -672,6 +672,34 @@ class TestEdit(test_utils.TestCase):
|
|||
|
||||
eq_(result, val)
|
||||
|
||||
def test_technical_on(self):
|
||||
# Turn everything on
|
||||
data = dict(developer_comments='Test comment!',
|
||||
binary='on',
|
||||
external_software='on',
|
||||
site_specific='on',
|
||||
view_source='on')
|
||||
|
||||
r = self.client.post(self.get_url('technical', True), data)
|
||||
eq_(r.status_code, 200)
|
||||
|
||||
addon = self.get_addon()
|
||||
for k in data:
|
||||
if k == 'developer_comments':
|
||||
eq_(unicode(getattr(addon, k)), unicode(data[k]))
|
||||
else:
|
||||
eq_(getattr(addon, k), True if data[k] == 'on' else False)
|
||||
|
||||
# Andddd offf
|
||||
data = dict(developer_comments='Test comment!')
|
||||
r = self.client.post(self.get_url('technical', True), data)
|
||||
addon = self.get_addon()
|
||||
|
||||
eq_(addon.binary, False)
|
||||
eq_(addon.external_software, False)
|
||||
eq_(addon.site_specific, False)
|
||||
eq_(addon.view_source, False)
|
||||
|
||||
|
||||
class TestProfile(test_utils.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
|
|
|
@ -13,7 +13,8 @@ from tower import ugettext_lazy as _lazy
|
|||
import amo.utils
|
||||
from amo.decorators import login_required, post_required
|
||||
from access import acl
|
||||
from addons.forms import AddonFormBasic, AddonFormDetails, AddonFormSupport
|
||||
from addons.forms import (AddonFormBasic, AddonFormDetails, AddonFormSupport,
|
||||
AddonFormTechnical)
|
||||
from addons.models import Addon, AddonUser, AddonLog
|
||||
from addons.views import BaseFilter
|
||||
from files.models import FileUpload
|
||||
|
@ -234,7 +235,8 @@ def upload_detail(request, uuid):
|
|||
def addons_section(request, addon_id, addon, section, editable=False):
|
||||
models = {'basic': AddonFormBasic,
|
||||
'details': AddonFormDetails,
|
||||
'support': AddonFormSupport}
|
||||
'support': AddonFormSupport,
|
||||
'technical': AddonFormTechnical}
|
||||
|
||||
if section not in models:
|
||||
return http.HttpResponseNotFound()
|
||||
|
|
Загрузка…
Ссылка в новой задаче