[UI][ROUTES][CONTROLLER] Fixing Settings navs and templates

This commit is contained in:
rainydaysavings 2020-07-26 16:05:07 +01:00 committed by Hugo Sales
parent a9b614bbdd
commit 6d729de07c
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
9 changed files with 153 additions and 181 deletions

View File

@ -120,15 +120,15 @@ class UserPanel extends AbstractController
return ['_template' => 'settings/avatar.html.twig', 'avatar' => $avatar->createView()]; return ['_template' => 'settings/avatar.html.twig', 'avatar' => $avatar->createView()];
} }
public function misc(Request $request) public function notifications(Request $request)
{ {
$misc = Form::create([ $notifications = Form::create([
[_m('transport'), TextType::class, ['help' => 'Address used to send and receive notices through IM.', 'label_format' => 'XMPP/Jabber']], [_m('transport'), TextType::class, ['help' => 'Address used to send and receive notices through IM.', 'label_format' => 'XMPP/Jabber']],
[_m('post_on_status_change'), CheckboxType::class, ['help' => 'Post a notice when my status changes.', 'label_format' => 'Status change']], [_m('post_on_status_change'), CheckboxType::class, ['help' => 'Post a notice when my status changes.', 'label_format' => 'Status change']],
[_m('mention'), CheckboxType::class, ['help' => 'Send me replies from people I\'m not subscribed to.', 'label_format' => 'Mentions']], [_m('mention'), CheckboxType::class, ['help' => 'Send me replies from people I\'m not subscribed to.', 'label_format' => 'Mentions']],
[_m('posts_by_followed'), CheckboxType::class, ['help' => 'Send me notices.', 'label_format' => 'Notices']], [_m('posts_by_followed'), CheckboxType::class, ['help' => 'Send me notices.', 'label_format' => 'Notices']],
['save', SubmitType::class, ['label' => _m('Save')]], ]); ['save', SubmitType::class, ['label' => _m('Save')]], ]);
return ['_template' => 'settings/misc.html.twig', 'misc' => $misc->createView()]; return ['_template' => 'settings/notifications.html.twig', 'notifications' => $notifications->createView()];
} }
} }

View File

@ -62,7 +62,7 @@ abstract class Main
// Settings pages // Settings pages
$r->connect('settings', '/settings', RedirectController::class, [], ['defaults' => ['route' => 'settings_personal_info']]); $r->connect('settings', '/settings', RedirectController::class, [], ['defaults' => ['route' => 'settings_personal_info']]);
foreach (['personal_info', 'avatar', 'misc', 'account'] as $s) { foreach (['personal_info', 'avatar', 'notifications', 'account'] as $s) {
$r->connect('settings_' . $s, '/settings/' . $s, [C\UserPanel::class, $s]); $r->connect('settings_' . $s, '/settings/' . $s, [C\UserPanel::class, $s]);
} }
} }

View File

@ -1,26 +1,34 @@
<!DOCTYPE html> {% extends 'left/left.html.twig' %}
<html>
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
{% block stylesheets %}{% endblock %}
<style>
body {
background-color: #333;
color: #ddd;
}
</style>
</head>
<body>
{% block body %}{% endblock %}
{% block javascripts %}{% endblock %}
{% block meta %}
{{ parent() }}
{% endblock %}
{% block title %}Welcome!{% endblock %}
{% block stylesheets %}
{{ parent() }}
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/network/public.css') }}">
{% endblock %}
{% block header %}
{{ parent() }}
{% endblock %}
{% block left %}
{{ parent() }}
{% endblock %}
{% block body %}
<div class="content">
{% if notices is defined %} {% if notices is defined %}
{% for notice in notices %} {% for notice in notices %}
<div> {{notice}} </div> <div> {{notice}} </div>
{% endfor %} {% endfor %}
{% else %} {% else %}
No notices here. No notices here.
{% endif %} {% endif %}
</body> </div>
</html> {% endblock %}
{% block javascripts %}{% endblock %}

View File

