diff --git a/src/mailmanweb/forms.py b/src/mailmanweb/forms.py index 7560d52..00aa07b 100644 --- a/src/mailmanweb/forms.py +++ b/src/mailmanweb/forms.py @@ -179,7 +179,6 @@ class ListSubscribe(FieldsetForm): """Form fields to join an existing list. """ - fqdn_listname = forms.EmailField(widget = forms.HiddenInput()) email = forms.EmailField(label = _('Your email address'), error_messages = {'required': _('Please enter an email address.'), 'invalid': _('Please enter a valid email address.')}) @@ -188,7 +187,6 @@ class ListUnsubscribe(FieldsetForm): """Form fields to leave an existing list. """ - fqdn_listname = forms.EmailField(widget=forms.HiddenInput()) email = forms.EmailField(label = _('Your email address'), error_messages = { 'required': _('Please enter an email address.'), diff --git a/src/mailmanweb/static/mailmanweb/default/css/style.css b/src/mailmanweb/static/mailmanweb/default/css/style.css index 80a2b8f..6c6e0e3 100755 --- a/src/mailmanweb/static/mailmanweb/default/css/style.css +++ b/src/mailmanweb/static/mailmanweb/default/css/style.css @@ -94,6 +94,19 @@ font-size: 14px; } +/* messages */ +.mm_messages { + margin: 10px 0 0 0; + list-style: none; +} + +/* (un)subscribe forms in list_summary */ +.list_summary .accordion { + float: right; + width: 300px; + margin-left: 20px; +} + /* forms */ fieldset { border: none; diff --git a/src/mailmanweb/templates/mailmanweb/base.html b/src/mailmanweb/templates/mailmanweb/base.html index e6ae9c8..b389fdd 100644 --- a/src/mailmanweb/templates/mailmanweb/base.html +++ b/src/mailmanweb/templates/mailmanweb/base.html @@ -17,7 +17,7 @@ - +
@@ -54,7 +54,7 @@ {% if messages %} {% endif %} diff --git a/src/mailmanweb/templates/mailmanweb/lists/subscribe.html b/src/mailmanweb/templates/mailmanweb/lists/subscribe.html index b5d77b2..76c2d48 100644 --- a/src/mailmanweb/templates/mailmanweb/lists/subscribe.html +++ b/src/mailmanweb/templates/mailmanweb/lists/subscribe.html @@ -2,6 +2,9 @@ {% load i18n %} {% block main %} -

{% trans 'Delete List' %} {{ list.fqdn_listname}}

-

{% trans 'Are you sure you want to delete' %} {{ list.fqdn_listname }}?

+

{% trans 'Subscribe' %} {{ list.fqdn_listname}}

+
+ {{form.as_p}} + +
{% endblock main %} diff --git a/src/mailmanweb/templates/mailmanweb/lists/summary.html b/src/mailmanweb/templates/mailmanweb/lists/summary.html index bd8ac30..e1399e5 100644 --- a/src/mailmanweb/templates/mailmanweb/lists/summary.html +++ b/src/mailmanweb/templates/mailmanweb/lists/summary.html @@ -1,14 +1,14 @@ {% extends "mailmanweb/base.html" %} {% load i18n %} +{% block body_class %}list_summary{% endblock %} + {% block main %} {% if user.is_superuser %} {% include 'mailmanweb/menu/list_nav.html' %} {% endif %}

{{list.real_name}}

-

{{list.settings.description }} -

@@ -38,7 +38,8 @@
-
+ +

{{list.settings.description }} {% endblock %} diff --git a/src/mailmanweb/views.py b/src/mailmanweb/views.py index a9f7b00..e27c7dc 100644 --- a/src/mailmanweb/views.py +++ b/src/mailmanweb/views.py @@ -209,12 +209,23 @@ """ try: the_list = List.objects.get_or_404(fqdn_listname=fqdn_listname) + if request.method == 'POST': + form = ListSubscribe(request.POST) + if form.is_valid(): + email = request.POST.get('email') + real_name = request.POST.get('real_name') + the_list.subscribe(email, real_name) + messages.success(request,_('You are now subscribed to %s.' % the_list.fqdn_listname)) + return redirect('list_summary', the_list.fqdn_listname) + else: + logger.debug(form) + else: + form = ListSubscribe() except MailmanApiError: return utils.render_api_error(request) - if request.method == 'POST': - form = ListSubscribe(request.POST) - else: - form = ListSubscribe() + except HTTPError, e: + messages.error(request,e.msg) + return redirect('list_summary', the_list.fqdn_listname) return render_to_response('mailmanweb/lists/subscribe.html', {'form': form, 'list': the_list,}, context_instance=RequestContext(request))