Use new style on the forum.

This commit is contained in:
flash 2018-10-22 00:11:14 +02:00
parent b8a30fae6c
commit ddedb556be
25 changed files with 78 additions and 49 deletions

View file

@ -59,13 +59,17 @@ body {
--site-background-meta: repeat;
--site-background-image: url('https://mikoto.misaka.nl/i/cloudss.png');
background-blend-mode: multiply;
--accent-colour: #452c4c;
--text-colour: #fff;
--text-colour-inverted: #000;
background-color: var(--accent-colour);
--gradient-start: var(--accent-colour);
}
&--legacy {
--background-color: #fbeeff;
--background-colour: #fbeeff;
--accent-colour: #9475b2;
}
&--bg-blend {

View file

@ -260,9 +260,6 @@ MIG;
'cache' => MSZ_DEBUG ? false : create_directory(build_path(sys_get_temp_dir(), 'msz-tpl-cache-' . md5(MSZ_ROOT))),
]);
// Remove this when the new style is kinda ready
use_legacy_style();
tpl_var('globals', [
'site_name' => config_get_default('Misuzu', 'Site', 'name'),
'site_description' => config_get('Site', 'description'),

View file

@ -5,6 +5,8 @@ $misuzuBypassLockdown = $authMode === 'login' || $authMode === 'get_user';
require_once '../misuzu.php';
use_legacy_style();
$usernameValidationErrors = [
'trim' => 'Your username may not start or end with spaces!',
'short' => sprintf('Your username is too short, it has to be at least %d characters!', MSZ_USERNAME_MIN_LENGTH),

View file

@ -1,6 +1,8 @@
<?php
require_once '../misuzu.php';
use_legacy_style();
$changelogOffset = max((int)($_GET['o'] ?? 0), 0);
$changelogRange = 30;

View file

@ -1,6 +1,8 @@
<?php
require_once '../misuzu.php';
use_legacy_style();
// basing whether or not this is an xhr request on whether a referrer header is present
// this page is never directy accessed, under normal circumstances
$redirect = !empty($_SERVER['HTTP_REFERER']) && empty($_SERVER['HTTP_X_MISUZU_XHR']) ? $_SERVER['HTTP_REFERER'] : '';

View file

@ -50,7 +50,7 @@ if ($forumMayHaveChildren) {
echo tpl_render('forum.forum', [
'forum_breadcrumbs' => forum_get_breadcrumbs($forum['forum_id']),
'forum_colour' => forum_get_colour($forum['forum_id']),
'global_accent_colour' => forum_get_colour($forum['forum_id']),
'forum_may_have_topics' => $forumMayHaveTopics,
'forum_may_have_children' => $forumMayHaveChildren,
'forum_info' => $forum,

View file

@ -137,6 +137,6 @@ if (!empty($topic)) {
echo tpl_render('forum.posting', [
'posting_breadcrumbs' => forum_get_breadcrumbs($forumId),
'forum_colour' => forum_get_colour($forumId),
'global_accent_colour' => forum_get_colour($forumId),
'posting_forum' => $forum,
]);

View file

@ -40,7 +40,7 @@ forum_topic_mark_read(user_session_current('user_id', 0), $topic['topic_id'], $t
echo tpl_render('forum.topic', [
'topic_breadcrumbs' => forum_get_breadcrumbs($topic['forum_id']),
'forum_colour' => forum_get_colour($topic['forum_id']),
'global_accent_colour' => forum_get_colour($topic['forum_id']),
'topic_info' => $topic,
'topic_posts' => $posts,
'topic_offset' => $postsOffset,

View file

@ -1,6 +1,8 @@
<?php
require_once '../misuzu.php';
use_legacy_style();
if (config_get_default(false, 'Site', 'embed_linked_data')) {
tpl_var('linked_data', [
'name' => config_get('Site', 'name'),

View file

@ -1,6 +1,8 @@
<?php
require_once '../misuzu.php';
use_legacy_style();
$pathInfo = $_SERVER['PATH_INFO'] ?? '';
if (empty($pathInfo) || $pathInfo === '/') {

View file

@ -1,6 +1,8 @@
<?php
require_once '../../misuzu.php';
use_legacy_style();
$changelogPerms = perms_get_user(MSZ_PERMS_CHANGELOG, user_session_current('user_id', 0));
$queryOffset = (int)($_GET['o'] ?? 0);

View file

@ -1,6 +1,8 @@
<?php
require_once '../../misuzu.php';
use_legacy_style();
switch ($_GET['v'] ?? null) {
case 'listing':
$forums = db_query('SELECT * FROM `msz_forum_categories`');

View file

@ -1,6 +1,8 @@
<?php
require_once '../../misuzu.php';
use_legacy_style();
$generalPerms = perms_get_user(MSZ_PERMS_GENERAL, user_session_current('user_id', 0));
switch ($_GET['v'] ?? null) {

View file

@ -1,6 +1,8 @@
<?php
require_once '../../misuzu.php';
use_legacy_style();
$newsPerms = perms_get_user(MSZ_PERMS_NEWS, user_session_current('user_id', 0));
switch ($_GET['v'] ?? null) {

View file

@ -1,6 +1,8 @@
<?php
require_once '../../misuzu.php';
use_legacy_style();
$userPerms = perms_get_user(MSZ_PERMS_USER, user_session_current('user_id', 0));
$isPostRequest = $_SERVER['REQUEST_METHOD'] === 'POST';
$queryQffset = (int)($_GET['o'] ?? 0);

View file

@ -1,6 +1,8 @@
<?php
require_once '../misuzu.php';
use_legacy_style();
$usersOffset = max((int)($_GET['o'] ?? 0), 0);
$usersTake = 30;

View file

@ -1,6 +1,8 @@
<?php
require_once '../misuzu.php';
use_legacy_style();
$categoryId = isset($_GET['c']) ? (int)$_GET['c'] : null;
$postId = isset($_GET['p']) ? (int)$_GET['p'] : (isset($_GET['n']) ? (int)$_GET['n'] : null);
$postsOffset = (int)($_GET['o'] ?? 0);

View file

@ -1,4 +1,6 @@
<?php
require_once '../misuzu.php';
use_legacy_style();
echo render_error(404);

View file

@ -4,6 +4,8 @@ $misuzuBypassLockdown = $mode === 'avatar';
require_once '../misuzu.php';
use_legacy_style();
$userId = (int)($_GET['u'] ?? 0);
switch ($mode) {

View file

@ -1,6 +1,8 @@
<?php
require_once '../misuzu.php';
use_legacy_style();
if (empty($_SERVER['HTTP_REFERER']) || !is_local_url($_SERVER['HTTP_REFERER'])) {
header('Location: /');
return;

View file

@ -1,6 +1,8 @@
<?php
require_once '../misuzu.php';
use_legacy_style();
$queryOffset = (int)($_GET['o'] ?? 0);
$queryTake = 15;

View file

@ -9,27 +9,25 @@
}) %}
{% block content %}
<div style="{{ forum_colour|html_colour('--accent-colour') }}">
{{ forum_header(forum_info.forum_name, forum_breadcrumbs, true) }}
{{ forum_header(forum_info.forum_name, forum_breadcrumbs, true) }}
{% if forum_may_have_children and forum_info.forum_subforums|length > 0 %}
{{ forum_category_listing(forum_info.forum_subforums, 'Forums') }}
{% endif %}
{% if forum_may_have_children and forum_info.forum_subforums|length > 0 %}
{{ forum_category_listing(forum_info.forum_subforums, 'Forums') }}
{% endif %}
{% if forum_may_have_topics %}
{% set fcbuttons = current_user is defined ? forum_category_buttons(forum_info, forum_perms) : '' %}
{% set fcpagination = pagination(
forum_info.forum_topic_count,
forum_range,
forum_offset,
'/forum/forum.php'|url_construct({'f': forum_info.forum_id}), 'forum__'
) %}
{% if forum_may_have_topics %}
{% set fcbuttons = current_user is defined ? forum_category_buttons(forum_info, forum_perms) : '' %}
{% set fcpagination = pagination(
forum_info.forum_topic_count,
forum_range,
forum_offset,
'/forum/forum.php'|url_construct({'f': forum_info.forum_id}), 'forum__'
) %}
{{ fcbuttons }}
{{ fcpagination }}
{{ forum_topic_listing(forum_topics) }}
{{ fcpagination }}
{{ fcbuttons }}
{% endif %}
</div>
{{ fcbuttons }}
{{ fcpagination }}
{{ forum_topic_listing(forum_topics) }}
{{ fcpagination }}
{{ fcbuttons }}
{% endif %}
{% endblock %}

View file

@ -12,8 +12,6 @@
{% endif %}
{% block content %}
<div style="{{ forum_colour|html_colour('--accent-colour') }}">
{{ forum_header('Creating Topic', posting_breadcrumbs) }}
{{ forum_posting_form(form_title, form_target_id, posting_topic is defined) }}
</div>
{{ forum_header('Creating Topic', posting_breadcrumbs) }}
{{ forum_posting_form(form_title, form_target_id, posting_topic is defined) }}
{% endblock %}

View file

@ -27,25 +27,23 @@
) %}
{% block content %}
<div style="{{ forum_colour|html_colour('--accent-colour') }}">
{{ forum_header(topic_info.topic_title, topic_breadcrumbs) }}
{{ forum_header(topic_info.topic_title, topic_breadcrumbs) }}
{{ forum_topic_locked(topic_info.topic_locked, topic_info.topic_archived) }}
{{ forum_topic_locked(topic_info.topic_locked, topic_info.topic_archived) }}
{{ ftbuttons }}
{{ ftpagination }}
{{ forum_post_listing(topic_posts, topic_info.topic_first_post_id) }}
{{ ftpagination }}
{{ ftbuttons }}
{{ ftpagination }}
{{ forum_post_listing(topic_posts, topic_info.topic_first_post_id) }}
{{ ftpagination }}
{% if can_reply %}
{{ forum_posting_form('Reply', topic_info.topic_id, true, 'reply', true) }}
{% if can_reply %}
{{ forum_posting_form('Reply', topic_info.topic_id, true, 'reply', true) }}
<script>
window.addEventListener('load', () => {
closeContainer('reply');
document.getElementById('reply').children[0].addEventListener('mouseover', () => openContainer('reply'));
});
</script>
{% endif %}
</div>
<script>
window.addEventListener('load', () => {
closeContainer('reply');
document.getElementById('reply').children[0].addEventListener('mouseover', () => openContainer('reply'));
});
</script>
{% endif %}
{% endblock %}

View file

@ -15,7 +15,9 @@
{% endif %}
</head>
<body class="main {{ use_legacy_style|default(false) ? 'main--legacy' : 'main--default' }}{% if current_user.user_background_settings is defined %} {{ current_user.user_background_settings|bg_settings('main--bg-%s')|join(' ') }}{% endif %}">
<body
class="main {{ use_legacy_style|default(false) ? 'main--legacy' : 'main--default' }}{% if current_user.user_background_settings is defined %} {{ current_user.user_background_settings|bg_settings('main--bg-%s')|join(' ') }}{% endif %}"
style="{% if global_accent_colour is defined %}{{ global_accent_colour|html_colour('--accent-colour') }}{% endif %}">
{% include '_layout/header.twig' %}
<div class="main__wrapper">