Add a clear-all link to notifications.
This commit is contained in:
Родитель
ff1eca16e4
Коммит
c7995bdd11
|
@ -30,7 +30,7 @@
|
|||
title="{{ _('Permanently delete your account') }}">{{ _('Delete Account') }}</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="primary prettyform" role="main">
|
||||
<div id="user_edit" class="primary prettyform" role="main">
|
||||
{% include "messages.html" %}
|
||||
<form method="post" action="" class="user-input island"
|
||||
enctype="multipart/form-data">
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<li>
|
||||
<label>
|
||||
{{ title }}
|
||||
<div class='more'>
|
||||
<a class='more-none' href='#'>none</a> ·
|
||||
<a class='more-all' href='#'>all</a>
|
||||
</div>
|
||||
</label>
|
||||
<ul class='checkboxes'>
|
||||
{% for option in options %}
|
||||
{{ option|safe }}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
|
@ -137,8 +137,6 @@ class TestEdit(UserViewBase):
|
|||
eq_(unicode(self.get_profile().bio), data['bio'])
|
||||
|
||||
def test_edit_notifications(self):
|
||||
import nose
|
||||
raise nose.SkipTest()
|
||||
post = self.correct.copy()
|
||||
post['notifications'] = [2, 4, 6]
|
||||
|
||||
|
@ -152,6 +150,9 @@ class TestEdit(UserViewBase):
|
|||
doc = pq(res.content)
|
||||
eq_(doc('[name=notifications]:checked').length, 7)
|
||||
|
||||
eq_(doc('.more-none').length, len(email.NOTIFICATION_GROUPS))
|
||||
eq_(doc('.more-all').length, len(email.NOTIFICATION_GROUPS))
|
||||
|
||||
|
||||
class TestPasswordAdmin(UserViewBase):
|
||||
fixtures = ['base/users']
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from django import forms
|
||||
from django.conf import settings
|
||||
from django.template import Context, loader
|
||||
from django.utils.encoding import force_unicode
|
||||
from django.utils.html import conditional_escape
|
||||
from django.utils.safestring import mark_safe
|
||||
|
@ -43,10 +44,11 @@ class NotificationsSelectMultiple(forms.CheckboxSelectMultiple):
|
|||
))
|
||||
|
||||
output = []
|
||||
template = u'<li><label>%s</label><ul class="checkboxes">%s</ul></li>'
|
||||
template_url = 'users/edit_notification_checkboxes.html'
|
||||
for e, name in email.NOTIFICATION_GROUPS.items():
|
||||
if e in groups:
|
||||
output.append(template % (name, u'\n'.join(groups[e])))
|
||||
context = {'title': name, 'options': groups[e]}
|
||||
output.append(loader.get_template(template_url).render(Context(context)))
|
||||
|
||||
return mark_safe(u'<ol class="complex">%s</ul>' % u'\n'.join(output))
|
||||
|
||||
|
|
|
@ -6,4 +6,7 @@
|
|||
margin-left: 135px;
|
||||
width: 100px;
|
||||
}
|
||||
.more {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
$(function() {
|
||||
if($('#user_edit').exists()) {
|
||||
$('.more-all, .more-none').click(_pd(function() {
|
||||
var $this = $(this);
|
||||
$this.closest('li').find('input:not([disabled]').attr('checked', $this.hasClass('more-all'));
|
||||
}));
|
||||
}
|
||||
});
|
|
@ -562,6 +562,7 @@ MINIFY_BUNDLES = {
|
|||
|
||||
# Users
|
||||
'js/zamboni/users.js',
|
||||
'js/impala/users.js',
|
||||
|
||||
# Fix-up outgoing links
|
||||
'js/zamboni/outgoing_links.js',
|
||||
|
|
Загрузка…
Ссылка в новой задаче