diff --git a/config/routes.php b/config/routes.php index 7cc2823d..c46b1b95 100644 --- a/config/routes.php +++ b/config/routes.php @@ -39,6 +39,10 @@ $route->get('/design', 'DesignController@index'); $route->addGroup( '/admin', function (RouteCollector $route) { + // Log + $route->get('/logs', 'Admin\\LogsController@index'); + $route->post('/logs', 'Admin\\LogsController@index'); + // Schedule $route->addGroup( '/schedule', @@ -48,6 +52,8 @@ $route->addGroup( $route->post('/import', 'Admin\\Schedule\\ImportSchedule@importSchedule'); } ); + + // News $route->addGroup( '/news', function (RouteCollector $route) { diff --git a/includes/includes.php b/includes/includes.php index 017e5c3e..ffbc84cc 100644 --- a/includes/includes.php +++ b/includes/includes.php @@ -68,7 +68,6 @@ $includeFiles = [ __DIR__ . '/../includes/pages/admin_arrive.php', __DIR__ . '/../includes/pages/admin_free.php', __DIR__ . '/../includes/pages/admin_groups.php', - __DIR__ . '/../includes/pages/admin_log.php', __DIR__ . '/../includes/pages/admin_questions.php', __DIR__ . '/../includes/pages/admin_rooms.php', __DIR__ . '/../includes/pages/admin_shifts.php', diff --git a/includes/pages/admin_free.php b/includes/pages/admin_free.php index 709954a0..4aac524b 100644 --- a/includes/pages/admin_free.php +++ b/includes/pages/admin_free.php @@ -102,9 +102,11 @@ function admin_free() form([ div('row', [ div('col-md-12 form-inline', [ - form_text('search', __('Search'), $search), - form_select('angeltype', __('Angeltype'), $angel_types, $angelType), - form_submit('submit', __('Search')) + div('inline-form-spacing', [ + form_text('search', __('Search'), $search), + form_select('angeltype', __('Angeltype'), $angel_types, $angelType), + form_submit('submit', __('Search')) + ]), ]), ]), ]), diff --git a/includes/pages/admin_log.php b/includes/pages/admin_log.php deleted file mode 100644 index 24903f6d..00000000 --- a/includes/pages/admin_log.php +++ /dev/null @@ -1,45 +0,0 @@ -has('keyword')) { - $filter = strip_request_item('keyword'); - } - - $log_entries = LogEntry::filter($filter); - - $entries = []; - foreach ($log_entries as $entry) { - $data = $entry->toArray(); - $data['message'] = nl2br(htmlspecialchars($data['message'])); - $data['created_at'] = date_format($entry->created_at, 'd.m.Y H:i'); - $entries[] = $data; - } - - return page_with_title(admin_log_title(), [ - msg(), - form([ - form_text('keyword', __('Search'), $filter), - form_submit(__('Search'), 'Go') - ]), - table([ - 'created_at' => 'Time', - 'level' => 'Type', - 'message' => 'Log Entry' - ], $entries) - ]); -} diff --git a/includes/sys_menu.php b/includes/sys_menu.php index 75b8df4b..03406c4e 100644 --- a/includes/sys_menu.php +++ b/includes/sys_menu.php @@ -108,6 +108,8 @@ function make_navigation() $admin_menu = []; $admin_pages = [ + // path => name + // path => [name, permission] 'admin_arrive' => 'Arrived angels', 'admin_active' => 'Active angels', 'admin_user' => 'All Angels', @@ -118,7 +120,7 @@ function make_navigation() 'admin_rooms' => 'Rooms', 'admin_groups' => 'Grouprights', 'admin/schedule' => ['schedule.import', 'schedule.import'], - 'admin_log' => 'Log', + 'admin/logs' => ['log.log', 'admin_log'], 'admin_event_config' => 'Event config', ]; diff --git a/resources/assets/themes/base.less b/resources/assets/themes/base.less index d0751180..aac32b8f 100644 --- a/resources/assets/themes/base.less +++ b/resources/assets/themes/base.less @@ -248,6 +248,10 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { overflow-x: inherit; } +.inline-form-spacing { + margin-bottom: @form-group-margin-bottom; +} + @keyframes pulse { 0% { transform: rotate(0deg); diff --git a/resources/lang/de_DE/default.po b/resources/lang/de_DE/default.po index 75dc4a80..d8fbe6b2 100644 --- a/resources/lang/de_DE/default.po +++ b/resources/lang/de_DE/default.po @@ -986,8 +986,6 @@ msgstr "Alle Schichten anzeigen" #: includes/pages/admin_active.php:307 includes/pages/admin_arrive.php:178 #: includes/pages/admin_arrive.php:179 includes/pages/admin_free.php:105 -#: includes/pages/admin_free.php:107 includes/pages/admin_log.php:36 -#: includes/pages/admin_log.php:37 msgid "Search" msgstr "Suche" @@ -1294,10 +1292,6 @@ msgstr "Zu löschende Schichten" msgid "It's done!" msgstr "Erledigt!" -#: includes/pages/admin_log.php:10 includes/sys_menu.php:121 -msgid "Log" -msgstr "Log" - #: includes/pages/user_messages.php:121 msgid "Message" msgstr "Nachricht" @@ -2866,3 +2860,18 @@ msgstr "Treffen" msgid "news.edit.message" msgstr "Nachricht" + +msgid "form.search" +msgstr "Suchen" + +msgid "log.log" +msgstr "Logs" + +msgid "log.time" +msgstr "Zeit" + +msgid "log.level" +msgstr "Level" + +msgid "log.message" +msgstr "Nachricht" diff --git a/resources/lang/en_US/default.po b/resources/lang/en_US/default.po index bafb2621..af7a3d0b 100644 --- a/resources/lang/en_US/default.po +++ b/resources/lang/en_US/default.po @@ -144,3 +144,18 @@ msgstr "Meeting" msgid "news.edit.message" msgstr "Message" + +msgid "form.search" +msgstr "Search" + +msgid "log.log" +msgstr "Logs" + +msgid "log.time" +msgstr "Time" + +msgid "log.level" +msgstr "Level" + +msgid "log.message" +msgstr "Message" diff --git a/resources/views/admin/log.twig b/resources/views/admin/log.twig new file mode 100644 index 00000000..f5b10754 --- /dev/null +++ b/resources/views/admin/log.twig @@ -0,0 +1,58 @@ +{% extends 'layouts/app.twig' %} +{% import 'macros/base.twig' as m %} +{% import 'macros/form.twig' as f %} + +{% set title %}{% block title %}{{ __('log.log') }}{% endblock %}{% endset %} + +{% block content %} +
{{ __('log.time') }} | +{{ __('log.level') }} | +{{ __('log.message') }} | +
---|---|---|
{{ entry.created_at.format(__('Y-m-d H:i')) }} | ++ {{ entry.level|capitalize }} + | +{{ entry.message|nl2br }} | +