Update the user settings view with a slider

master
Pierre Jaury 8 years ago
parent 76c33df91f
commit 1ce0bf2ef7

@ -59,7 +59,7 @@ class UserForm(Form):
class UserSettingsForm(Form): class UserSettingsForm(Form):
displayed_name = fields.StringField('Displayed name') displayed_name = fields.StringField('Displayed name')
spam_enabled = fields.BooleanField('Enable spam filter') 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') submit = fields.SubmitField('Save settings')

@ -1,4 +1,4 @@
{% extends "form.html" %} {% extends "base.html" %}
{% block title %} {% block title %}
User settings User settings
@ -7,3 +7,15 @@ User settings
{% block subtitle %} {% block subtitle %}
{{ user }} {{ user }}
{% endblock %} {% endblock %}
{% block box_content %}
<form class="form" method="post" role="form">
{{ 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='<span class="input-group-addon"><span id="threshold">'+(form.spam_threshold.data).__int__().__str__()+'</span>&nbsp;/&nbsp;15</span>',
oninput='$("#threshold").text(this.value);') }}
{{ macros.form_field(form.submit) }}
</form>
{% endblock %}

Loading…
Cancel
Save