Use twig to render profile setting page

main
Igor Scheller 4 years ago
parent 0c3ff73454
commit 27331b4cf6

@ -4,6 +4,7 @@ use Carbon\Carbon;
use Engelsystem\Models\Room; use Engelsystem\Models\Room;
use Engelsystem\Models\User\User; use Engelsystem\Models\User\User;
use Engelsystem\Models\Worklog; use Engelsystem\Models\Worklog;
use Engelsystem\Renderer\Renderer;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Str; use Illuminate\Support\Str;
@ -37,18 +38,16 @@ 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');
return page_with_title(settings_title(), [ /** @var Renderer $renderer */
msg(), $renderer = app(Renderer::class);
div('row', [ return $renderer->render(
div('col-md-3 settings-menu', [ 'pages/settings/settings.twig',
'<ul class="nav nav-pills nav-stacked">', [
'<li class="active"><a href="' . url('/user-settings') . '">' . __('settings.profile') . '</a></li>', 'title' => 'settings.profile',
'<li><a href="' . url('/settings/password') . '">' . __('settings.password') . '</a></li>', 'content' =>
'<li><a href="' . url('/settings/oauth') . '">' . __('settings.oauth') . '</a></li>', msg()
'</ul>' . div('row', [
]),
div('col-md-9', [ 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!')),
@ -62,14 +61,18 @@ function User_settings_view(
$enable_planned_arrival ? form_date( $enable_planned_arrival ? form_date(
'planned_arrival_date', 'planned_arrival_date',
__('Planned date of arrival') . ' ' . entry_required(), __('Planned date of arrival') . ' ' . entry_required(),
$personalData->planned_arrival_date ? $personalData->planned_arrival_date->getTimestamp() : '', $personalData->planned_arrival_date
? $personalData->planned_arrival_date->getTimestamp()
: '',
$buildup_start_date, $buildup_start_date,
$teardown_end_date $teardown_end_date
) : '', ) : '',
$enable_planned_arrival ? form_date( $enable_planned_arrival ? form_date(
'planned_departure_date', 'planned_departure_date',
__('Planned date of departure'), __('Planned date of departure'),
$personalData->planned_departure_date ? $personalData->planned_departure_date->getTimestamp() : '', $personalData->planned_departure_date
? $personalData->planned_departure_date->getTimestamp()
: '',
$buildup_start_date, $buildup_start_date,
$teardown_end_date $teardown_end_date
) : '', ) : '',
@ -111,7 +114,8 @@ function User_settings_view(
]), ]),
]) ])
]) ])
], true); ]
);
} }
/** /**

@ -4,7 +4,7 @@
{% block title %}{{ __('settings.oauth') }}{% endblock %} {% block title %}{{ __('settings.oauth') }}{% endblock %}
{% block container_title %} {% block container_title %}
<h2 id="oauth-settings-title">{{ block('title') }}</h2> <h1 id="oauth-settings-title">{{ __('settings.settings') }} <small>{{ block('title') }}</small></h1>
{% endblock %} {% endblock %}
{% block row_content %} {% block row_content %}

@ -1,11 +1,14 @@
{% extends 'layouts/app.twig' %} {% extends 'layouts/app.twig' %}
{% import 'macros/base.twig' as m %} {% import 'macros/base.twig' as m %}
{% block title %}{{ __('settings') }}{% endblock %} {% block title %}{{ __(title|default(__('settings.settings'))) }}{% endblock %}
{% block content %} {% block content %}
<div class="container user-settings"> <div class="container user-settings">
<h1>{{ __('settings.settings') }}</h1> {% block container_title %}
<h1>{{ __('settings.settings') }} <small>{{ block('title') }}</small></h1>
{% endblock %}
<div class="row"> <div class="row">
<div class="col-md-3 settings-menu"> <div class="col-md-3 settings-menu">
<ul class="nav nav-pills nav-stacked"> <ul class="nav nav-pills nav-stacked">
@ -22,13 +25,10 @@
</div> </div>
<div class="col-md-9"> <div class="col-md-9">
{% block container_title %}
<h2>{{ block('title') }}</h2>
{% endblock %}
{% include 'layouts/parts/messages.twig' %} {% include 'layouts/parts/messages.twig' %}
{% block row_content %} {% block row_content %}
{{ content|raw }}
{% endblock %} {% endblock %}
</div> </div>
</div> </div>

@ -210,6 +210,10 @@ class LegacyMiddleware implements MiddlewareInterface
return response($content, (int)$page); return response($content, (int)$page);
} }
if (strpos($content, '<html') !== false) {
return response($content);
}
return response( return response(
view( view(
'layouts/app', 'layouts/app',

Loading…
Cancel
Save