Bug 599043, manage versions page
This commit is contained in:
Родитель
564c0df120
Коммит
5bff43f095
|
@ -218,6 +218,8 @@ def check_paypal_id(paypal_id):
|
|||
class VersionForm(happyforms.ModelForm):
|
||||
releasenotes = forms.CharField(widget=TranslationTextarea(),
|
||||
required=False)
|
||||
approvalnotes = forms.CharField(widget=TranslationTextarea(),
|
||||
required=False)
|
||||
|
||||
class Meta:
|
||||
model = Version
|
||||
|
@ -296,7 +298,8 @@ CompatFormSet = modelformset_factory(
|
|||
class NewFileForm(happyforms.Form):
|
||||
# Points to a FileUpload.uuid.
|
||||
upload = forms.CharField(max_length=36)
|
||||
platform = File._meta.get_field('platform').formfield(empty_label=None)
|
||||
platform = File._meta.get_field('platform').formfield(empty_label=None,
|
||||
widget=forms.RadioSelect(attrs={'class': 'platform'}))
|
||||
|
||||
|
||||
class FileForm(happyforms.ModelForm):
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
</section>
|
||||
|
||||
<section id="dashboard-sidebar" class="secondary" role="complementary">
|
||||
<p id="submit-addon">
|
||||
<p id="submit-addon" class="cta">
|
||||
<a href="{{ url('devhub.submit') }}"
|
||||
class="button prominent">{{ _('Submit a New Add-on') }}</a>
|
||||
</p>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
<section class="primary" role="main">
|
||||
{{ l10n_menu() }}
|
||||
<div id="edit-addon">
|
||||
<div id="edit-addon" class="devhub-form">
|
||||
|
||||
<div class="edit-addon-section" id="edit-addon-basic">
|
||||
{% include 'devhub/includes/addon_edit_basic.html' %}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
{{ dev_breadcrumbs(addon) }}
|
||||
<h2>{{ title }}</h2>
|
||||
</header>
|
||||
<section id="edit-addon" class="primary" role="main">
|
||||
<section id="edit-addon" class="primary devhub-form" role="main">
|
||||
<form method="post" class="item" action="">
|
||||
{{ csrf() }}
|
||||
<div class="item_wrapper">
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
{{ dev_breadcrumbs(addon) }}
|
||||
<h2>{{ title }}</h2>
|
||||
</header>
|
||||
<section class="primary payments" role="main" id="edit-addon">
|
||||
<section class="primary payments devhub-form" role="main">
|
||||
{% set contrib = addon.takes_contributions and addon.has_full_profile() or errors %}
|
||||
{% if contrib and not errors %}
|
||||
<div id="status-bar">
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
{{ dev_breadcrumbs(addon) }}
|
||||
<h2>{{ title }}</h2>
|
||||
</header>
|
||||
<section id="edit-addon" class="primary" role="main">
|
||||
<section id="edit-addon" class="primary devhub-form" role="main">
|
||||
|
||||
<h3>{{ _('Current Status') }}</h3>
|
||||
<div class="item" id="version-status">
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
{% with file = form.instance %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ file.get_url_path(amo.FIREFOX, 'devhub') }}">
|
||||
{{ file.filename }}</a>
|
||||
</td>
|
||||
<td>{{ (file.size * 1024)|filesizeformat }}</td>
|
||||
<td>{{ form.platform|safe }}</td>
|
||||
<td>{{ form.status|safe }}</td>
|
||||
<td>
|
||||
<span class="js-hidden">
|
||||
<span class="delete">{{ form.DELETE|safe }}</span>
|
||||
{{ form.id|safe }}
|
||||
</span>
|
||||
<a class="remove" href="#">x</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endwith %}
|
|
@ -1,70 +1,85 @@
|
|||
{% extends "devhub/base.html" %}
|
||||
|
||||
{% from "devhub/includes/macros.html" import tip, empty_unless, compat %}
|
||||
|
||||
{% set title = _('Manage Version {0}')|f(version.version) %}
|
||||
|
||||
{% block title %}{{ dev_page_title(title, addon) }}{% endblock %}
|
||||
|
||||
{% macro compat(form) %}
|
||||
<tr><th>
|
||||
<img src="{{ MEDIA_URL }}img/amo2009/app-icons/small/{{ form.app.short }}.png">
|
||||
</th></tr>
|
||||
{{ form|safe }}
|
||||
{% endmacro %}
|
||||
|
||||
{% block content %}
|
||||
<header>
|
||||
{{ dev_breadcrumbs(addon) }}
|
||||
{# L10n: {0} is an add-on name. #}
|
||||
<h2>{{ _('Manage {0}')|f(addon.name) }}</h2>
|
||||
</header>
|
||||
<section class="primary" role="main">
|
||||
<section class="primary devhub-form" role="main">
|
||||
<h3>{{ title }}</h3>
|
||||
<a href="{{ url('devhub.versions', addon.id) }}">{{ _('Back to All Versions') }}</a>
|
||||
<div class="listing featured">
|
||||
<div class="featured-inner">
|
||||
<form method="post" action="">
|
||||
<form method="post" action="">
|
||||
<div class="item">
|
||||
<div class="item_wrapper">
|
||||
{{ csrf() }}
|
||||
|
||||
<a href="#" class="add-file button">{{ _('Add File') }}</a>
|
||||
|
||||
<table>
|
||||
{{ file_form.management_form|safe }}
|
||||
{{ file_form.non_form_errors()|safe }}
|
||||
{% for form in file_form.forms %}
|
||||
{% with file = form.instance %}
|
||||
<tr>
|
||||
<td><a href="{{ file.get_url_path(amo.FIREFOX, 'devhub') }}">
|
||||
{{ file.filename }}</a></td>
|
||||
<td>{{ (file.size * 1000)|filesizeformat }}</td>
|
||||
<td>{{ form.platform|safe }}</td>
|
||||
<td>{{ form.status|safe }}</td>
|
||||
<td>
|
||||
{{ form.DELETE|safe }}
|
||||
{{ form.id|safe }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
<table>
|
||||
{% if compat_form %}
|
||||
{{ compat_form.non_form_errors()|safe }}
|
||||
{{ compat_form.management_form|safe }}
|
||||
{% for form in compat_form.initial_forms %}
|
||||
{{ compat(form) }}
|
||||
{% endfor %}
|
||||
{% for form in compat_form.extra_forms %}
|
||||
{{ compat(form) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{{ version_form|safe }}
|
||||
<tr>
|
||||
<th>{{ _('License') }}</th>
|
||||
<th>{{ _("Files") }}</th>
|
||||
<td>
|
||||
{{ file_form.management_form|safe }}
|
||||
{{ file_form.non_form_errors()|safe }}
|
||||
<table id="file-list">
|
||||
<tbody>
|
||||
{% for form in file_form.forms %}
|
||||
{% include "devhub/includes/version_file.html" %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<a href="#" class="add-file button">{{ _('Upload Another File') }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ tip(_("Compatibility"),
|
||||
_("Adjusting application information here will allow users to install your
|
||||
add-on even if the install manifest in the package indicates that the
|
||||
add-on is incompatible.")) }}</th>
|
||||
<td class="compat-versions">
|
||||
{{ compat_form.non_form_errors()|safe }}
|
||||
{{ compat_form.management_form|safe }}
|
||||
<table>
|
||||
<tbody>
|
||||
{% for form in compat_form.initial_forms %}
|
||||
{{ compat(form) }}
|
||||
{% endfor %}
|
||||
{% for form in compat_form.extra_forms %}
|
||||
{{ compat(form, is_extra_form=True) }}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="add-app">
|
||||
<a href="#">{{ _('Add Another Application…')|safe }}</a>
|
||||
</p>
|
||||
<div class="new-apps"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="releasenotes">{{ _("Release Notes") }}</label>
|
||||
{{ tip(None, "Information about changes in this release, new features,
|
||||
known bugs, and other useful information specific to this
|
||||
release/version. This information is also shown in the
|
||||
Add-ons Manager when updating.") }}
|
||||
</th>
|
||||
<td>
|
||||
{{ version_form.releasenotes.errors|safe }}
|
||||
{{ version_form.releasenotes|safe }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
{{ _("License") }}
|
||||
</th>
|
||||
<td>
|
||||
{{ version.license.name }}
|
||||
{% if version.license.url %}
|
||||
<a href="{{ version.license.url }}">{{ _('Details') }}</a>
|
||||
<a class="extra" href="{{ version.license.url }}">{{ _('Details') }}</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -85,16 +100,27 @@
|
|||
{% endfor %}
|
||||
</ul>
|
||||
</td>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="approvalnotes">{{ _("Notes for Reviewers") }}</label>
|
||||
{{ tip(None, "Optionally, enter any information that may be useful
|
||||
to the Editor reviewing this add-on, such as test
|
||||
account information.") }}
|
||||
</th>
|
||||
<td>
|
||||
{{ version_form.approvalnotes.errors|safe }}
|
||||
{{ version_form.approvalnotes|safe }}
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p class="item-group">
|
||||
<button type="submit">{{ _('Save Changes') }}</button> {{ _('or') }}
|
||||
<a href="{{ url('devhub.versions', addon.id) }}">{{ _('Cancel') }}</a>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<div class="listing-footer">
|
||||
<button type="submit">{{ _('Save Changes') }}</button> {{ _('or') }}
|
||||
<a href="{{ url('devhub.versions', addon.id) }}">{{ _('Cancel') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="add-file-modal upload-file modal hidden">
|
||||
<form method="post" id="upload-file" action="{{ url('devhub.upload') }}"
|
||||
enctype="multipart/form-data">
|
||||
|
@ -108,11 +134,16 @@
|
|||
</p>
|
||||
|
||||
{{ csrf() }}
|
||||
<label>{{ _('Select the target platform for this file.') }}</label>
|
||||
{{ new_file_form.platform|safe }}
|
||||
<div class="hidden">
|
||||
{{ new_file_form.upload|safe }}
|
||||
</div>
|
||||
|
||||
<label for="upload-file-input" class="brform">
|
||||
{{ _('Select the add-on file to upload.') }}
|
||||
</label>
|
||||
<input type="file" id="upload-file-input" name="upload" />
|
||||
<div class="invisible-upload" id="upload-file-widget">
|
||||
<a class="button prominent" href="#">{{ _('Select a File') }}</a>
|
||||
<input type="file" id="upload-file-input">
|
||||
</div>
|
||||
<div class="upload-details">
|
||||
{{ _('Your add-on should end with .xpi or .jar.') }}
|
||||
</div>
|
||||
|
@ -136,13 +167,9 @@
|
|||
</div>
|
||||
|
||||
<div class="upload-status-button-add">
|
||||
<button class="button">{{ _('Add File') }}</button> or
|
||||
<button id="upload-file-finish" disabled data-url="{{ url('devhub.versions.add_file', addon.id, version.id) }}" class="button">{{ _('Add File') }}</button> or
|
||||
<a href="#" class="upload-file-cancel">{{ _('Cancel') }}</a>
|
||||
</div>
|
||||
<div class="upload-status-button-close">
|
||||
<a href="#" class="upload-file-reset button"></a> or
|
||||
<a href="#" class="upload-file-cancel"></a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
@ -440,6 +440,8 @@ def version_edit(request, addon_id, addon, version_id):
|
|||
version = get_object_or_404(Version, pk=version_id, addon=addon)
|
||||
version_form = forms.VersionForm(request.POST or None, instance=version)
|
||||
|
||||
new_file_form = forms.NewFileForm(request.POST or None)
|
||||
|
||||
file_form = forms.FileFormSet(request.POST or None, prefix='files',
|
||||
queryset=version.files.all())
|
||||
data = {'version_form': version_form, 'file_form': file_form}
|
||||
|
@ -467,7 +469,7 @@ def version_edit(request, addon_id, addon, version_id):
|
|||
compat.save()
|
||||
return redirect('devhub.versions.edit', addon_id, version_id)
|
||||
|
||||
data.update({'addon': addon, 'version': version})
|
||||
data.update({'addon': addon, 'version': version, 'new_file_form': new_file_form})
|
||||
return jingo.render(request, 'devhub/versions/edit.html', data)
|
||||
|
||||
|
||||
|
@ -489,7 +491,10 @@ def version_add_file(request, addon_id, addon, version_id):
|
|||
return json_view.error(json.dumps(form.errors))
|
||||
upload = get_object_or_404(FileUpload, pk=form.cleaned_data['upload'])
|
||||
File.from_upload(upload, version, form.cleaned_data['platform'])
|
||||
return {}
|
||||
file_form = forms.FileFormSet(prefix='files', queryset=version.files.all())
|
||||
# TODO (jbalogh): get the right form
|
||||
return jingo.render(request, 'devhub/includes/version_file.html',
|
||||
{'form': file_form.forms[-1]})
|
||||
|
||||
|
||||
@dev_required
|
||||
|
|
|
@ -35,7 +35,7 @@ class File(amo.models.ModelBase):
|
|||
db_table = 'files'
|
||||
|
||||
def __unicode__(self):
|
||||
return self.id
|
||||
return unicode(self.id)
|
||||
|
||||
@property
|
||||
def amo_platform(self):
|
||||
|
|
|
@ -9,20 +9,20 @@ form.select-review:after {
|
|||
visibility: hidden;
|
||||
}
|
||||
/* @group Edit addon */
|
||||
#edit-addon .label,
|
||||
#edit-addon th label {
|
||||
.devhub-form .label,
|
||||
.devhub-form th label {
|
||||
margin-right:5px;
|
||||
}
|
||||
|
||||
#edit-addon .edit-addon-section {
|
||||
.devhub-form .edit-addon-section {
|
||||
margin-bottom:3em;
|
||||
}
|
||||
|
||||
#edit-addon h3 a {
|
||||
.devhub-form h3 a {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
#edit-addon .item {
|
||||
.devhub-form .item {
|
||||
background-color: #FFFFFF;
|
||||
background-position: left bottom;
|
||||
background-repeat: repeat-x;
|
||||
|
@ -35,7 +35,7 @@ form.select-review:after {
|
|||
border-radius: 8px;
|
||||
}
|
||||
|
||||
#edit-addon .listing-footer {
|
||||
.devhub-form .listing-footer {
|
||||
-moz-border-radius: 0 0 8px 8px;
|
||||
-webkit-border-radius: 0 0 8px 8px;
|
||||
border-radius: 0 0 8px 8px;
|
||||
|
@ -43,49 +43,49 @@ form.select-review:after {
|
|||
padding: 9px;
|
||||
}
|
||||
|
||||
#edit-addon .item_wrapper {
|
||||
.devhub-form .item_wrapper {
|
||||
padding: 5px 13px;
|
||||
}
|
||||
|
||||
#edit-addon h3:first-child {
|
||||
.devhub-form h3:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
|
||||
#edit-addon table {
|
||||
.devhub-form table {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#edit-addon table th {
|
||||
.devhub-form table th {
|
||||
width: 130px;
|
||||
vertical-align: top;
|
||||
padding: 8px 20px 8px 0;
|
||||
border-top: 1px dotted #ADD0DC;
|
||||
}
|
||||
|
||||
#edit-addon table td {
|
||||
.devhub-form table td {
|
||||
padding: 8px 0;
|
||||
border-top: 1px dotted #ADD0DC;
|
||||
}
|
||||
|
||||
#edit-addon table, #edit-addon tbody {
|
||||
.devhub-form table, .devhub-form tbody {
|
||||
border-top: medium none;
|
||||
border-bottom: medium none;
|
||||
}
|
||||
|
||||
#edit-addon table tr:first-child td,
|
||||
#edit-addon table tr:first-child th {
|
||||
.devhub-form table tr:first-child td,
|
||||
.devhub-form table tr:first-child th {
|
||||
border-top: medium none;
|
||||
}
|
||||
|
||||
#edit-addon table .screenshot.thumbnail {
|
||||
.devhub-form table .screenshot.thumbnail {
|
||||
width: 100px;
|
||||
height: 75px;
|
||||
}
|
||||
|
||||
|
||||
#edit-addon .help,
|
||||
.devhub-form .help,
|
||||
a.remove {
|
||||
-moz-border-radius: 20px;
|
||||
-webkit-border-radius :20px;
|
||||
|
@ -102,7 +102,7 @@ a.remove {
|
|||
text-decoration :none;
|
||||
width: 18px;
|
||||
}
|
||||
#edit-addon .help {
|
||||
.devhub-form .help {
|
||||
vertical-align: top;
|
||||
}
|
||||
a.remove {
|
||||
|
@ -112,24 +112,24 @@ a.remove {
|
|||
margin-top: 2px;
|
||||
}
|
||||
|
||||
#edit-addon .author:hover .remove,
|
||||
.devhub-form .author:hover .remove,
|
||||
a.remove:hover,
|
||||
#edit-addon tr:hover .help {
|
||||
.devhub-form tr:hover .help {
|
||||
background-color: #CCC;
|
||||
}
|
||||
|
||||
#edit-addon tr:hover .help:hover,
|
||||
#edit-addon .author .remove:hover {
|
||||
.devhub-form tr:hover .help:hover,
|
||||
.devhub-form .author .remove:hover {
|
||||
background-color: #2A4364;
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
#edit-addon .empty {
|
||||
.devhub-form .empty {
|
||||
color: #999999;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
#edit-addon-nav div:last-child ul.refinements {
|
||||
.devhub-form-nav div:last-child ul.refinements {
|
||||
border-bottom: 0 none;
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0;
|
||||
|
@ -152,14 +152,14 @@ a.remove:hover,
|
|||
font-size:10px;
|
||||
}
|
||||
|
||||
#edit-addon label {
|
||||
.devhub-form label {
|
||||
font-weight: normal;
|
||||
}
|
||||
#edit-addon th label {
|
||||
.devhub-form th label {
|
||||
font-weight: bold;
|
||||
display: inline-block;
|
||||
}
|
||||
#edit-addon th label .locale{
|
||||
.devhub-form th label .locale{
|
||||
font-weight: normal;
|
||||
font-size: .9em;
|
||||
color: #888;
|
||||
|
@ -413,8 +413,8 @@ a.more-actions:after:hover {
|
|||
#submit-addon {
|
||||
margin-bottom: 3em;
|
||||
}
|
||||
#submit-addon a.button:link,
|
||||
#submit-addon a.button:visited {
|
||||
.cta a.button:link,
|
||||
.cta a.button:visited {
|
||||
background: #5af;
|
||||
background: -moz-linear-gradient(top, #acf, #5af);
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#acf), to(#5af));
|
||||
|
@ -426,14 +426,14 @@ a.more-actions:after:hover {
|
|||
padding: 0.75em 0.95em;
|
||||
text-align: center;
|
||||
}
|
||||
#submit-addon a.button:hover,
|
||||
#submit-addon a.button:focus {
|
||||
.cta a.button:hover,
|
||||
.cta a.button:focus {
|
||||
border-color: #25f;
|
||||
-moz-box-shadow: inset 0 0 2px #fff;
|
||||
-webkit-box-shadow: inset 0 0 2px #fff;
|
||||
box-shadow: inset 0 0 2px #fff;
|
||||
}
|
||||
#submit-addon a.button:active {
|
||||
.cta a.button:active {
|
||||
border-color: #03c;
|
||||
background: #7bf;
|
||||
background: -moz-linear-gradient(top, #5af, #7bf);
|
||||
|
@ -554,15 +554,15 @@ input.valid {
|
|||
.license-other input {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
#edit-addon .priv label,
|
||||
#edit-addon .eula label,
|
||||
#edit-addon .license-other label {
|
||||
.devhub-form .priv label,
|
||||
.devhub-form .eula label,
|
||||
.devhub-form .license-other label {
|
||||
font-weight: bold;
|
||||
margin-bottom: .5em;
|
||||
}
|
||||
#edit-addon .priv,
|
||||
#edit-addon .eula,
|
||||
#edit-addon .license-other {
|
||||
.devhub-form .priv,
|
||||
.devhub-form .eula,
|
||||
.devhub-form .license-other {
|
||||
margin: 16px 0 0 32px;
|
||||
}
|
||||
.eula label,
|
||||
|
@ -595,8 +595,8 @@ input.valid {
|
|||
.payments .intro .button-wrapper {
|
||||
text-align: center;
|
||||
}
|
||||
#edit-addon .brform label,
|
||||
#edit-addon .b {
|
||||
.devhub-form .brform label,
|
||||
.devhub-form .b {
|
||||
font-weight: 500;
|
||||
}
|
||||
.brform > label,
|
||||
|
@ -1143,3 +1143,75 @@ form.select-review .errorlist {
|
|||
/* @end */
|
||||
|
||||
/* @end */
|
||||
|
||||
/** Invisible file inputs */
|
||||
.invisible-upload {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.invisible-upload input {
|
||||
display: block;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: auto;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
z-index: 1;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.invisible-upload:hover input {
|
||||
font-size: 1000px;
|
||||
}
|
||||
|
||||
.invisible-upload a.button {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.invisible-upload:hover a.button,
|
||||
.invisible-upload.focused a.button {
|
||||
border-color: #25f;
|
||||
-moz-box-shadow: inset 0 0 2px #fff;
|
||||
-webkit-box-shadow: inset 0 0 2px #fff;
|
||||
box-shadow: inset 0 0 2px #fff;
|
||||
|
||||
}
|
||||
|
||||
.invisible-upload a.link {
|
||||
text-decoration: none;
|
||||
color: #0055EE;
|
||||
}
|
||||
|
||||
.invisible-upload:hover a.link,
|
||||
.invisible-upload.focused a.link {
|
||||
text-decoration: underline;
|
||||
}
|
||||
/* @end */
|
||||
|
||||
#upload-file li {
|
||||
float: left;
|
||||
margin-right: 8px;
|
||||
}
|
||||
#upload-file ul {
|
||||
overflow: hidden;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
#file-list { margin-bottom: 1em;}
|
||||
#file-list tr {
|
||||
border-bottom: 1px dotted #ADD0DC;
|
||||
}
|
||||
|
||||
.devhub-form .compat-versions tbody {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.devhub-form .compat-versions p.add-app {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
|
|
@ -156,13 +156,7 @@ function initEditVersions() {
|
|||
$modal = $(".add-file-modal").modal(".add-file", {
|
||||
width: '450px',
|
||||
hideme: false,
|
||||
callback:resetModal
|
||||
});
|
||||
|
||||
// Reset link
|
||||
$('.upload-file-reset').click(function(e) {
|
||||
e.preventDefault();
|
||||
resetModal();
|
||||
callback: resetModal
|
||||
});
|
||||
|
||||
// Cancel link
|
||||
|
@ -175,17 +169,29 @@ function initEditVersions() {
|
|||
$('#uploadstatus_abort a').click(abortUpload);
|
||||
|
||||
// Upload form submit
|
||||
$('#upload-file').submit(function(e){
|
||||
e.preventDefault();
|
||||
|
||||
$('.upload-status-button-add, .upload-status-button-close').hide();
|
||||
|
||||
fileUpload($('#upload-file-input'), $(this).attr('action'));
|
||||
|
||||
$('.upload-file-box').hide();
|
||||
$("#upload-file").delegate("#upload-file-input", 'change', function(e) {
|
||||
resetModal(false);
|
||||
fileUpload($(this), $(this).closest('form').attr('action'));
|
||||
$('.upload-status').show();
|
||||
});
|
||||
|
||||
$("#upload-file-finish").click(function (e) {
|
||||
e.preventDefault();
|
||||
$tgt = $(this);
|
||||
if ($tgt.attr("disabled")) return;
|
||||
$.post($tgt.attr("data-url"), $("#upload-file").serialize(), function (resp) {
|
||||
$("#file-list tbody").append(resp);
|
||||
$("#id_files-TOTAL_FORMS").val($("#file-list tr").length);
|
||||
$modal.hideMe();
|
||||
});
|
||||
});
|
||||
|
||||
$("#file-list").delegate("a.remove", "click", function() {
|
||||
$tr = $(this).closest("tr").first();
|
||||
$tr.hide().find(".delete input").attr("checked", "checked");
|
||||
$("#id_files-TOTAL_FORMS").val($("#file-list tr").length);
|
||||
});
|
||||
|
||||
function fileUpload(img, url) {
|
||||
var f = img[0].files[0];
|
||||
|
||||
|
@ -322,22 +328,13 @@ function initEditVersions() {
|
|||
$('#upload-status-results').html(body).addClass('status-fail');
|
||||
$('.upload-status-button-add').hide();
|
||||
$('.upload-status-button-close').show();
|
||||
|
||||
text_reset = gettext('Try Again');
|
||||
text_cancel = gettext('Cancel');
|
||||
|
||||
inputDiv = $('.upload-status-button-close');
|
||||
$('.upload-file-reset', inputDiv).text(text_reset);
|
||||
$('.upload-file-cancel', inputDiv).text(text_cancel);
|
||||
}
|
||||
|
||||
function resetModal(obj) {
|
||||
function resetModal(fileInput) {
|
||||
if (fileInput === undefined) fileInput = true;
|
||||
|
||||
file = {name: '', size: 0, data: '', aborted: false};
|
||||
|
||||
upload = $("<input type='file'>").attr('name', 'upload')
|
||||
.attr('id', 'upload-file-input');
|
||||
|
||||
$('.upload-file-box').show();
|
||||
$('.upload-status').hide();
|
||||
|
||||
|
@ -346,16 +343,24 @@ function initEditVersions() {
|
|||
|
||||
$('#upload-status-bar').attr('class', '');
|
||||
$('#upload-status-text').text("");
|
||||
$('#upload-file-input').replaceWith(upload); // Clear file input
|
||||
if (fileInput) resetFileInput(); // Clear file input
|
||||
$('#upload-status-results').text("").attr("class", "");
|
||||
$('#upload-status-bar div').css('width', 0).show();
|
||||
$('#upload-status-bar').removeClass('progress-idle');
|
||||
$("#upload-file-finish").attr("disabled", true);
|
||||
|
||||
|
||||
updateStatus(0);
|
||||
$('#uploadstatus_abort').show();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function resetFileInput() {
|
||||
upload = $("<input type='file'>").attr('name', 'upload')
|
||||
.attr('id', 'upload-file-input');
|
||||
$('#upload-file-input').replaceWith(upload); // Clear file input
|
||||
}
|
||||
|
||||
function addonUploaded(json) {
|
||||
$('#uploadstatus_abort').hide();
|
||||
|
@ -379,6 +384,8 @@ function initEditVersions() {
|
|||
|
||||
var body = "<strong>";
|
||||
if(!v.errors) {
|
||||
$("#upload-file-finish").attr("disabled", false);
|
||||
$("#id_upload").val(json.upload);
|
||||
body += format(ngettext(
|
||||
"Your add-on passed validation with no errors and {0} warning.",
|
||||
"Your add-on passed validation with no errors and {0} warnings.",
|
||||
|
@ -409,23 +416,11 @@ function initEditVersions() {
|
|||
|
||||
statusclass = v.errors ? 'status-fail' : 'status-pass';
|
||||
$('#upload-status-results').html(body).addClass(statusclass);
|
||||
|
||||
$('.upload-status-button-add').hide();
|
||||
$('.upload-status-button-close').show();
|
||||
|
||||
inputDiv = $('.upload-status-button-close');
|
||||
|
||||
if(v.errors) {
|
||||
text_reset = gettext('Try Again');
|
||||
text_cancel = gettext('Cancel');
|
||||
} else {
|
||||
text_reset = gettext('Upload Another');
|
||||
text_cancel = gettext('Finish Uploading');
|
||||
}
|
||||
|
||||
$('.upload-file-reset', inputDiv).text(text_reset);
|
||||
$('.upload-file-cancel', inputDiv).text(text_cancel);
|
||||
}
|
||||
|
||||
statusclass = v.errors ? 'status-fail' : 'status-pass';
|
||||
$('#upload-status-results').html(body).addClass(statusclass);
|
||||
resetFileInput();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -626,7 +621,7 @@ function initCompatibility() {
|
|||
$('.new-apps ul').delegate('a', 'click', function(e) {
|
||||
e.preventDefault();
|
||||
var extraAppRow = $('tr.app-extra td[class=' + $(this).attr('class') + ']', outer);
|
||||
extraAppRow.parents('tr').find('input:checkbox').removeAttr('checked')
|
||||
extraAppRow.parents('tr.app-extra').find('input:checkbox').removeAttr('checked')
|
||||
.closest('tr').removeClass('app-extra');
|
||||
|
||||
$(this).closest('li').remove();
|
||||
|
|
Загрузка…
Ссылка в новой задаче