From 7917e32f3ec6ac0a06455598f2b89dcdaf411070 Mon Sep 17 00:00:00 2001
From: Igor Scheller
Date: Sat, 24 Jul 2021 20:31:40 +0200
Subject: [PATCH] Fixed api key toggle driver license config display and
dashboard
---
config/config.default.php | 2 +-
includes/pages/user_shifts.php | 4 +-
includes/sys_template.php | 2 +-
includes/view/PublicDashboard_view.php | 45 +++++++++++++----------
includes/view/UserDriverLicenses_view.php | 4 +-
src/Renderer/Twig/Extensions/Globals.php | 4 +-
6 files changed, 34 insertions(+), 27 deletions(-)
diff --git a/config/config.default.php b/config/config.default.php
index 1fffd772..1967e563 100644
--- a/config/config.default.php
+++ b/config/config.default.php
@@ -164,7 +164,7 @@ return [
],
3 => [
'name' => 'Engelsystem 32c3 (2015)',
- 'type' => 'dark',
+ 'type' => 'light',
'navbar_classes' => 'navbar-dark bg-black border-dark',
],
2 => [
diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php
index 7751147d..e24c6d59 100644
--- a/includes/pages/user_shifts.php
+++ b/includes/pages/user_shifts.php
@@ -314,7 +314,9 @@ function ical_hint()
page_link_to('shifts_json_export', ['key' => $user->api_key]),
page_link_to('user_myshifts', ['reset' => 1])
)
- . '
'
diff --git a/includes/sys_template.php b/includes/sys_template.php
index f7dfedb7..6258dbb4 100644
--- a/includes/sys_template.php
+++ b/includes/sys_template.php
@@ -18,7 +18,7 @@ function stats($label, $number, $style = null)
$style = 'success';
}
}
- return div('stats stats-' . $style, [
+ return div('col stats stats-' . $style, [
$label,
div('number', [
$number
diff --git a/includes/view/PublicDashboard_view.php b/includes/view/PublicDashboard_view.php
index 9e56b8a0..4fa3e8c8 100644
--- a/includes/view/PublicDashboard_view.php
+++ b/includes/view/PublicDashboard_view.php
@@ -34,22 +34,24 @@ function public_dashboard_view($stats, $free_shifts)
$isFiltered = request()->get('filtered');
$filter = collect(session()->get('shifts-filter'))->only(['rooms', 'types'])->toArray();
return page([
- div('public-dashboard', [
- div('first', [
- stats(__('Angels needed in the next 3 hrs'), $stats['needed-3-hours']),
- stats(__('Angels needed for nightshifts'), $stats['needed-night']),
- stats(__('Angels currently working'), $stats['angels-working'], 'default'),
- stats(__('Hours to be worked'), $stats['hours-to-work'], 'default'),
- ''
- ], 'statistics'),
- $needed_angels
- ], 'public-dashboard'),
+ div('wrapper', [
+ div('public-dashboard', [
+ div('first row', [
+ stats(__('Angels needed in the next 3 hrs'), $stats['needed-3-hours']),
+ stats(__('Angels needed for nightshifts'), $stats['needed-night']),
+ stats(__('Angels currently working'), $stats['angels-working'], 'default'),
+ stats(__('Hours to be worked'), $stats['hours-to-work'], 'default'),
+ ''
+ ], 'statistics'),
+ $needed_angels
+ ], 'public-dashboard'),
+ ]),
div('first col-md-12 text-center', [buttons([
button_js(
'
@@ -91,9 +93,14 @@ function public_dashboard_shift_render($shift)
. '';
}
- return div('col-md-3', [
- div('dashboard-panel panel panel-' . $shift['style'], [
- div('panel-body', [
+ $type = 'bg-dark';
+ if (theme_type() == 'light') {
+ $type = 'bg-light';
+ }
+
+ return div('col-md-3 mb-3', [
+ div('dashboard-card card card-' . $shift['style'] . ' ' . $type, [
+ div('card-body', [
'',
$panel_body
])
diff --git a/includes/view/UserDriverLicenses_view.php b/includes/view/UserDriverLicenses_view.php
index 36ad575a..d43b6b03 100644
--- a/includes/view/UserDriverLicenses_view.php
+++ b/includes/view/UserDriverLicenses_view.php
@@ -20,8 +20,7 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver
form([
form_info(__('Privacy'), __('Your driving license information is only visible for supporters and admins.')),
form_checkbox('wants_to_drive', __('I am willing to drive a car for the event'), $wants_to_drive),
- div('panel panel-default', [
- div('panel-body', [
+ div('m-3', [
form_checkbox(
'has_car',
__('I have my own car with me and am willing to use it for the event (You\'ll get reimbursed for fuel)'),
@@ -49,7 +48,6 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver
__('Forklift'),
$user_driver_license['has_license_forklift']
)
- ])
], 'driving_license'),
form_submit('submit', __('Save'))
]),
diff --git a/src/Renderer/Twig/Extensions/Globals.php b/src/Renderer/Twig/Extensions/Globals.php
index 862b892d..b7ad9293 100644
--- a/src/Renderer/Twig/Extensions/Globals.php
+++ b/src/Renderer/Twig/Extensions/Globals.php
@@ -42,8 +42,8 @@ class Globals extends TwigExtension implements GlobalsInterface
}
$query = $this->request->query->get('theme');
- if (!is_null($query) && isset($themes[$query])) {
- $themeId = $query;
+ if (!is_null($query) && isset($themes[(int)$query])) {
+ $themeId = (int)$query;
}
$theme = $themes[$themeId];