Additional updates to Version Edit page

This commit is contained in:
Gregory Koberger 2010-11-03 10:45:10 -07:00
Родитель a4c29bca78
Коммит 9e807045ff
4 изменённых файлов: 19 добавлений и 19 удалений

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

@ -10,8 +10,7 @@
I didn't want to bother "doing it right", though, when I'd
just have to change it in a few days #}
<div>
<strong class="version-status {{ 'version-unreviewed' if status_id in amo.UNREVIEWED_STATUSES
else 'version-' + status.lower().replace(' ', '-') }}">
<strong class="version-status">
{# L10n: The status of the addon #}
{% trans %}
This add-on is <span>{{ status }}</span>.
@ -104,6 +103,11 @@
{% endfor %}
</table>
</div>
{% if versions.paginator.num_pages > 1 %}
<div class="listing-footer">
{{ versions|paginator }}
</div>
{% endif %}
</div>
</section>
@ -144,7 +148,7 @@
<div id="modal-delete-version" class="modal modal_delete">
<form method="post" action="">
<h2>Delete Add-on Version</h2>
<h2>{{ _('Delete Add-on Version') }}</h2>
<p>
{% trans %}
Deleting your add-on version will remove it from the site.
@ -171,7 +175,7 @@
{% endtrans %}
</p>
<input type="hidden" name="addon_id" class="addon_id" value="{{ addon.id }}">
<button type="submit">{{ _('Delete Add-on Version') }}</button>
<button type="submit">{{ _('Disable Add-on') }}</button>
{{ _('or') }} <a href="#" class="close">{{ _('Cancel') }}</a>
</form>
</div>

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

@ -25,7 +25,7 @@
<form method="post" action="">
{{ csrf() }}
<a href="#" class="add-file button">Add File</a>
<a href="#" class="add-file button">{{ _('Add File') }}</a>
<table>
{{ file_form.management_form|safe }}

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

@ -19,16 +19,13 @@ from amo import messages
import amo.utils
from amo.decorators import json_view, login_required, post_required
from access import acl
from addons.forms import (AddonFormBasic, AddonFormDetails, AddonFormSupport,
AddonFormTechnical)
import addons.forms
from addons.models import Addon, AddonUser, AddonLog
from addons.views import BaseFilter
from devhub.models import ActivityLog
from files.models import FileUpload
from versions.models import License, Version
from . import forms, tasks
from .forms import (AuthorFormSet, LicenseForm, PolicyForm, ProfileForm,
CharityForm, ContribForm)
log = commonware.log.getLogger('z.devhub')
@ -278,10 +275,10 @@ def upload_detail(request, uuid, format='html'):
@dev_required
def addons_section(request, addon_id, addon, section, editable=False):
models = {'basic': AddonFormBasic,
'details': AddonFormDetails,
'support': AddonFormSupport,
'technical': AddonFormTechnical}
models = {'basic': addons.forms.AddonFormBasic,
'details': addons.forms.AddonFormDetails,
'support': addons.forms.AddonFormSupport,
'technical': addons.forms.AddonFormTechnical}
if section not in models:
return http.HttpResponseNotFound()

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

@ -41,13 +41,12 @@ class Version(amo.models.ModelBase):
return self.addon.flush_urls()
def files_status(self):
statuses = {}
statuses = []
for file in self.files.all():
statuses[file.status] = statuses.get(file.status, 0) + 1
# Tupleize and add status name
choices = amo.STATUS_CHOICES
return [(unicode(amo.STATUS_CHOICES[s]), c) for s, c in statuses.items()]
# Uses unicode since ngettext didn't like the lazy trans proxies.
statuses.append((unicode(amo.STATUS_CHOICES[file.status]),
file.status))
return statuses
@amo.cached_property(writable=True)
def compatible_apps(self):