Rewrote URL registry.
This commit is contained in:
parent
a94b905116
commit
c3827bceff
75 changed files with 750 additions and 599 deletions
templates
_layout
changelog
forum
home
macros.twigmanage
changelog
forum
general
news
users
news
profile
settings
user
|
@ -26,8 +26,8 @@
|
|||
<div class="header__background"></div>
|
||||
|
||||
<div class="header__desktop">
|
||||
<a class="header__desktop__logo" href="{{ url('index') }}" title="{{ globals.site_name }}">
|
||||
{{ globals.site_name }}
|
||||
<a class="header__desktop__logo" href="{{ url('index') }}" title="{{ globals.site_info.name }}">
|
||||
{{ globals.site_info.name }}
|
||||
</a>
|
||||
|
||||
<div class="header__desktop__menus">
|
||||
|
@ -76,7 +76,7 @@
|
|||
</label>
|
||||
|
||||
<a class="header__mobile__logo header__mobile__icon" href="{{ url('index') }}">
|
||||
{{ globals.site_name }}
|
||||
{{ globals.site_info.name }}
|
||||
</a>
|
||||
|
||||
<label class="header__mobile__icon header__mobile__avatar" for="toggle-mobile-header">
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
{% apply spaceless %}
|
||||
{% set description = description|default(globals.site_description) %}
|
||||
{% set description = description|default(globals.site_info.description) %}
|
||||
|
||||
{% if title is defined %}
|
||||
{% set browser_title = title ~ ' :: ' ~ globals.site_name %}
|
||||
{% set browser_title = title ~ ' :: ' ~ globals.site_info.name %}
|
||||
{% else %}
|
||||
{% set browser_title = globals.site_name %}
|
||||
{% set browser_title = globals.site_info.name %}
|
||||
{% endif %}
|
||||
|
||||
<title>{{ browser_title }}</title>
|
||||
|
||||
<meta property="og:title" content="{{ title|default(globals.site_name) }}">
|
||||
<meta property="og:site_name" content="{{ globals.site_name }}">
|
||||
<meta property="og:title" content="{{ title|default(globals.site_info.name) }}">
|
||||
<meta property="og:site_name" content="{{ globals.site_info.name }}">
|
||||
|
||||
{% if description|length > 0 %}
|
||||
<meta name="description" content="{{ description }}">
|
||||
|
@ -21,11 +21,7 @@
|
|||
|
||||
{% if image is defined %}
|
||||
{% if image|slice(0, 1) == '/' %}
|
||||
{% if globals.site_url is not defined or globals.site_url|length < 1 %}
|
||||
{% set image = '' %}
|
||||
{% else %}
|
||||
{% set image = globals.site_url|trim('/') ~ image %}
|
||||
{% endif %}
|
||||
{% set image = globals.site_info.hasURL ? (globals.site_info.url ~ image) : '' %}
|
||||
{% endif %}
|
||||
|
||||
{% if image|length > 0 %}
|
||||
|
@ -35,11 +31,7 @@
|
|||
|
||||
{% if canonical_url is defined %}
|
||||
{% if canonical_url|slice(0, 1) == '/' %}
|
||||
{% if globals.site_url is not defined or globals.site_url|length < 1 %}
|
||||
{% set canonical_url = '' %}
|
||||
{% else %}
|
||||
{% set canonical_url = globals.site_url|trim('/') ~ canonical_url %}
|
||||
{% endif %}
|
||||
{% set canonical_url = globals.site_info.hasURL ? (globals.site_info.url ~ canonical_url) : '' %}
|
||||
{% endif %}
|
||||
|
||||
{% if canonical_url|length > 0 %}
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
{% if not is_date %}
|
||||
<div class="changelog__pagination">
|
||||
{{ pagination(changelog_pagination, url('changelog-index'), null, {'date':changelog_date_fmt, 'user':changelog_user.id|default(0)})}}
|
||||
{{ pagination(changelog_pagination, 'changelog-index', {'date': changelog_date_fmt, 'user': changelog_user.id|default(0)}) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
|
||||
{% set is_locked = is_archived %}
|
||||
{% set can_topic = not is_locked and perms.can_create_topic %}
|
||||
{% set pag = pagination(pagination_info, url('forum-category'), null, {'f': forum_id}) %}
|
||||
{% set pag = pagination(pagination_info, 'forum-category', {'forum': forum_id}) %}
|
||||
|
||||
{% if can_topic or pag|trim|length > 0 %}
|
||||
<div class="container forum__actions">
|
||||
|
@ -114,7 +114,7 @@
|
|||
{% macro forum_topic_tools(info, pagination_info, can_reply) %}
|
||||
{% from 'macros.twig' import pagination %}
|
||||
|
||||
{% set pag = pagination(pagination_info, url('forum-topic'), null, {'t': info.id}, 'page') %}
|
||||
{% set pag = pagination(pagination_info, 'forum-topic', {'topic': info.id}) %}
|
||||
|
||||
{% if can_reply or pag|trim|length > 0 %}
|
||||
<div class="container forum__actions">
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<div class="landingv2-header-content">
|
||||
<div class="landingv2-welcome">
|
||||
<a href="{{ url('index') }}">
|
||||
<img src="/images/landing-logo.png" alt="{{ globals.site_name }}">
|
||||
<img src="/images/landing-logo.png" alt="{{ globals.site_info.name }}">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -11,11 +11,10 @@
|
|||
</ul>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro pagination(info, path, page_range, params, page_param, url_fragment) %}
|
||||
{% macro pagination(info, name, params, range) %}
|
||||
{% if info.page is defined and info.pages > 1 %}
|
||||
{% set params = params is iterable ? params : [] %}
|
||||
{% set page_param = page_param|default('p') %}
|
||||
{% set page_range = page_range|default(5) %}
|
||||
{% set params = params is iterable ? params : {} %}
|
||||
{% set range = range|default(3) %}
|
||||
|
||||
<div class="pagination">
|
||||
<div class="pagination__section pagination__section--first">
|
||||
|
@ -27,21 +26,21 @@
|
|||
<i class="fas fa-angle-left"></i>
|
||||
</div>
|
||||
{% else %}
|
||||
<a href="{{ url_construct(path, params, url_fragment) }}" class="pagination__link pagination__link--first" rel="first">
|
||||
<a href="{{ url(name, params) }}" class="pagination__link pagination__link--first" rel="first">
|
||||
<i class="fas fa-angle-double-left"></i>
|
||||
</a>
|
||||
<a href="{{ url_construct(path, info.page <= 2 ? params : params|merge({(page_param): info.page - 1}), url_fragment) }}" class="pagination__link pagination__link--prev" rel="prev">
|
||||
<a href="{{ url(name, params|merge({'page': info.page - 1})) }}" class="pagination__link pagination__link--prev" rel="prev">
|
||||
<i class="fas fa-angle-left"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="pagination__section pagination__section--pages">
|
||||
{% set p_start = max(info.page - page_range, 1) %}
|
||||
{% set p_stop = min(info.page + page_range, info.pages) %}
|
||||
{% set p_start = max(info.page - range, 1) %}
|
||||
{% set p_stop = min(info.page + range, info.pages) %}
|
||||
|
||||
{% for i in p_start..p_stop %}
|
||||
<a href="{{ url_construct(path, i <= 1 ? params : params|merge({(page_param): i}), url_fragment) }}" class="pagination__link{{ info.page == i ? ' pagination__link--current' : '' }}">
|
||||
<a href="{{ url(name, params|merge({'page': i})) }}" class="pagination__link{{ info.page == i ? ' pagination__link--current' : '' }}">
|
||||
{{ i }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
|
@ -56,10 +55,10 @@
|
|||
<i class="fas fa-angle-double-right"></i>
|
||||
</div>
|
||||
{% else %}
|
||||
<a href="{{ url_construct(path, params|merge({(page_param): info.page + 1}), url_fragment) }}" class="pagination__link pagination__link--next" rel="next">
|
||||
<a href="{{ url(name, params|merge({'page': info.page + 1})) }}" class="pagination__link pagination__link--next" rel="next">
|
||||
<i class="fas fa-angle-right"></i>
|
||||
</a>
|
||||
<a href="{{ url_construct(path, params|merge({(page_param): info.pages}), url_fragment) }}" class="pagination__link pagination__link--last" rel="last">
|
||||
<a href="{{ url(name, params|merge({'page': info.pages})) }}" class="pagination__link pagination__link--last" rel="last">
|
||||
<i class="fas fa-angle-double-right"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
{% from 'changelog/macros.twig' import changelog_listing %}
|
||||
|
||||
{% block manage_content %}
|
||||
{% set changelog_pagination = pagination(changelog_pagination, url('manage-changelog-changes')) %}
|
||||
{% set changelog_pagination = pagination(changelog_pagination, 'manage-changelog-changes') %}
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{% from 'macros.twig' import pagination, container_title %}
|
||||
{% from '_layout/input.twig' import input_csrf, input_text %}
|
||||
|
||||
{% set redirs_pagination = pagination(manage_redirs_pagination, url('manage-forum-topic-redirs')) %}
|
||||
{% set redirs_pagination = pagination(manage_redirs_pagination, 'manage-forum-topic-redirs') %}
|
||||
|
||||
{% block manage_content %}
|
||||
<div class="container">
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
{% block manage_content %}
|
||||
<div class="container settings__container">
|
||||
{{ container_title('<i class="fas fa-file-alt fa-fw"></i> Global Log') }}
|
||||
{% set glp = pagination(global_logs_pagination, url('manage-general-logs'), null, {'v': 'logs'}) %}
|
||||
{% set glp = pagination(global_logs_pagination, 'manage-general-logs') %}
|
||||
|
||||
<div class="settings__account-logs">
|
||||
<div class="settings__account-logs__pagination">
|
||||
|
|
|
@ -16,6 +16,6 @@
|
|||
</p>
|
||||
{% endfor %}
|
||||
|
||||
{{ pagination(categories_pagination, url('manage-news-categories')) }}
|
||||
{{ pagination(categories_pagination, 'manage-news-categories') }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -22,6 +22,6 @@
|
|||
</p>
|
||||
{% endfor %}
|
||||
|
||||
{{ pagination(posts_pagination, url('manage-news-posts')) }}
|
||||
{{ pagination(posts_pagination, 'manage-news-posts') }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends 'manage/users/master.twig' %}
|
||||
{% from 'macros.twig' import pagination, container_title, avatar %}
|
||||
|
||||
{% set bans_pagination = pagination(manage_bans_pagination, url('manage-users-bans', {'user': manage_bans_filter_user.id|default(0)})) %}
|
||||
{% set bans_pagination = pagination(manage_bans_pagination, 'manage-users-bans', {'user': manage_bans_filter_user.id|default(0)}) %}
|
||||
{% set bans_filtering = manage_bans_filter_user is not null %}
|
||||
|
||||
{% block manage_content %}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends 'manage/users/master.twig' %}
|
||||
{% from 'macros.twig' import pagination, container_title, avatar %}
|
||||
|
||||
{% set notes_pagination = pagination(manage_notes_pagination, url('manage-users-notes', {'user': manage_notes_filter_user.id|default(0)})) %}
|
||||
{% set notes_pagination = pagination(manage_notes_pagination, 'manage-users-notes', {'user': manage_notes_filter_user.id|default(0)}) %}
|
||||
{% set notes_filtering = manage_notes_filter_user is not null %}
|
||||
|
||||
{% block manage_content %}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends 'manage/users/master.twig' %}
|
||||
{% from 'macros.twig' import pagination, container_title %}
|
||||
|
||||
{% set roles_pagination = pagination(manage_roles_pagination, url('manage-roles')) %}
|
||||
{% set roles_pagination = pagination(manage_roles_pagination, 'manage-roles') %}
|
||||
|
||||
{% block manage_content %}
|
||||
<div class="container manage__roles">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends 'manage/users/master.twig' %}
|
||||
{% from 'macros.twig' import pagination, container_title, avatar %}
|
||||
|
||||
{% set users_pagination = pagination(manage_users_pagination, url('manage-users')) %}
|
||||
{% set users_pagination = pagination(manage_users_pagination, 'manage-users') %}
|
||||
|
||||
{% block manage_content %}
|
||||
<div class="container manage__users">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends 'manage/users/master.twig' %}
|
||||
{% from 'macros.twig' import pagination, container_title, avatar %}
|
||||
|
||||
{% set warns_pagination = pagination(manage_warns_pagination, url('manage-users-warnings', {'user': manage_warns_filter_user.id|default(0)})) %}
|
||||
{% set warns_pagination = pagination(manage_warns_pagination, 'manage-users-warnings', {'user': manage_warns_filter_user.id|default(0)}) %}
|
||||
{% set warns_filtering = manage_warns_filter_user is not null %}
|
||||
|
||||
{% block manage_content %}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
:root {
|
||||
--background-width: {{ site_background.width }}px;
|
||||
--background-height: {{ site_background.height }}px;
|
||||
--background-image: url('{{ site_background.url|raw }}');
|
||||
--background-image: url('{{ site_background_url|raw }}');
|
||||
}
|
||||
</style>
|
||||
{% endif %}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
{% endfor %}
|
||||
|
||||
<div class="container" style="padding: 4px; display: {{ news_pagination.pages > 1 ? 'block' : 'none' }}">
|
||||
{{ pagination(news_pagination, url('news-category', {'category': news_category.id})) }}
|
||||
{{ pagination(news_pagination, 'news-category', {'category': news_category.id}) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
{% endfor %}
|
||||
|
||||
<div class="container" style="padding: 4px; display: {{ news_pagination.pages > 1 ? 'block' : 'none' }}">
|
||||
{{ pagination(news_pagination, url('news-index')) }}
|
||||
{{ pagination(news_pagination, 'news-index') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
{% set manage_link = url('manage-user', {'user': profile_user.id}) %}
|
||||
{% if (not profile_is_banned or profile_can_edit) %}
|
||||
{% set site_background = profile_background_info %}
|
||||
{% set site_background_url = url('user-background', {'user': profile_user.id}) %}
|
||||
{% endif %}
|
||||
{% set stats = [
|
||||
{
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
{% block settings_content %}
|
||||
<div class="container settings__container" id="login-history">
|
||||
{{ container_title('<i class="fas fa-user-lock fa-fw"></i> Login History') }}
|
||||
{% set lhpagination = pagination(login_history_pagination, url('settings-logs'), null, {
|
||||
'ap': account_log_pagination.page > 1 ? account_log_pagination.page : 0,
|
||||
}, 'hp', 'login-history') %}
|
||||
{% set lhpagination = pagination(login_history_pagination, 'settings-logs-logins', {
|
||||
'account-page': account_log_pagination.page > 1 ? account_log_pagination.page : 0,
|
||||
}) %}
|
||||
|
||||
<div class="settings__description">
|
||||
<p>These are all the login attempts to your account. If any attempt that you don't recognise is marked as successful your account may be compromised, ask a staff member for advice in this case.</p>
|
||||
|
@ -38,9 +38,9 @@
|
|||
|
||||
<div class="container settings__container" id="account-log">
|
||||
{{ container_title('<i class="fas fa-file-alt fa-fw"></i> Account Log') }}
|
||||
{% set alpagination = pagination(account_log_pagination, url('settings-logs'), null, {
|
||||
'hp': login_history_pagination.page > 1 ? login_history_pagination.page : 0,
|
||||
}, 'ap', 'account-log') %}
|
||||
{% set alpagination = pagination(account_log_pagination, 'settings-logs-account', {
|
||||
'logins-page': login_history_pagination.page > 1 ? login_history_pagination.page : 0,
|
||||
}) %}
|
||||
|
||||
<div class="settings__description">
|
||||
<p>This is a log of all "important" actions that have been done using your account for your review. If you notice anything strange, please alert the staff.</p>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<div class="container settings__container">
|
||||
{{ container_title('<i class="fas fa-key fa-fw"></i> Sessions') }}
|
||||
|
||||
{% set spagination = pagination(session_pagination, url('settings-sessions')) %}
|
||||
{% set spagination = pagination(session_pagination, 'settings-sessions') %}
|
||||
|
||||
<div class="settings__description">
|
||||
<p>These are the active logins to your account, clicking the Kill button will force a logout on that session. Your current login is highlighted with a different colour so you don't accidentally force yourself to logout.</p>
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
</form>
|
||||
|
||||
<div class="userlist__pagination">
|
||||
{{ pagination(users_pagination, url('user-list'), null, {'r': url_role, 'ss': url_sort, 'sd': url_direction}) }}
|
||||
{{ pagination(users_pagination, 'user-list', null, {'r': url_role, 'ss': url_sort, 'sd': url_direction}) }}
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue