Compare commits

...

3 Commits

15 changed files with 100 additions and 49 deletions

View File

@@ -60,11 +60,3 @@ def get_badges():
uploads = BadgeUploads.get_for_user(get_active_user().id) uploads = BadgeUploads.get_for_user(get_active_user().id)
badges = sorted(Badges.findall({'user_id': int(get_active_user().id)}), key=lambda x: x['sort_order']) badges = sorted(Badges.findall({'user_id': int(get_active_user().id)}), key=lambda x: x['sort_order'])
return render_template('components/badge_editor_badges.html', uploads=uploads, badges=badges) return render_template('components/badge_editor_badges.html', uploads=uploads, badges=badges)
@bp.get('/badge-editor/template')
@login_required
@account_required
def get_badge_template():
uploads = BadgeUploads.get_for_user(get_active_user().id)
return render_template('components/badge_editor_template.html', uploads=uploads)

View File

@@ -394,7 +394,8 @@ def page(username):
@login_required @login_required
@redirect_to_own @redirect_to_own
def settings(username): def settings(username):
return render_template('users/settings.html') uploads = BadgeUploads.get_for_user(get_active_user().id)
return render_template('users/settings.html', uploads=uploads)
@bp.post('/<username>/settings') @bp.post('/<username>/settings')

View File

@@ -331,8 +331,8 @@
{% else %} {% else %}
{% set selected_href = defaults[0].file_path %} {% set selected_href = defaults[0].file_path %}
{% endif %} {% endif %}
<bitty-7-0 data-connect="{{ '/static/js/bitties/pyrom-bitty.js' | cachebust }} BadgeEditorBadge" data-listeners="click input submit change"> <bitty-7-0 data-connect="{{ '/static/js/bitties/pyrom-bitty.js' | cachebust }} BadgeEditorBadge" data-listeners="click input submit change" data-receive="deleteBadge">
<div class="settings-badge-container" data-receive="deleteBadge"> <div class="settings-badge-container">
<div class="settings-badge-select"> <div class="settings-badge-select">
<select data-send="badgeUpdatePreview badgeToggleFilePicker" name="badge_choice[]" required> <select data-send="badgeUpdatePreview badgeToggleFilePicker" name="badge_choice[]" required>
<optgroup label="Default"> <optgroup label="Default">

View File

@@ -1,4 +1,4 @@
{% from 'common/macros.html' import badge_editor_single with context %} {% from 'common/macros.html' import badge_editor_single %}
{% for badge in badges %} {% for badge in badges %}
{{ badge_editor_single(options=uploads, selected=badge.upload, badge=badge) }} {{ badge_editor_single(options=uploads, selected=badge.upload, badge=badge) }}
{% endfor %} {% endfor %}

View File

@@ -1,2 +1,2 @@
{% from 'common/macros.html' import badge_editor_single with context %} {% from 'common/macros.html' import badge_editor_single %}
{{ badge_editor_single(options=uploads) }} {{ badge_editor_single(options=uploads) }}

View File

@@ -1,4 +1,4 @@
{% from 'common/macros.html' import babycode_editor_component %} {% from 'common/macros.html' import babycode_editor_component, badge_editor_single %}
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}settings{% endblock %} {% block title %}settings{% endblock %}
{% block content %} {% block content %}
@@ -68,4 +68,8 @@
<a class="linkbutton critical" href="{{ url_for('users.delete_page', username=active_user.username) }}">Delete account</a> <a class="linkbutton critical" href="{{ url_for('users.delete_page', username=active_user.username) }}">Delete account</a>
</div> </div>
</div> </div>
<template id='badge-editor-template'>
{{ badge_editor_single(options=uploads) }}
</template>
{% endblock %} {% endblock %}

View File

@@ -60,11 +60,6 @@ body {
color: black; color: black;
} }
@media (orientation: portrait) {
body {
margin: 20px 0;
}
}
:where(a:link) { :where(a:link) {
color: #c11c1c; color: #c11c1c;
} }
@@ -1539,3 +1534,19 @@ img.badge-button {
background-color: rgb(186.8501612903, 155.5098387097, 132.6498387097); background-color: rgb(186.8501612903, 155.5098387097, 132.6498387097);
color: black; color: black;
} }
@media (orientation: portrait) {
body {
margin: 20px 0;
}
.guide-container {
grid-template-areas: "guide-toc" "guide-topics";
grid-template-columns: unset;
}
.guide-toc {
position: unset;
}
.guide-section {
padding-right: 20px;
}
}

View File

