Updated forum post styling.

This commit is contained in:
flash 2018-10-15 23:57:16 +02:00
parent 47bbaadc40
commit 880668a6f6
3 changed files with 134 additions and 117 deletions

View file

@ -1,8 +1,5 @@
.forum__post {
display: flex;
border: 1px solid var(--accent-colour);
box-shadow: 0 1px 2px var(--accent-colour);
background-color: var(--background-colour);
margin: 2px 0;
@media (max-width: @site-mobile-width) {
@ -16,100 +13,112 @@
flex-shrink: 1;
word-wrap: break-word;
overflow: hidden;
&__text {
margin: 2px;
line-height: 1.2em;
@media (max-width: @site-mobile-width) {
margin: 4px;
font-size: 1.2em;
line-height: 1.3em;
}
}
&__info {
font-size: .9em;
line-height: 1.7em;
padding: 0 2px;
border-bottom: 1px solid var(--accent-colour);
display: flex;
justify-content: space-between;
&__link {
color: inherit;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
}
}
&__author {
border-right: 1px solid var(--accent-colour);
text-align: center;
flex-grow: 0;
flex-shrink: 0;
min-width: 170px;
&__details {
font-size: .9em;
line-height: 1.7em;
padding: 0 2px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
color: #888;
}
@media (max-width: @site-mobile-width) {
border-right-width: 0;
border: 1px solid var(--accent-colour);
flex-direction: row;
border-bottom-width: 2px;
}
&__datetime,
&__id {
color: inherit;
text-decoration: none;
&__joined {
flex-grow: 1;
flex-shrink: 1;
margin: 5px;
max-width: 170px;
@media (max-width: @site-mobile-width) {
display: none;
}
}
&__link {
margin: 15px;
color: inherit;
text-decoration: none;
flex-grow: 0;
flex-shrink: 0;
@media (max-width: @site-mobile-width) {
display: flex;
align-items: center;
margin: 5px;
flex-grow: 1;
}
}
&__avatar {
width: 120px;
height: 120px;
box-shadow: 0 1px 2px var(--accent-colour);
@media (max-width: @site-mobile-width) {
width: 40px;
height: 40px;
margin-right: 5px;
}
}
&__username {
color: var(--user-colour);
font-size: 1.5em;
line-height: 1.7em;
}
&:not(&--deleted) &__username:hover {
&:hover {
text-decoration: underline;
}
}
&__text {
margin: 2px;
line-height: 1.2em;
@media (max-width: @site-mobile-width) {
margin: 4px;
font-size: 1.2em;
line-height: 1.3em;
}
}
&__info {
background-image: linear-gradient(90deg, var(--user-colour), transparent);
min-width: 150px;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
padding: 15px;
flex: 0 0 auto;
margin-right: 4px;
@media (max-width: @site-mobile-width) {
background-image: linear-gradient(180deg, var(--user-colour), transparent);
flex-direction: row;
margin: 0;
padding: 5px;
}
}
&__icons {
display: flex;
align-items: center;
@media (max-width: @site-mobile-width) {
flex-direction: column;
align-items: flex-end;
}
}
&__posts-count {
font-size: .9em;
margin-left: 4px;
}
&__joined {
flex: 1 1 auto;
margin: 2px;
max-width: 170px;
font-size: .9em;
justify-self: flex-end;
margin-top: 10px;
margin-bottom: -10px;
@media (max-width: @site-mobile-width) {
display: none;
}
}
&__avatar {
width: 120px;
height: 120px;
@media (max-width: @site-mobile-width) {
width: 40px;
height: 40px;
margin-right: 4px;
}
}
&__username {
color: inherit;
font-size: 1.4em;
line-height: 1.5em;
text-decoration: none;
margin: 2px 0 1px;
&[href]:hover {
text-decoration: underline;
}
@media (max-width: @site-mobile-width) {
flex: 1 1 auto;
text-align: left;
margin: 0 4px;
}
}
}

View file

@ -53,7 +53,14 @@ define('MSZ_FORUM_POST_LISTING_QUERY_STANDARD', '
u.`user_id` as `poster_id`,
u.`username` as `poster_name`,
u.`created_at` as `poster_joined`,
COALESCE(u.`user_colour`, r.`role_colour`) as `poster_colour`
u.`user_country` as `poster_country`,
COALESCE(u.`user_colour`, r.`role_colour`) as `poster_colour`,
(
SELECT COUNT(`post_id`)
FROM `msz_forum_posts`
WHERE `user_id` = p.`user_id`
AND `post_deleted` IS NULL
) as `poster_post_count`
FROM `msz_forum_posts` as p
LEFT JOIN `msz_users` as u
ON u.`user_id` = p.`user_id`

View file

@ -130,7 +130,7 @@
{% macro forum_topic_buttons(topic) %}
<div class="forum__actions forum__actions__content">
<a href="#reply"
class="input__button forum__actions__button"
class="input__button input__button--new forum__actions__button"
onclick="openContainer('reply')">Reply</a>
</div>
{% endmacro %}
@ -263,40 +263,41 @@
{% set is_original_post = is_original_post|default(false) %}
{% set is_original_poster = is_original_poster|default(false) %}
<div class="forum__post" id="p{{ post.post_id }}">
{% if post.poster_id is not null %}
<div class="forum__post__author">
<a class="forum__post__author__link" href="/profile.php?u={{ post.poster_id }}">
<div
class="avatar forum__post__author__avatar"
style="background-image:url('/profile.php?u={{ post.poster_id }}&amp;m=avatar');">
</div>
<div
class="forum__post__author__username"
style="{{ post.poster_colour|html_colour }}">{{ post.poster_name }}</div>
<div class="container container--new forum__post" id="p{{ post.post_id }}">
<div class="forum__post__info" style="{{ post.poster_colour|html_colour }}">
{% if post.poster_id is not null %}
<a class="avatar avatar--new forum__post__avatar"
style="background-image:url('/profile.php?u={{ post.poster_id }}&amp;m=avatar');"
href="/profile.php?u={{ post.poster_id }}">
</a>
<div class="forum__post__author__joined">
<a class="forum__post__username" href="/profile.php?u={{ post.poster_id }}">{{ post.poster_name }}</a>
<div class="forum__post__icons">
<div class="flag flag--{{ post.poster_country|lower }}" title="{{ post.poster_country|country_name }}"></div>
<div class="forum__post__posts-count">{{ post.poster_post_count|number_format }} posts</div>
</div>
<div class="forum__post__joined">
joined <time datetime="{{ post.poster_joined|date('c') }}" title="{{ post.poster_joined|date('r') }}">{{ post.poster_joined|time_diff }}</time>
</div>
</div>
{% else %}
<div class="forum__post__author forum__post__author--deleted">
<div class="forum__post__author__link">
<div class="forum__post__author__username">Deleted User</div>
</div>
</div>
{% endif %}
{% else %}
<div class="forum__post__username">Deleted User</div>
{% endif %}
</div>
<div class="forum__post__content">
<div class="forum__post__content__info">
<a class="forum__post__content__info__link" href="/forum/topic.php?t={{ post.topic_id }}#p{{ post.post_id }}">
<div class="forum__post__details">
<a class="forum__post__datetime" href="/forum/topic.php?t={{ post.topic_id }}#p{{ post.post_id }}">
<time datetime="{{ post.post_created|date('c') }}" title="{{ post.post_created|date('r') }}">{{ post.post_created|time_diff }}</time>
</a>
<a class="forum__post__content__info__link" href="/forum/topic.php?p={{ post.post_id }}#p{{ post.post_id }}">
<a class="forum__post__id" href="/forum/topic.php?p={{ post.post_id }}#p{{ post.post_id }}">
#{{ post.post_id }}
</a>
</div>
<div class="forum__post__content__text">
<div class="forum__post__text">
{{ post.post_text|escape|parse_text(post.post_parse)|raw }}
</div>
</div>