Skip to content

Commit

Permalink
Related to #34, allow multiple forward destinations
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiyou committed Aug 11, 2016
1 parent 163494c commit 68a1fb4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 1 addition & 3 deletions admin/freeposte/admin/forms.py
Expand Up @@ -71,9 +71,7 @@ class UserPasswordForm(Form):

class UserForwardForm(Form):
forward_enabled = fields.BooleanField('Enable forwarding')
forward_destination = fields.StringField(
'Destination', [validators.Optional(), validators.Email()]
)
forward_destination = DestinationField()
submit = fields.SubmitField('Update')


Expand Down
2 changes: 1 addition & 1 deletion admin/freeposte/admin/templates/alias/create.html
Expand Up @@ -12,7 +12,7 @@
<form class="form" method="post" role="form">
{{ form.hidden_tag() }}
{{ macros.form_field(form.localpart, append='<span class="input-group-addon">@'+domain.name+'</span>') }}
{{ macros.form_field(form.destination, id='destination') }}
{{ macros.form_field(form.destination) }}
{{ macros.form_field(form.comment) }}
{{ macros.form_field(form.submit) }}
<script>
Expand Down
9 changes: 9 additions & 0 deletions admin/freeposte/admin/templates/user/forward.html
Expand Up @@ -17,5 +17,14 @@
{{ macros.form_field(form.forward_destination,
**{("enabled" if user.forward_enabled else "disabled"): ""}) }}
{{ macros.form_field(form.submit) }}
<script>
$("form").on("submit", function() {
$("#forward_destination").removeAttr("disabled");
});
$("#forward_destination").select2({
tags: true,
tokenSeparators: [',', ' ']
})
</script>
</form>
{% endblock %}

0 comments on commit 68a1fb4

Please sign in to comment.