Profile settings page: Add "back to my shifts" menu item and icons

This commit is contained in:
Igor Scheller 2023-09-10 17:43:28 +02:00 committed by Michael Weimann
parent dc9441d925
commit cf4dc63495
10 changed files with 30 additions and 13 deletions

View File

@ -8,7 +8,7 @@ use Engelsystem\Models\User\User;
*/
function myshifts_title()
{
return __('My shifts');
return __('profile.my-shifts');
}
/**

View File

@ -174,7 +174,10 @@ function Shift_view(Shift $shift, ShiftType $shifttype, Room $room, $angeltypes_
$admin_rooms ? button(room_link($room), icon('pin-map-fill') . $room->name) : '',
];
}
$buttons[] = button(user_link(auth()->user()->id), '<span class="icon-icon_angel"></span> ' . __('My shifts'));
$buttons[] = button(
user_link(auth()->user()->id),
'<span class="icon-icon_angel"></span> ' . __('profile.my-shifts')
);
$content[] = buttons($buttons);
$content[] = Shift_view_header($shift, $room);

View File

@ -172,6 +172,9 @@ msgstr "Der OAuth-Provider ist aufgrund eines unerwarteten Fehlers nicht in der
msgid "oauth.temporarily_unavailable"
msgstr "Der OAuth-Provider ist aufgrund Überlastung oder Wartung temporär nicht in der Lage, die Anfrage zu erfüllen"
msgid "profile.my-shifts"
msgstr "Meine Schichten"
msgid "settings.profile"
msgstr "Profil"

View File

@ -1092,9 +1092,6 @@ msgstr "Übertragung wurde mit einem Fehler abgebrochen."
msgid "Wrong action."
msgstr "Falsche Aktion."
msgid "My shifts"
msgstr "Meine Schichten"
msgid "Key changed."
msgstr "Key geändert."

View File

@ -171,6 +171,9 @@ msgid "oauth.temporarily_unavailable"
msgstr "The OAuth-Provider is currently unable to handle the request "
"due to a temporary overloading or maintenance of the server."
msgid "profile.my-shifts"
msgstr "My shifts"
msgid "settings.profile"
msgstr "Profile"

View File

@ -156,7 +156,7 @@ msgstr "Você já está inscrito. Obrigado!"
#: includes/controller/shift_entries_controller.php:103
#: includes/pages/user_myshifts.php:4
msgid "My shifts"
msgid "profile.my-shifts"
msgstr "Meus turnos"
#: includes/controller/shift_entries_controller.php:111

View File

@ -88,7 +88,7 @@
</a>
<ul class="dropdown-menu dropdown-menu-end">
{% if has_permission_to('user_myshifts') %}
{{ _self.dropdown_item(__('My shifts'), url('users', {'action': 'view'}), 'users', m.icon('calendar-range')) }}
{{ _self.dropdown_item(__('profile.my-shifts'), url('users', {'action': 'view'}), 'users', m.icon('calendar-range')) }}
{% endif %}
{% if has_permission_to('user_settings') %}

View File

@ -18,6 +18,7 @@
{% for url,title in settings_menu %}
<li class="nav-item{% if title.hidden ?? false and url != request.url() %} d-none{% endif %}">
<a class="nav-link {% if url == request.url() %}active{% endif %}" href="{{ url }}">
{{ m.icon(title.icon ?? 'gear-fill') }}
{{ __(title.title ?? title) }}
</a>
</li>

View File

@ -322,12 +322,13 @@ class SettingsController extends BaseController
public function settingsMenu(): array
{
$menu = [
url('/users', ['action' => 'view']) => ['title' => 'profile.my-shifts', 'icon' => 'chevron-left'],
url('/settings/profile') => 'settings.profile',
url('/settings/password') => 'settings.password',
url('/settings/password') => ['title' => 'settings.password', 'icon' => 'key-fill'],
];
if (count(config('locales')) > 1) {
$menu[url('/settings/language')] = 'settings.language';
$menu[url('/settings/language')] = ['title' => 'settings.language', 'icon' => 'translate'];
}
if (count(config('themes')) > 1) {
@ -335,7 +336,7 @@ class SettingsController extends BaseController
}
if (config('ifsg_enabled')) {
$menu[url('/settings/certificates')] = 'settings.certificates';
$menu[url('/settings/certificates')] = ['title' => 'settings.certificates', 'icon' => 'card-checklist'];
}
$menu[url('/settings/sessions')] = 'settings.sessions';

View File

@ -840,7 +840,10 @@ class SettingsControllerTest extends ControllerTest
{
$menu = $this->controller->settingsMenu();
$this->assertArrayHasKey('http://localhost/settings/password', $menu);
$this->assertEquals('settings.password', $menu['http://localhost/settings/password']);
$this->assertEquals(
['title' => 'settings.password', 'icon' => 'key-fill'],
$menu['http://localhost/settings/password']
);
}
/**
@ -850,7 +853,10 @@ class SettingsControllerTest extends ControllerTest
{
$menu = $this->controller->settingsMenu();
$this->assertArrayHasKey('http://localhost/settings/language', $menu);
$this->assertEquals('settings.language', $menu['http://localhost/settings/language']);
$this->assertEquals(
['title' => 'settings.language', 'icon' => 'translate'],
$menu['http://localhost/settings/language']
);
}
/**
@ -895,7 +901,10 @@ class SettingsControllerTest extends ControllerTest
$menu = $this->controller->settingsMenu();
$this->assertArrayHasKey('http://localhost/settings/certificates', $menu);
$this->assertEquals('settings.certificates', $menu['http://localhost/settings/certificates']);
$this->assertEquals(
['title' => 'settings.certificates', 'icon' => 'card-checklist'],
$menu['http://localhost/settings/certificates']
);
}
/**