back buttons on edit and deletion pages

This commit is contained in:
Xu 2023-10-25 17:38:23 +02:00 committed by Igor Scheller
parent 185b7e3fb6
commit 89321306bc
15 changed files with 267 additions and 204 deletions

View File

@ -199,8 +199,9 @@ function shift_edit_controller()
);
}
$link = button(page_link_to('user-shifts'), icon('chevron-left'), 'btn-sm');
return page_with_title(
shifts_title(),
$link . ' ' . shifts_title(),
[
msg(),
'<noscript>'
@ -270,7 +271,10 @@ function shift_delete_controller()
throw_redirect(page_link_to('user_shifts'));
}
return page_with_title(shifts_title(), [
$link = button(page_link_to('user-shifts'), icon('chevron-left'), 'btn-sm');
return page_with_title(
$link . ' ' . shifts_title(),
[
error(sprintf(
__('Do you want to delete the shift %s from %s to %s?'),
$shift->shiftType->name,
@ -281,7 +285,8 @@ function shift_delete_controller()
form_hidden('delete_shift', $shift->id),
form_submit('delete', __('delete')),
]),
]);
]
);
}
/**

View File

@ -453,8 +453,9 @@ function admin_shifts()
. '</div>';
}
$link = button(page_link_to('user-shifts'), icon('chevron-left'), 'btn-sm');
return page_with_title(
admin_shifts_title() . ' ' . sprintf(
$link . ' ' . admin_shifts_title() . ' ' . sprintf(
'<a href="%s">%s</a>',
page_link_to('admin_shifts_history'),
icon('clock-history')

View File

@ -303,9 +303,13 @@ function admin_user()
}
}
return page_with_title(__('Edit user'), [
$link = button(page_link_to('users', ['action' => 'view', 'user_id' => $user_id]), icon('chevron-left'), 'btn-sm');
return page_with_title(
$link . ' ' . __('Edit user'),
[
$html,
]);
]
);
}
/**

View File

@ -80,7 +80,12 @@ function AngelType_delete_view(AngelType $angeltype)
*/
function AngelType_edit_view(AngelType $angeltype, bool $supporter_mode)
{
return page_with_title(sprintf(__('Edit %s'), $angeltype->name), [
$link = button($angeltype->id
? page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])
: page_link_to('angeltypes'), icon('chevron-left'), 'btn-sm');
return page_with_title(
$link . ' ' . sprintf(__('Edit %s'), $angeltype->name),
[
buttons([
button(page_link_to('angeltypes'), icon('person-lines-fill') . __('angeltypes.angeltypes'), 'back'),
]),
@ -158,7 +163,8 @@ function AngelType_edit_view(AngelType $angeltype, bool $supporter_mode)
form_text('contact_email', __('general.email'), $angeltype->contact_email),
form_submit('submit', __('form.save')),
]),
]);
]
);
}
/**
@ -422,7 +428,9 @@ function AngelType_view(
ShiftCalendarRenderer $shiftCalendarRenderer,
$tab
) {
return page_with_title(sprintf(__('Team %s'), $angeltype->name), [
return page_with_title(
sprintf(__('Team %s'), $angeltype->name),
[
AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporter, $user_driver_license, $user),
msg(),
tabs([
@ -439,7 +447,9 @@ function AngelType_view(
$shiftCalendarRenderer
),
], $tab),
], true);
],
true
);
}
/**

View File

@ -213,7 +213,14 @@ function ShiftEntry_edit_view(
$comment = '';
}
return page_with_title(__('Edit shift entry'), [
$link = button(
page_link_to('users', ['action' => 'view', 'user_id' => $angel->id]),
icon('chevron-left'),
'btn-sm'
);
return page_with_title(
$link . ' ' . __('Edit shift entry'),
[
msg(),
form([
form_info(__('Angel:'), User_Nick_render($angel)),
@ -225,5 +232,6 @@ function ShiftEntry_edit_view(
join('', $freeload_form),
form_submit('submit', __('form.save')),
]),
]);
]
);
}

View File

@ -45,7 +45,15 @@ function ShiftType_delete_view(ShiftType $shifttype)
*/
function ShiftType_edit_view($name, $description, $shifttype_id)
{
return page_with_title($shifttype_id ? __('Edit shifttype') : __('Create shifttype'), [
return page_with_title(
$shifttype_id
? (button(
page_link_to('shifttypes', ['action' => 'view', 'shifttype_id' => $shifttype_id]),
icon('chevron-left'),
'btn-sm'
) . ' ' . __('Edit shifttype'))
: (button(page_link_to('shifttypes'), icon('chevron-left'), 'btn-sm') . ' ' . __('Create shifttype')),
[
msg(),
buttons([
button(page_link_to('shifttypes'), shifttypes_title(), 'back'),
@ -56,7 +64,9 @@ function ShiftType_edit_view($name, $description, $shifttype_id)
form_info('', __('Please use markdown for the description.')),
form_submit('submit', __('form.save')),
]),
], true);
],
true
);
}
/**

View File

@ -12,10 +12,10 @@ use Engelsystem\Models\User\User;
*/
function UserDriverLicense_edit_view($user_source, $user_driver_license)
{
return page_with_title(sprintf(__('Edit %s driving license information'), User_Nick_render($user_source)), [
buttons([
button(user_link($user_source->id), __('Back to profile'), 'back'),
]),
$link = button(user_link($user_source->id), icon('chevron-left'), 'btn-sm');
return page_with_title(
$link . ' ' . sprintf(__('Edit %s driving license information'), User_Nick_render($user_source)),
[
msg(),
form([
form_info(__('Privacy'), __('Your driving license information is only visible for supporters and admins.')),
@ -51,5 +51,7 @@ function UserDriverLicense_edit_view($user_source, $user_driver_license)
], 'driving_license'),
form_submit('submit', __('form.save')),
]),
], true);
],
true
);
}

