add: forge pinned tickets

This commit is contained in:
trisua 2025-06-10 22:12:22 -04:00
parent 68071b96c8
commit 46f8aea538
5 changed files with 44 additions and 16 deletions

View file

@ -41,12 +41,23 @@
(text "{{ icon \"award\" }}") (text "{{ icon \"award\" }}")
(span (span
(text "{{ text \"communities:label.my_communities\" }}"))) (text "{{ text \"communities:label.my_communities\" }}")))
(a
("href" "/communities/search") (div
("class" "button quaternary small") ("class" "flex items-center gap-2")
(text "{{ icon \"search\" }}") (a
(span ("href" "/forges")
(text "{{ text \"communities:label.join_new\" }}")))) ("class" "button quaternary small")
(text "{{ icon \"anvil\" }}")
(span
("class" "desktop")
(text "{{ text \"forge:label.my_forges\" }}")))
(a
("href" "/communities/search")
("class" "button quaternary small")
(text "{{ icon \"search\" }}")
(span
("class" "desktop")
(text "{{ text \"communities:label.join_new\" }}")))))
(div (div
("class" "card flex flex-col gap-2") ("class" "card flex flex-col gap-2")
(text "{% for item in list %} {{ components::community_listing_card(community=item) }} {% endfor %}"))) (text "{% for item in list %} {{ components::community_listing_card(community=item) }} {% endfor %}")))

View file

@ -1789,7 +1789,12 @@
(text "{{ self::full_username(user=owner) }}")) (text "{{ self::full_username(user=owner) }}"))
; timestamp ; timestamp
(span ("class" "date") (text "{{ post.created }}"))) (span ("class" "date") (text "{{ post.created }}"))
; pinned
(text "{% if post.context.is_pinned -%}")
(icon (text "pin"))
(text "{%- endif %}"))
; post title ; post title
(a (a

View file

@ -3,5 +3,4 @@
("class" "flex flex-col gap-4 w-full") ("class" "flex flex-col gap-4 w-full")
(text "{{ macros::forge_nav(community=community, selected=\"info\") }}") (text "{{ macros::forge_nav(community=community, selected=\"info\") }}")
(text "{{ components::community_info(community=community) }}")) (text "{{ components::community_info(community=community) }}"))
; (text "{{ components::community_banner(id=community.id, community=community) }}")
(text "{% endblock %}") (text "{% endblock %}")

View file

@ -2,6 +2,19 @@
(div (div
("class" "flex flex-col gap-4 w-full") ("class" "flex flex-col gap-4 w-full")
(text "{{ macros::forge_nav(community=community, selected=\"tickets\") }}") (text "{{ macros::forge_nav(community=community, selected=\"tickets\") }}")
(div
("class" "card-nest")
(div
("class" "card small flex items-center gap-2")
(icon (text "pin"))
(str (text "communities:label.pinned")))
(div
("class" "card flex flex-col gap-2")
(text "{% for post in pinned -%}")
(text "{{ components::ticket(post=post[0], owner=post[1]) }}")
(text "{%- endfor %}")))
(div (div
("class" "card-nest") ("class" "card-nest")
(div (div

View file

@ -171,13 +171,13 @@ pub async fn tickets_request(
Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)), Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)),
}; };
// let pinned = match data.0.get_pinned_posts_by_community(community.id).await { let pinned = match data.0.get_pinned_posts_by_community(community.id).await {
// Ok(p) => match data.0.fill_posts(p, &ignore_users, &user).await { Ok(p) => match data.0.fill_posts(p, &ignore_users, &user).await {
// Ok(p) => p, Ok(p) => p,
// Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)), Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)),
// }, },
// Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)), Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)),
// }; };
// init context // init context
let lang = get_lang!(jar, data.0); let lang = get_lang!(jar, data.0);
@ -195,7 +195,7 @@ pub async fn tickets_request(
) = community_context_bools!(data, user, community); ) = community_context_bools!(data, user, community);
context.insert("feed", &feed); context.insert("feed", &feed);
// context.insert("pinned", &pinned); context.insert("pinned", &pinned);
context.insert("page", &props.page); context.insert("page", &props.page);
community_context( community_context(
&mut context, &mut context,