misuzu/templates/home/landing.twig

205 lines
9.5 KiB
Twig
Raw Permalink Normal View History

2022-09-13 13:14:49 +00:00
{% extends 'home/master.twig' %}
{% from 'macros.twig' import container_title, avatar %}
{% set canonical_url = '/' %}
{% set landing_stats = [
{
icon: 'fas fa-users fa-fw',
name: 'members',
value: statistics.count_users_all|number_format,
},
{
icon: 'fas fa-user-check fa-fw',
name: 'online',
value: statistics.count_users_online|number_format,
},
{
icon: 'fas fa-user-clock fa-fw',
name: 'active (24 hr)',
value: statistics.count_users_active|number_format,
},
{
icon: 'fas fa-list fa-fw',
name: 'topics',
value: statistics.count_forum_topics|number_format,
},
{
icon: 'fas fa-comments fa-fw',
name: 'posts',
value: statistics.count_forum_posts|number_format,
},
{
icon: 'fas fa-comment-dots fa-fw',
name: 'comments',
value: statistics.count_comments|number_format,
},
] %}
{% block main_header %}
<div class="landingv2-header">
<div class="landingv2-header-background"></div>
<div class="landingv2-header-content">
<div class="landingv2-welcome">
<a href="{{ url('index') }}">
<img src="/images/landing-logo.png" alt="{{ globals.site_name }}"/>
</a>
</div>
<div class="landingv2-header-menu">
{% for item in site_menu[1:] %}
{% if item.display is not defined or item.display %}
<a href="{{ item.url }}" class="landingv2-header-menu-link">{{ item.title }}</a>
{% endif %}
{% endfor %}
<a href="{{ url('auth-login') }}" class="landingv2-header-menu-link landingv2-auth-link landingv2-auth-link-login">
<div><i class="fas fa-sign-in-alt fa-fw"></i> Log in</div>
</a>
<a href="{{ url('auth-register') }}" class="landingv2-header-menu-link landingv2-auth-link landingv2-auth-link-register">
<div><i class="fas fa-user-plus fa-fw"></i> Register</div>
</a>
</div>
</div>
</div>
{% endblock %}
{% block main_footer %}
<footer class="landingv2-footer">
<div class="landingv2-footer-background"></div>
<div class="landingv2-footer-wrapper">
<div class="landingv2-footer-navigation">
{% for item in site_menu[0].menu %}
{% if item.display is not defined or item.display %}
<div>
<a href="{{ item.url }}">{{ item.title }}</a>
</div>
{% endif %}
{% endfor %}
</div>
<div class="landingv2-footer-copyright">
<div class="landingv2-footer-copyright-line">
<a href="https://flash.moe" target="_blank" rel="noreferrer noopener">Flashwave</a> 2013-{{ ''|date('Y') }}
</div>
<div class="landingv2-footer-copyright-line">
{% set git_branch = git_branch() %}
{% if git_branch != 'HEAD' %}
<a href="https://github.com/flashwave/misuzu/tree/{{ git_branch }}" target="_blank" rel="noreferrer noopener">{{ git_branch }}</a>
{% else %}
{% set git_tag = git_tag() %}
<a href="https://github.com/flashwave/misuzu/tree/{{ git_tag }}" target="_blank" rel="noreferrer noopener">{{ git_tag }}</a>
{% endif %}
# <a href="https://github.com/flashwave/misuzu/commit/{{ git_commit_hash(true) }}" target="_blank" rel="noreferrer noopener">{{ git_commit_hash() }}</a>
</div>
{% if constant('MSZ_DEBUG') or current_user.super|default(false) %}
{% set sql_query_count = sql_query_count() %}
2022-09-13 13:14:49 +00:00
<div class="landingv2-footer-copyright-line">
{{ sql_query_count.total|number_format }} (<span title="{{ sql_query_count.ndx|number_format }} queries processed through Index">{{ sql_query_count.ndx|number_format }}</span> + <span title="{{ sql_query_count.pdo|number_format }} queries processed through PDO">{{ sql_query_count.pdo|number_format }}</span>) queries / {{ (startup_time() - startup_time(constant('MSZ_TPL_RENDER')))|number_format(5) }} load / {{ startup_time(constant('MSZ_TPL_RENDER'))|number_format(5) }} render / {{ startup_time()|number_format(5) }} total
2022-09-13 13:14:49 +00:00
</div>
{% endif %}
</div>
</div>
</footer>
{% endblock %}
{% block content %}
<div class="landingv2-content">
<div class="landingv2-stats">
{% for stat in landing_stats %}
<div class="landingv2-stat">
<div class="landingv2-stat-icon">
<i class="{{ stat.icon }}"></i>
</div>
<div class="landingv2-stat-value">
<span class="landingv2-stat-value-num">{{ stat.value }}</span> {{ stat.name }}
</div>
</div>
{% endfor %}
</div>
<div class="landingv2-forum">
<div class="landingv2-forum-topics landingv2-forum-topics-popular">
{{ container_title('<i class="fas fa-star fa-fw"></i> Popular Topics') }}
<div class="landingv2-forum-topics-list">
{% for topic in forum_popular %}
<div class="landingv2-forum-topic">
<a href="{{ url('forum-topic', {'topic': topic.topic_id}) }}" class="landingv2-forum-topic-link"></a>
<div class="landingv2-forum-topic-info">
<div class="landingv2-forum-topic-info-icon">
<i class="{{ topic.forum_icon|default('fas fa-comments fa-fw') }}"></i>
</div>
<div class="landingv2-forum-topic-info-details">
<div class="landingv2-forum-topic-info-details-title">
{{ topic.topic_title }}
</div>
</div>
<div class="landingv2-forum-topic-info-stats">
<div class="landingv2-forum-topic-info-stats-posts">{{ topic.topic_count_posts|number_format }}</div>
<div class="landingv2-forum-topic-info-stats-views">{{ topic.topic_count_views|number_format }}</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
<div class="landingv2-forum-topics landingv2-forum-topics-active">
{{ container_title('<i class="fas fa-wind fa-fw"></i> Active Topics') }}
<div class="landingv2-forum-topics-list">
{% for topic in forum_active %}
<div class="landingv2-forum-topic">
<a href="{{ url('forum-post', {'post': topic.latest_post_id}) }}" class="landingv2-forum-topic-link"></a>
<div class="landingv2-forum-topic-info">
<div class="landingv2-forum-topic-info-icon">
<i class="{{ topic.forum_icon|default('fas fa-comments fa-fw') }}"></i>
</div>
<div class="landingv2-forum-topic-info-details">
<div class="landingv2-forum-topic-info-details-title">
{{ topic.topic_title }}
</div>
</div>
<div class="landingv2-forum-topic-info-stats">
<div class="landingv2-forum-topic-info-stats-posts">{{ topic.topic_count_posts|number_format }}</div>
<div class="landingv2-forum-topic-info-stats-views">{{ topic.topic_count_views|number_format }}</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
<div class="landingv2-news">
{% for post in featured_news %}
<div class="landingv2-news-post markdown">
<h1>{{ post.title }}</h1>
2023-07-15 17:02:46 +00:00
<p>{{ post.firstParagraph|parse_text(2)|raw }}</p>
2022-09-13 13:14:49 +00:00
<div class="landingv2-news-post-options">
<a href="{{ url('news-post', {'post': post.id}) }}" class="landingv2-news-post-option">Continue reading</a>
| {{ post.createdTime|time_diff }}
</div>
</div>
{% endfor %}
</div>
{% if online_users|length > 0 %}
<div class="landingv2-online">
{{ container_title('<i class="fas fa-users fa-fw"></i> Currently Online') }}
<div class="landingv2-online-users">
<div class="landingv2-online-inner">
{% for user in online_users %}
<a href="{{ url('user-profile', {'user': user.user_id}) }}" class="landingv2-online-avatar" title="{{ user.username }}">
{{ avatar(user.user_id, 50, user.username) }}
</a>
{% endfor %}
</div>
</div>
</div>
{% endif %}
</div>
{% if linked_data is defined and linked_data is iterable %}
<script type="application/ld+json">{ "@context": "http://schema.org", "@type": "Organization", "name": "{{ linked_data.name }}", "url": "{{ linked_data.url }}", "logo": "{{ linked_data.logo }}", "sameAs": ["{{ linked_data.same_as|join('", "')|raw }}"] }</script>
{% endif %}
{% endblock %}