misuzu/templates/user/profile.twig
2018-09-19 00:41:38 +02:00

175 lines
8.8 KiB
Twig

{% extends 'user/master.twig' %}
{% from 'macros.twig' import navigation %}
{% set image = '/profile.php?u=' ~ profile.user_id ~ '&m=avatar' %}
{% set canonical_url = '/profile.php?u=' ~ profile.user_id %}
{% set title = 'Profile of ' ~ profile.username %}
{% set manage_link = '/manage/users.php?v=view&u=' ~ profile.user_id %}
{% if has_background %}
{% set site_background_url = '/profile.php?m=background&u=' ~ profile.user_id %}
{% endif %}
{% block content %}
<div class="profile" id="profile">
<div class="profile__header">
<div class="profile__header__details">
<div class="avatar 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="profile__header__action">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="profile__header__action profile__header__action--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="profile__header__action">{{ 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="profile__container__placeholder">
<div class="profile__container__placeholder__content">
The profile pages are still under much construction, more things will eventually populate the area where this container current exists.
</div>
</div>
<div class="profile__container">
<div class="profile__container__side">
{% if current_user is not defined %}
<div class="profile__accounts">
<div class="profile__accounts__notice">
You must <a href="/auth.php?m=login" class="profile__accounts__link">log in</a> to view full profiles!
</div>
</div>
{% elseif profile_fields|default([])|length > 0 %}
<div class="profile__accounts">
{% for name, data in profile_fields %}
<div class="profile__accounts__item">
<div class="profile__accounts__title">
{{ data.name }}
</div>
<div class="profile__accounts__value"
{% if data.tooltip is defined %}title="{{ data.tooltip|format(data.value)|raw }}"{% endif %}>
{% set profile_field_value = (data.format is defined ? data.format : '%s')|format(data.value) %}
{% if data.link is defined %}
{{ data.link|format(data.value)|html_link(profile_field_value, 'profile__accounts__link')|raw }}
{% else %}
{{ profile_field_value }}
{% endif %}
</div>
</div>
{% endfor %}
</div>
{% endif %}
</div>
<div class="profile__container__main">
</div>
</div>
</div>
{% endblock %}