Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
e8c6ea660f Experimental floating headers thingy. 2025-02-01 03:40:03 +00:00
6 changed files with 92 additions and 93 deletions

View file

@ -0,0 +1,12 @@
.forum-float {
position: sticky;
z-index: 1000;
}
.forum-float-top {
top: 2px;
}
.forum-float-bottom {
bottom: 2px;
}

View file

@ -3,6 +3,7 @@
align-items: center;
min-height: 40px;
margin: 2px 0;
position: sticky;
}
.forum__status__icon {

View file

@ -150,6 +150,7 @@ html {
@include forum/actions.css;
@include forum/categories.css;
@include forum/confirm.css;
@include forum/float.css;
@include forum/header.css;
@include forum/leaderboard.css;
@include forum/poll.css;

View file

@ -1,4 +1,5 @@
{% extends 'forum/master.twig' %}
{% from 'macros.twig' import pagination %}
{% from 'forum/macros.twig' import forum_category_listing, forum_topic_listing, forum_category_buttons, forum_header, forum_category_tools %}
{% set title = forum_info.name %}
@ -8,29 +9,45 @@
}) %}
{% block content %}
{{ forum_header(forum_info.name, forum_breadcrumbs, true, canonical_url, [
{
html: '<i class="far fa-check-circle"></i> <span class="js-action-text">Mark as Read</span>',
display: forum_show_mark_as_read,
method: 'POST',
url: url('forum-mark-as-read', { category: forum_info.id }),
disableWith: 'Marking as read...',
disableWithTarget: '.js-action-text',
withCsrf: true,
refreshOnSuccess: true,
}
]) }}
<div class="forum-float forum-float-top">
{{ forum_header(forum_info.name, forum_breadcrumbs, true, canonical_url, [
{
html: '<i class="far fa-check-circle"></i> <span class="js-action-text">Mark as Read</span>',
display: forum_show_mark_as_read,
method: 'POST',
url: url('forum-mark-as-read', { category: forum_info.id }),
disableWith: 'Marking as read...',
disableWithTarget: '.js-action-text',
withCsrf: true,
refreshOnSuccess: true,
}
]) }}
</div>
{% if forum_children|length > 0 %}
{{ forum_category_listing(forum_children, 'Forums') }}
{% endif %}
{% if forum_info.mayHaveTopics %}
{% set category_tools = forum_category_tools(forum_info, forum_perms, forum_pagination) %}
{{ category_tools }}
{{ forum_topic_listing(forum_topics) }}
{{ category_tools }}
{% endif %}
{% set can_topic = not forum_info.archived and forum_perms.can_create_topic %}
{% set topics_pagination = pagination(forum_pagination, 'forum-category', {'forum': forum_info.id}) %}
{{ forum_header('', forum_breadcrumbs) }}
{{ forum_topic_listing(forum_topics) }}
{% if can_topic or topics_pagination|trim|length > 0 %}
<div class="forum-float forum-float-bottom">
<div class="container forum__actions">
<div class="forum__actions__buttons">
{% if can_topic %}
<a href="{{ url('forum-topic-new', {'forum': forum_info.id}) }}" class="input__button forum__actions__button">New Topic</a>
{% endif %}
</div>
<div class="forum__actions__pagination">
{{ topics_pagination }}
</div>
</div>
</div>
{% endif %}
{% endif %}
{% endblock %}

View file

@ -81,36 +81,6 @@
</div>
{% endmacro %}
{% macro forum_category_tools(info, perms, pagination_info) %}
{% from 'macros.twig' import pagination %}
{% if info.forum_id is defined %}
{% set forum_id = info.forum_id %}
{% set is_archived = info.forum_archived != 0 %}
{% else %}
{% set forum_id = info.id %}
{% set is_archived = info.archived %}
{% endif %}
{% set is_locked = is_archived %}
{% set can_topic = not is_locked and perms.can_create_topic %}
{% set pag = pagination(pagination_info, 'forum-category', {'forum': forum_id}) %}
{% if can_topic or pag|trim|length > 0 %}
<div class="container forum__actions">
<div class="forum__actions__buttons">
{% if can_topic %}
<a href="{{ url('forum-topic-new', {'forum': forum_id}) }}" class="input__button forum__actions__button">New Topic</a>
{% endif %}
</div>
<div class="forum__actions__pagination">
{{ pag }}
</div>
</div>
{% endif %}
{% endmacro %}
{% macro forum_topic_tools(info, pagination_info, can_reply) %}
{% from 'macros.twig' import pagination %}
@ -283,33 +253,6 @@
</div>
{% endmacro %}
{% macro forum_topic_redirect(redirect) %}
{% from _self import forum_topic_notice %}
{% if redirect is not empty %}
{% set body %}
This topic redirects to <span class="forum__status__emphasis"><a href="{{ redirect.linkTarget }}" class="link">{{ redirect.linkTarget }}</a></span>.
{% endset %}
{{ forum_topic_notice('share', body) }}
{% endif %}
{% endmacro %}
{% macro forum_topic_locked(locked, archived) %}
{% from _self import forum_topic_notice %}
{% if locked is not null or archived %}
{% set body %}
{% if archived %}
This topic has been <span class="forum__status__emphasis">archived</span>.
{% else %}
This topic was locked
<time class="forum__status__emphasis"
datetime="{{ locked|date('c') }}"
title="{{ locked|date('r') }}">{{ locked|time_format }}</time>.
{% endif %}
{% endset %}
{{ forum_topic_notice(archived ? 'archive' : 'lock', body) }}
{% endif %}
{% endmacro %}
{% macro forum_topic_listing(topics, title) %}
{% from _self import forum_topic_entry %}
{% from 'macros.twig' import container_title %}

View file

@ -1,15 +1,6 @@
{% extends 'forum/master.twig' %}
{% from 'macros.twig' import pagination %}
{%
from 'forum/macros.twig'
import
forum_post_listing,
forum_topic_buttons,
forum_topic_locked,
forum_header,
forum_topic_tools,
forum_topic_redirect
%}
{% from 'forum/macros.twig' import forum_post_listing, forum_topic_buttons, forum_topic_notice, forum_header %}
{% set title = topic_info.title %}
{% set canonical_url = url('forum-topic', {
@ -17,8 +8,6 @@
'page': topic_pagination.page > 1 ? topic_pagination.page : 0,
}) %}
{% set topic_tools = forum_topic_tools(topic_info, topic_pagination, can_reply) %}
{% set topic_notice = forum_topic_locked(topic_info.lockedTime, category_info.archived) ~ forum_topic_redirect(topic_redir_info|default(null)) %}
{% set topic_actions = [
{
html: '<i class="fas fa-trash-alt fa-fw"></i> <span class="js-action-text">Delete</span>',
@ -86,11 +75,47 @@
] %}
{% block content %}
{{ forum_header(topic_info.title, topic_breadcrumbs, false, canonical_url, topic_actions) }}
{{ topic_notice|raw }}
{{ topic_tools }}
<div class="forum-float forum-float-top">
{{ forum_header(topic_info.title, topic_breadcrumbs, false, canonical_url, topic_actions) }}
{% if topic_info.locked or category_info.archived %}
{% set body %}
{% if category_info.archived %}
This topic has been <span class="forum__status__emphasis">archived</span>.
{% else %}
This topic was locked
<time class="forum__status__emphasis" datetime="{{ topic_info.lockedTime|date('c') }}"
title="{{ topic_info.lockedTime|date('r') }}">{{ topic_info.lockedTime|time_format }}</time>.
{% endif %}
{% endset %}
{{ forum_topic_notice(category_info.archived ? 'archive' : 'lock', body) }}
{% endif %}
{% if topic_redir_info is defined %}
{% set body %}
This topic redirects to <span class="forum__status__emphasis"><a href="{{ topic_redir_info.linkTarget }}" class="link">{{ topic_redir_info.linkTarget }}</a></span>.
{% endset %}
{{ forum_topic_notice('share', body) }}
{% endif %}
</div>
{{ forum_post_listing(topic_posts, topic_user_id, topic_perms) }}
{{ topic_tools }}
{{ topic_notice|raw }}
{{ forum_header('', topic_breadcrumbs) }}
<div class="forum-float forum-float-bottom">
{% set posts_pagination = pagination(topic_pagination, 'forum-topic', {'topic': topic_info.id}) %}
{% if can_reply or posts_pagination|trim|length > 0 %}
<div class="container forum__actions">
<div class="forum__actions__buttons">
{% if can_reply %}
<a href="{{ url('forum-reply-new', {'topic': topic_info.id}) }}" class="input__button">Reply</a>
{% endif %}
</div>
<div class="forum__actions__pagination">
{{ posts_pagination }}
</div>
</div>
{% endif %}
</div>
{% endblock %}