@ -1,39 +1,19 @@
{% extends 'base.html.twig' %} {% extends 'settings/base.html.twig' %}
{% block stylesheets %}
{{ parent() }}
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/settings/settings.css') }}" media="screen and (min-width: 1300px)">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/settings/settings_mid.css') }}" media="screen and (max-width: 1300px)">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/settings/settings_small.css') }}" media="screen and (max-width: 750px)">
{% endblock %}
{% block title %}Account Settings{% endblock %} {% block title %}Notification Settings{% endblock %}
{% block header %}{{ parent() }}{% endblock %}
{% block body %} {% block body %}
<div class='content'> <div class='content'>
<nav class='set-nav'> {% block primary_nav %}
<ul> {{ parent() }}
<li> {% endblock primary_nav %}
<a href="{{ path('settings_personal_info') }}" class='hover-effect {% if (app.request.attributes.get('_route') starts with 'settings_personal_info') or (app.request.attributes.get('_route') starts with 'settings_avatar')%}active{% endif %}'>Settings</a>
</li>
<li>
<a href="{{ path('settings_account') }}" class='hover-effect {% if app.request.attributes.get('_route') starts with 'settings_account' %}active{% endif %}'>Account</a>
</li>
<li>
<a href="{{ path('settings_misc') }}" class='hover-effect {% if app.request.attributes.get('_route') starts with 'settings_misc' %}active{% endif %}'>Misc</a>
</li>
</ul>
</nav>
{% block form %} {% block form %}
<div class='form-single'>
{{ form(acc) }}
</div>
{% endblock form %}
</div>
<div class='form-single'> {% endblock body %}
{{ form(acc) }}
</div>
{% endblock %}
</div>
{% endblock %}

View File

@ -1,45 +1,13 @@
{% extends 'base.html.twig' %} {% extends 'settings/profile.html.twig' %}
{% block stylesheets %}
{{ parent() }}
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/settings/settings.css') }}" media="screen and (min-width: 1300px)">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/settings/settings_mid.css') }}" media="screen and (max-width: 1300px)">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/settings/settings_small.css') }}" media="screen and (max-width: 750px)">
{% endblock %}
{% block title %}Avatar Settings{% endblock %} {% block title %}Avatar Settings{% endblock %}
{% block header %}{{ parent() }}{% endblock %}
{% block body %} {% block body %}
{{ parent() }}
{% endblock body %}
<div class='content'> {% block form %}
<nav class='set-nav'> <div class='form'>
<ul> {{ form(avatar) }}
<li>
<a href="{{ path('settings_personal_info') }}" class='hover-effect {% if (app.request.attributes.get('_route') starts with 'settings_profile') or (app.request.attributes.get('_route') starts with 'settings_avatar')%}active{% endif %}'>Settings</a>
</li>
<li>
<a href="{{ path('settings_account') }}" class='hover-effect {% if app.request.attributes.get('_route') starts with 'settings_account' %}active{% endif %}'>Account</a>
</li>
<li>
<a href="{{ path('settings_misc') }}" class='hover-effect {% if app.request.attributes.get('_route') starts with 'settings_misc' %}active{% endif %}'>Misc</a>
</li>
</ul>
</nav>
<nav class='set-nav2'>
<ul>
<li>
<a href="{{ path('settings_personal_info') }}" class='hover-effect {% if app.request.attributes.get('_route') starts with 'settings_profile' %}active{% endif %}'>Profile</a>
</li>
<li>
<a href="{{ path('settings_avatar') }}" class='hover-effect {% if app.request.attributes.get('_route') starts with 'settings_avatar' %}active{% endif %}'>Avatar</a>
</li>
</ul>
</nav>
{% block form %}
<div class='form'>
{{ form(avatar) }}
</div>
{% endblock %}
</div> </div>
{% endblock %} {% endblock form %}

View File

@ -0,0 +1,51 @@
{% extends 'left/left.html.twig' %}
{% block meta %}
{{ parent() }}
{% endblock %}
{% block title %}{% endblock %}
{% block stylesheets %}
{{ parent() }}
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/settings/settings.css') }}" media="screen and (min-width: 1300px)">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/settings/settings_mid.css') }}" media="screen and (max-width: 1300px)">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/settings/settings_small.css') }}" media="screen and (max-width: 750px)">
{% endblock %}
{% block header %}
{{ parent() }}
{% endblock %}
{% block body %}
{% block left %}
{{ parent() }}
{% endblock %}
<div class="content">
{% block primary_nav %}
<nav class='set-nav'>
<ul>
<li>
<a href="{{ path('settings_personal_info') }}" class='hover-effect {{ active('settings_personal_info', 'settings_avatar') }}'>Profile</a>
</li>
<li>
<a href="{{ path('settings_account') }}" class='hover-effect {{ active('settings_account') }}'>Account</a>
</li>
<li>
<a href="{{ path('settings_notifications') }}" class='hover-effect {{ active('settings_notifications') }}'>Notifications</a>
</li>
</ul>
</nav>
{% endblock primary_nav %}
{% block secundary_nav %}
{% endblock secundary_nav %}
{% block form %}
{% endblock form %}
</div>
{% endblock body %}
{% block javascripts %}{% endblock %}

