From 54304926e8dd381846659e270a2ffcd8cca7dc5e Mon Sep 17 00:00:00 2001 From: Lotte Steenbrink Date: Wed, 7 Aug 2024 11:21:08 +0200 Subject: [PATCH 01/13] make docker dev instructions easier to discover and skim --- DEVELOPMENT.md | 24 +++++++++++++++++------- README.md | 3 +++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index aef759b92..ed5b73aad 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -41,18 +41,20 @@ ln -s ../../bin/pre-commit .git/hooks/pre-commit ## Docker -We suggest using Docker for the Development local build. +> [!TIP] +> We suggest using Docker for the Development local build. +> This repo [ships a docker setup](docker/dev) for a quick development start. +> If you use another uid/gid than 1000 on your machine you have to adjust it in [docker/dev/.env](docker/dev/.env). -If unspecific issues appear try using Docker version >= 20.10.14. - -This repo [ships a docker setup](docker/dev) for a quick development start. - -If you use another uid/gid than 1000 on your machine you have to adjust it in [docker/dev/.env](docker/dev/.env). -Run this once +Make sure you're in the `docker/dev` subfolder: ```bash cd docker/dev +``` + +Then, run +```bash docker compose up ``` @@ -215,3 +217,11 @@ For some reason *PhpStorm* is unable to detect the server name. But without a server name it's impossible to set up path mappings. Because of that the docker setup sets the server name *engelsystem*. To get Xdebug working you have to create a server with the name *engelsystem* manually. + +## Troubleshooting + +### Docker version +If unspecific issues appear try using Docker version >= 20.10.14. + +### `service "es_workspace" is not running` +Make sure you're running your docker commands from the `docker/dev` directory, not from `docker` \ No newline at end of file diff --git a/README.md b/README.md index 3212d5e6b..516180b90 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,9 @@ The Engelsystem can now be used. * Both Apache and Nginx allow for different VirtualHost configurations. ### Docker + +For instructions on how to build the Docker container for development, please consult the [DEVELOPMENT.md](DEVELOPMENT.md). + #### Build To build the `es_server` container: ```bash From 585e267e062692fadcaec95a22b8fb324337406d Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Mon, 19 Aug 2024 21:19:39 +0200 Subject: [PATCH 02/13] Fix linting --- DEVELOPMENT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index ed5b73aad..001b0cbce 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -224,4 +224,4 @@ To get Xdebug working you have to create a server with the name *engelsystem* ma If unspecific issues appear try using Docker version >= 20.10.14. ### `service "es_workspace" is not running` -Make sure you're running your docker commands from the `docker/dev` directory, not from `docker` \ No newline at end of file +Make sure you're running your docker commands from the `docker/dev` directory, not from `docker` From 7c1fcb10e1281cf36f94013899b1f32123f1476c Mon Sep 17 00:00:00 2001 From: Xu Date: Sat, 15 Jun 2024 11:54:06 +0200 Subject: [PATCH 03/13] DayOfEvent::get needs config enable_show_day_of_event --- includes/helper/legacy_helper.php | 2 +- includes/view/PublicDashboard_view.php | 2 +- resources/views/emails/mail.twig | 2 +- resources/views/layouts/parts/footer.twig | 6 +++--- src/Helpers/DayOfEvent.php | 4 ++++ tests/Unit/Helpers/DayOfEventTest.php | 10 ++++++++++ tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php | 1 + 7 files changed, 21 insertions(+), 6 deletions(-) diff --git a/includes/helper/legacy_helper.php b/includes/helper/legacy_helper.php index 1bf719bd0..22a415a37 100644 --- a/includes/helper/legacy_helper.php +++ b/includes/helper/legacy_helper.php @@ -31,7 +31,7 @@ function dateWithEventDay(string $day): string $dayOfEvent = DayOfEvent::get($date); $dateFormatted = $date->format(__('general.date')); - if (!config('enable_show_day_of_event') || is_null($dayOfEvent)) { + if (is_null($dayOfEvent)) { return $dateFormatted; } diff --git a/includes/view/PublicDashboard_view.php b/includes/view/PublicDashboard_view.php index c40448f46..c8532b5cb 100644 --- a/includes/view/PublicDashboard_view.php +++ b/includes/view/PublicDashboard_view.php @@ -55,7 +55,7 @@ function public_dashboard_view($stats, $free_shifts, $highlighted_news) $dayOfEvent = DayOfEvent::get(); - if (config('enable_show_day_of_event') && $dayOfEvent !== null) { + if ($dayOfEvent !== null) { $stats[] = stats(__('dashboard.day'), $dayOfEvent, 'default'); } diff --git a/resources/views/emails/mail.twig b/resources/views/emails/mail.twig index f84d9f969..1d1af6fb9 100644 --- a/resources/views/emails/mail.twig +++ b/resources/views/emails/mail.twig @@ -7,7 +7,7 @@ {{ '-- ' }} {% block footer %} {{ config('name') }} -{%- if config('enable_show_day_of_event') and day_of_event is defined -%} +{%- if day_of_event is defined -%} {% if config('name') %}, {% endif %}{{ __('event.day', [day_of_event]) }} {%- endif %} diff --git a/resources/views/layouts/parts/footer.twig b/resources/views/layouts/parts/footer.twig index dfc715276..4fee72848 100644 --- a/resources/views/layouts/parts/footer.twig +++ b/resources/views/layouts/parts/footer.twig @@ -11,7 +11,7 @@ config('event_start').format(__('general.date')), config('event_end').format(__('general.date')) ]) }} - {%- if config('enable_show_day_of_event') and day_of_event is defined -%} + {%- if day_of_event is defined -%} , {{ __('event.day', [day_of_event]) }} {% endif %} {% elseif config('event_start') %} @@ -19,7 +19,7 @@ config('name'), config('event_start').format(__('general.date')) ]) }} - {%- if config('enable_show_day_of_event') and day_of_event is defined -%} + {%- if day_of_event is defined -%} , {{ __('event.day', [day_of_event]) }} {% endif %} {% else %} @@ -30,7 +30,7 @@ config('event_start').format(__('general.date')), config('event_end').format(__('general.date')) ]) }} - {%- if config('enable_show_day_of_event') and day_of_event is defined -%} + {%- if day_of_event is defined -%} , {{ __('event.day', [day_of_event]) }} {% endif %}
{% endif %} diff --git a/src/Helpers/DayOfEvent.php b/src/Helpers/DayOfEvent.php index 1ae8640aa..45f9dd1cc 100644 --- a/src/Helpers/DayOfEvent.php +++ b/src/Helpers/DayOfEvent.php @@ -13,6 +13,10 @@ class DayOfEvent */ public static function get(Carbon $date = null): int | null { + if (!config('enable_show_day_of_event')) { + return null; + } + $startOfEvent = config('event_start'); if (!$startOfEvent) { diff --git a/tests/Unit/Helpers/DayOfEventTest.php b/tests/Unit/Helpers/DayOfEventTest.php index ad13bcd6f..ffd247797 100644 --- a/tests/Unit/Helpers/DayOfEventTest.php +++ b/tests/Unit/Helpers/DayOfEventTest.php @@ -18,6 +18,7 @@ public function setUp(): void { $app = $this->createAndSetUpAppWithConfig([]); $this->config = $app->get('config'); + $this->config->set('enable_show_day_of_event', true); } public function tearDown(): void @@ -65,4 +66,13 @@ public function testGet( Carbon::setTestNow(Carbon::createFromFormat(self::FORMAT, $now)); $this->assertSame($expected, DayOfEvent::get()); } + /** + * @dataProvider provideTestGetData + * @covers \Engelsystem\Helpers\DayOfEvent + */ + public function testGetDisabledShowDayOfEvent(): void + { + $this->config->set('enable_show_day_of_event', false); + $this->assertNull(DayOfEvent::get()); + } } diff --git a/tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php b/tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php index 1f3d01b6c..a73b946e8 100644 --- a/tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php +++ b/tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php @@ -50,6 +50,7 @@ public function testGetGlobals(): void $config = new Config( [ 'event_start' => Carbon::createFromFormat('Y-m-d', '2023-08-13'), + 'enable_show_day_of_event' => true, 'theme' => 23, 'themes' => [ 42 => $theme, From c04b04656a185e905708783f228749378ead6269 Mon Sep 17 00:00:00 2001 From: Xu Date: Sat, 15 Jun 2024 11:55:58 +0200 Subject: [PATCH 04/13] rename config enable_show_day_of_event to enable_day_of_event --- config/config.default.php | 2 +- src/Helpers/DayOfEvent.php | 2 +- tests/Unit/Helpers/DayOfEventTest.php | 4 ++-- tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/config.default.php b/config/config.default.php index 3d4510d18..81e0b74f7 100644 --- a/config/config.default.php +++ b/config/config.default.php @@ -413,7 +413,7 @@ // Whether to show the current day of the event (-2, -1, 0, 1, 2…) in footer and on the dashboard. // The event start date has to be set for it to appear. - 'enable_show_day_of_event' => (bool) env('ENABLE_SHOW_DAY_OF_EVENT', false), + 'enable_day_of_event' => (bool) env('ENABLE_DAY_OF_EVENT', false), // If true there will be a day 0 (-1, 0, 1…). If false there won't (-1, 1…) 'event_has_day0' => (bool) env('EVENT_HAS_DAY0', true), diff --git a/src/Helpers/DayOfEvent.php b/src/Helpers/DayOfEvent.php index 45f9dd1cc..a3b8285d3 100644 --- a/src/Helpers/DayOfEvent.php +++ b/src/Helpers/DayOfEvent.php @@ -13,7 +13,7 @@ class DayOfEvent */ public static function get(Carbon $date = null): int | null { - if (!config('enable_show_day_of_event')) { + if (!config('enable_day_of_event')) { return null; } diff --git a/tests/Unit/Helpers/DayOfEventTest.php b/tests/Unit/Helpers/DayOfEventTest.php index ffd247797..470c44131 100644 --- a/tests/Unit/Helpers/DayOfEventTest.php +++ b/tests/Unit/Helpers/DayOfEventTest.php @@ -18,7 +18,7 @@ public function setUp(): void { $app = $this->createAndSetUpAppWithConfig([]); $this->config = $app->get('config'); - $this->config->set('enable_show_day_of_event', true); + $this->config->set('enable_day_of_event', true); } public function tearDown(): void @@ -72,7 +72,7 @@ public function testGet( */ public function testGetDisabledShowDayOfEvent(): void { - $this->config->set('enable_show_day_of_event', false); + $this->config->set('enable_day_of_event', false); $this->assertNull(DayOfEvent::get()); } } diff --git a/tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php b/tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php index a73b946e8..f3d526a54 100644 --- a/tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php +++ b/tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php @@ -50,7 +50,7 @@ public function testGetGlobals(): void $config = new Config( [ 'event_start' => Carbon::createFromFormat('Y-m-d', '2023-08-13'), - 'enable_show_day_of_event' => true, + 'enable_day_of_event' => true, 'theme' => 23, 'themes' => [ 42 => $theme, From 61faf2815a5359b92eaf3505a61f92f8240b605b Mon Sep 17 00:00:00 2001 From: Xu Date: Sat, 15 Jun 2024 12:29:52 +0200 Subject: [PATCH 05/13] Add dayOfEvent to shift dates --- includes/pages/admin_shifts.php | 4 ++-- includes/view/Shifts_view.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/pages/admin_shifts.php b/includes/pages/admin_shifts.php index 1c9380b7c..1ecb52ad5 100644 --- a/includes/pages/admin_shifts.php +++ b/includes/pages/admin_shifts.php @@ -339,9 +339,9 @@ function admin_shifts() $shifts_table_entry = [ 'timeslot' => icon('clock-history') . ' ' - . $start->format(__('general.datetime')) + . dateWithEventDay($start->format('Y-m-d')) . ' ' . $start->format(__('H:i')) . ' - ' - . '' + . '' . $end->format(__('H:i')) . '' . ', ' . round($end->copy()->diffInMinutes($start) / 60, 2) . 'h' diff --git a/includes/view/Shifts_view.php b/includes/view/Shifts_view.php index 372946905..bcfa50a42 100644 --- a/includes/view/Shifts_view.php +++ b/includes/view/Shifts_view.php @@ -33,7 +33,7 @@ function Shift_view_header(Shift $shift, Location $location) div('col-sm-3 col-xs-6', [ '

' . __('shifts.start') . '

', '

', - icon('calendar-event') . $shift->start->format(__('general.date')), + icon('calendar-event') . dateWithEventDay($shift->start->format('Y-m-d')), '
', icon('clock') . $shift->start->format('H:i'), '

', @@ -41,7 +41,7 @@ function Shift_view_header(Shift $shift, Location $location) div('col-sm-3 col-xs-6', [ '

' . __('shifts.end') . '

', '

', - icon('calendar-event') . $shift->end->format(__('general.date')), + icon('calendar-event') . dateWithEventDay($shift->end->format('Y-m-d')), '
', icon('clock') . $shift->end->format('H:i'), '

', From 75511931b1c90d109619789a87efc114c31d194d Mon Sep 17 00:00:00 2001 From: Xu Date: Sun, 4 Aug 2024 17:02:24 +0200 Subject: [PATCH 06/13] fix wording and translations # Conflicts: # includes/controller/user_angeltypes_controller.php # includes/pages/admin_shifts.php --- includes/controller/angeltypes_controller.php | 8 +- .../controller/shift_entries_controller.php | 4 +- includes/controller/shifts_controller.php | 4 +- .../controller/user_angeltypes_controller.php | 39 +++++----- includes/pages/admin_active.php | 2 +- includes/pages/admin_arrive.php | 2 +- includes/pages/admin_free.php | 2 +- includes/pages/admin_shifts.php | 2 +- includes/pages/user_shifts.php | 4 +- includes/view/AngelTypes_view.php | 10 +-- includes/view/ShiftCalendarRenderer.php | 2 +- includes/view/ShiftEntry_view.php | 2 +- includes/view/UserAngelTypes_view.php | 8 +- resources/lang/de_DE/default.po | 73 ++++++++----------- resources/lang/en_US/default.po | 22 +++--- 15 files changed, 87 insertions(+), 97 deletions(-) diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php index 8a20fa9f8..25128d742 100644 --- a/includes/controller/angeltypes_controller.php +++ b/includes/controller/angeltypes_controller.php @@ -65,13 +65,13 @@ function angeltype_delete_controller() if (request()->hasPostData('delete')) { $angeltype->delete(); - engelsystem_log('Deleted angeltype: ' . AngelType_name_render($angeltype, true)); - success(sprintf(__('Angeltype %s deleted.'), $angeltype->name)); + engelsystem_log('Deleted angel type: ' . AngelType_name_render($angeltype, true)); + success(sprintf(__('Angel type %s deleted.'), $angeltype->name)); throw_redirect(url('/angeltypes')); } return [ - sprintf(__('Delete angeltype %s'), htmlspecialchars($angeltype->name)), + sprintf(__('Delete angel type %s'), htmlspecialchars($angeltype->name)), AngelType_delete_view($angeltype), ]; } @@ -137,7 +137,7 @@ function angeltype_edit_controller() success(__('Angel type saved.')); engelsystem_log( - 'Saved angeltype: ' . $angeltype->name . ($angeltype->restricted ? ', restricted' : '') + 'Saved angel type: ' . $angeltype->name . ($angeltype->restricted ? ', restricted' : '') . ($angeltype->shift_self_signup ? ', shift_self_signup' : '') . (config('driving_license_enabled') ? (($angeltype->requires_driver_license ? ', requires driver license' : '') . ', ') diff --git a/includes/controller/shift_entries_controller.php b/includes/controller/shift_entries_controller.php index 0fb81faae..3eded31a7 100644 --- a/includes/controller/shift_entries_controller.php +++ b/includes/controller/shift_entries_controller.php @@ -149,7 +149,7 @@ function shift_entry_create_controller_supporter(Shift $shift, AngelType $angelt } if (!$signup_user->userAngelTypes()->wherePivot('angel_type_id', $angeltype->id)->exists()) { - error(__('User is not in angeltype.')); + error(__('User is not in angel type.')); throw_redirect(shift_link($shift)); } @@ -186,7 +186,7 @@ function shift_entry_create_controller_supporter(Shift $shift, AngelType $angelt function shift_entry_error_message(ShiftSignupState $shift_signup_state) { match ($shift_signup_state->getState()) { - ShiftSignupStatus::ANGELTYPE => error(__('You need be accepted member of the angeltype.')), + ShiftSignupStatus::ANGELTYPE => error(__('You need be accepted member of the angel type.')), ShiftSignupStatus::COLLIDES => error(__('This shift collides with one of your shifts.')), ShiftSignupStatus::OCCUPIED => error(__('This shift is already occupied.')), ShiftSignupStatus::SHIFT_ENDED => error(__('This shift ended already.')), diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php index 6ebd1d4b6..ed41e6ba8 100644 --- a/includes/controller/shifts_controller.php +++ b/includes/controller/shifts_controller.php @@ -104,7 +104,7 @@ function shift_edit_controller() $shifttype_id = $request->input('shifttype_id'); } else { $valid = false; - error(__('Please select a shifttype.')); + error(__('Please select a shift type.')); } if ($request->has('start') && $tmp = DateTime::createFromFormat('Y-m-d H:i', $request->input('start'))) { @@ -208,7 +208,7 @@ function shift_edit_controller() . info(__('This page is much more comfortable with javascript.'), true) . '', form([ - form_select('shifttype_id', __('Shifttype'), $shifttypes, $shifttype_id), + form_select('shifttype_id', __('Shift type'), $shifttypes, $shifttype_id), form_text('title', __('title.title'), $title), form_select('rid', __('Location:'), $locations, $rid), form_text('start', __('Start:'), $start->format('Y-m-d H:i')), diff --git a/includes/controller/user_angeltypes_controller.php b/includes/controller/user_angeltypes_controller.php index c9be47f54..299304bd5 100644 --- a/includes/controller/user_angeltypes_controller.php +++ b/includes/controller/user_angeltypes_controller.php @@ -38,19 +38,18 @@ function user_angeltypes_unconfirmed_hint() $unconfirmed_links[] = '' . htmlspecialchars($user_angeltype->angelType->name) - . ' (+' . $user_angeltype->count . ')' + . ' (+' . $user_angeltype->users_count . ')' . ''; } $count = $unconfirmed_user_angeltypes->count(); return _e( - 'There is %d unconfirmed angeltype.', - 'There are %d unconfirmed angeltypes.', + 'There are unconfirmed angels in %d angel type. Angel type that needs approval:', + 'There are unconfirmed angels in %d angel types. Angel types that need approvals:', $count, [$count] ) - . ' ' . __('Angel types which need approvals:') . ' ' . join(', ', $unconfirmed_links); } @@ -70,7 +69,7 @@ function user_angeltypes_delete_all_controller(): array $angeltype = AngelType::findOrFail($request->input('angeltype_id')); if (!auth()->user()->isAngelTypeSupporter($angeltype) && !auth()->can('admin_user_angeltypes')) { - error(__('You are not allowed to delete all users for this angeltype.')); + error(__('You are not allowed to delete all users for this angel type.')); throw_redirect(url('/angeltypes')); } @@ -79,8 +78,8 @@ function user_angeltypes_delete_all_controller(): array ->whereNull('confirm_user_id') ->delete(); - engelsystem_log(sprintf('Denied all users for angeltype %s', AngelType_name_render($angeltype, true))); - success(sprintf(__('Denied all users for angeltype %s.'), $angeltype->name)); + engelsystem_log(sprintf('Denied all users for angel type %s', AngelType_name_render($angeltype, true))); + success(sprintf(__('Denied all users for angel type %s.'), $angeltype->name)); throw_redirect(url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])); } @@ -107,7 +106,7 @@ function user_angeltypes_confirm_all_controller(): array $angeltype = AngelType::findOrFail($request->input('angeltype_id')); if (!auth()->can('admin_user_angeltypes') && !$user->isAngelTypeSupporter($angeltype)) { - error(__('You are not allowed to confirm all users for this angeltype.')); + error(__('You are not allowed to confirm all users for this angel type.')); throw_redirect(url('/angeltypes')); } @@ -118,8 +117,8 @@ function user_angeltypes_confirm_all_controller(): array ->whereNull('confirm_user_id') ->update(['confirm_user_id' => $user->id]); - engelsystem_log(sprintf('Confirmed all users for angeltype %s', AngelType_name_render($angeltype, true))); - success(sprintf(__('Confirmed all users for angeltype %s.'), $angeltype->name)); + engelsystem_log(sprintf('Confirmed all users for angel type %s', AngelType_name_render($angeltype, true))); + success(sprintf(__('Confirmed all users for angel type %s.'), $angeltype->name)); foreach ($users as $user) { user_angeltype_confirm_email($user, $angeltype); @@ -145,7 +144,7 @@ function user_angeltype_confirm_controller(): array $request = request(); if (!$request->has('user_angeltype_id')) { - error(__('User angeltype doesn\'t exist.')); + error(__('User angel type doesn\'t exist.')); throw_redirect(url('/angeltypes')); } @@ -153,7 +152,7 @@ function user_angeltype_confirm_controller(): array $user_angeltype = UserAngelType::findOrFail($request->input('user_angeltype_id')); $angeltype = $user_angeltype->angelType; if (!$user->isAngelTypeSupporter($angeltype) && !auth()->can('admin_user_angeltypes')) { - error(__('You are not allowed to confirm this users angeltype.')); + error(__('You are not allowed to confirm this users angel type.')); throw_redirect(url('/angeltypes')); } @@ -163,11 +162,11 @@ function user_angeltype_confirm_controller(): array $user_angeltype->save(); engelsystem_log(sprintf( - '%s confirmed for angeltype %s', + '%s confirmed for angel type %s', User_Nick_render($user_source, true), AngelType_name_render($angeltype, true) )); - success(sprintf(__('%s confirmed for angeltype %s.'), $user_source->displayName, $angeltype->name)); + success(sprintf(__('%s confirmed for angel type %s.'), $user_source->displayName, $angeltype->name)); user_angeltype_confirm_email($user_source, $angeltype); @@ -175,7 +174,7 @@ function user_angeltype_confirm_controller(): array } return [ - __('Confirm angeltype for user'), + __('Confirm angel type for user'), UserAngelType_confirm_view($user_angeltype, $user_source, $angeltype), ]; } @@ -223,7 +222,7 @@ function user_angeltype_delete_controller(): array $user = auth()->user(); if (!$request->has('user_angeltype_id')) { - error(__('User angeltype doesn\'t exist.')); + error(__('User angel type doesn\'t exist.')); throw_redirect(url('/angeltypes')); } @@ -237,7 +236,7 @@ function user_angeltype_delete_controller(): array && !$user->isAngelTypeSupporter($angeltype) && !auth()->can('admin_user_angeltypes') ) { - error(__('You are not allowed to delete this users angeltype.')); + error(__('You are not allowed to delete this users angel type.')); throw_redirect(url('/angeltypes')); } @@ -251,7 +250,7 @@ function user_angeltype_delete_controller(): array } return [ - __('Leave angeltype'), + __('Leave angel type'), UserAngelType_delete_view($user_angeltype, $user_source, $angeltype, $isOwnAngelType), ]; } @@ -272,7 +271,7 @@ function user_angeltype_update_controller(): array } if (!$request->has('user_angeltype_id')) { - error(__('User angeltype doesn\'t exist.')); + error(__('User angel type doesn\'t exist.')); throw_redirect(url('/angeltypes')); } @@ -389,7 +388,7 @@ function user_angeltype_add_controller(): array } return [ - __('Add user to angeltype'), + __('Add user to angel type'), UserAngelType_add_view($angeltype, $users_select, $user_source->id), ]; } diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php index 4d4a75297..769506fde 100644 --- a/includes/pages/admin_active.php +++ b/includes/pages/admin_active.php @@ -270,7 +270,7 @@ function admin_active() $parameters['show_all_shifts'] = 1; } $actions[] = form( - [form_submit('submit', icon('plus-lg') . __('set active'), 'btn-sm', false, 'secondary')], + [form_submit('submit', icon('plus-lg') . __('Set active'), 'btn-sm', false, 'secondary')], url('/admin-active', $parameters), false, true diff --git a/includes/pages/admin_arrive.php b/includes/pages/admin_arrive.php index 51b00c980..16c2bf17c 100644 --- a/includes/pages/admin_arrive.php +++ b/includes/pages/admin_arrive.php @@ -212,7 +212,7 @@ function admin_arrive() table(array_merge( ['name' => __('general.name'),], ($admin_arrive ? ['rendered_planned_arrival_date' => __('Planned arrival')] : []), - ['arrived' => __('Arrived?')], + ['arrived' => __('Arrived')], ($admin_arrive ? [ 'rendered_arrival_date' => __('Arrival date'), 'rendered_planned_departure_date' => __('Planned departure'), diff --git a/includes/pages/admin_free.php b/includes/pages/admin_free.php index 1a6b9547e..2fc2ce291 100644 --- a/includes/pages/admin_free.php +++ b/includes/pages/admin_free.php @@ -118,7 +118,7 @@ function admin_free() div('col-md-12 form-inline', [ div('row', [ form_text('search', __('form.search'), $search, null, null, null, 'col'), - form_select('angeltype', __('Angeltype'), $angel_types, $angelType, '', 'col'), + form_select('angeltype', __('Angel type'), $angel_types, $angelType, '', 'col'), form_submit('submit', icon('search') . __('form.search')), ]), ]), diff --git a/includes/pages/admin_shifts.php b/includes/pages/admin_shifts.php index 1ecb52ad5..967a7b4bb 100644 --- a/includes/pages/admin_shifts.php +++ b/includes/pages/admin_shifts.php @@ -511,7 +511,7 @@ function admin_shifts() form([ div('row', [ div('col-md-6 col-xl-5', [ - form_select('shifttype_id', __('Shifttype'), $shifttypes, $shifttype_id), + form_select('shifttype_id', __('Shift type'), $shifttypes, $shifttype_id), form_text('title', __('title.title'), $title, false, 255), form_select('lid', __('Location'), $location_array, $lid), ]), diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index 1f9d9b6c1..e83993959 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -179,7 +179,7 @@ function load_types() $isShico = auth()->can('admin_shifts'); if (!AngelType::count()) { - error(__('The administration has not configured any angeltypes yet - or you are not subscribed to any angeltype.')); + error(__('The administration has not configured any angel types yet - or you are not subscribed to any angel type.')); throw_redirect(url('/')); } @@ -326,7 +326,7 @@ function view_user_shifts() 'types', icon('person-lines-fill') . __('angeltypes.angeltypes') . ' ', $ownAngelTypes ), diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php index b6dd8b66c..41aa9b0b0 100644 --- a/includes/view/AngelTypes_view.php +++ b/includes/view/AngelTypes_view.php @@ -63,8 +63,8 @@ function AngelType_delete_view(AngelType $angeltype) $link = button($angeltype->id ? url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id]) : url('/angeltypes'), icon('chevron-left'), 'btn-sm', '', __('general.back')); - return page_with_title($link . ' ' . sprintf(__('Delete angeltype %s'), htmlspecialchars($angeltype->name)), [ - info(sprintf(__('Do you want to delete angeltype %s?'), $angeltype->name), true), + return page_with_title($link . ' ' . sprintf(__('Delete angel type %s'), htmlspecialchars($angeltype->name)), [ + info(sprintf(__('Do you want to delete angel type %s?'), $angeltype->name), true), form([ buttons([ button(url('/angeltypes'), icon('x-lg') . __('form.cancel')), @@ -120,7 +120,7 @@ function AngelType_edit_view(AngelType $angeltype, bool $supporter_mode) $link . ' ' . ( $angeltype->id ? sprintf(__('Edit %s'), htmlspecialchars((string) $angeltype->name)) : - __('Create angeltype') + __('Create angel type') ), [ $angeltype->id ? @@ -233,7 +233,7 @@ function AngelType_view_buttons( ); } else { if (config('driving_license_enabled') && $angeltype->requires_driver_license && !$user_license->wantsToDrive()) { - error(__('This angeltype requires a driver license. Please enter your driver license information!')); + error(__('This angel type requires a driver license. Please enter your driver license information!')); } if ( @@ -246,7 +246,7 @@ function AngelType_view_buttons( if ($angeltype->restricted && !$user_angeltype->confirm_user_id) { error(sprintf( - __('You are unconfirmed for this angeltype. Please go to the introduction for %s to get confirmed.'), + __('You are unconfirmed for this angel type. Please go to the introduction for %s to get confirmed.'), $angeltype->name )); } diff --git a/includes/view/ShiftCalendarRenderer.php b/includes/view/ShiftCalendarRenderer.php index 61b7177cf..6271e928e 100644 --- a/includes/view/ShiftCalendarRenderer.php +++ b/includes/view/ShiftCalendarRenderer.php @@ -346,7 +346,7 @@ private function renderLegend() return div('legend mt-3', [ badge(__('Your shift'), 'primary'), badge(__('Help needed'), 'danger'), - badge(__('Other angeltype needed / collides with my shifts'), 'warning'), + badge(__('Other angel type needed / collides with my shifts'), 'warning'), badge(__('Shift is full'), 'success'), badge(__('Shift is running/ended or you have not arrived'), 'secondary'), ]); diff --git a/includes/view/ShiftEntry_view.php b/includes/view/ShiftEntry_view.php index ce02337b4..a223b5de0 100644 --- a/includes/view/ShiftEntry_view.php +++ b/includes/view/ShiftEntry_view.php @@ -106,7 +106,7 @@ function ShiftEntry_create_view_admin( Shift_view_header($shift, $location), info(__('Do you want to sign up the following user for this shift?'), true), form([ - form_select('angeltype_id', __('Angeltype'), $angeltypes_select, $angeltype->id), + form_select('angeltype_id', __('Angel type'), $angeltypes_select, $angeltype->id), form_select('user_id', __('general.user'), $users_select, $signup_user->id), form_submit('submit', icon('save') . __('form.save')), ]), diff --git a/includes/view/UserAngelTypes_view.php b/includes/view/UserAngelTypes_view.php index 37b0fde53..6bd79e331 100644 --- a/includes/view/UserAngelTypes_view.php +++ b/includes/view/UserAngelTypes_view.php @@ -88,7 +88,7 @@ function UserAngelTypes_confirm_all_view(AngelType $angeltype) */ function UserAngelType_confirm_view(UserAngelType $user_angeltype, User $user, AngelType $angeltype) { - return page_with_title(__('Confirm angeltype for user'), [ + return page_with_title(__('Confirm angel type for user'), [ msg(), info(sprintf( __('Do you really want to confirm %s for %s?'), @@ -113,7 +113,7 @@ function UserAngelType_confirm_view(UserAngelType $user_angeltype, User $user, A */ function UserAngelType_delete_view(UserAngelType $user_angeltype, User $user, AngelType $angeltype, bool $isOwnAngelType) { - return page_with_title(__('Leave angeltype'), [ + return page_with_title(__('Leave angel type'), [ msg(), info(sprintf( $isOwnAngelType ? __('Do you really want to leave "%2$s"?') : __('Do you really want to remove "%s" from "%s"?'), @@ -144,10 +144,10 @@ function UserAngelType_add_view(AngelType $angeltype, $users_select, $user_id) '', __('general.back') ); - return page_with_title($link . ' ' . __('Add user to angeltype'), [ + return page_with_title($link . ' ' . __('Add user to angel type'), [ msg(), form([ - form_info(__('Angeltype'), htmlspecialchars($angeltype->name)), + form_info(__('Angel type'), htmlspecialchars($angeltype->name)), $angeltype->restricted ? form_checkbox('auto_confirm_user', __('Confirm user'), true) : '', diff --git a/resources/lang/de_DE/default.po b/resources/lang/de_DE/default.po index 215b6cce2..d48a7e10b 100644 --- a/resources/lang/de_DE/default.po +++ b/resources/lang/de_DE/default.po @@ -168,10 +168,10 @@ msgstr "Mindestlänge %d Zeichen" msgid "form.recover" msgstr "Wiederherstellen" -msgid "Angeltype %s deleted." +msgid "Angel type %s deleted." msgstr "Engeltyp %s gelöscht." -msgid "Delete angeltype %s" +msgid "Delete angel type %s" msgstr "Lösche Engeltyp %s" msgid "Please check the name. Maybe it already exists." @@ -180,7 +180,7 @@ msgstr "Bitte überprüfe den Namen. Vielleicht ist er bereits vergeben." msgid "Angel type saved." msgstr "Engeltyp wurde gespeichert." -msgid "Create angeltype" +msgid "Create angel type" msgstr "Engeltyp erstellen" msgid "Edit %s" @@ -210,13 +210,13 @@ msgstr "Zufällige Schicht" msgid "%s has been subscribed to the shift." msgstr "%s wurde in die Schicht eingetragen." -msgid "User is not in angeltype." +msgid "User is not in angel type." msgstr "User ist nicht im Engeltyp." msgid "This shift is already occupied." msgstr "Die Schicht ist schon voll." -msgid "You need be accepted member of the angeltype." +msgid "You need be accepted member of the angel type." msgstr "Du musst bestätigtes Mitglied des Engeltyps sein." msgid "This shift collides with one of your shifts." @@ -255,9 +255,6 @@ msgstr "" msgid "Please select a location." msgstr "Bitte einen Ort auswählen." -msgid "Please select a shifttype." -msgstr "Bitte einen Schichttyp wählen." - msgid "Please enter a valid starting time for the shifts." msgstr "Bitte gib eine korrekte Startzeit für die Schichten ein." @@ -276,7 +273,7 @@ msgstr "Schicht aktualisiert." msgid "This page is much more comfortable with javascript." msgstr "Diese Seite ist mit JavaScript viel komfortabler." -msgid "Shifttype" +msgid "Shift type" msgstr "Schichttyp" msgid "title.title" @@ -303,42 +300,39 @@ msgstr "Möchtest Du die Schicht \"%s\" von %s bis %s löschen?" msgid "Shift could not be found." msgstr "Schicht konnte nicht gefunden werden." -msgid "There is %d unconfirmed angeltype." -msgid_plural "There are %d unconfirmed angeltypes." -msgstr[0] "Es gibt %d nicht freigeschalteten Engeltypen!" -msgstr[1] "Es gibt %d nicht freigeschaltete Engeltypen!" +msgid "There are unconfirmed angels in %d angel type. Angel type that needs approval:" +msgid_plural "There are unconfirmed angels in %d angel types. Angel types that need approvals:" +msgstr[0] "Es gibt nicht freigeschaltete Engel in %d Engeltypen! Engeltyp der bestätigt werden muss:" +msgstr[1] "Es gibt nicht freigeschaltete Engel in %d Engeltypen! Engeltypen die bestätigt werden müssen:" -msgid "Angel types which need approvals:" -msgstr "Engeltypen die bestätigt werden müssen:" - -msgid "You are not allowed to delete all users for this angeltype." +msgid "You are not allowed to delete all users for this angel type." msgstr "Du darfst nicht alle Benutzer von diesem Engeltyp entfernen." -msgid "Denied all users for angeltype %s." +msgid "Denied all users for angel type %s." msgstr "Alle Benutzer mit Engeltyp %s abgelehnt." msgid "Deny all users" msgstr "Alle Benutzer ablehnen" -msgid "You are not allowed to confirm all users for this angeltype." +msgid "You are not allowed to confirm all users for this angel type." msgstr "Du darfst nicht alle Benutzer für diesen Engeltyp freischalten." -msgid "Confirmed all users for angeltype %s." +msgid "Confirmed all users for angel type %s." msgstr "Alle Benutzer für Engeltyp %s freigeschaltet." msgid "Confirm all users" msgstr "Alle Benutzer bestätigen" -msgid "You are not allowed to confirm this users angeltype." +msgid "You are not allowed to confirm this users angel type." msgstr "Du darfst diesen Benutzer nicht für diesen Engeltyp freischalten." -msgid "%s confirmed for angeltype %s." +msgid "%s confirmed for angel type %s." msgstr "%s für Engeltyp %s freigeschaltet." -msgid "Confirm angeltype for user" +msgid "Confirm angel type for user" msgstr "Engeltyp für Benutzer bestätigen" -msgid "You are not allowed to delete this users angeltype." +msgid "You are not allowed to delete this users angel type." msgstr "Du darfst diesen Benutzer nicht von diesem Engeltyp entfernen." msgid "User \"%s\" removed from \"%s\"." @@ -350,7 +344,7 @@ msgstr "Zertifikate bearbeiten" msgid "You successfully left \"%2$s\"." msgstr "Du hast erfolgreich \"%2$s\" verlassen." -msgid "Leave angeltype" +msgid "Leave angel type" msgstr "Engeltyp verlassen" msgid "You are not allowed to set supporter rights." @@ -374,7 +368,7 @@ msgstr "Supporterrechte entfernen" msgid "User %s added to %s." msgstr "Benutzer %s zu %s hinzugefügt." -msgid "Add user to angeltype" +msgid "Add user to angel type" msgstr "Benutzer zu Engeltyp hinzufügen" msgid "You are already a %s." @@ -479,17 +473,17 @@ msgstr "Engel hat ein T-Shirt bekommen." msgid "Angel has got no T-shirt." msgstr "Engel hat kein T-Shirt bekommen." -msgid "set active" -msgstr "setze aktiv" +msgid "Set active" +msgstr "Setze aktiv" msgid "Remove active" -msgstr "entferne aktiv" +msgstr "Entferne aktiv" msgid "Got T-shirt" msgstr "T-Shirt bekommen" msgid "Remove T-shirt" -msgstr "entferne T-Shirt" +msgstr "Entferne T-Shirt" msgid "Sum" msgstr "Summe" @@ -548,9 +542,6 @@ msgstr "Zurücksetzen" msgid "Planned arrival" msgstr "Geplanter Ankunftstag" -msgid "Arrived?" -msgstr "Angekommen?" - msgid "Arrival date" msgstr "Ankunftsdatum" @@ -575,7 +566,7 @@ msgstr "Geplante Abreise-Statistik" msgid "Free angels" msgstr "Freie Engel" -msgid "Angeltype" +msgid "Angel type" msgstr "Engeltyp" msgid "shift.next" @@ -753,8 +744,8 @@ msgid "The administration has not configured any shifts yet." msgstr "Die Administratoren haben noch keine Schichten angelegt." msgid "" -"The administration has not configured any angeltypes yet - or you are not " -"subscribed to any angeltype." +"The administration has not configured any angel types yet - or you are not " +"subscribed to any angel type." msgstr "" "Die Administratoren haben noch keine Engeltypen konfiguriert - oder Du hast " "noch keine Engeltypen ausgewählt." @@ -772,7 +763,7 @@ msgid "Occupancy" msgstr "Belegung" msgid "" -"The tasks shown here are influenced by the angeltypes you joined already!" +"The tasks shown here are influenced by the angel types you joined already!" msgstr "" "Die Schichten, die hier angezeigt werden, sind von Deinen Einstellungen " "(Engeltypen/Aufgaben) abhängig!" @@ -840,7 +831,7 @@ msgstr "Supporter" msgid "Member" msgstr "Mitglied" -msgid "Do you want to delete angeltype %s?" +msgid "Do you want to delete angel type %s?" msgstr "Möchtest Du den Engeltypen %s löschen?" msgid "angeltypes.restricted" @@ -886,14 +877,14 @@ msgid "angeltype.driving_license.required.info.preview" msgstr "Dieser Engeltyp benötigt Führerschein-Infos." msgid "" -"This angeltype requires a driver license. Please enter your driver license " +"This angel type requires a driver license. Please enter your driver license " "information!" msgstr "" "Dieser Engeltyp benötigt Führerschein-Infos. Bitte trage Deine Führerschein-" "Infos ein!" msgid "" -"You are unconfirmed for this angeltype. Please go to the introduction for %s " +"You are unconfirmed for this angel type. Please go to the introduction for %s " "to get confirmed." msgstr "" "Du bist noch nicht für diesen Engeltyp bestätigt. Bitte gehe zur Einführung " @@ -962,7 +953,7 @@ msgstr "Meine Schicht" msgid "Help needed" msgstr "Hilfe benötigt" -msgid "Other angeltype needed / collides with my shifts" +msgid "Other angel type needed / collides with my shifts" msgstr "Andere Engeltypen benötigt / kollidiert mit meinen Schichten" msgid "Shift is full" diff --git a/resources/lang/en_US/default.po b/resources/lang/en_US/default.po index 51bc9bf89..a1829908a 100644 --- a/resources/lang/en_US/default.po +++ b/resources/lang/en_US/default.po @@ -365,7 +365,7 @@ msgid "settings.profile.shirt.link" msgstr "More information" msgid "settings.profile.angeltypes.info" -msgstr "You can manage your Angeltypes on the Angeltypes page." +msgstr "You can manage your angel types on the angel types page." msgid "settings.password" msgstr "Password" @@ -488,22 +488,22 @@ msgid "angeltype.ifsg.own" msgstr "My health instruction" msgid "angeltype.ifsg.required.info.preview" -msgstr "This angeltype requires a health instruction." +msgstr "This angel type requires a health instruction." msgid "angeltype.ifsg.required.info" -msgstr "This angeltype requires a health instruction. Please enter your health instruction information!" +msgstr "This angel type requires a health instruction. Please enter your health instruction information!" msgid "angeltype.ifsg.required.info.here" -msgstr "You joined an angeltype which requires a health instruction. " +msgstr "You joined an angel type which requires a health instruction. " "Please edit your health instruction information here: %s." msgid "angeltype.driving_license.required.info.here" msgstr "" -"You joined an angeltype which requires a driving license. " +"You joined an angel type which requires a driving license. " "Please edit your driving license information here: %s." msgid "angeltype.driving_license.required.info.preview" -msgstr "This angeltype requires a driver's license." +msgstr "This angel type requires a driver's license." msgid "ifsg.info" msgstr "Health instruction information" @@ -676,7 +676,7 @@ msgid "worklog.delete.info" msgstr "Do you really want to delete the work log for %s?" msgid "angeltypes.angeltypes" -msgstr "Angeltypes" +msgstr "Angel types" msgid "angeltypes.about" msgstr "Teams-/Job description" @@ -692,7 +692,7 @@ msgstr "Angel types which require introduction can only be used by an angel " "if enabled by a supporter (double opt-in)." msgid "angeltypes.restricted.hint" -msgstr "This angeltype requires the attendance at an introduction meeting. " +msgstr "This angel type requires the attendance at an introduction meeting. " "You might find additional information in the description." msgid "angeltypes.can-change-later" @@ -712,8 +712,8 @@ msgid "angeltypes.hide_on_shift_view" msgstr "Hide on shift view" msgid "angeltypes.hide_on_shift_view.info" -msgstr "If checked only admins and members of the angeltype " -"can see the filter option for this angeltype on the shifts page" +msgstr "If checked only admins and members of the angel type " +"can see the filter option for this angel type on the shifts page" msgid "registration.register" msgstr "Register" @@ -1006,7 +1006,7 @@ msgid "admin_shifts.no_shifttypes" msgstr "No shift type has been created yet. Shifts can't be created without one." msgid "admin_shifts.no_angeltypes" -msgstr "No angeltype has been created yet. Shifts can't be created without one." +msgstr "No angel type has been created yet. Shifts can't be created without one." msgid "shift.sign_out.hint" msgstr "You can self sign out up to %s hours before the start of the shift. " From 89dbad4bc5471180b4163fbfb4adaaf5ab33c560 Mon Sep 17 00:00:00 2001 From: Xu Date: Sun, 18 Aug 2024 15:04:14 +0200 Subject: [PATCH 07/13] better error handling for some errors --- .../controller/user_angeltypes_controller.php | 19 ++++++++----------- resources/lang/de_DE/default.po | 3 --- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/includes/controller/user_angeltypes_controller.php b/includes/controller/user_angeltypes_controller.php index 299304bd5..e855a4498 100644 --- a/includes/controller/user_angeltypes_controller.php +++ b/includes/controller/user_angeltypes_controller.php @@ -1,5 +1,7 @@ has('user_angeltype_id')) { - error(__('User angel type doesn\'t exist.')); - throw_redirect(url('/angeltypes')); + throw new HttpNotFound(); } /** @var UserAngelType $user_angeltype */ @@ -222,8 +223,7 @@ function user_angeltype_delete_controller(): array $user = auth()->user(); if (!$request->has('user_angeltype_id')) { - error(__('User angel type doesn\'t exist.')); - throw_redirect(url('/angeltypes')); + throw new HttpNotFound(); } /** @var UserAngelType $user_angeltype */ @@ -265,14 +265,11 @@ function user_angeltype_update_controller(): array $supporter = false; $request = request(); - if (!auth()->can('admin_angel_types') && !config('supporters_can_promote')) { - error(__('You are not allowed to set supporter rights.')); - throw_redirect(url('/angeltypes')); - } - if (!$request->has('user_angeltype_id')) { - error(__('User angel type doesn\'t exist.')); - throw_redirect(url('/angeltypes')); + throw new HttpNotFound(); + } + if (!auth()->can('admin_angel_types') && !config('supporters_can_promote')) { + throw new HttpForbidden(); } if ($request->has('supporter') && preg_match('/^[01]$/', $request->input('supporter'))) { diff --git a/resources/lang/de_DE/default.po b/resources/lang/de_DE/default.po index d48a7e10b..60684dc96 100644 --- a/resources/lang/de_DE/default.po +++ b/resources/lang/de_DE/default.po @@ -347,9 +347,6 @@ msgstr "Du hast erfolgreich \"%2$s\" verlassen." msgid "Leave angel type" msgstr "Engeltyp verlassen" -msgid "You are not allowed to set supporter rights." -msgstr "Du darfst keine Supporterrechte bearbeiten." - msgid "No supporter update given." msgstr "Kein Update für Supporterrechte gegeben." From f57364794c0ecab5f7cc29eda705e33da43be5ad Mon Sep 17 00:00:00 2001 From: Fenrikur <3359222+Fenrikur@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:30:08 +0200 Subject: [PATCH 08/13] chore(translation): turn some more angels into critters --- resources/lang/en_US/default.po | 46 ++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/resources/lang/en_US/default.po b/resources/lang/en_US/default.po index 41ab7d0ae..14567b319 100644 --- a/resources/lang/en_US/default.po +++ b/resources/lang/en_US/default.po @@ -367,7 +367,7 @@ msgid "settings.profile.shirt.link" msgstr "More information" msgid "settings.profile.angeltypes.info" -msgstr "You can manage your angel types on the angel types page." +msgstr "You can manage your critter types on the critter types page." msgid "settings.password" msgstr "Password" @@ -490,22 +490,22 @@ msgid "angeltype.ifsg.own" msgstr "My health instruction" msgid "angeltype.ifsg.required.info.preview" -msgstr "This crittertype requires a health instruction." +msgstr "This critter type requires a health instruction." msgid "angeltype.ifsg.required.info" -msgstr "This crittertype requires a health instruction. Please enter your health instruction information!" +msgstr "This critter type requires a health instruction. Please enter your health instruction information!" msgid "angeltype.ifsg.required.info.here" -msgstr "You joined an crittertype which requires a health instruction. " +msgstr "You joined a critter type which requires a health instruction. " "Please edit your health instruction information here: %s." msgid "angeltype.driving_license.required.info.here" msgstr "" -"You joined an angel type which requires a driving license. " +"You joined a critter type which requires a driving license. " "Please edit your driving license information here: %s." msgid "angeltype.driving_license.required.info.preview" -msgstr "This crittertype requires a driver's license." +msgstr "This critter type requires a driver's license." msgid "ifsg.info" msgstr "Health instruction information" @@ -645,7 +645,7 @@ msgid "message.title" msgstr "Messages" msgid "message.choose_angel" -msgstr "Choose an Angel" +msgstr "Choose a critter" msgid "message.to_conversation" msgstr "To Conversation" @@ -654,7 +654,7 @@ msgid "message.message" msgstr "Message" msgid "angel" -msgstr "Angel" +msgstr "Critter" msgid "worklog.add" msgstr "Add work log" @@ -678,7 +678,7 @@ msgid "worklog.delete.info" msgstr "Do you really want to delete the work log for %s?" msgid "angeltypes.angeltypes" -msgstr "Angel types" +msgstr "Critter types" msgid "angeltypes.about" msgstr "Teams-/Job description" @@ -690,19 +690,19 @@ msgid "angeltypes.restricted" msgstr "Requires introduction" msgid "angeltypes.restricted.info" -msgstr "Angel types which require introduction can only be used by an critter " +msgstr "Critter types which require introduction can only be used by a critter " "if enabled by a supporter (double opt-in)." msgid "angeltypes.restricted.hint" -msgstr "This crittertype requires the attendance at an introduction meeting. " +msgstr "This critter type requires the attendance at an introduction meeting. " "You might find additional information in the description." msgid "angeltypes.can-change-later" msgstr "You can change your selection later in the settings." msgid "angeltypes.shift.self_signup.info" -msgstr "Angel types which have shift self signup enabled allow critters to self sign up for their shifts, " -"if shift self signup is disabled only supporters and admins can sign angels into shifts of these angel types." +msgstr "Critter types which have shift self sign-up enabled allow critters to self sign up for their shifts, " +"if shift self sign-up is disabled only supporters and admins can sign critters into shifts of these critter types." msgid "shift.self_signup" msgstr "Shift self signup" @@ -714,8 +714,8 @@ msgid "angeltypes.hide_on_shift_view" msgstr "Hide on shift view" msgid "angeltypes.hide_on_shift_view.info" -msgstr "If checked only admins and members of the crittertype " -"can see the filter option for this crittertype on the shifts page" +msgstr "If checked only admins and members of the critter type " +"can see the filter option for this critter type on the shifts page" msgid "registration.register" msgstr "Register" @@ -766,7 +766,7 @@ msgid "dashboard.day" msgstr "Day" msgid "registration.title" -msgstr "Angel registration" +msgstr "Critter registration" msgid "registration.login_data" msgstr "Login data" @@ -842,7 +842,7 @@ msgstr "User info" msgid "user.info.hint" msgstr "" "Is displayed for shift coordinators and admins in the user view. " -"If an angel is not marked as arrived a user-info removes the not-arrived notification in the angels sysmenu." +"If a critter is not marked as arrived a user-info removes the not-arrived notification in the critters sysmenu." msgid "user_info.not_arrived_hint" msgstr "If you want to sign up for shifts, feel free to drop by the Info Desk." @@ -949,7 +949,7 @@ msgid "login.cookies" msgstr "Please note: You have to activate cookies!" msgid "general.angel" -msgstr "Angel" +msgstr "Critter" msgid "title.date" msgstr "Date" @@ -1008,7 +1008,7 @@ msgid "admin_shifts.no_shifttypes" msgstr "No shift type has been created yet. Shifts can't be created without one." msgid "admin_shifts.no_angeltypes" -msgstr "No crittertype has been created yet. Shifts can't be created without one." +msgstr "No critter type has been created yet. Shifts can't be created without one." msgid "shift.sign_out.hint" msgstr "You can self sign out up to %s hours before the start of the shift. " @@ -1028,13 +1028,13 @@ msgstr "You were not present for at least %s shifts. Therefore, shift registrati msgid "freeload.freeloaded.info.goodie" msgstr "" -"If an angel was not present for a shift, the double length of the shift is deducted from the %s. " -"If %s shifts are freeloaded, the shift registration is blocked for the angel." +"If a critter was not present for a shift, the double length of the shift is deducted from the %s. " +"If %s shifts are freeloaded, the shift registration is blocked for the critter." msgid "freeload.freeloaded.info" msgstr "" -"The angel was not present for a shift. " -"If %s shifts are freeloaded, the shift registration is blocked for the angel." +"The critter was not present for a shift. " +"If %s shifts are freeloaded, the shift registration is blocked for the critter." msgid "config.config" msgstr "Config" From 23c7b2938af149b202934c8035d6414cc0e908af Mon Sep 17 00:00:00 2001 From: Fenrikur <3359222+Fenrikur@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:33:44 +0200 Subject: [PATCH 09/13] chore(translation): turn the last heaven into the Info Desk --- resources/lang/de_DE/additional.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/de_DE/additional.po b/resources/lang/de_DE/additional.po index 2bee747db..0224df3ed 100644 --- a/resources/lang/de_DE/additional.po +++ b/resources/lang/de_DE/additional.po @@ -13,7 +13,7 @@ msgstr "" msgid "auth.not-found" msgstr "" "Es wurde kein User gefunden oder das Passwort ist falsch. Probiere es bitte noch einmal. Wenn das Problem " -"weiterhin besteht, melde dich im Himmel." +"weiterhin besteht, melde dich am Info Desk." msgid "validation.password.required" msgstr "Bitte gib ein Passwort an." From 9e39ed16ad237440caaf651aed99dff7e3ee0ecd Mon Sep 17 00:00:00 2001 From: Fenrikur <3359222+Fenrikur@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:34:42 +0200 Subject: [PATCH 10/13] chore(translation): typo --- resources/lang/de_DE/default.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/de_DE/default.po b/resources/lang/de_DE/default.po index 22fb5ddba..3d7fa3fcf 100644 --- a/resources/lang/de_DE/default.po +++ b/resources/lang/de_DE/default.po @@ -301,7 +301,7 @@ msgstr "Schicht konnte nicht gefunden werden." msgid "There are unconfirmed angels in %d angel type. Angel type that needs approval:" msgid_plural "There are unconfirmed angels in %d angel types. Angel types that need approvals:" -msgstr[0] "Es gibt nicht freigeschaltete Critter in %d Crittertyp! Crittertyp der bestätigt werden muss:" +msgstr[0] "Es gibt nicht freigeschaltete Critter in %d Crittertypen! Crittertyp der bestätigt werden muss:" msgstr[1] "Es gibt nicht freigeschaltete Critter in %d Crittertypen! Crittertypen die bestätigt werden müssen:" msgid "You are not allowed to delete all users for this angel type." From d4f8193b3a00b8c53d2937207dba5b925673662f Mon Sep 17 00:00:00 2001 From: Fenrikur <3359222+Fenrikur@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:44:00 +0200 Subject: [PATCH 11/13] chore(translation): use Telegram in place of DECT --- resources/lang/de_DE/additional.po | 12 ++++++------ resources/lang/de_DE/default.po | 6 +++--- resources/lang/en_US/additional.po | 2 +- resources/lang/en_US/default.po | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/resources/lang/de_DE/additional.po b/resources/lang/de_DE/additional.po index 0224df3ed..e88eff7ae 100644 --- a/resources/lang/de_DE/additional.po +++ b/resources/lang/de_DE/additional.po @@ -25,22 +25,22 @@ msgid "validation.login.required" msgstr "Bitte gib einen Loginnamen an." msgid "validation.pronoun.required" -msgstr "Bitte gebe dein Pronomen an." +msgstr "Bitte gib dein Pronomen an." msgid "validation.firstname.required" -msgstr "Bitte gebe deinen Vornamen an." +msgstr "Bitte gib deinen Vornamen an." msgid "validation.lastname.required" -msgstr "Bitte gebe deinen Nachnamen an." +msgstr "Bitte gib deinen Nachnamen an." msgid "validation.mobile.required" -msgstr "Bitte gebe deine Handynummer an." +msgstr "Bitte gib deine Handynummer an." msgid "validation.dect.required" -msgstr "Bitte gebe deine DECT-Nummer an." +msgstr "Bitte gib dein Telegram-Handle an." msgid "validation.username.required" -msgstr "Bitte gebe deinen Nick an." +msgstr "Bitte gib deinen Nick an." msgid "validation.username.username" msgstr "" diff --git a/resources/lang/de_DE/default.po b/resources/lang/de_DE/default.po index 3d7fa3fcf..cdccb68de 100644 --- a/resources/lang/de_DE/default.po +++ b/resources/lang/de_DE/default.po @@ -584,7 +584,7 @@ msgid "Last shift" msgstr "Letzte Schicht" msgid "general.dect" -msgstr "DECT" +msgstr "Telegram" msgid "Grouprights" msgstr "Gruppenrechte" @@ -1213,8 +1213,8 @@ msgstr "Bitte gib eine T-Shirt-Größe in deinen Einstellungen an." msgid "dect.required.hint" msgstr "" -"Bitte gib eine DECT-Telefonnummer in deinen Einstellungen an. Wenn du " -"keine Nummer hast, trage einfach '-' ein." +"Bitte gib ein Telegram-Handle in deinen Einstellungen an. Wenn du " +"keinen Telegram-Account hast, trage einfach '-' ein." msgid "pronoun.required.hint" msgstr "Bitte gib ein Pronomen in deinen Einstellungen an." diff --git a/resources/lang/en_US/additional.po b/resources/lang/en_US/additional.po index 67bea12dc..2a07ef545 100644 --- a/resources/lang/en_US/additional.po +++ b/resources/lang/en_US/additional.po @@ -34,7 +34,7 @@ msgid "validation.mobile.required" msgstr "Please enter your mobile number." msgid "validation.dect.required" -msgstr "Please enter your DECT number." +msgstr "Please enter your Telegram handle." msgid "validation.username.required" msgstr "Please enter your nick." diff --git a/resources/lang/en_US/default.po b/resources/lang/en_US/default.po index 14567b319..3991ccf6e 100644 --- a/resources/lang/en_US/default.po +++ b/resources/lang/en_US/default.po @@ -34,7 +34,7 @@ msgid "general.login" msgstr "Login" msgid "general.dect" -msgstr "DECT" +msgstr "Telegram" msgid "general.name" msgstr "Name" @@ -782,8 +782,8 @@ msgstr "Please specify a T-shirt size in your settings!" msgid "dect.required.hint" msgstr "" -"Please specify a DECT phone number in your settings! " -"If you don't have a DECT phone, just enter '-'." +"Please specify a Telegram handle in your settings! " +"If you don't have a Telegram account, just enter '-'." msgid "pronoun.required.hint" msgstr "Please enter a pronoun in your settings!" From 0c5b31a2e6f4e6f98d9b644eb81db41c5126b479 Mon Sep 17 00:00:00 2001 From: Fenrikur <3359222+Fenrikur@users.noreply.github.com> Date: Thu, 22 Aug 2024 22:12:45 +0200 Subject: [PATCH 12/13] feat: use DECT as Telegram handle --- includes/view/Locations_view.php | 2 +- includes/view/User_view.php | 4 ++-- resources/api/openapi.yml | 2 +- resources/views/pages/angeltypes/about.twig | 6 +++++- resources/views/pages/registration.twig | 1 - src/Controllers/Admin/LocationsController.php | 2 +- src/Controllers/SettingsController.php | 2 +- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/includes/view/Locations_view.php b/includes/view/Locations_view.php index e296c059c..bb00661e2 100644 --- a/includes/view/Locations_view.php +++ b/includes/view/Locations_view.php @@ -47,7 +47,7 @@ function location_view(Location $location, ShiftsFilterRenderer $shiftsFilterRen if (config('enable_dect') && $location->dect) { $dect = heading(__('Contact'), 3) . description([__('general.dect') => sprintf( - '%1$s', + '%1$s', htmlspecialchars($location->dect) )]); } diff --git a/includes/view/User_view.php b/includes/view/User_view.php index 9f8082ed0..cdc9b6536 100644 --- a/includes/view/User_view.php +++ b/includes/view/User_view.php @@ -96,7 +96,7 @@ function Users_view( . user_info_icon($user); $u['first_name'] = htmlspecialchars((string) $user->personalData->first_name); $u['last_name'] = htmlspecialchars((string) $user->personalData->last_name); - $u['dect'] = sprintf('%1$s', htmlspecialchars((string) $user->contact->dect)); + $u['dect'] = sprintf('%1$s', htmlspecialchars((string) $user->contact->dect)); $u['arrived'] = icon_bool($user->state->arrived); if (config('enable_voucher')) { $u['got_voucher'] = $user->state->got_voucher; @@ -713,7 +713,7 @@ function User_view( config('enable_dect') && $user_source->contact->dect ? heading( icon('phone') - . ' ' + . ' ' . htmlspecialchars($user_source->contact->dect) . '' ) diff --git a/resources/api/openapi.yml b/resources/api/openapi.yml index 57ff80703..28da26529 100644 --- a/resources/api/openapi.yml +++ b/resources/api/openapi.yml @@ -322,7 +322,7 @@ components: type: string nullable: true example: 4242 - description: The DECT number is a short internal number where users can be easily reached + description: The Telegram handle stored in the dect field is used as a way to easily reach users mobile: type: string nullable: true diff --git a/resources/views/pages/angeltypes/about.twig b/resources/views/pages/angeltypes/about.twig index e3d4bd9f7..0108f9fe1 100644 --- a/resources/views/pages/angeltypes/about.twig +++ b/resources/views/pages/angeltypes/about.twig @@ -78,7 +78,7 @@
{% for type, info in { 'contact_name': {'name': __('general.name')}, - 'contact_dect': {'name': __('general.dect'), 'url': 'tel'}, + 'contact_dect': {'name': __('general.dect'), 'pattern': 'https://t.me/%s'}, 'contact_email': {'name': __('general.email'), 'url': 'mailto'}, } %} {% if angeltype[type] and (type != 'contact_dect' or config('enable_dect')) %} @@ -90,6 +90,10 @@ {{ angeltype[type] }} + {% elseif info.pattern is defined %} + + {{ angeltype[type] }} + {% else %} {{ angeltype[type] }} {% endif %} diff --git a/resources/views/pages/registration.twig b/resources/views/pages/registration.twig index a019023b2..bc876592b 100644 --- a/resources/views/pages/registration.twig +++ b/resources/views/pages/registration.twig @@ -280,7 +280,6 @@ "dect", __('general.dect'), { - 'type': 'tel-local', 'max_length': 40, 'required': isDectRequired, 'required_icon': isDectRequired, diff --git a/src/Controllers/Admin/LocationsController.php b/src/Controllers/Admin/LocationsController.php index 4dc7648cc..b36876349 100644 --- a/src/Controllers/Admin/LocationsController.php +++ b/src/Controllers/Admin/LocationsController.php @@ -92,7 +92,7 @@ public function save(Request $request): Response $location->name = $data['name']; $location->description = $data['description']; - $location->dect = $data['dect']; + $location->dect = ltrim($data['dect'], '@'); $location->map_url = $data['map_url']; $location->save(); diff --git a/src/Controllers/SettingsController.php b/src/Controllers/SettingsController.php index 84e818ae1..ab3e27b7b 100644 --- a/src/Controllers/SettingsController.php +++ b/src/Controllers/SettingsController.php @@ -91,7 +91,7 @@ public function saveProfile(Request $request): Response } if (config('enable_dect')) { - $user->contact->dect = $data['dect']; + $user->contact->dect = ltrim($data['dect'], '@'); } $user->contact->mobile = $data['mobile']; From 594de51b22a3669cc8048542e4a5e250f4555147 Mon Sep 17 00:00:00 2001 From: Fenrikur <3359222+Fenrikur@users.noreply.github.com> Date: Thu, 22 Aug 2024 22:22:11 +0200 Subject: [PATCH 13/13] chore(translation): fix missing space in `msgid`s containing `angel type` --- resources/lang/de_DE/default.po | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/resources/lang/de_DE/default.po b/resources/lang/de_DE/default.po index cdccb68de..c490245c0 100644 --- a/resources/lang/de_DE/default.po +++ b/resources/lang/de_DE/default.po @@ -215,7 +215,7 @@ msgstr "User ist nicht im Crittertyp." msgid "This shift is already occupied." msgstr "Die Schicht ist schon voll." -msgid "You need be accepted member of the angeltype." +msgid "You need be accepted member of the angel type." msgstr "Du musst bestätigtes Mitglied des Crittertyps sein." msgid "This shift collides with one of your shifts." @@ -313,25 +313,25 @@ msgstr "Alle Benutzer mit Crittertyp %s abgelehnt." msgid "Deny all users" msgstr "Alle Benutzer ablehnen" -msgid "You are not allowed to confirm all users for this angeltype." +msgid "You are not allowed to confirm all users for this angel type." msgstr "Du darfst nicht alle Benutzer für diesen Crittertyp freischalten." -msgid "Confirmed all users for angeltype %s." +msgid "Confirmed all users for angel type %s." msgstr "Alle Benutzer für Crittertyp %s freigeschaltet." msgid "Confirm all users" msgstr "Alle Benutzer bestätigen" -msgid "You are not allowed to confirm this users angeltype." +msgid "You are not allowed to confirm this users angel type." msgstr "Du darfst diesen Benutzer nicht für diesen Crittertyp freischalten." -msgid "%s confirmed for angeltype %s." +msgid "%s confirmed for angel type %s." msgstr "%s für Crittertyp %s freigeschaltet." -msgid "Confirm angeltype for user" +msgid "Confirm angel type for user" msgstr "Crittertyp für Benutzer bestätigen" -msgid "You are not allowed to delete this users angeltype." +msgid "You are not allowed to delete this users angel type." msgstr "Du darfst diesen Benutzer nicht von diesem Crittertyp entfernen." msgid "User \"%s\" removed from \"%s\"." @@ -343,7 +343,7 @@ msgstr "Zertifikate bearbeiten" msgid "You successfully left \"%2$s\"." msgstr "Du hast erfolgreich \"%2$s\" verlassen." -msgid "Leave angeltype" +msgid "Leave angel type" msgstr "Crittertyp verlassen" msgid "No supporter update given." @@ -364,7 +364,7 @@ msgstr "Supporterrechte entfernen" msgid "User %s added to %s." msgstr "Benutzer %s zu %s hinzugefügt." -msgid "Add user to angeltype" +msgid "Add user to angel type" msgstr "Benutzer zu Crittertyp hinzufügen" msgid "You are already a %s." @@ -562,7 +562,7 @@ msgstr "Geplante Abreise-Statistik" msgid "Free angels" msgstr "Freie Critter" -msgid "Angeltype" +msgid "Angel type" msgstr "Crittertyp" msgid "shift.next" @@ -827,7 +827,7 @@ msgstr "Supporter" msgid "Member" msgstr "Mitglied" -msgid "Do you want to delete angeltype %s?" +msgid "Do you want to delete angel type %s?" msgstr "Möchtest Du den Crittertypen %s löschen?" msgid "angeltypes.restricted" @@ -949,7 +949,7 @@ msgstr "Meine Schicht" msgid "Help needed" msgstr "Hilfe benötigt" -msgid "Other angeltype needed / collides with my shifts" +msgid "Other angel type needed / collides with my shifts" msgstr "Andere Crittertypen benötigt / kollidiert mit meinen Schichten" msgid "Shift is full"