Merge branch 'dev' into preprod

This commit is contained in:
Darks 2020-09-18 19:44:31 +02:00
commit 6d42ff7898
Signed by: Darks
GPG Key ID: 7515644268BE1433
12 changed files with 193 additions and 34 deletions

View File

@ -7,7 +7,7 @@
vertical-align: middle;
}
.form form > div:not(:last-child) {
.form form > div:not(:last-child):not(.editor-toolbar) {
margin-bottom: 16px;
}

7
app/static/css/simplemde.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,113 @@
/* Theme metadata
@NAME: FK's Dark Theme
@AUTHOR: Flammingkite
*/
/*
#22292c = gris bleuté, menu original
#1c2122 = gris foncé, intérieur du menu
*/
:root {
--background: #1c2124; /*22292c, 1c2124, 1E1E1E, 242424,*/
--text: #f2f2f2;
--links: #fe2d2d;
--ok: #149641;
--ok-text: #ffffff;
--ok-active: #0f7331;
--warn: #f59f25;
--warn-text: #ffffff;
--warn-active: #ea9720;
--error: #d23a2f;
--error-text: #ffffff;
--error-active: #b32a20;
--info: #2e7aec;
--info-text: #ffffff;
--info-active: #215ab0;
--hr-border: 1px solid #b0b0b0;
}
.form {
--background: #ffffff;
--text: #000000;
--border: 1px solid #c8c8c8;
--border-focused: #7cade0;
--shadow-focused: rgba(87, 143, 228, 0.5);
}
.editor button {
--background: #ffffff;
--text: #000000;
--border: 1px solid rgba(0, 0, 0, 0);
--border-focused: 1px solid rgba(0, 0, 0, .5);
}
#light-menu {
--background: #1c2124; /*1c2124, 22292c*/
--text: #ffffff;
--icons: #ffffff;
--shadow: 0 0 4px rgba(255, 255, 255, 0.15);
--logo-bg: #bf1c11;
--logo-shadow: 0 0 2px rgba(0, 0, 0, .7);
--logo-active: #d72411;
}
#menu {
--background: #1c2124;
--text: #ffffff;
--icons: #ffffff;
--shadow: 0 0 8px rgba(0, 0, 0, 0.3);
--input-bg: #22292c;
--input-text: #ffffff;
--input-border: 1px solid #474747;
}
header {
--background: #0d1215; /*5a5a5a*/
--text: #000000;
--border: 1px solid #d0d0d0;
}
footer {
--background: rgba(0, 0, 0, 1); /* #ffffff */
--text: #a0a0a0;
--border: #d0d0d0;
}
.flash {
--background: #ffffff;
--text: #212121;
--shadow: 0 1px 12px rgba(0, 0, 0, 0.3);
/* Uncomment to inherit :root values
--ok: #149641;
--warn: #f59f25;
--error: #d23a2f;
--info: #2e7aec; */
--btn-bg: rgba(0, 0, 0, 0);
--btn-text: #000000;
--btn-bg-active: rgba(0, 0, 0, .15);
}
.profile-xp {
--background: #e0e0e0;
--border: 1px solid #c0c0c0;
--background-xp: #f85555;
--border-xp: 1px solid #d03333;
}
table tr:nth-child(even) { --background: rgba(255, 255, 255, 0.15); }
table tr:nth-child(odd) { --background: #1c2124; } /* 22292c = background, 1c2124, 1e1e1e*/

15
app/static/scripts/simplemde.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -20,7 +20,7 @@
</div>
<div style="padding:30px;">
<div style="font-size:115%;font-style:italic;margin-bottom:15px;">
{{ member.signature }}
{{ member.signature|md }}
</div>
<div>
Membre depuis le {{ member.register_date|date('%Y-%m-%d') }}
@ -30,7 +30,7 @@
<h2>Présentation</h2>
<div>
{{ member.bio }}
{{ member.bio|md }}
</div>
<h2>Groupes</h2>

View File

@ -13,7 +13,7 @@
<h1>{{ t.title }}</h1>
<table class="thread"><tr>
<td class="author">{{ widget_user.profile(t.author ) }}</td>
<td>{{ t.thread.top_comment.text }}</td>
<td>{{ t.thread.top_comment.text|md }}</td>
</tr></table>
{{ widget_pagination.paginate(comments, 'forum_topic', t, {'f': t.forum}) }}
@ -34,8 +34,9 @@
| <a href="#">Supprimer</a>
</div>
<!--<hr>-->
<p>{{ c.text }}</p>
{{ c.text|md }}
{{ widget_attachments.attachments(c) }}
{{ c.author.signature|md }}
{% elif loop.index0 != 0 %}
<div>Ce message est le top comment</div>
{% endif %}

View File

@ -1,28 +1,23 @@
{% macro text_editor(field, label=True) %}
<div class="editor">
{{ field.label if label }}
<div class="buttons">
<button type="button" title="Gras" onclick="edit(this, 'bold')"><img src="{{ url_for('static', filename = 'icons/editor/format-bold.svg') }}" alt="Gras" /></button>
<button type="button" title="Italique" onclick="edit(this, 'italic')"><img src="{{ url_for('static', filename = 'icons/editor/format-italic.svg') }}" alt="Italique" /></button>
<button type="button" title="Souligné" onclick="edit(this, 'underline')"><img src="{{ url_for('static', filename = 'icons/editor/format-underline.svg') }}" alt="Souligné" /></button>
<button type="button" title="Barré" onclick="edit(this, 'strikethrough')"><img src="{{ url_for('static', filename = 'icons/editor/format-strikethrough.svg') }}" alt="Barré" /></button>
<button type="button" title="Titre 1" onclick="edit(this, 'h1')"><img src="{{ url_for('static', filename = 'icons/editor/format-header-1.svg') }}" alt="Titre 1" /></button>
<button type="button" title="Titre 2" onclick="edit(this, 'h2')"><img src="{{ url_for('static', filename = 'icons/editor/format-header-2.svg') }}" alt="Titre 2" /></button>
<button type="button" title="Titre 3" onclick="edit(this, 'h3')"><img src="{{ url_for('static', filename = 'icons/editor/format-header-3.svg') }}" alt="Titre 3" /></button>
<button type="button" title="Liste à puces" onclick="edit(this, 'list-bulleted')"><img src="{{ url_for('static', filename = 'icons/editor/format-list-bulleted.svg') }}" alt="Liste à puces" /></button>
<button type="button" title="Liste numérotée" onclick="edit(this, 'list-numbered')"><img src="{{ url_for('static', filename = 'icons/editor/format-list-numbered.svg') }}" alt="Liste numérotée" /></button>
<button type="button" title="Citation" onclick="edit(this, 'quote')"><img src="{{ url_for('static', filename = 'icons/editor/format-quote-close.svg') }}" alt="Citation" /></button>
<button type="button" title="Code" onclick="edit(this, 'code')"><img src="{{ url_for('static', filename = 'icons/editor/code-braces.svg') }}" alt="Code" /></button>
<button type="button" title="Spoiler" onclick="edit(this, 'spoiler')"><img src="{{ url_for('static', filename = 'icons/editor/comment-alert-outline.svg') }}" alt="Spoiler" /></button>
<button type="button" title="Lien" onclick="edit(this, 'link')"><img src="{{ url_for('static', filename = 'icons/editor/link-variant.svg') }}" alt="Lien" /></button>
</div>
{{ field() }}
{% for error in field.errors %}
<span class="msgerror">{{ error }}</span>
{% endfor %}
</div>
{{ field.label if label }}
{{ field() }}
<script>
window.addEventListener("load", function(){
var simplemde = new SimpleMDE({
element: document.getElementById("{{field.name}}"),
autofocus: true,
hideIcons: ["guide", "side-by-side", "fullscreen", "heading"],
showIcons: ["code", "table", "horizontal-rule", "ordered-list", "unordered-list", "heading-1", "heading-2", "heading-3", "strikethrough"],
insertTexts: {
image: ["![](https://", ")"],
link: ["[", "](https://)"],
},
spellChecker: false,
forceSync: true,
});
});
</script>
{% for error in field.errors %}
<span class="msgerror">{{ error }}</span>
{% endfor %}
{% endmacro %}

View File

@ -1,3 +1,3 @@
# Register filters here
from app.utils.filters import date, is_title, pluralize
from app.utils.filters import date, is_title, markdown, pluralize

View File

@ -0,0 +1,13 @@
from app import app
from markupsafe import Markup
from markdown import markdown
from werkzeug.utils import escape
@app.template_filter('md')
def md(text):
"""
Converts markdown to html5
"""
# Escape html chars because markdown does not
safe = escape(text)
return Markup(markdown(safe))

View File

@ -17,19 +17,19 @@ def render(*args, styles=[], scripts=[], **kwargs):
'css/header.css',
'css/container.css',
'css/widgets.css',
'css/editor.css',
'css/form.css',
'css/footer.css',
'css/flash.css',
'css/table.css',
'css/pagination.css',
'css/responsive.css',
'css/simplemde.min.css',
]
scripts_ = [
'scripts/trigger_menu.js',
'scripts/pc-utils.js',
'scripts/smartphone_patch.js',
'scripts/editor.js',
'scripts/simplemde.min.js'
]
for s in styles:

View File

@ -9,3 +9,4 @@ class LocalConfig(object):
SECRET_KEY = "a-random-secret-key" # CHANGE THIS VALUE *NOW*
AVATARS_FOLDER = '/home/pc/data/avatars/'
ENABLE_GUEST_POST = True
SEND_MAILS = True

View File

@ -42,6 +42,8 @@ Type 'add-group <member> #<group-id>' to add a new member to a group.
Type 'create-trophies' to reset trophies and titles and their icons.
Type 'create-forums' to reset the forum tree.
Type 'enable-user' to enable a email-disabled account.
"""
#
@ -257,6 +259,17 @@ def add_group(member, group):
db.session.add(m)
db.session.commit()
def enable_user(member):
norm = unicode_names.normalize(member)
m = Member.query.filter_by(norm=norm).first()
if m is None:
print(f"error: no member has a normalized name of '{norm}'")
return
m.email_confirmed = True
db.session.add(m)
db.session.commit()
#
# Main program
#
@ -274,6 +287,7 @@ commands = {
"create-trophies": create_trophies,
"create-forums": create_forums,
"add-group": add_group,
"enable-user": enable_user,
}
while True: