misuzu/templates/user/view.twig

200 lines
9.4 KiB
Twig
Raw Normal View History

2018-08-15 01:12:58 +00:00
{% extends 'user/master.twig' %}
{% from 'macros.twig' import navigation %}
2018-03-22 02:56:41 +00:00
2018-04-14 02:58:53 +00:00
{% set image = '/profile.php?u=' ~ profile.user_id ~ '&m=avatar' %}
{% set canonical_url = '/profile.php?u=' ~ profile.user_id %}
2018-03-22 02:56:41 +00:00
{% set title = 'Profile of ' ~ profile.username %}
{% set manage_link = '/manage/users.php?v=view&u=' ~ profile.user_id %}
2018-03-22 02:56:41 +00:00
2018-04-06 21:57:05 +00:00
{% set youtube_is_channel_id = profile.user_youtube|slice(0, 2) == 'UC' and profile.user_youtube|length == 24 %}
2018-03-23 00:27:46 +00:00
{% set profile_fields = {
2018-07-06 01:28:06 +00:00
'twitter': {
'title': 'Twitter',
'value': profile.user_twitter|escape,
'link': 'https://twitter.com/%s',
'format': '@%s',
2018-03-23 00:27:46 +00:00
},
2018-07-06 01:28:06 +00:00
'osu': {
'title': 'osu!',
'value': profile.user_osu|escape,
'link': 'https://osu.ppy.sh/users/%s',
2018-03-23 00:27:46 +00:00
},
2018-07-06 01:28:06 +00:00
'website': {
'title': 'Website',
'value': profile.user_website|escape,
'link': '%s',
'tooltip': '%s',
2018-03-23 00:27:46 +00:00
},
2018-07-06 01:28:06 +00:00
'youtube': {
'title': 'Youtube',
'value': profile.user_youtube|escape,
'link': 'https://youtube.com/' ~ (youtube_is_channel_id ? 'channel/' : '') ~ '%s',
'format': youtube_is_channel_id ? 'Channel' : '%s',
2018-03-23 00:27:46 +00:00
},
2018-07-06 01:28:06 +00:00
'steam': {
'title': 'Steam',
'value': profile.user_steam|escape,
'link': 'https://steamcommunity.com/id/%s',
2018-03-23 00:27:46 +00:00
},
2018-07-06 01:28:06 +00:00
'twitchtv': {
'title': 'Twitch.tv',
'value': profile.user_twitchtv|escape,
'link': 'https://twitch.tv/%s',
2018-03-23 00:27:46 +00:00
},
2018-07-06 01:28:06 +00:00
'lastfm': {
'title': 'Last.fm',
'value': profile.user_lastfm|escape,
'link': 'http://last.fm/user/%s',
2018-03-23 00:27:46 +00:00
},
2018-07-06 01:28:06 +00:00
'github': {
'title': 'Github',
'value': profile.user_github|escape,
'link': 'https://github.com/%s',
2018-03-23 00:27:46 +00:00
},
2018-07-06 01:28:06 +00:00
'skype': {
'title': 'Skype',
'value': profile.user_skype|escape,
'link': 'skype:%s?userinfo',
2018-03-23 00:27:46 +00:00
},
2018-07-06 01:28:06 +00:00
'discord': {
'title': 'Discord',
'value': profile.user_discord|escape,
2018-03-23 00:27:46 +00:00
},
} %}
2018-03-22 02:56:41 +00:00
{% block content %}
{# navigation({
(profile.username): 'profile',
'Comments': 'comments',
}, 'profile', true, '#%s') #}
2018-03-22 02:56:41 +00:00
<div class="profile" id="profile">
2018-04-16 00:33:54 +00:00
<div class="container profile__header">
<div class="container__title">Profile of {{ profile.username }}</div>
<div class="profile__header__content">
2018-04-16 00:33:54 +00:00
<div class="profile__info">
<div class="profile__info__section">
<div class="profile__info__block">
2018-05-16 02:58:21 +00:00
{% if profile.user_title is not empty %}
<div class="profile__info__row">
2018-07-06 01:28:06 +00:00
<div class="profile__info__column profile__info__column--user-title" style="{{ profile.user_colour|html_colour }}">
2018-05-16 02:58:21 +00:00
{{ profile.user_title }}
</div>
</div>
{% endif %}
2018-04-16 00:33:54 +00:00
<div class="profile__info__row">
<div class="profile__info__column profile__info__column--icons">
2018-07-06 01:28:06 +00:00
<div class="flag flag--{{ profile.user_country|lower }} profile__icon">{{ profile.user_country }}</div>
2018-03-23 00:27:46 +00:00
</div>
2018-04-16 00:33:54 +00:00
<div class="profile__info__column profile__info__column--country">
2018-03-23 00:27:46 +00:00
{{ profile.user_country|country_name }}
</div>
2018-03-22 02:56:41 +00:00
</div>
</div>
2018-04-16 00:33:54 +00:00
<div class="profile__info__block">
<div class="profile__info__row" title="{{ profile.created_at|date('r') }}">
2018-04-16 00:33:54 +00:00
<div class="profile__info__column profile__info__column--heading">
2018-03-22 02:56:41 +00:00
Joined
</div>
<time class="profile__info__column" datetime="{{ profile.created_at|date('c') }}">
{{ profile.created_at|time_diff }}
</time>
2018-03-22 02:56:41 +00:00
</div>
2018-05-18 01:20:27 +00:00
{% if profile.last_seen is not null %}
<div class="profile__info__row" title="{{ profile.last_seen|date('r') }}">
2018-05-18 01:20:27 +00:00
<div class="profile__info__column profile__info__column--heading">
Last Seen
</div>
<time class="profile__info__column" datetime="{{ profile.last_seen|date('c') }}">
2018-05-27 23:24:16 +00:00
{{ profile.last_seen|date('U') + 10 >= ''|date('U') ? 'just now' : profile.last_seen|time_diff }}
</time>
2018-05-18 01:20:27 +00:00
</div>
{% endif %}
</div>
<div class="profile__info__block">
<div class="profile__info__row">
<div class="profile__info__column profile__info__column--heading">
2018-05-18 01:20:27 +00:00
Topics
</div>
2018-05-18 01:20:27 +00:00
<div class="profile__info__column profile__info__column--numeric">
2018-07-06 01:28:06 +00:00
{{ profile.forum_topic_count|number_format }}
2018-05-18 01:20:27 +00:00
</div>
</div>
<div class="profile__info__row">
<div class="profile__info__column profile__info__column--heading">
Posts
</div>
<div class="profile__info__column profile__info__column--numeric">
2018-07-06 01:28:06 +00:00
{{ profile.forum_post_count|number_format }}
</div>
</div>
2018-03-22 02:56:41 +00:00
</div>
2018-07-06 01:28:06 +00:00
2018-08-12 13:35:50 +00:00
{% if profile.comments_count > 0 %}
<div class="profile__info__block">
<div class="profile__info__row">
<div class="profile__info__column profile__info__column--heading">
Comments
</div>
<div class="profile__info__column profile__info__column--numeric">
{{ profile.comments_count|number_format }}
</div>
</div>
</div>
{% endif %}
2018-07-06 01:28:06 +00:00
{% if profile.changelog_count > 0 %}
<div class="profile__info__block">
2018-07-07 19:25:12 +00:00
<a class="profile__info__row profile__info__row--link" href="/changelog.php?u={{ profile.user_id }}">
2018-07-06 01:28:06 +00:00
<div class="profile__info__column profile__info__column--heading">
Changes
</div>
<div class="profile__info__column profile__info__column--numeric">
{{ profile.changelog_count|number_format }}
</div>
2018-07-07 19:25:12 +00:00
</a>
2018-07-06 01:28:06 +00:00
</div>
{% endif %}
2018-03-22 02:56:41 +00:00
</div>
2018-03-23 00:27:46 +00:00
2018-05-16 02:58:21 +00:00
{% if app.hasActiveSession %}
2018-03-23 00:27:46 +00:00
{% spaceless %}
2018-04-16 00:33:54 +00:00
<div class="profile__info__section">
<div class="profile__info__block profile__info__block--links">
2018-07-06 01:28:06 +00:00
{% autoescape false %}
2018-03-23 00:27:46 +00:00
{% for name, data in profile_fields %}
2018-03-25 21:46:07 +00:00
{% if (data.display is defined ? data.display : true) and data.value|length > 0 %}
2018-04-16 00:33:54 +00:00
<div class="profile__info__row profile__info__row--field-{{ name }}">
<div class="profile__info__column profile__info__column--heading">
2018-03-23 00:27:46 +00:00
{{ data.title }}
</div>
2018-07-06 01:28:06 +00:00
<div class="profile__info__column"
{% if data.tooltip is defined %}title="{{ data.tooltip|format(data.value)|raw }}"{% endif %}>
2018-03-23 00:27:46 +00:00
{% set profile_field_value = (data.format is defined ? data.format : '%s')|format(data.value) %}
{% if data.link is defined %}
2018-07-06 01:28:06 +00:00
{{ data.link|format(data.value)|html_link(profile_field_value, 'profile__account-link') }}
2018-03-23 00:27:46 +00:00
{% else %}
{{ profile_field_value }}
{% endif %}
</div>
</div>
{% endif %}
{% endfor %}
2018-07-06 01:28:06 +00:00
{% endautoescape %}
2018-03-23 00:27:46 +00:00
</div>
</div>
{% endspaceless %}
2018-03-25 21:46:07 +00:00
{% endif %}
2018-03-22 02:56:41 +00:00
</div>
<div class="avatar profile__avatar" style="background-image:url('{{ image }}')"></div>
2018-03-22 02:56:41 +00:00
</div>
</div>
</div>
{% endblock %}