Skip to content

Commit

Permalink
Bug 604156 - [editpage] Technical Details
Browse files Browse the repository at this point in the history
  • Loading branch information
gkoberger committed Oct 19, 2010
1 parent 24ba494 commit 9ebb79b
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 4 deletions.
13 changes: 11 additions & 2 deletions apps/addons/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AddonFormDetails(happyforms.ModelForm):
homepage = forms.URLField(widget=TranslationTextInput)

class Meta:
mode = Addon
model = Addon
fields = ('description', 'default_locale', 'homepage')


Expand All @@ -58,10 +58,19 @@ def save(self, addon, commit=False):
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,)
Expand Down
4 changes: 4 additions & 0 deletions apps/devhub/templates/devhub/addons/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ <h2>{{ title }}</h2>
{% 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>

Expand Down
101 changes: 101 additions & 0 deletions apps/devhub/templates/devhub/includes/addon_edit_technical.html
Original file line number Diff line number Diff line change
@@ -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>

28 changes: 28 additions & 0 deletions apps/devhub/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,34 @@ def test_edit_support_getsatisfaction(self):

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']
Expand Down
6 changes: 4 additions & 2 deletions apps/devhub/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
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
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 9ebb79b

Please sign in to comment.