From b41a9a02d12edf8d012d2a992069c94817cc2f3c Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Thu, 22 Jul 2021 21:22:21 +0200 Subject: [PATCH] Use bootstrap icons instead of glyphicons --- includes/controller/angeltypes_controller.php | 4 +- includes/pages/admin_active.php | 6 +- includes/pages/admin_arrive.php | 2 +- includes/pages/admin_free.php | 2 +- includes/pages/admin_rooms.php | 2 +- includes/pages/admin_shifts.php | 8 +-- includes/pages/admin_user.php | 2 +- includes/pages/guest_login.php | 2 +- includes/pages/user_messages.php | 2 +- includes/pages/user_shifts.php | 4 +- includes/sys_form.php | 10 +-- includes/sys_menu.php | 8 +-- includes/sys_template.php | 38 +++++++----- includes/view/AngelTypes_view.php | 42 ++++++------- includes/view/PublicDashboard_view.php | 12 ++-- includes/view/Rooms_view.php | 6 +- includes/view/ShiftCalendarShiftRenderer.php | 10 +-- includes/view/ShiftEntry_view.php | 14 ++--- includes/view/ShiftTypes_view.php | 4 +- includes/view/ShiftsFilterRenderer.php | 2 +- includes/view/Shifts_view.php | 22 +++---- includes/view/UserAngelTypes_view.php | 24 +++---- includes/view/UserHintsRenderer.php | 4 +- includes/view/UserWorkLog_view.php | 4 +- includes/view/User_view.php | 62 +++++++++---------- resources/assets/themes/cyborg_variables.scss | 11 ---- resources/assets/themes/theme15.scss | 10 --- resources/views/admin/schedule/index.twig | 2 +- resources/views/layouts/maintenance.html | 6 +- resources/views/layouts/parts/footer.twig | 4 +- resources/views/layouts/parts/navbar.twig | 12 ++-- resources/views/macros/base.twig | 6 +- resources/views/pages/design.twig | 8 +-- resources/views/pages/faq/edit.twig | 8 +-- resources/views/pages/faq/overview.twig | 8 +-- resources/views/pages/login.twig | 2 +- resources/views/pages/news/edit.twig | 8 +-- resources/views/pages/news/news.twig | 2 +- resources/views/pages/news/overview.twig | 10 +-- resources/views/pages/questions/edit.twig | 8 +-- resources/views/pages/questions/overview.twig | 10 +-- 41 files changed, 197 insertions(+), 214 deletions(-) diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php index 3b4ed1be..ee6c2e60 100644 --- a/includes/controller/angeltypes_controller.php +++ b/includes/controller/angeltypes_controller.php @@ -320,8 +320,8 @@ function angeltypes_list_controller() ); } - $angeltype['restricted'] = $angeltype['restricted'] ? glyph('book') : ''; - $angeltype['no_self_signup'] = $angeltype['no_self_signup'] ? '' : glyph('share'); + $angeltype['restricted'] = $angeltype['restricted'] ? icon('book') : ''; + $angeltype['no_self_signup'] = $angeltype['no_self_signup'] ? '' : icon('share'); $angeltype['name'] = '%1$s', $usr->contact->dect), 'email' => $usr->settings->email_human ? sprintf('%1$s', $email) - : glyph('eye-close'), + : icon('eye-slash'), 'actions' => auth()->can('admin_user') ? button(page_link_to('admin_user', ['id' => $usr->id]), __('edit'), 'btn-xs') diff --git a/includes/pages/admin_rooms.php b/includes/pages/admin_rooms.php index be11c5fc..017fea58 100644 --- a/includes/pages/admin_rooms.php +++ b/includes/pages/admin_rooms.php @@ -22,7 +22,7 @@ function admin_rooms() foreach ($rooms_source as $room) { $rooms[] = [ 'name' => Room_name_render($room), - 'map_url' => glyph_bool($room->map_url), + 'map_url' => icon_bool($room->map_url), 'actions' => table_buttons([ button( page_link_to('admin_rooms', ['show' => 'edit', 'id' => $room->id]), diff --git a/includes/pages/admin_shifts.php b/includes/pages/admin_shifts.php index 0e0df1c6..cf5ed47b 100644 --- a/includes/pages/admin_shifts.php +++ b/includes/pages/admin_shifts.php @@ -291,7 +291,7 @@ function admin_shifts() foreach ($shifts as $shift) { $shifts_table_entry = [ 'timeslot' => - ' ' + icon('clock') . ' ' . date('Y-m-d H:i', $shift['start']) . ' - ' . date('H:i', $shift['end']) @@ -332,13 +332,13 @@ function admin_shifts() form_hidden('change_hours', implode(', ', $change_hours)), form_hidden('angelmode', $angelmode), form_hidden('shift_over_midnight', $shift_over_midnight ? 'true' : 'false'), - form_submit('back', glyph('menu-left') . __('back')), + form_submit('back', icon('chevron-left') . __('back')), table([ 'timeslot' => __('Time and location'), 'title' => __('Type and title'), 'needed_angels' => __('Needed angels') ], $shifts_table), - form_submit('submit', glyph('floppy-disk') . __('Save')) + form_submit('submit', icon('save') . __('Save')) ]) ]); } @@ -468,7 +468,7 @@ function admin_shifts() ]) ]) ]), - form_submit('preview', glyph('search') . __('Preview')) + form_submit('preview', icon('search') . __('Preview')) ]) ]); } diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php index e5ba9a2b..5c690226 100644 --- a/includes/pages/admin_user.php +++ b/includes/pages/admin_user.php @@ -181,7 +181,7 @@ function admin_user() } $html .= buttons([ - button(user_delete_link($user_source->id), glyph('lock') . __('delete'), 'btn-danger') + button(user_delete_link($user_source->id), icon('trash') . __('delete'), 'btn-danger') ]); $html .= "
"; diff --git a/includes/pages/guest_login.php b/includes/pages/guest_login.php index 1e486135..25eb8f42 100644 --- a/includes/pages/guest_login.php +++ b/includes/pages/guest_login.php @@ -440,5 +440,5 @@ function guest_register() */ function entry_required() { - return ''; + return icon('exclamation-triangle', 'text-info'); } diff --git a/includes/pages/user_messages.php b/includes/pages/user_messages.php index 4b611fbc..48dc651c 100644 --- a/includes/pages/user_messages.php +++ b/includes/pages/user_messages.php @@ -75,7 +75,7 @@ function user_messages() $receiver_user_source = $message->receiver; $messages_table_entry = [ - 'new' => !$message->read ? '' : '', + 'new' => !$message->read ? icon('envelope') : '', 'timestamp' => $message->created_at->format(__('Y-m-d H:i')), 'from' => User_Nick_render($sender_user_source), 'to' => User_Nick_render($receiver_user_source), diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index be43b67e..ec896eaa 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -287,7 +287,7 @@ function view_user_shifts() 'set_next_8h' => __('next 8h'), 'buttons' => button( public_dashboard_link(), - glyph('dashboard') . __('Public Dashboard') + icon('speedometer2') . __('Public Dashboard') ) ]) ]) @@ -357,7 +357,7 @@ function make_select($items, $selected, $name, $title = null, $additionalButtons . '' - . (!isset($i['enabled']) || $i['enabled'] ? '' : glyph('lock')) + . (!isset($i['enabled']) || $i['enabled'] ? '' : icon('lock')) . ''; } $html .= '
' . "\n"; diff --git a/includes/sys_form.php b/includes/sys_form.php index 1a09a58a..874ccc51 100644 --- a/includes/sys_form.php +++ b/includes/sys_form.php @@ -31,10 +31,10 @@ function form_spinner($name, $label, $value)
@@ -72,7 +72,7 @@ function form_date($name, $label, $value, $start_date = '', $end_date = '') return form_element($label, '
' - . '' . glyph('th') . ' + . '' . icon('grid-3x3-gap-fill') . '
', $dom_id); } @@ -97,7 +97,7 @@ function form_datetime(string $name, string $label, $value)
' - . '' . glyph('th') . ' + . '' . icon('grid-3x3-gap-fill') . '
', $dom_id, $name, htmlspecialchars($value ? $value->format('Y-m-d H:i') : '')), $dom_id); } @@ -214,7 +214,7 @@ function form_radio($name, $label, $selected, $value) function form_info($label, $text = '') { if ($label == '') { - return '' . glyph('info-sign') . $text . ''; + return '' . icon('info-lg') . $text . ''; } if ($text == '') { return '

' . $label . '

'; diff --git a/includes/sys_menu.php b/includes/sys_menu.php index c8f69ac0..0d653b2f 100644 --- a/includes/sys_menu.php +++ b/includes/sys_menu.php @@ -68,7 +68,7 @@ function make_user_submenu() page_link_to('user_settings'), __('Settings'), $page == 'user_settings', - 'bi-gear' + 'gear' ); } @@ -77,7 +77,7 @@ function make_user_submenu() page_link_to('logout'), __('Logout'), $page == 'logout', - 'bi-box-arrow-left', + 'box-arrow-left', ); } @@ -116,7 +116,7 @@ function make_navigation() // path => [name, permission] 'admin_arrive' => 'Arrive angels', 'admin_active' => 'Active angels', - 'admin_user' => 'All Angels', + 'users' => ['All Angels', 'admin_user'], 'admin_free' => 'Free angels', 'admin/questions' => ['Answer questions', 'question.edit'], 'shifttypes' => 'Shifttypes', @@ -192,7 +192,7 @@ function make_room_navigation($menu) $room_menu[] = toolbar_dropdown_item_divider(); } foreach ($rooms as $room) { - $room_menu[] = toolbar_dropdown_item(room_link($room), $room->name, false, 'map-marker'); + $room_menu[] = toolbar_dropdown_item(room_link($room), $room->name, false, 'geo-alt'); } if (count($room_menu) > 0) { $menu[] = toolbar_dropdown('map-marker', __('Rooms'), $room_menu); diff --git a/includes/sys_template.php b/includes/sys_template.php index 0a7aeb98..c18eeda5 100644 --- a/includes/sys_template.php +++ b/includes/sys_template.php @@ -108,14 +108,16 @@ function progress_bar($valuemin, $valuemax, $valuenow, $class = '', $content = ' } /** - * Render glyphicon + * Render bootstrap icon + * + * @param string $icon_name + * @param string $class * - * @param string $glyph_name * @return string */ -function glyph($glyph_name) +function icon(string $icon_name, string $class = ''): string { - return ' '; + return ' '; } /** @@ -124,10 +126,10 @@ function glyph($glyph_name) * @param boolean $boolean * @return string */ -function glyph_bool($boolean) +function icon_bool($boolean) { return '' - . glyph($boolean ? 'ok' : 'remove') + . icon($boolean ? 'check-lg' : 'x-lg') . ''; } @@ -187,10 +189,10 @@ function toolbar_item_link($href, $icon, $label, $active = false) function toolbar_dropdown_item(string $href, string $label, bool $active, string $icon = null): string { return strtr( - '
  • {icon}{label}
  • ', + '
  • {icon} {label}
  • ', [ '{href}' => $href, - '{icon}' => $icon === null ? '' : '', + '{icon}' => $icon === null ? '' : '', '{label}' => $label, '{active}' => $active ? ' active' : '' ] @@ -234,18 +236,19 @@ EOT; } /** - * @param string $glyphicon + * @param string $icon * @param string $label * @param string[] $content * @param string $class + * * @return string */ -function toolbar_popover($glyphicon, $label, $content, $class = '') +function toolbar_popover($icon, $label, $content, $class = '') { - $dom_id = md5(microtime() . $glyphicon . $label); + $dom_id = md5(microtime() . $icon . $label); return '