add settings routes
This commit is contained in:
@@ -72,7 +72,7 @@
|
||||
<div class="tab-container">
|
||||
<div class="tab-bar" role="tablist">
|
||||
{%- for tab_label in labels -%}
|
||||
<button type="button" class="tab-button" role="tab" aria-selected="{{'true' if loop.index0==0 else 'false'}}" id="{{prefix+'-'+(tab_label | lower)+'-tab'}}" aria-controls="{{prefix+'-'+(tab_label | lower)+'-content'}}">{{tab_label}}</button>
|
||||
<button type="button" class="tab-button" role="tab" aria-selected="{{'true' if loop.index0==0 else 'false'}}" id="{{prefix+'-'+(tab_label | lower)+'-tab'}}" aria-controls="{{prefix+'-'+(tab_label | lower)+'-content'}}" disabled>{{tab_label}}</button>
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
{%- for tab_label in labels -%}
|
||||
@@ -87,25 +87,38 @@
|
||||
placeholder='Post content',
|
||||
prefill='',
|
||||
required=true,
|
||||
id='babycode-content'
|
||||
id='babycode-content',
|
||||
banned_tags=[]
|
||||
) -%}
|
||||
{%- call(idx) tabs(prefix='babycode', labels=['Write', 'Preview']) -%}
|
||||
{%- if idx == 0 -%}
|
||||
<span class="babycode-editor-controls">
|
||||
<span class="button-row">
|
||||
<button type="button" class="minimal"><b>B</b></button>
|
||||
<button type="button" class="minimal"><i>i</i></button>
|
||||
<button type="button" class="minimal"><s>S</s></button>
|
||||
<button type="button" class="minimal"><u>U</u></button>
|
||||
<button type="button" class="minimal"><code>://</code></button>
|
||||
<button type="button" class="minimal"><code></></code></button>
|
||||
<button type="button" class="minimal">1.</button>
|
||||
<button type="button" class="minimal">•</button>
|
||||
<button type="button" class="minimal"><img src="/static/emoji/angry.png" class="emoji"></button>
|
||||
<span class="babycode-editor-controls">
|
||||
<span class="button-row">
|
||||
<button type="button" class="minimal" disabled><b>B</b></button>
|
||||
<button type="button" class="minimal" disabled><i>i</i></button>
|
||||
<button type="button" class="minimal" disabled><s>S</s></button>
|
||||
<button type="button" class="minimal" disabled><u>U</u></button>
|
||||
<button type="button" class="minimal" disabled><code>://</code></button>
|
||||
<button type="button" class="minimal" disabled><code></></code></button>
|
||||
<button type="button" class="minimal" disabled>1.</button>
|
||||
<button type="button" class="minimal" disabled>•</button>
|
||||
<button type="button" class="minimal" disabled><img src="/static/emoji/angry.png" class="emoji"></button>
|
||||
</span>
|
||||
<span class="flex-last">{# stub: char count #}</span>
|
||||
</span>
|
||||
</span>
|
||||
<textarea name="babycode_content" id="{{id}}" class="babycode-editor" placeholder="{{placeholder}}" {{'required' if required else ''}}>{{ prefill }}</textarea>
|
||||
<a href="##">babycode help</a>
|
||||
<input type="hidden" name="babycode_banned_tags" id="{{id}}-banned-tags" value="{{banned_tags | unique | list | tojson | forceescape}}">
|
||||
<textarea name="babycode_content" id="{{id}}" class="babycode-editor" placeholder="{{placeholder}}" {{'required' if required else ''}} autocomplete="off" maxlength="5000">{{ prefill }}</textarea>
|
||||
{%- if banned_tags -%}
|
||||
<div>
|
||||
<span>Forbidden tags:</span>
|
||||
<ul class="horizontal">
|
||||
{%- for tag in banned_tags -%}
|
||||
<li><code class="inline-code">{{tag}}</code></li>
|
||||
{%- endfor -%}
|
||||
</ul>
|
||||
</div>
|
||||
{%- endif -%}
|
||||
<a href="##">babycode help</a>
|
||||
{%- endif -%}
|
||||
{%- endcall -%}
|
||||
{%- endmacro %}
|
||||
@@ -132,7 +145,7 @@
|
||||
<div class="usercard-inner">
|
||||
{{avatar(post.avatar_path)}}
|
||||
<div class="usercard-rest">
|
||||
<a href="{{url_for('users.user_page', username=post.username)}}">{{post.display_name if post.display_name else post.username}}</a>
|
||||
<a href="{{url_for('users.user_page', username=post.username)}}" class="usercard-username">{{post.display_name if post.display_name else post.username}}</a>
|
||||
<abbr title="mention">@{{post.username}}</abbr>
|
||||
<i>{{post.status}}</i>
|
||||
{%- set badges=post.badges_json | fromjson -%}
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
<h2 class="info">Reply to "{{thread.title}}"</h2>
|
||||
{{- babycode_editor_component() -}}
|
||||
<span>
|
||||
<input type="checkbox" checked name="subscribe" id="subscribe">
|
||||
<input type="checkbox" {{'' if session['dont_subscribe_by_default'] else 'checked'}} name="subscribe" id="subscribe" autocomplete=off>
|
||||
<label for="subscribe">Subscribe to thread</label>
|
||||
</span>
|
||||
<span><input type="submit" value="Post reply"></span>
|
||||
|
||||
80
app/templates/users/settings.html
Normal file
80
app/templates/users/settings.html
Normal file
@@ -0,0 +1,80 @@
|
||||
{%- from 'common/macros.html' import babycode_editor_component -%}
|
||||
{%- from 'common/macros.html' import subheader, avatar -%}
|
||||
{%- extends 'base.html' -%}
|
||||
{%- block title -%}settings{%- endblock -%}
|
||||
{%- block content -%}
|
||||
{%- set sub -%}
|
||||
{%- if user.is_guest() -%}You are a guest. Your customization options are limited until a moderator confirms your account.{%- endif -%}
|
||||
{%- endset -%}
|
||||
{{- subheader('User settings', sub) -}}
|
||||
{%- if not user.is_guest() -%}
|
||||
<fieldset class="plank">
|
||||
<legend>Avatar</legend>
|
||||
<form method="POST" class="avatar-form" action="{{url_for('users.set_avatar', username=user.username)}}" enctype="multipart/form-data">
|
||||
{{- avatar(user.get_avatar_url()) -}}
|
||||
<span class="avatar-form-controls">
|
||||
<label for="avatar" class="linkbutton alt">Upload…</label>
|
||||
<span class="avatar-form-size-label">1MB max. Will be cropped to square.</span>
|
||||
<input type="file" style="display: none;" id="avatar" name="avatar" accept="image/*">
|
||||
<input type="submit" value="Save">
|
||||
<input type="submit" class="warn" value="Clear" formaction="{{url_for('users.clear_avatar', username=user.username)}}">
|
||||
</span>
|
||||
</form>
|
||||
</fieldset>
|
||||
{%- endif -%}
|
||||
<fieldset class="plank">
|
||||
<legend>Change password</legend>
|
||||
<p>After you change your password, you will be logged out of all sessions and will need to log in again.</p>
|
||||
<form class="full-width" method="POST" action="{{ url_for('users.change_password', username=user.username) }}">
|
||||
<label for="current-password">Current password</label>
|
||||
<input type="password" name="current_password" id="current-password" autocomplete="current-password" required>
|
||||
<label for="new-password">New password</label>
|
||||
<input type="password" name="new_password" id="new-password" autocomplete="new-password" pattern="(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_])(?!.*\s).{10,255}" title="10+ chars with at least: 1 uppercase, 1 lowercase, 1 number, 1 special char, and no spaces" required>
|
||||
<label for="new-password2">Confirm new password</label>
|
||||
<input type="password" name="new_password2" id="new-password2" autocomplete="new-password" pattern="(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_])(?!.*\s).{10,255}" title="10+ chars with at least: 1 uppercase, 1 lowercase, 1 number, 1 special char, and no spaces" required>
|
||||
<input type="submit" value="Change password" class="warn">
|
||||
</form>
|
||||
</fieldset>
|
||||
{%- if not user.is_guest() -%}
|
||||
<fieldset class="plank">
|
||||
<legend>Personalization</legend>
|
||||
<form class="full-width" method="POST" action="{{ url_for('users.set_personalization', username=user.username)}}">
|
||||
<label for="sort-by">Sort threads by:</label>
|
||||
<select name="sort_by" id="sort-by" autocomplete=off>
|
||||
<option value="activity" {{ 'selected' if sort_by == 'activity' else '' }}>Activity</option>
|
||||
<option value="thread" {{ 'selected' if sort_by == 'thread' else '' }}>Newest</option>
|
||||
</select>
|
||||
<label for="display-name">Display name</label>
|
||||
<input type="text" name="display_name" id="display-name" value="{{user.display_name}}" placeholder="Same as username" pattern="(?:[\w!#$%^*\(\)\-_=+\[\]\{\}\|;:,.?\s]{3,50})?" title="Optional. 3-50 characters, no @, no <>, no &." maxlength="50" autocomplete=off>
|
||||
<label for="status">Status</label>
|
||||
<input type="text" name="status" id="status" maxlength="100" value="{{user.status}}" placeholder="Will be shown under your username on posts. Max. 100 characters." autocomplete="off">
|
||||
<span>
|
||||
<input type="checkbox" id="subscribe-by-default" name="subscribe_by_default" {{'' if session['dont_subscribe_by_default'] else 'checked'}} autocomplete="off">
|
||||
<label for="subscribe-by-default">Automatically subscribe to thread when responding</label>
|
||||
</span>
|
||||
<input type="submit" value="Save">
|
||||
</form>
|
||||
</fieldset>
|
||||
<fieldset class="plank">
|
||||
<legend>Signature</legend>
|
||||
<form method="POST" class="full-width" action="{{url_for('users.set_sig', username=user.username)}}">
|
||||
<p>The signature will appear under each of your posts.</p>
|
||||
{{babycode_editor_component(id='signature-content', placeholder='Signature content', prefill=user.signature_original_markup, required=false, banned_tags=['@mention'])}}
|
||||
<input type="submit" value="Save signature">
|
||||
</form>
|
||||
</fieldset>
|
||||
{#<fieldset class="plank">
|
||||
<legend>About me/Bio</legend>
|
||||
<form method="POST" class="full-width">
|
||||
<span>Your bio will appear on your profile.</span>
|
||||
{{babycode_editor_component(id='bio-content', placeholder='Bio content', prefill=user.signature_original_markup, required=false, banned_tags=['@mention'])}}
|
||||
<input type="submit" value="Save bio">
|
||||
</form>
|
||||
</fieldset>#}
|
||||
<fieldset class="plank">
|
||||
<legend>Badges</legend>
|
||||
<div>Loading badges…</div>
|
||||
<div>If badges fail to load, make sure JS is enabled.</div>
|
||||
</fieldset>
|
||||
{%- endif -%}
|
||||
{%- endblock -%}
|
||||
@@ -14,9 +14,9 @@ Please read the rules etc. stub
|
||||
<label for="username">Username</label>
|
||||
<input type="text" id="username" name="username" pattern="[a-zA-Z0-9_\-]{3,24}" title="3-24 characters. Only upper and lowercase letters, digits, hyphens, and underscores" autocomplete="username" required>
|
||||
<label for="password">Create password</label>
|
||||
<input type="password" id="password" name="password" pattern="(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_])(?!.*\s).{10,255}" title="10+ chars with: 1 uppercase, 1 lowercase, 1 number, 1 special char, and no spaces" autocomplete="new-password" required>
|
||||
<input type="password" id="password" name="password" pattern="(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_])(?!.*\s).{10,255}" title="10+ chars with at least: 1 uppercase, 1 lowercase, 1 number, 1 special char, and no spaces" autocomplete="new-password" required>
|
||||
<label for="password2">Confirm password</label>
|
||||
<input type="password" id="password2" name="password" pattern="(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_])(?!.*\s).{10,255}" title="10+ chars with: 1 uppercase, 1 lowercase, 1 number, 1 special char, and no spaces" autocomplete="new-password" required>
|
||||
<input type="password" id="password2" name="password" pattern="(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_])(?!.*\s).{10,255}" title="10+ chars with at least: 1 uppercase, 1 lowercase, 1 number, 1 special char, and no spaces" autocomplete="new-password" required>
|
||||
<span><input type="checkbox" name="remember" id="remember"> <label for="remember">Remember me</label></span>
|
||||
<input type="submit" value="Sign up">
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user