Moved profile header into a separate file.

This commit is contained in:
flash 2018-09-23 16:04:48 +02:00
parent aa168ed1d0
commit 26d17455dc
3 changed files with 111 additions and 120 deletions

View file

@ -263,7 +263,7 @@
{% endif %} {% endif %}
{% if settings_perms.edit_about %} {% if settings_perms.edit_about %}
<div class="container"> <div class="container container--translucent">
<div class="container__title"> <div class="container__title">
About About
</div> </div>

View file

@ -0,0 +1,80 @@
<div class="profile__header">
<div class="profile__header__details">
<div class="avatar avatar--new profile__header__avatar" style="background-image:url('{{ image }}')"></div>
<div class="profile__header__details__content">
<div class="profile__header__username" style="{{ profile.user_colour|html_colour({
'color': '%s',
'text-shadow': '0 0 5px %s',
}) }}">
{{ profile.username }}
</div>
{% if profile.user_title is not empty %}
<div class="profile__header__title">
{{ profile.user_title }}
</div>
{% endif %}
<div class="profile__header__country">
<div class="flag flag--{{ profile.user_country|lower }}"></div>
<div class="profile__header__country__name">
{{ profile.user_country|country_name }}
</div>
</div>
</div>
{% if friend_info is defined and (friend_info.profile_relation is not null or friend_info.visitor_relation is not null) %}
<div class="profile__header__details__relation" title="Since {{ friend_info.relation_created|date('r') }}">
{% if friend_info.profile_relation and friend_info.visitor_relation %}
Mutual Friends
{% elseif friend_info.visitor_relation %}
You Follow
{% elseif friend_info.profile_relation %}
Follows You
{% endif %}
</div>
{% endif %}
</div>
<div class="profile__header__options">
<div class="profile__header__actions">
{% if current_user.user_id|default(0) == profile.user_id %}
<a href="/settings.php" class="input__button input__button--new">Edit Profile</a>
{% elseif current_user is defined %}
{% if friend_info.visitor_relation == constant('MSZ_USER_RELATION_FOLLOW') %}
<a href="/relations.php?u={{ profile.user_id }}&amp;m=remove" class="input__button input__button--new input__button--destroy">{{ friend_info.profile_relation == constant('MSZ_USER_RELATION_FOLLOW') ? 'Unfriend' : 'Unfollow' }}</a>
{% else %}
<a href="/relations.php?u={{ profile.user_id }}&amp;m=add&amp;t=follow" class="input__button input__button--new">{{ friend_info.profile_relation == constant('MSZ_USER_RELATION_FOLLOW') ? 'Add as Friend' : 'Follow' }}</a>
{% endif %}
{% endif %}
</div>
{% if stats is defined %}
<div class="profile__header__stats">
{% for stat in stats %}
{% if stat.value|default(false) %}
{% set is_date = stat.is_date|default(false) %}
<div class="profile__header__stat{% if is_date %} profile__header__stat--date{% endif %}"
title="{{ stat.value|date('r') }}">
<div class="profile__header__stat__name">
{{ stat.title }}
</div>
{% if is_date %}
<time class="profile__header__stat__value" datetime="{{ stat.value|date('c') }}">
{{ stat.value|time_diff }}
</time>
{% else %}
<div class="profile__header__stat__value">
{{ stat.value|number_format }}
</div>
{% endif %}
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
</div>
</div>

View file

