account: set markdown editor for signature and bio
This commit is contained in:
parent
e5dafb68e5
commit
4df78eb0c3
|
@ -50,6 +50,8 @@ def edit_account():
|
|||
flash('Erreur lors de la modification', 'error')
|
||||
else:
|
||||
form.theme.data = current_user.theme or 'default_theme'
|
||||
form.signature.data = current_user.signature
|
||||
form.biography.data = current_user.bio
|
||||
|
||||
return render('account/account.html', scripts=["+scripts/entropy.js"],
|
||||
form=form)
|
||||
|
|
|
@ -71,6 +71,9 @@ def adm_edit_account(user_id):
|
|||
return redirect(request.url)
|
||||
else:
|
||||
flash('Erreur lors de la modification', 'error')
|
||||
else:
|
||||
form.signature.data = user.signature
|
||||
form.biography.data = user.bio
|
||||
|
||||
# Trophies
|
||||
if trophy_form.submit.data:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{% extends "base/base.html" %}
|
||||
{% import "widgets/editor.html" as widget_editor %}
|
||||
|
||||
{% set tabtitle = "Gestion du compte" %}
|
||||
|
||||
|
@ -68,18 +69,10 @@
|
|||
{% endfor %}
|
||||
</div>
|
||||
<div>
|
||||
{{ form.signature.label }}
|
||||
<textarea id="{{ form.signature.name }}" name="{{ form.signature.name }}">{{ current_user.signature }}</textarea>
|
||||
{% for error in form.signature.errors %}
|
||||
<span class="msgerror">{{ error }}</span>
|
||||
{% endfor %}
|
||||
{{ widget_editor.text_editor(form.signature) }}
|
||||
</div>
|
||||
<div>
|
||||
{{ form.biography.label }}
|
||||
<textarea id="{{ form.biography.name }}" name="{{ form.biography.name }}">{{ current_user.bio }}</textarea>
|
||||
{% for error in form.biography.errors %}
|
||||
<span class="msgerror">{{ error }}</span>
|
||||
{% endfor %}
|
||||
{{ widget_editor.text_editor(form.biography) }}
|
||||
</div>
|
||||
|
||||
<h2>Préférences</h2>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{% extends "base/base.html" %}
|
||||
{% import "widgets/editor.html" as widget_editor %}
|
||||
|
||||
{% set tabtitle = "Administration - Édition du compte de " + user.name %}
|
||||
|
||||
|
@ -81,18 +82,10 @@
|
|||
{% endfor %}
|
||||
</div>
|
||||
<div>
|
||||
{{ form.signature.label }}
|
||||
<textarea id="{{ form.signature.name }}" name="{{ form.signature.name }}">{{ user.signature }}</textarea>
|
||||
{% for error in form.signature.errors %}
|
||||
<span class="msgerror">{{ error }}</span>
|
||||
{% endfor %}
|
||||
{{ widget_editor.text_editor(form.signature) }}
|
||||
</div>
|
||||
<div>
|
||||
{{ form.biography.label }}
|
||||
<textarea id="{{ form.biography.name }}" name="{{ form.biography.name }}">{{ user.bio }}</textarea>
|
||||
{% for error in form.biography.errors %}
|
||||
<span class="msgerror">{{ error }}</span>
|
||||
{% endfor %}
|
||||
{{ widget_editor.text_editor(form.biography) }}
|
||||
</div>
|
||||
|
||||
<h2>Préférences</h2>
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
{% macro text_editor(field, label=True, autofocus=false) %}
|
||||
<div class="editor">
|
||||
<!-- Field label if needed -->
|
||||
{{ field.label if label }}
|
||||
|
||||
<!-- Buttons for the text editor -->
|
||||
<div class="btn-group">
|
||||
<!-- Underline, Bold, Italic, Strikethrough -->
|
||||
|
@ -172,8 +175,7 @@
|
|||
<a href="#">Aide</a>
|
||||
</div>
|
||||
|
||||
<!-- Field & desc -->
|
||||
{{ field.label if label }}
|
||||
<!-- Field -->
|
||||
{{ field() }}
|
||||
|
||||
<!-- Comment preview -->
|
||||
|
|
Loading…
Reference in New Issue