[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
No known key found for this signature in database
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()];
}
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('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('posts_by_followed'), CheckboxType::class, ['help' => 'Send me notices.', 'label_format' => 'Notices']],
['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
$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]);
}
}

View File

@ -1,20 +1,26 @@
<!DOCTYPE html>
<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 %}
{% extends 'left/left.html.twig' %}
{% 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 %}
{% for notice in notices %}
<div> {{notice}} </div>
@ -22,5 +28,7 @@
{% else %}
No notices here.
{% endif %}
</body>
</html>
</div>
{% endblock %}
{% block javascripts %}{% endblock %}

View File

@ -1,39 +1,19 @@
{% 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 %}
{% extends 'settings/base.html.twig' %}
{% block title %}Account Settings{% endblock %}
{% block header %}{{ parent() }}{% endblock %}
{% block title %}Notification Settings{% 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_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>
<div class='content'>
{% block primary_nav %}
{{ parent() }}
{% endblock primary_nav %}
{% block form %}
<div class='form-single'>
{% block form %}
<div class='form-single'>
{{ form(acc) }}
</div>
</div>
{% endblock form %}
</div>
{% endblock %}
</div>
{% endblock %}
{% endblock body %}

View File

@ -1,45 +1,13 @@
{% 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 %}
{% extends 'settings/profile.html.twig' %}
{% block title %}Avatar Settings{% endblock %}
{% block header %}{{ parent() }}{% endblock %}
{% block body %}
{{ parent() }}
{% endblock 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>
<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 %}
{% block form %}
<div class='form'>
{{ form(avatar) }}
</div>
{% endblock %}
</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' %}
{% 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 %}
{% extends 'settings/base.html.twig' %}
{% block title %}Profile 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 {{ 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>
{% block primary_nav %}
{{ parent() }}
{% endblock primary_nav %}
{% block secundary_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>
<a href="{{ path('settings_personal_info') }}"
class='hover-effect {{ active('settings_personal_info') }}'>Personal Info</a>
</li>
<li>
<a href="{{ path('settings_avatar') }}" class='hover-effect {{ active('settings_avatar') }}'>Avatar</a>
</li>
</ul>
</nav>
</div>
{% endblock secundary_nav %}
{% block form %}
<div class='form'>
{% block form %}
<div class='form'>
{{ form(prof) }}
</div>
{% endblock %}
</div>
{% endblock %}
</div>
{% endblock form %}
</div>
{% endblock body %}