From 1ce0bf2ef7bf7a8812adad89b5490adb3ea718a8 Mon Sep 17 00:00:00 2001 From: Pierre Jaury Date: Thu, 18 Aug 2016 20:42:35 +0200 Subject: [PATCH] Update the user settings view with a slider --- admin/freeposte/admin/forms.py | 2 +- admin/freeposte/admin/templates/user/settings.html | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/admin/freeposte/admin/forms.py b/admin/freeposte/admin/forms.py index e15b9d5c..8c8c4844 100644 --- a/admin/freeposte/admin/forms.py +++ b/admin/freeposte/admin/forms.py @@ -59,7 +59,7 @@ class UserForm(Form): class UserSettingsForm(Form): displayed_name = fields.StringField('Displayed name') spam_enabled = fields.BooleanField('Enable spam filter') - spam_threshold = fields.DecimalField('Spam filter sensitivity') + spam_threshold = fields_.IntegerSliderField('Spam filter threshold') submit = fields.SubmitField('Save settings') diff --git a/admin/freeposte/admin/templates/user/settings.html b/admin/freeposte/admin/templates/user/settings.html index ef31cba7..229510e5 100644 --- a/admin/freeposte/admin/templates/user/settings.html +++ b/admin/freeposte/admin/templates/user/settings.html @@ -1,4 +1,4 @@ -{% extends "form.html" %} +{% extends "base.html" %} {% block title %} User settings @@ -7,3 +7,15 @@ User settings {% block subtitle %} {{ user }} {% endblock %} + +{% block box_content %} +
+ {{ form.hidden_tag() }} + {{ macros.form_field(form.displayed_name) }} + {{ macros.form_field(form.spam_enabled) }} + {{ macros.form_field(form.spam_threshold, step=1, max=15, + prepend=''+(form.spam_threshold.data).__int__().__str__()+' / 15', + oninput='$("#threshold").text(this.value);') }} + {{ macros.form_field(form.submit) }} +
+{% endblock %}