@@ -60,11 +60,6 @@ body {
color: #e6e6e6; color: #e6e6e6;
} }
@media (orientation: portrait) {
body {
margin: 20px 0;
}
}
:where(a:link) { :where(a:link) {
color: #e87fe1; color: #e87fe1;
} }
@@ -1540,6 +1535,21 @@ img.badge-button {
color: black; color: black;
} }
@media (orientation: portrait) {
body {
margin: 20px 0;
}
.guide-container {
grid-template-areas: "guide-toc" "guide-topics";
grid-template-columns: unset;
}
.guide-toc {
position: unset;
}
.guide-section {
padding-right: 20px;
}
}
#topnav { #topnav {
margin-bottom: 10px; margin-bottom: 10px;
border: 10px solid rgb(40, 40, 40); border: 10px solid rgb(40, 40, 40);

View File

@@ -60,11 +60,6 @@ body {
color: black; color: black;
} }
@media (orientation: portrait) {
body {
margin: 12px 0;
}
}
:where(a:link) { :where(a:link) {
color: black; color: black;
} }
@@ -1540,6 +1535,21 @@ img.badge-button {
color: black; color: black;
} }
@media (orientation: portrait) {
body {
margin: 12px 0;
}
.guide-container {
grid-template-areas: "guide-toc" "guide-topics";
grid-template-columns: unset;
}
.guide-toc {
position: unset;
}
.guide-section {
padding-right: 12px;
}
}
#topnav { #topnav {
border-top-left-radius: 16px; border-top-left-radius: 16px;
border-top-right-radius: 16px; border-top-right-radius: 16px;

View File

@@ -60,11 +60,6 @@ body {
color: black; color: black;
} }
@media (orientation: portrait) {
body {
margin: 20px 0;
}
}
:where(a:link) { :where(a:link) {
color: #711579; color: #711579;
} }
@@ -1539,3 +1534,19 @@ img.badge-button {
background-color: rgb(186.8501612903, 155.5098387097, 132.6498387097); background-color: rgb(186.8501612903, 155.5098387097, 132.6498387097);
color: black; color: black;
} }
@media (orientation: portrait) {
body {
margin: 20px 0;
}
.guide-container {
grid-template-areas: "guide-toc" "guide-topics";
grid-template-columns: unset;
}
.guide-toc {
position: unset;
}
.guide-section {
padding-right: 20px;
}
}

View File

@@ -23,7 +23,6 @@
if (inThread()) { if (inThread()) {
const form = ta.closest('.post-edit-form'); const form = ta.closest('.post-edit-form');
console.log(ta.closest('.post-edit-form'));
if (form){ if (form){
form.addEventListener("submit", () => { form.addEventListener("submit", () => {
localStorage.removeItem(window.location.pathname); localStorage.removeItem(window.location.pathname);

View File

@@ -287,11 +287,8 @@ export class BadgeEditorForm {
return; return;
} }
if (this.#badgeTemplate === undefined){ if (this.#badgeTemplate === undefined){
const badge = await this.api.getHTML(`${badgeEditorEndpoint}/template`) this.#badgeTemplate = document.getElementById('badge-editor-template').content;
if (!badge.value){ console.log(this.#badgeTemplate);
return;
}
this.#badgeTemplate= badge.value;
} }
el.replaceChildren(); el.replaceChildren();
const addButton = `<button data-disable-if-max="1" data-receive="updateBadgeCount" DISABLE_IF_MAX type="button" data-send="addBadge">Add badge</button>`; const addButton = `<button data-disable-if-max="1" data-receive="updateBadgeCount" DISABLE_IF_MAX type="button" data-send="addBadge">Add badge</button>`;

View File

@@ -178,13 +178,6 @@ body {
color: $DEFAULT_FONT_COLOR; color: $DEFAULT_FONT_COLOR;
} }
$body_portrait_margin: $BIG_PADDING $ZERO_PADDING !default;
@media (orientation: portrait) {
body {
margin: $body_portrait_margin;
}
}
$link_color: #c11c1c !default; $link_color: #c11c1c !default;
$link_color_visited: #730c0c !default; $link_color_visited: #730c0c !default;
:where(a:link){ :where(a:link){
@@ -1536,3 +1529,26 @@ $rss_button_font_color_active: black !default;
color: $rss_button_font_color_active; color: $rss_button_font_color_active;
} }
} }
@media (orientation: portrait) {
$body_portrait_margin: $BIG_PADDING $ZERO_PADDING !default;
body {
margin: $body_portrait_margin;
}
.guide-container {
grid-template-areas:
"guide-toc"
"guide-topics";
grid-template-columns: unset;
}
.guide-toc {
position: unset;
}
$guide_section_padding_right_portrait: $BIG_PADDING !default;
.guide-section {
padding-right: $guide_section_padding_right_portrait;
}
}