Bug 592114, more collection edit tweaks
This commit is contained in:
Родитель
48fbdeec41
Коммит
0fc1232f49
|
@ -42,7 +42,8 @@ def locale_url(url):
|
|||
@register.function
|
||||
def url(viewname, *args, **kwargs):
|
||||
"""Helper for Django's ``reverse`` in templates."""
|
||||
return urlresolvers.reverse(viewname, args=args, kwargs=kwargs)
|
||||
add_prefix = kwargs.pop('add_prefix', True)
|
||||
return urlresolvers.reverse(viewname, args=args, kwargs=kwargs, add_prefix=add_prefix)
|
||||
|
||||
|
||||
@register.filter
|
||||
|
|
|
@ -47,14 +47,14 @@ def get_app_redirect(app):
|
|||
|
||||
|
||||
def reverse(viewname, urlconf=None, args=None, kwargs=None, prefix=None,
|
||||
current_app=None):
|
||||
current_app=None, add_prefix=True):
|
||||
"""Wraps django's reverse to prepend the correct locale and app."""
|
||||
prefixer = get_url_prefix()
|
||||
# Blank out the script prefix since we add that in prefixer.fix().
|
||||
if prefixer:
|
||||
prefix = prefix or '/'
|
||||
url = django_reverse(viewname, urlconf, args, kwargs, prefix, current_app)
|
||||
if prefixer:
|
||||
if prefixer and add_prefix:
|
||||
return prefixer.fix(url)
|
||||
else:
|
||||
return url
|
||||
|
|
|
@ -4,15 +4,13 @@
|
|||
<form>
|
||||
<fieldset>
|
||||
{{ field(form.name, _('Name:')) }}
|
||||
{% set slug_base = url('collections.user', user.get_profile().username, add_prefix=False) %}
|
||||
<p id="collection-form-slug">
|
||||
{{ form.errors['slug']|safe }}
|
||||
<label>{{ form.slug.label|safe }}</label>
|
||||
<span id="slug_edit">
|
||||
{{ url('collections.user', user.get_profile().username)|absolutify -}}
|
||||
{{ form.slug|safe }}
|
||||
</span>
|
||||
<span id="slug_edit"><span>{{ slug_base }}</span>{{ form.slug|safe }}</span>
|
||||
<span id="slug_readonly">
|
||||
{{ url('collections.user', user.get_profile().username)|absolutify -}}<span id="slug_value"></span>
|
||||
{{ slug_base }}<span id="slug_value"></span>
|
||||
<a id="edit_slug" href="#">{{ _('Edit') }}</a>
|
||||
</span>
|
||||
</p>
|
||||
|
|
|
@ -39,7 +39,11 @@
|
|||
<textarea name="addon_comment">{{ comments[addon.id] }}</textarea>
|
||||
</p>
|
||||
</td>
|
||||
<td>{{ addon.added }}</td>
|
||||
{% if meta %}
|
||||
<td>{{ meta[addon.id].created|datetime }}</td>
|
||||
{% else %}
|
||||
<td>{{ _('Pending') }}</td>
|
||||
{% endif %}
|
||||
<td><a title="{{ _('Add a comment') }}" class="comment">{{ _('Comment') }}</a></td>
|
||||
<td class="remove"><a title="{{ _('Remove this add-on from the collection') }}" class="remove">{{ _('Remove') }}</a></td>
|
||||
</tr>
|
||||
|
|
|
@ -352,6 +352,8 @@ def edit(request, collection, username, slug):
|
|||
else:
|
||||
form = forms.CollectionForm(instance=collection)
|
||||
|
||||
qs = CollectionAddon.objects.filter(collection=collection)
|
||||
meta = dict((c.addon_id, c) for c in qs)
|
||||
addons = collection.addons.no_cache().all()
|
||||
comments = get_notes(collection, raw=True).next()
|
||||
|
||||
|
@ -367,6 +369,7 @@ def edit(request, collection, username, slug):
|
|||
user=request.amo_user,
|
||||
username=username,
|
||||
slug=slug,
|
||||
meta=meta,
|
||||
filter=get_filter(request),
|
||||
is_admin=is_admin,
|
||||
admin_form=admin_form,
|
||||
|
|
|
@ -3477,12 +3477,6 @@ background-position:left -303px;
|
|||
padding: 0 20px 0 0;
|
||||
}
|
||||
|
||||
.html-rtl .share {
|
||||
background-position: right -100px;
|
||||
padding: 0 20px 0 0;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.html-rtl .addons {
|
||||
background-position: right -200px;
|
||||
padding: 0 20px 7px 0;
|
||||
|
|
|
@ -1051,7 +1051,7 @@ select:disabled {
|
|||
}
|
||||
|
||||
.user-input textarea {
|
||||
width: 98%;
|
||||
/* width: 98%;*/
|
||||
}
|
||||
|
||||
.user-input .instruct {
|
||||
|
@ -1187,7 +1187,7 @@ form .error .note.error {
|
|||
}
|
||||
|
||||
#user-profile .trans {
|
||||
width: 96%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.html-rtl #user-edit #acct-notify {
|
||||
|
@ -2496,10 +2496,6 @@ label > .optional {
|
|||
#id_slug:focus {
|
||||
outline: 0;
|
||||
}
|
||||
.collection-add-dropdown #id_slug {
|
||||
text-align:right;
|
||||
display:inline-block;
|
||||
}
|
||||
#slug_edit span {
|
||||
border: 1px solid #5875A0;
|
||||
border-right:0;
|
||||
|
@ -2532,6 +2528,8 @@ label > .optional {
|
|||
|
||||
#ajax_collections_list {
|
||||
margin: 0 0 .5em 0;
|
||||
max-height: 200px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#ajax_new_collection {
|
||||
|
@ -2886,6 +2884,15 @@ a.outlink:hover {
|
|||
.collection_widgets.condensed .widget > a{
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
.html-rtl .collection_widgets.condensed a.widget,
|
||||
.html-rtl .collection_widgets.condensed .widget > a{
|
||||
padding-right: 16px;
|
||||
padding-left: 0;
|
||||
margin-right: 0;
|
||||
margin-left: .8em;
|
||||
}
|
||||
|
||||
.widgets.condensed a.widget > span,
|
||||
.widgets.condensed .widget > a > span {
|
||||
display: none;
|
||||
|
|
|
@ -417,7 +417,7 @@ $('#addon-select').click(function() {
|
|||
'<p class="comments">' +
|
||||
'<textarea name="addon_comment"></textarea>' +
|
||||
'</p></td>' +
|
||||
'<td>Pending</td>' +
|
||||
'<td>' + gettext('Pending') + '</td>' +
|
||||
'<td><a title="' + gettext('Add a comment') + '" class="comment">' + gettext('Comment') + '</a></td>' +
|
||||
'<td class="remove"><a title="' + gettext('Remove this add-on from the collection') + '" class="remove">' + gettext('Remove') + '</a></td>' +
|
||||
'</tr>'
|
||||
|
@ -639,6 +639,7 @@ $(document).ready(function () {
|
|||
.delegate('#collections-new form', 'submit', handleSubmit)
|
||||
.delegate('#ajax_new_collection', 'click', handleNew)
|
||||
.delegate('#collections-new-cancel', 'click', loadList)
|
||||
.delegate('#id_name', 'keyup', slugify)
|
||||
.delegate('#id_name', 'blur', slugify)
|
||||
.delegate('#edit_slug', 'click', show_slug_edit)
|
||||
.delegate('#id_slug', 'change', function() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче