Moved mark as read button to the actions row.
This commit is contained in:
parent
9869190b2a
commit
2896eca542
4 changed files with 17 additions and 9 deletions
|
@ -5,7 +5,12 @@ switch ($_GET['m'] ?? '') {
|
|||
case 'mark':
|
||||
$forumId = (int)($_GET['f'] ?? null);
|
||||
$markEntireForum = $forumId === 0;
|
||||
$markAction = forum_mark_read($markEntireForum ? null : $forumId, user_session_current('user_id', 0));
|
||||
$markAction = false;
|
||||
|
||||
if (user_session_active() && csrf_verify('forum_mark', $_GET['c'] ?? '')) {
|
||||
$markAction = forum_mark_read($markEntireForum ? null : $forumId, user_session_current('user_id', 0));
|
||||
}
|
||||
|
||||
header('Location: /forum' . (!$markAction || $markEntireForum ? '' : url_construct('/forum.php', ['f' => $forumId])));
|
||||
break;
|
||||
|
||||
|
|
|
@ -8,14 +8,20 @@
|
|||
}) %}
|
||||
|
||||
{% block content %}
|
||||
{{ forum_header(forum_info.forum_name, forum_breadcrumbs, true, canonical_url) }}
|
||||
{{ forum_header(forum_info.forum_name, forum_breadcrumbs, true, canonical_url, [
|
||||
{
|
||||
'html': '<i class="far fa-check-circle"></i> Mark as Read',
|
||||
'url': url_construct('/forum/index.php', {'m': 'mark', 'f': forum_info.forum_id, 'c': csrf_token('forum_mark')}),
|
||||
'display': current_user is defined,
|
||||
}
|
||||
]) }}
|
||||
|
||||
{% if forum_may_have_children and forum_info.forum_subforums|length > 0 %}
|
||||
{{ forum_category_listing(forum_info.forum_subforums, 'Forums') }}
|
||||
{% endif %}
|
||||
|
||||
{% if forum_may_have_topics %}
|
||||
{% set category_tools = forum_category_tools(forum_info, forum_perms, forum_pagination, current_user|default(false)) %}
|
||||
{% set category_tools = forum_category_tools(forum_info, forum_perms, forum_pagination) %}
|
||||
{{ category_tools }}
|
||||
{{ forum_topic_listing(forum_topics) }}
|
||||
{{ category_tools }}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
{% if current_user is defined %}
|
||||
<div class="container forum__actions">
|
||||
<a href="?m=mark" class="input__button forum__actions__button">Mark All Read</a>
|
||||
<a href="?m=mark&c={{ csrf_token('forum_mark') }}" class="input__button forum__actions__button">Mark All Read</a>
|
||||
{#<a href="?m=unread" class="input__button forum__actions__button">Unread Posts</a>#}
|
||||
{#<a href="?m=your" class="input__button forum__actions__button">Your Posts</a>#}
|
||||
</div>
|
||||
|
|
|
@ -65,22 +65,19 @@
|
|||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro forum_category_tools(info, perms, pagination_info, user) %}
|
||||
{% macro forum_category_tools(info, perms, pagination_info) %}
|
||||
{% from 'macros.twig' import pagination %}
|
||||
|
||||
{% set is_locked = info.forum_archived != 0 %}
|
||||
{% set can_topic = not is_locked and perms|perms_check(constant('MSZ_FORUM_PERM_CREATE_TOPIC')) %}
|
||||
{% set pag = pagination(pagination_info, '/forum/forum.php', null, {'f': info.forum_id}) %}
|
||||
|
||||
{% if user or can_topic or pag|trim|length > 0 %}
|
||||
{% if can_topic or pag|trim|length > 0 %}
|
||||
<div class="container forum__actions">
|
||||
<div class="forum__actions__buttons">
|
||||
{% if can_topic %}
|
||||
<a href="{{ url_construct('/forum/posting.php', {'f':info.forum_id}) }}" class="input__button forum__actions__button">New Topic</a>
|
||||
{% endif %}
|
||||
{% if user %}
|
||||
<a href="{{ url_construct('/forum/index.php', {'m':'mark','f':info.forum_id}) }}" class="input__button forum__actions__button">Mark As Read</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="forum__actions__pagination">
|
||||
|
|
Loading…
Add table
Reference in a new issue