From 299fcb091a87452e5b88cdbd29e91eeba16f9509 Mon Sep 17 00:00:00 2001 From: Kevin Papst Date: Mon, 19 Aug 2019 12:53:36 +0200 Subject: [PATCH] added documentation links to all screens (#1044) --- templates/export/index.html.twig | 10 +---- templates/macros/actions.html.twig | 37 +++++++++++++++++++ .../system-configuration/index.html.twig | 2 + tests/Controller/PluginControllerTest.php | 2 +- tests/Controller/TeamControllerTest.php | 2 +- tests/Controller/TimesheetControllerTest.php | 2 +- .../TimesheetTeamControllerTest.php | 2 +- 7 files changed, 45 insertions(+), 12 deletions(-) diff --git a/templates/export/index.html.twig b/templates/export/index.html.twig index d1ad3abc..2f4e7f73 100644 --- a/templates/export/index.html.twig +++ b/templates/export/index.html.twig @@ -2,6 +2,7 @@ {% import "macros/widgets.html.twig" as widgets %} {% import "macros/toolbar.html.twig" as toolbar %} {% import "macros/datatables.html.twig" as tables %} +{% import "macros/actions.html.twig" as actions %} {% set columns = { 'date': 'alwaysVisible', @@ -20,14 +21,7 @@ {% block page_title %}{{ 'export.title'|trans }}{% endblock %} {% block page_subtitle %}{{ 'export.subtitle'|trans }}{% endblock %} -{% block page_actions %} - {% set actions = { - 'filter': '#collapseExport', - 'visibility': '#modal_export', - 'off': {'id':'export-toggle-button'} - } %} - {{ widgets.page_actions(actions) }} -{% endblock %} +{% block page_actions %}{{ actions.export('index') }}{% endblock %} {% block main_before %} {{ toolbar.toolbar(form, 'collapseExport', true) }} diff --git a/templates/macros/actions.html.twig b/templates/macros/actions.html.twig index 033fbf70..688b8c15 100644 --- a/templates/macros/actions.html.twig +++ b/templates/macros/actions.html.twig @@ -7,6 +7,8 @@ {% set actions = actions|merge({'create': path('admin_activity_create')}) %} {% endif %} + {% set actions = actions|merge({'help': {'url': 'activity.html'|docu_link, 'target': '_blank'}}) %} + {% set event = trigger('actions.activities', {'actions': actions, 'view': view}) %} {{ widgets.page_actions(event.payload.actions) }} {% endmacro %} @@ -73,6 +75,8 @@ {% set actions = actions|merge({'help': {'url': 'permissions.html'|docu_link, 'target': '_blank'}}) %} {% endif %} + {% set actions = actions|merge({'help': {'url': 'users.html'|docu_link, 'target': '_blank'}}) %} + {% set event = trigger('actions.users', {'actions': actions, 'view': view}) %} {{ widgets.page_actions(event.payload.actions) }} {% endmacro %} @@ -126,6 +130,8 @@ {% set actions = actions|merge({'create': path('admin_project_create')}) %} {% endif %} + {% set actions = actions|merge({'help': {'url': 'project.html'|docu_link, 'target': '_blank'}}) %} + {% set event = trigger('actions.projects', {'actions': actions, 'view': view}) %} {{ widgets.page_actions(event.payload.actions) }} {% endmacro %} @@ -182,6 +188,8 @@ {% set actions = actions|merge({'create': path('admin_customer_create')}) %} {% endif %} + {% set actions = actions|merge({'help': {'url': 'customer.html'|docu_link, 'target': '_blank'}}) %} + {% set event = trigger('actions.customers', {'actions': actions, 'view': view}) %} {{ widgets.page_actions(event.payload.actions) }} {% endmacro %} @@ -257,6 +265,8 @@ {% set actions = actions|merge({'create': {'url': path('timesheet_create'), 'class': 'modal-ajax-form'}}) %} {% endif %} + {% set actions = actions|merge({'help': {'url': 'timesheet.html'|docu_link, 'target': '_blank'}}) %} + {% set event = trigger('actions.timesheets', {'actions': actions, 'view': view}) %} {{ widgets.page_actions(event.payload.actions) }} {% endmacro %} @@ -313,6 +323,8 @@ {% set actions = actions|merge({'create': {'url': path('admin_timesheet_create'), 'class': 'modal-ajax-form'}}) %} {% endif %} + {% set actions = actions|merge({'help': {'url': 'timesheet.html'|docu_link, 'target': '_blank'}}) %} + {% set event = trigger('actions.timesheets_team', {'actions': actions, 'view': view}) %} {{ widgets.page_actions(event.payload.actions) }} {% endmacro %} @@ -359,6 +371,7 @@ {% import "macros/widgets.html.twig" as widgets %} {% set actions = {'shop': {'url': constant('App\\Constants::HOMEPAGE') ~ '/store/', 'target': '_blank'}} %} + {% set actions = actions|merge({'help': {'url': 'plugins.html'|docu_link, 'target': '_blank'}}) %} {% set event = trigger('actions.plugins', {'actions': actions, 'view': view}) %} {{ widgets.page_actions(event.payload.actions) }} @@ -393,6 +406,8 @@ {% import "macros/widgets.html.twig" as widgets %} {% set actions = {'filter': '#collapseTags'} %} + {% set actions = actions|merge({'help': {'url': 'tags.html'|docu_link, 'target': '_blank'}}) %} + {% set event = trigger('actions.tags', {'actions': actions, 'view': view}) %} {{ widgets.page_actions(event.payload.actions) }} {% endmacro %} @@ -414,6 +429,26 @@ {{ widgets.table_actions(event.payload.actions) }} {% endmacro %} +{% macro system_configuration(view) %} + {% import "macros/widgets.html.twig" as widgets %} + + {% set actions = {} %} + {% set actions = actions|merge({'help': {'url': 'configurations.html'|docu_link, 'target': '_blank'}}) %} + + {% set event = trigger('actions.system_configuration', {'actions': actions, 'view': view}) %} + {{ widgets.page_actions(event.payload.actions) }} +{% endmacro %} + +{% macro export(view) %} + {% import "macros/widgets.html.twig" as widgets %} + + {% set actions = {'filter': '#collapseExport', 'visibility': '#modal_export', 'off': {'id':'export-toggle-button'}} %} + {% set actions = actions|merge({'help': {'url': 'export.html'|docu_link, 'target': '_blank'}}) %} + + {% set event = trigger('actions.export', {'actions': actions, 'view': view}) %} + {{ widgets.page_actions(event.payload.actions) }} +{% endmacro %} + {% macro invoices(view) %} {% import "macros/widgets.html.twig" as widgets %} @@ -457,6 +492,8 @@ {% set actions = actions|merge({'create': {'url': path('admin_team_create')}}) %} {% endif %} + {% set actions = actions|merge({'help': {'url': 'teams.html'|docu_link, 'target': '_blank'}}) %} + {% set event = trigger('actions.teams', {'actions': actions, 'view': view}) %} {{ widgets.page_actions(event.payload.actions) }} {% endmacro %} diff --git a/templates/system-configuration/index.html.twig b/templates/system-configuration/index.html.twig index 782157d5..30f07033 100644 --- a/templates/system-configuration/index.html.twig +++ b/templates/system-configuration/index.html.twig @@ -1,7 +1,9 @@ {% extends 'base.html.twig' %} +{% import "macros/actions.html.twig" as actions %} {% block page_title %}{{ 'title'|trans({}, 'system-configuration') }}{% endblock %} {% block page_subtitle %}{{ 'subtitle'|trans({}, 'system-configuration') }}{% endblock %} +{% block page_actions %}{{ actions.system_configuration('index') }}{% endblock %} {% block main %} diff --git a/tests/Controller/PluginControllerTest.php b/tests/Controller/PluginControllerTest.php index 12ef1168..a505313d 100644 --- a/tests/Controller/PluginControllerTest.php +++ b/tests/Controller/PluginControllerTest.php @@ -29,7 +29,7 @@ class PluginControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $this->assertAccessIsGranted($client, '/admin/plugins/'); $this->assertCalloutWidgetWithMessage($client, 'You have no plugins installed yet'); - $this->assertPageActions($client, ['shop' => 'https://www.kimai.org/store/']); + $this->assertPageActions($client, ['shop' => 'https://www.kimai.org/store/', 'help' => 'https://www.kimai.org/documentation/plugins.html']); } public function testIndexActionWithInstalledPlugins() diff --git a/tests/Controller/TeamControllerTest.php b/tests/Controller/TeamControllerTest.php index e17045ce..47806084 100644 --- a/tests/Controller/TeamControllerTest.php +++ b/tests/Controller/TeamControllerTest.php @@ -37,7 +37,7 @@ class TeamControllerTest extends ControllerBaseTest $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $this->assertAccessIsGranted($client, '/admin/teams/'); - $this->assertPageActions($client, ['create' => $this->createUrl('/admin/teams/create')]); + $this->assertPageActions($client, ['create' => $this->createUrl('/admin/teams/create'), 'help' => 'https://www.kimai.org/documentation/teams.html']); $this->assertHasDataTable($client); $this->assertDataTableRowCount($client, 'datatable_admin_teams', 5); } diff --git a/tests/Controller/TimesheetControllerTest.php b/tests/Controller/TimesheetControllerTest.php index 80ec1bd7..faee61ca 100644 --- a/tests/Controller/TimesheetControllerTest.php +++ b/tests/Controller/TimesheetControllerTest.php @@ -35,7 +35,7 @@ class TimesheetControllerTest extends ControllerBaseTest $this->assertHasNoEntriesWithFilter($client); $result = $client->getCrawler()->filter('div.breadcrumb div.box-tools div.btn-group a.btn'); - $this->assertEquals(4, count($result)); + $this->assertEquals(5, count($result)); foreach ($result as $item) { $this->assertContains('btn btn-default', $item->getAttribute('class')); diff --git a/tests/Controller/TimesheetTeamControllerTest.php b/tests/Controller/TimesheetTeamControllerTest.php index 64bff538..0e25206b 100644 --- a/tests/Controller/TimesheetTeamControllerTest.php +++ b/tests/Controller/TimesheetTeamControllerTest.php @@ -35,7 +35,7 @@ class TimesheetTeamControllerTest extends ControllerBaseTest $this->assertHasNoEntriesWithFilter($client); $result = $client->getCrawler()->filter('div.breadcrumb div.box-tools div.btn-group a.btn'); - $this->assertEquals(4, count($result)); + $this->assertEquals(5, count($result)); foreach ($result as $item) { $this->assertContains('btn btn-default', $item->getAttribute('class'));