View File

@ -43,11 +43,11 @@ function User_delete_view($user)
*/
function User_edit_vouchers_view($user)
{
return page_with_title(sprintf(__('%s\'s vouchers'), User_Nick_render($user)), [
$link = button(user_link($user->id), icon('chevron-left'), 'btn-sm');
return page_with_title(
$link . ' ' . sprintf(__('%s\'s vouchers'), User_Nick_render($user)),
[
msg(),
buttons([
button(user_link($user->id), icon('chevron-left') . __('back')),
]),
info(sprintf(
$user->state->force_active
? __('Angel can receive another %d vouchers and is FA.')
@ -61,7 +61,8 @@ function User_edit_vouchers_view($user)
],
page_link_to('users', ['action' => 'edit_vouchers', 'user_id' => $user->id])
),
]);
]
);
}
/**

View File

@ -7,6 +7,10 @@
{% block content %}
<div class="container">
<h1>
{% if not is_index|default(false) %}
{{ m.button(m.icon('chevron-left'), room ? url('/rooms', {'action': 'view', 'room_id': room.id}) : url('/admin/rooms'), 'secondary', 'sm') }}
{% endif %}
{{ block('title') }}
{% if is_index|default(false) %}

View File

@ -8,7 +8,10 @@
{% block content %}
<div class="container">
<h1>{{ block('title') }}: <small>{{ m.user(userdata) }}</small></h1>
<h1>
{{ m.button(m.icon('chevron-left'), url('/admin-active'), null, 'sm') }}
{{ block('title') }}: <small>{{ m.user(userdata) }}</small>
</h1>
{% include 'layouts/parts/messages.twig' %}

View File

@ -6,16 +6,16 @@
{% block content %}
<div class="container">
<h1>{{ block('title') }}</h1>
<h1>
{{ m.button(m.icon('chevron-left'), url('/users', {action: 'view', user_id: user.id}), null, 'sm') }}
{{ block('title') }}
</h1>
{% include 'layouts/parts/messages.twig' %}
<form method="post">
{{ csrf() }}
<div class="row g-2">
<div class="col-12">
{{ m.button(__('back'), url('/users', {action: 'view', user_id: user.id})) }}
</div>
<div class="col-12">
<div>
<label class="form-label">{{ __('User') }}</label>

View File

@ -6,7 +6,10 @@
{% block content %}
<div class="container">
<h1>{{ block('title') }}</h1>
<h1>
{{ m.button(m.icon('chevron-left'), url('/faq'), 'secondary', 'sm') }}
{{ block('title') }}
</h1>
{% include 'layouts/parts/messages.twig' %}

View File

@ -6,7 +6,10 @@
{% block content %}
<div class="container">
<h1>{{ block('title') }}</h1>
<h1>
{{ m.button(m.icon('chevron-left'), url('/news'), null, 'sm') }}
{{ block('title') }}
</h1>
{% include 'layouts/parts/messages.twig' %}

View File

@ -6,7 +6,10 @@
{% block content %}
<div class="container">
<h1>{{ block('title') }}</h1>
<h1>
{{ m.button(m.icon('chevron-left'), url('/questions'), null, 'sm') }}
{{ block('title') }}
</h1>
{% include 'layouts/parts/messages.twig' %}

View File

@ -7,7 +7,13 @@
{% block content %}
<div class="container">
<div class="mb-5">
<h1>{{ __('page.sign-up.title') }}</h1>
<h1>
{{ has_permission_to('admin_user')
? m.button(m.icon('chevron-left'), url('/users'), null, 'sm')
: ''
}}
{{ __('page.sign-up.title') }}
</h1>
</div>
{% include 'layouts/parts/messages.twig' %}