Added basic priority star display.
This commit is contained in:
parent
a9e2458ac5
commit
957f32e588
7 changed files with 82 additions and 6 deletions
|
@ -5,6 +5,7 @@
|
||||||
@import "header";
|
@import "header";
|
||||||
@import "post";
|
@import "post";
|
||||||
@import "poll";
|
@import "poll";
|
||||||
|
@import "priority";
|
||||||
@import "status";
|
@import "status";
|
||||||
@import "topic";
|
@import "topic";
|
||||||
@import "topics";
|
@import "topics";
|
||||||
|
|
41
assets/less/forum/priority.less
Normal file
41
assets/less/forum/priority.less
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
.forum__priority {
|
||||||
|
|
||||||
|
&__votes {
|
||||||
|
text-align: center;
|
||||||
|
margin: 5px 16px 5px 5px;
|
||||||
|
-webkit-touch-callout: none !important;
|
||||||
|
-webkit-user-select: none !important;
|
||||||
|
-khtml-user-select: none !important;
|
||||||
|
-moz-user-select: none !important;
|
||||||
|
-ms-user-select: none !important;
|
||||||
|
user-select: none !important;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__vote {
|
||||||
|
font-size: 14px;
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__star {
|
||||||
|
margin-right: -.9em;
|
||||||
|
opacity: .6;
|
||||||
|
text-shadow: 0 1px 1px #000;
|
||||||
|
color: var(--user-colour);
|
||||||
|
transition: text-shadow .2s;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-right: 0;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__vote:hover &__star {
|
||||||
|
text-shadow: 0 0 1px #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__input {
|
||||||
|
margin: 5px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
|
@ -77,6 +77,10 @@
|
||||||
background-color: var(--accent-colour);
|
background-color: var(--accent-colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&--faded {
|
||||||
|
opacity: .3;
|
||||||
|
}
|
||||||
|
|
||||||
&__participated {
|
&__participated {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 2px;
|
bottom: 2px;
|
||||||
|
|
|
@ -380,4 +380,5 @@ echo tpl_render('forum.topic', [
|
||||||
'topic_can_lock' => $canLockTopic,
|
'topic_can_lock' => $canLockTopic,
|
||||||
'topic_poll_options' => $pollOptions ?? [],
|
'topic_poll_options' => $pollOptions ?? [],
|
||||||
'topic_poll_user_answers' => $pollUserAnswers ?? [],
|
'topic_poll_user_answers' => $pollUserAnswers ?? [],
|
||||||
|
'topic_priority_votes' => $topicPriority ?? [],
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -75,7 +75,7 @@ function forum_topic_get(int $topicId, bool $allowDeleted = false): array
|
||||||
'
|
'
|
||||||
SELECT
|
SELECT
|
||||||
t.`topic_id`, t.`forum_id`, t.`topic_title`, t.`topic_type`, t.`topic_locked`, t.`topic_created`,
|
t.`topic_id`, t.`forum_id`, t.`topic_title`, t.`topic_type`, t.`topic_locked`, t.`topic_created`,
|
||||||
f.`forum_archived` AS `topic_archived`, t.`topic_deleted`, t.`topic_bumped`,
|
f.`forum_archived` AS `topic_archived`, t.`topic_deleted`, t.`topic_bumped`, f.`forum_type`,
|
||||||
tp.`poll_id`, tp.`poll_max_votes`, tp.`poll_expires`, tp.`poll_preview_results`, tp.`poll_change_vote`,
|
tp.`poll_id`, tp.`poll_max_votes`, tp.`poll_expires`, tp.`poll_preview_results`, tp.`poll_change_vote`,
|
||||||
(tp.`poll_expires` < CURRENT_TIMESTAMP) AS `poll_expired`,
|
(tp.`poll_expires` < CURRENT_TIMESTAMP) AS `poll_expired`,
|
||||||
fp.`topic_id` AS `author_post_id`, fp.`user_id` AS `author_user_id`,
|
fp.`topic_id` AS `author_post_id`, fp.`user_id` AS `author_user_id`,
|
||||||
|
@ -674,11 +674,18 @@ function forum_topic_priority(int $topic): array
|
||||||
}
|
}
|
||||||
|
|
||||||
$getPriority = db_prepare('
|
$getPriority = db_prepare('
|
||||||
SELECT tp.`topic_id`, tp.`topic_priority`
|
SELECT
|
||||||
|
tp.`topic_id`, tp.`topic_priority`,
|
||||||
|
u.`user_id`, u.`username`,
|
||||||
|
COALESCE(u.`user_colour`, r.`role_colour`) AS `user_colour`
|
||||||
FROM `msz_forum_topics_priority` AS tp
|
FROM `msz_forum_topics_priority` AS tp
|
||||||
LEFT JOIN `msz_users` AS u
|
LEFT JOIN `msz_users` AS u
|
||||||
ON u.`user_id` = tp.`user_id`
|
ON u.`user_id` = tp.`user_id`
|
||||||
|
LEFT JOIN `msz_roles` AS r
|
||||||
|
ON u.`display_role` = r.`role_id`
|
||||||
|
WHERE `topic_id` = :topic
|
||||||
');
|
');
|
||||||
|
$getPriority->bindValue('topic', $topic);
|
||||||
|
|
||||||
return db_fetch_all($getPriority);
|
return db_fetch_all($getPriority);
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,6 +256,7 @@
|
||||||
{% macro forum_topic_entry(topic, topic_icon, topic_unread) %}
|
{% macro forum_topic_entry(topic, topic_icon, topic_unread) %}
|
||||||
{% set topic_unread = topic_unread|default(topic.topic_unread|default(false)) %}
|
{% set topic_unread = topic_unread|default(topic.topic_unread|default(false)) %}
|
||||||
{% set topic_important = topic.topic_type == constant('MSZ_TOPIC_TYPE_STICKY') or topic.topic_type == constant('MSZ_TOPIC_TYPE_ANNOUNCEMENT') or topic.topic_type == constant('MSZ_TOPIC_TYPE_GLOBAL_ANNOUNCEMENT') %}
|
{% set topic_important = topic.topic_type == constant('MSZ_TOPIC_TYPE_STICKY') or topic.topic_type == constant('MSZ_TOPIC_TYPE_ANNOUNCEMENT') or topic.topic_type == constant('MSZ_TOPIC_TYPE_GLOBAL_ANNOUNCEMENT') %}
|
||||||
|
{% set has_priority_voting = forum_has_priority_voting(topic.forum_type) %}
|
||||||
|
|
||||||
{% if topic_icon is null %}
|
{% if topic_icon is null %}
|
||||||
{% if topic.topic_deleted is defined and topic.topic_deleted is not null %}
|
{% if topic.topic_deleted is defined and topic.topic_deleted is not null %}
|
||||||
|
@ -268,7 +269,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% elseif topic.topic_locked is defined and topic.topic_locked is not null %}
|
{% elseif topic.topic_locked is defined and topic.topic_locked is not null %}
|
||||||
{% set topic_icon = 'fas fa-lock' %}
|
{% set topic_icon = 'fas fa-lock' %}
|
||||||
{% elseif forum_has_priority_voting(topic.forum_type) %}
|
{% elseif has_priority_voting %}
|
||||||
{% set topic_icon = 'far fa-star' %}
|
{% set topic_icon = 'far fa-star' %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set topic_icon = (topic_unread ? 'fas' : 'far') ~ ' fa-comment' %}
|
{% set topic_icon = (topic_unread ? 'fas' : 'far') ~ ' fa-comment' %}
|
||||||
|
@ -280,9 +281,9 @@
|
||||||
|
|
||||||
<div class="forum__topic__container">
|
<div class="forum__topic__container">
|
||||||
<div class="forum__topic__icon forum__topic__icon--{{ topic_unread ? 'unread' : 'read' }}">
|
<div class="forum__topic__icon forum__topic__icon--{{ topic_unread ? 'unread' : 'read' }}">
|
||||||
<i class="{{ topic_icon }} fa-fw"></i>
|
<i class="{{ topic_icon }} fa-fw{% if has_priority_voting %} forum__topic__icon--faded{% endif %}"></i>
|
||||||
|
|
||||||
{% if forum_has_priority_voting(topic.forum_type) %}
|
{% if has_priority_voting %}
|
||||||
<div class="forum__topic__icon__priority">{{ topic.topic_priority|number_format }}</div>
|
<div class="forum__topic__icon__priority">{{ topic.topic_priority|number_format }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -569,3 +570,20 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% macro forum_priority_votes(topic, votes) %}
|
||||||
|
<div class="container forum__priority">
|
||||||
|
<div class="forum__priority__votes">
|
||||||
|
{% for vote in votes %}
|
||||||
|
<div title="{{ vote.username }} ({{ vote.topic_priority|number_format }})" class="forum__priority__vote" style="{{ vote.user_colour|html_colour }}">
|
||||||
|
{% for i in 0..vote.topic_priority %}
|
||||||
|
<span class="forum__priority__star fas fa-star fa-fw"></span>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
<div class="forum__priority__input">
|
||||||
|
<button class="input__button">Vote for this feature</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endmacro %}
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
forum_topic_locked,
|
forum_topic_locked,
|
||||||
forum_header,
|
forum_header,
|
||||||
forum_topic_tools,
|
forum_topic_tools,
|
||||||
forum_poll
|
forum_poll,
|
||||||
|
forum_priority_votes
|
||||||
%}
|
%}
|
||||||
|
|
||||||
{% set title = topic_info.topic_title %}
|
{% set title = topic_info.topic_title %}
|
||||||
|
@ -56,6 +57,9 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{{ forum_header(topic_info.topic_title, topic_breadcrumbs, false, canonical_url, topic_actions) }}
|
{{ forum_header(topic_info.topic_title, topic_breadcrumbs, false, canonical_url, topic_actions) }}
|
||||||
{{ topic_notice }}
|
{{ topic_notice }}
|
||||||
|
{% if forum_has_priority_voting(topic_info.forum_type) %}
|
||||||
|
{{ forum_priority_votes(topic_info, topic_priority_votes) }}
|
||||||
|
{% endif %}
|
||||||
{{ forum_poll(topic_info, topic_poll_options, topic_poll_user_answers, topic_info.topic_id, current_user.user_id|default(0) > 0, topic_info.author_user_id == current_user.user_id|default(0)) }}
|
{{ forum_poll(topic_info, topic_poll_options, topic_poll_user_answers, topic_info.topic_id, current_user.user_id|default(0) > 0, topic_info.author_user_id == current_user.user_id|default(0)) }}
|
||||||
{{ topic_tools }}
|
{{ topic_tools }}
|
||||||
{{ forum_post_listing(topic_posts, current_user.user_id|default(0), topic_perms) }}
|
{{ forum_post_listing(topic_posts, current_user.user_id|default(0), topic_perms) }}
|
||||||
|
|
Loading…
Add table
Reference in a new issue