add: profile motivational header setting

This commit is contained in:
trisua 2025-04-19 14:52:33 -04:00
parent bc57782bfe
commit 2266afde01
4 changed files with 28 additions and 11 deletions

View file

@ -650,11 +650,18 @@ show_community=true, secondary=false) -%}
</div>
</div>
{%- endmacro %} {% macro create_question_form(receiver="0", community="",
is_global=false) -%}
header="", is_global=false) -%}
<div class="card-nest">
<div class="card small flex items-center gap-2">
{{ icon "message-circle-heart" }}
<span>{{ text "requests:label.ask_question" }}</span>
<span class="no_p_margin">
<!-- prettier-ignore -->
{% if header %}
{{ header|markdown|safe }}
{% else %}
{{ text "requests:label.ask_question" }}
{% endif %}
</span>
</div>
<form

View file

@ -1,7 +1,8 @@
{% extends "profile/base.html" %} {% block content %} {% if
profile.settings.enable_questions and user %}
<div style="display: contents">
{{ components::create_question_form(receiver=profile.id) }}
{{ components::create_question_form(receiver=profile.id,
header=profile.settings.motivational_header) }}
</div>
{% endif %} {% if pinned|length != 0 %}
<div class="card-nest">

View file

@ -748,14 +748,7 @@
settings.warning,
"textarea",
],
],
settings,
);
ui.generate_settings_ui(
profile_settings,
[
[[], "Privacy", "title"],
[[], "Questions", "title"],
[
[
"enable_questions",
@ -764,6 +757,19 @@
"{{ profile.settings.enable_questions }}",
"checkbox",
],
[
["motivational_header", "Motivational header"],
settings.motivational_header,
"input",
],
],
settings,
);
ui.generate_settings_ui(
profile_settings,
[
[[], "Privacy", "title"],
[
[
"private_profile",

View file

@ -133,6 +133,9 @@ pub struct UserSettings {
pub disable_other_theme_css: bool,
#[serde(default)]
pub enable_questions: bool,
/// A header shown in the place of "Ask question" if `enable_questions` is true.
#[serde(default)]
pub motivational_header: String,
}
impl Default for User {