new setting page layout

This commit is contained in:
msquare 2020-11-24 12:01:19 +01:00 committed by Igor Scheller
parent d3265ef70a
commit 0c3ff73454
4 changed files with 17 additions and 21 deletions

View File

@ -37,23 +37,22 @@ function User_settings_view(
$enable_dect = config('enable_dect'); $enable_dect = config('enable_dect');
$enable_planned_arrival = config('enable_planned_arrival'); $enable_planned_arrival = config('enable_planned_arrival');
$showOauth = false;
foreach ($oauth2_providers as $name => $config) {
$showOauth = $showOauth || !isset($config['hidden']) || !$config['hidden'];
}
return page_with_title(settings_title(), [ return page_with_title(settings_title(), [
msg(), msg(),
div('row', [ div('row', [
div('col-md-6', [ div('col-md-3 settings-menu', [
'<ul class="nav nav-pills nav-stacked">',
'<li class="active"><a href="' . url('/user-settings') . '">' . __('settings.profile') . '</a></li>',
'<li><a href="' . url('/settings/password') . '">' . __('settings.password') . '</a></li>',
'<li><a href="' . url('/settings/oauth') . '">' . __('settings.oauth') . '</a></li>',
'</ul>'
]),
div('col-md-9', [
heading(__('settings.profile'), 2),
form([ form([
form_info('', __('Here you can change your user details.')), form_info('', __('Here you can change your user details.')),
form_info(entry_required() . ' = ' . __('Entry required!')), form_info(entry_required() . ' = ' . __('Entry required!')),
form_text('nick', __('Nick'), $user_source->name, true), form_text('nick', __('Nick'), $user_source->name, true),
form_info(
'',
__('Use up to 23 letters, numbers, connecting punctuations or spaces for your nickname.')
),
$enable_pronoun $enable_pronoun
? form_text('pronoun', __('Pronoun'), $personalData->pronoun, false, 15) ? form_text('pronoun', __('Pronoun'), $personalData->pronoun, false, 15)
. form_info('', __('Will be shown on your profile page and in angel lists.')) . form_info('', __('Will be shown on your profile page and in angel lists.'))
@ -99,14 +98,7 @@ function User_settings_view(
) : '', ) : '',
form_info('', __('Please visit the angeltypes page to manage your angeltypes.')), form_info('', __('Please visit the angeltypes page to manage your angeltypes.')),
form_submit('submit', __('Save')) form_submit('submit', __('Save'))
]) ]),
]),
div('col-md-6', [
($showOauth ?
form_info(__('oauth.login'))
. button(url('/settings/oauth'), __('settings.oauth'), 'btn-primary')
: ''
),
form([ form([
form_info(__('Here you can choose your color settings:')), form_info(__('Here you can choose your color settings:')),
form_select('theme', __('Color settings:'), $themes, $user_source->settings->theme), form_select('theme', __('Color settings:'), $themes, $user_source->settings->theme),
@ -119,7 +111,7 @@ function User_settings_view(
]), ]),
]) ])
]) ])
]); ], true);
} }
/** /**

View File

@ -77,3 +77,8 @@
{% macro submit(label, opt) %} {% macro submit(label, opt) %}
{{ _self.button(label|default(__('form.submit')), opt|default({})|merge({'type': 'submit'})) }} {{ _self.button(label|default(__('form.submit')), opt|default({})|merge({'type': 'submit'})) }}
{%- endmacro %} {%- endmacro %}
{% macro info(text) %}
{% import 'macros/base.twig' as m %}
<span class="help-block">{{ m.glyphicon('info-sign') }}{{ text }}</span>
{%- endmacro %}

View File

@ -10,7 +10,7 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{{ m.alert(__('Here you can change your password.')) }} {{ f.info(__('Here you can change your password.')) }}
{{ f.input( {{ f.input(
'password', 'password',
__('Old password:'), __('Old password:'),

View File

@ -11,7 +11,6 @@ use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Engelsystem\Http\Redirector;
use Engelsystem\Helpers\Authenticator; use Engelsystem\Helpers\Authenticator;
use Engelsystem\Test\Unit\HasDatabase; use Engelsystem\Test\Unit\HasDatabase;
use Engelsystem\Http\Request; use Engelsystem\Http\Request;