View File

@ -1,39 +0,0 @@
{% extends 'base.html.twig' %}
{% block stylesheets %}
{{ parent() }}
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/settings/settings.css') }}" media="screen and (min-width: 1300px)">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/settings/settings_mid.css') }}" media="screen and (max-width: 1300px)">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/settings/settings_small.css') }}" media="screen and (max-width: 750px)">
{% endblock %}
{% block title %}Misc Settings{% endblock %}
{% block header %}{{ parent() }}{% endblock %}
{% block body %}
<div class='content'>
<nav class='set-nav'>
<ul>
<li>
<a href="{{ path('settings_personal_info') }}" class='hover-effect {% if (app.request.attributes.get('_route') starts with 'settings_profile') or (app.request.attributes.get('_route') starts with 'settings_avatar')%}active{% endif %}'>Settings</a>
</li>
<li>
<a href="{{ path('settings_account') }}" class='hover-effect {% if app.request.attributes.get('_route') starts with 'settings_account' %}active{% endif %}'>Account</a>
</li>
<li>
<a href="{{ path('settings_misc') }}" class='hover-effect {% if app.request.attributes.get('_route') starts with 'settings_misc' %}active{% endif %}'>Misc</a>
</li>
</ul>
</nav>
{% block form %}
<div class='form-single'>
{{ form(misc) }}
</div>
{% endblock %}
</div>
{% endblock %}

View File

@ -0,0 +1,19 @@
{% extends 'settings/base.html.twig' %}
{% block title %}Notification Settings{% endblock %}
{% block body %}
<div class='content'>
{% block primary_nav %}
{{ parent() }}
{% endblock primary_nav %}
{% block form %}
<div class='form-single'>
{{ form(notifications) }}
</div>
{% endblock form %}
</div>
{% endblock body %}

View File

@ -1,51 +1,36 @@
{% extends 'base.html.twig' %} {% extends 'settings/base.html.twig' %}
{% block stylesheets %}
{{ parent() }}
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/settings/settings.css') }}" media="screen and (min-width: 1300px)">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/settings/settings_mid.css') }}" media="screen and (max-width: 1300px)">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/settings/settings_small.css') }}" media="screen and (max-width: 750px)">
{% endblock %}
{% block title %}Profile Settings{% endblock %} {% block title %}Profile Settings{% endblock %}
{% block header %}{{ parent() }}{% endblock %}
{% block body %} {% block body %}
<div class='content'> <div class='content'>
<nav class='set-nav'> {% block primary_nav %}
<ul> {{ parent() }}
<li> {% endblock primary_nav %}
<a href="{{ path('settings_personal_info') }}" class='hover-effect {{ active('settings_personal_info', 'settings_avatar') }}'>Settings</a>
</li>
<li>
<a href="{{ path('settings_account') }}" class='hover-effect {{ active('settings_account') }}'>Account</a>
</li>
<li>
<a href="{{ path('settings_misc') }}" class='hover-effect {{ active('settings_misc') }}'>Misc</a>
</li>
</ul>
</nav>
<nav class='set-nav2'>
<ul>
{# {% for tab in tabs %} #}
{# {% endfor %} #}
<li>
<a href="{{ path('settings_personal_info') }}" class='hover-effect {{ active('settings_profile') }}'>Profile</a>
</li>
<li>
<a href="{{ path('settings_avatar') }}" class='hover-effect {{ active('settings_avatar') }}'>Avatar</a>
</li>
</ul>
</nav>
</div>
{% block form %} {% block secundary_nav %}
<nav class='set-nav2'>
<ul>
{# {% for tab in tabs %} #}
{# {% endfor %} #}
<div class='form'> <li>
{{ form(prof) }} <a href="{{ path('settings_personal_info') }}"
</div> class='hover-effect {{ active('settings_personal_info') }}'>Personal Info</a>
{% endblock %} </li>
</div> <li>
{% endblock %} <a href="{{ path('settings_avatar') }}" class='hover-effect {{ active('settings_avatar') }}'>Avatar</a>
</li>
</ul>
</nav>
{% endblock secundary_nav %}
{% block form %}
<div class='form'>
{{ form(prof) }}
</div>
{% endblock form %}
</div>
{% endblock body %}