@ -10,127 +10,38 @@
{% set site_background_url = '/profile.php?m=background&u=' ~ profile.user_id %} {% set site_background_url = '/profile.php?m=background&u=' ~ profile.user_id %}
{% endif %} {% endif %}
{% set stats = [
{
'title': 'Joined',
'is_date': true,
'value': profile.created_at,
},
{
'title': 'Last seen',
'is_date': true,
'value': profile.last_seen,
},
{
'title': 'Topics',
'value': profile.forum_topic_count,
},
{
'title': 'Posts',
'value': profile.forum_post_count,
},
{
'title': 'Comments',
'value': profile.comments_count,
},
{
'title': 'Changes',
'value': profile.changelog_count,
},
] %}
{% block content %} {% block content %}
<div class="profile" id="profile"> <div class="profile" id="profile">
<div class="profile__header"> {% include 'user/_layout/header.twig' %}
<div class="profile__header__details">
<div class="avatar avatar--new profile__header__avatar" style="background-image:url('{{ image }}')"></div>
<div class="profile__header__details__content">
<div class="profile__header__username" style="{{ profile.user_colour|html_colour({
'color': '%s',
'text-shadow': '0 0 5px %s',
}) }}">
{{ profile.username }}
</div>
{% if profile.user_title is not empty %}
<div class="profile__header__title">
{{ profile.user_title }}
</div>
{% endif %}
<div class="profile__header__country">
<div class="flag flag--{{ profile.user_country|lower }}"></div>
<div class="profile__header__country__name">
{{ profile.user_country|country_name }}
</div>
</div>
</div>
{% if friend_info is defined and (friend_info.profile_relation is not null or friend_info.visitor_relation is not null) %}
<div class="profile__header__details__relation" title="Since {{ friend_info.relation_created|date('r') }}">
{% if friend_info.profile_relation and friend_info.visitor_relation %}
Mutual Friends
{% elseif friend_info.visitor_relation %}
You Follow
{% elseif friend_info.profile_relation %}
Follows You
{% endif %}
</div>
{% endif %}
</div>
<div class="profile__header__options">
<div class="profile__header__actions">
{% if current_user.user_id|default(0) == profile.user_id %}
<a href="/settings.php" class="input__button input__button--new">Edit Profile</a>
{% elseif current_user is defined %}
{% if friend_info.visitor_relation == constant('MSZ_USER_RELATION_FOLLOW') %}
<a href="/relations.php?u={{ profile.user_id }}&amp;m=remove" class="input__button input__button--new input__button--destroy">{{ friend_info.profile_relation == constant('MSZ_USER_RELATION_FOLLOW') ? 'Unfriend' : 'Unfollow' }}</a>
{% else %}
<a href="/relations.php?u={{ profile.user_id }}&amp;m=add&amp;t=follow" class="input__button input__button--new">{{ friend_info.profile_relation == constant('MSZ_USER_RELATION_FOLLOW') ? 'Add as Friend' : 'Follow' }}</a>
{% endif %}
{% endif %}
</div>
<div class="profile__header__stats">
<div class="profile__header__stat profile__header__stat--date" title="{{ profile.created_at|date('r') }}">
<div class="profile__header__stat__name">
Joined
</div>
<time class="profile__header__stat__value" datetime="{{ profile.created_at|date('c') }}">
{{ profile.created_at|time_diff }}
</time>
</div>
{% if profile.last_seen is not null %}
<div class="profile__header__stat profile__header__stat--date" title="{{ profile.last_seen|date('r') }}">
<div class="profile__header__stat__name">
Last seen
</div>
<time class="profile__header__stat__value" datetime="{{ profile.last_seen|date('c') }}">
{{ profile.last_seen|date('U') + 10 >= ''|date('U') ? 'just now' : profile.last_seen|time_diff }}
</time>
</div>
{% endif %}
{% if profile.forum_topic_count > 0 %}
<div class="profile__header__stat">
<div class="profile__header__stat__name">
Topics
</div>
<div class="profile__header__stat__value">
{{ profile.forum_topic_count|number_format }}
</div>
</div>
{% endif %}
{% if profile.forum_post_count > 0 %}
<div class="profile__header__stat">
<div class="profile__header__stat__name">
Posts
</div>
<div class="profile__header__stat__value">
{{ profile.forum_post_count|number_format }}
</div>
</div>
{% endif %}
{% if profile.comments_count > 0 %}
<div class="profile__header__stat">
<div class="profile__header__stat__name">
Comments
</div>
<div class="profile__header__stat__value">
{{ profile.comments_count|number_format }}
</div>
</div>
{% endif %}
{% if profile.changelog_count > 0 %}
<a class="profile__header__stat" href="/changelog.php?u={{ profile.user_id }}">
<div class="profile__header__stat__name">
Changes
</div>
<div class="profile__header__stat__value">
{{ profile.changelog_count|number_format }}
</div>
</a>
{% endif %}
</div>
</div>
</div>
<div class="warning"> <div class="warning">
<div class="warning__content"> <div class="warning__content">