add more buttons

This commit is contained in:
Xu 2023-11-03 15:02:54 +01:00 committed by Igor Scheller
parent 27323bfba5
commit 24204b1f3c
10 changed files with 35 additions and 20 deletions

View File

@ -199,7 +199,7 @@ function shift_edit_controller()
);
}
$link = button(page_link_to('user-shifts'), icon('chevron-left'), 'btn-sm');
$link = button(page_link_to('shifts', ['action' => 'view', 'shift_id' => $shift_id]), icon('chevron-left'), 'btn-sm');
return page_with_title(
$link . ' ' . shifts_title(),
[
@ -271,7 +271,7 @@ function shift_delete_controller()
throw_redirect(page_link_to('user_shifts'));
}
$link = button(page_link_to('user-shifts'), icon('chevron-left'), 'btn-sm');
$link = button(page_link_to('shifts', ['action' => 'view', 'shift_id' => $shift_id]), icon('chevron-left'), 'btn-sm');
return page_with_title(
$link . ' ' . shifts_title(),
[

View File

@ -60,7 +60,10 @@ function AngelType_render_membership(AngelType $user_angeltype)
*/
function AngelType_delete_view(AngelType $angeltype)
{
return page_with_title(sprintf(__('Delete angeltype %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(__('Delete angeltype %s'), $angeltype->name), [
info(sprintf(__('Do you want to delete angeltype %s?'), $angeltype->name), true),
form([
buttons([
@ -186,10 +189,6 @@ function AngelType_view_buttons(
$user_driver_license,
$user
) {
$buttons = [
button(page_link_to('angeltypes'), icon('person-lines-fill') . __('angeltypes.angeltypes'), 'back'),
];
if ($angeltype->requires_driver_license) {
$buttons[] = button(
user_driver_license_edit_link($user),
@ -428,8 +427,9 @@ function AngelType_view(
ShiftCalendarRenderer $shiftCalendarRenderer,
$tab
) {
$link = button(page_link_to('angeltypes'), icon('chevron-left'), 'btn-sm');
return page_with_title(
sprintf(__('Team %s'), $angeltype->name),
$link . ' ' . sprintf(__('Team %s'), $angeltype->name),
[
AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporter, $user_driver_license, $user),
msg(),

View File

@ -57,7 +57,11 @@ function Room_view(Room $room, ShiftsFilterRenderer $shiftsFilterRenderer, Shift
$selected_tab = count($tabs) - 1;
}
return page_with_title(icon('pin-map-fill') . $room->name, [
$link = button(page_link_to('admin/rooms'), icon('chevron-left'), 'btn-sm');
return page_with_title(
(auth()->can('admin_rooms') ? $link . ' ' : '') .
icon('pin-map-fill') . $room->name,
[
$assignNotice,
auth()->can('admin_rooms') ? buttons([
button(
@ -68,7 +72,9 @@ function Room_view(Room $room, ShiftsFilterRenderer $shiftsFilterRenderer, Shift
$dect,
$description,
tabs($tabs, $selected_tab),
], true);
],
true
);
}
/**

View File

@ -77,10 +77,10 @@ function ShiftType_view(ShiftType $shifttype)
{
$parsedown = new Parsedown();
$title = $shifttype->name;
return page_with_title($title, [
$link = button(page_link_to('shifttypes'), icon('chevron-left'), 'btn-sm');
return page_with_title($link . ' ' . $title, [
msg(),
buttons([
button(page_link_to('shifttypes'), shifttypes_title(), 'back'),
button(
page_link_to('shifttypes', ['action' => 'edit', 'shifttype_id' => $shifttype->id]),
icon('pencil') . __('edit')

View File

@ -199,8 +199,9 @@ function Shift_view(Shift $shift, ShiftType $shifttype, Room $room, $angeltypes_
$start = $shift->start->format(__('Y-m-d H:i'));
$link = button(page_link_to('user-shifts'), icon('chevron-left'), 'btn-sm');
return page_with_title(
$shift->shiftType->name . ' <small title="' . $start . '" data-countdown-ts="' . $shift->start->timestamp . '">%c</small>',
$link . ' ' . $shift->shiftType->name . ' <small title="' . $start . '" data-countdown-ts="' . $shift->start->timestamp . '">%c</small>',
$content
);
}

View File

@ -2,7 +2,10 @@
{% import 'macros/base.twig' as m %}
{% import 'macros/form.twig' as f %}
{% block title %}{{ schedule ? __('schedule.edit.title') : __('schedule.import.title') }}{% endblock %}
{% block title %}
{{ m.button(m.icon('chevron-left'), url('/admin/schedule'), 'secondary', 'sm') }}
{{ schedule ? __('schedule.edit.title') : __('schedule.import.title') }}
{% endblock %}
{% block row_content %}
{% if schedule and schedule.updated_at %}

View File

@ -1,7 +1,11 @@
{% extends 'admin/schedule/index.twig' %}
{% import 'macros/base.twig' as m %}
{% import 'macros/form.twig' as f %}
{% block title %}{{ __('schedule.import.load.title') }}{% endblock %}
{% block title %}
{{ m.button(m.icon('chevron-left'), url('/admin/schedule'), 'secondary', 'sm') }}
{{ __('schedule.import.load.title') }}
{% endblock %}
{% block row_content %}
<form method="post" action="{{ url('/admin/schedule/import/' ~ schedule_id) }}">

View File

@ -8,6 +8,7 @@
<div class="container">
<div class="page-header">
<h1>
{{ m.button(m.icon('chevron-left'), url('/messages'), null, 'sm') }}
{{ __('message.title') }}: {{ m.user(other_user, {'pronoun': true}) }}
</h1>
</div>

View File

@ -2,7 +2,10 @@
{% import 'macros/base.twig' as m %}
{% import 'macros/form.twig' as f %}
{% block title %}{% if news.is_meeting %}{{ __('news.is_meeting') }} {% endif %}{{ news.title }}{% endblock %}
{% block title %}
{{ m.button(m.icon('chevron-left'), url('/news'), null, 'sm') }}
{% if news.is_meeting %}{{ __('news.is_meeting') }} {% endif %}{{ news.title }}
{% endblock %}
{% block news %}
{{ _self.news(news) }}

View File

@ -11,10 +11,7 @@
<div class="page-header">
<h1>
{{ block('title') }}
{% if not is_admin|default(false) %}
{{ m.button(m.icon('plus-lg'), url('questions/new'), 'secondary') }}
{% endif %}
{{ m.button(m.icon('plus-lg'), url('questions/new'), 'secondary') }}
</h1>
</div>