added keyboard shortcuts (#3536)

This commit is contained in:
Kevin Papst
2022-09-14 14:30:15 +02:00
committed by GitHub
parent 7eded6e126
commit 496a74f7a3
5 changed files with 21 additions and 18 deletions

View File

@@ -4,21 +4,21 @@
As announced in the [README](README.md) I only support the latest available release and master.
| Version | Supported |
|---------|--------------------|
| master | :white_check_mark: |
| 1.24 | :white_check_mark: |
| < 1.24 | :x: |
| Version | Supported |
|----------------------|--------------------|
| master | :white_check_mark: |
| latest minor release | :white_check_mark: |
| older releases | :x: |
## Reporting a Vulnerability
Please read the [Bughunter](https://www.kimai.org/documentation/bughunter.html) documentation before posting,
and then you can report any security related vulnerability in the [advisories section at GitHub](https://github.com/kevinpapst/kimai2/security/advisories) or via email to kpapst@gmx.net.
Please read the [Bughunter](https://www.kimai.org/documentation/bughunter.html) documentation before posting.
Xou can report any security related vulnerability in the [advisories section at GitHub](https://github.com/kevinpapst/kimai2/security/advisories) or via email to kpapst@gmx.net.
I will work as fast as I can to fix the problem and publish a bugfix release / security update.
Depending on the size of the required fixes, this might take a couple of hours or a couple of days.
You can expect that your message will be answered ASAP.
You will be mentioned in the release notes if your issue is valid and after it was fixed.
You will be mentioned in the release notes if your issue is valid.
I am grateful for any (discrete) disclosure of vulnerabilities!

View File

@@ -138,7 +138,7 @@ class PageActionsEvent extends ThemeEvent
}
}
$this->addAction('search', ['modal' => '#modal_search', 'label' => $label]);
$this->addAction('search', ['modal' => '#modal_search', 'label' => $label, 'accesskey' => 'q']);
}
public function addQuickExport(string $url): void
@@ -148,12 +148,12 @@ class PageActionsEvent extends ThemeEvent
public function addCreate(string $url, bool $modal = true): void
{
$this->addAction('create', ['url' => $url, 'class' => ($modal ? 'modal-ajax-form' : '')]);
$this->addAction('create', ['url' => $url, 'class' => ($modal ? 'modal-ajax-form' : ''), 'accesskey' => 'a']);
}
public function addHelp(string $url): void
{
$this->addAction('help', ['url' => $url, 'target' => '_blank']);
$this->addAction('help', ['url' => $url, 'target' => '_blank', 'accesskey' => 'h']);
}
public function addBack(string $url): void

View File

@@ -133,7 +133,7 @@
{% set entry = active_timesheets[0] %}
<div class="ddt-small ticktac-single ticktac-running">
<div class="ticktac-stop">
<a data-replacer="url" class="api-link" href="{{ path('stop_timesheet', {'id' : entry.id}) }}" data-event="kimai.timesheetStop kimai.timesheetUpdate" data-method="PATCH" data-msg-error="timesheet.stop.error" data-msg-success="timesheet.stop.success">
<a accesskey="s" data-replacer="url" class="api-link" href="{{ path('stop_timesheet', {'id' : entry.id}) }}" data-event="kimai.timesheetStop kimai.timesheetUpdate" data-method="PATCH" data-msg-error="timesheet.stop.error" data-msg-success="timesheet.stop.success">
<i class="{{ 'stop-small'|icon }} fa-2x"></i><span data-replacer="duration" data-title="true" data-since="{{ entry.begin is null ? '' : entry.begin|date_format(constant('DATE_ISO8601')) }}">{{ entry|duration }}</span>
</a>
</div>
@@ -151,7 +151,7 @@
<ul class="menu">
{% for entry in active_timesheets %}
<li data-template="active-record">
<a data-replacer="url" href="{{ path('stop_timesheet', {'id' : entry.id}) }}" class="api-link" data-event="kimai.timesheetStop kimai.timesheetUpdate" data-method="PATCH" data-msg-error="timesheet.stop.error" data-msg-success="timesheet.stop.success">
<a accesskey="s" data-replacer="url" href="{{ path('stop_timesheet', {'id' : entry.id}) }}" class="api-link" data-event="kimai.timesheetStop kimai.timesheetUpdate" data-method="PATCH" data-msg-error="timesheet.stop.error" data-msg-success="timesheet.stop.success">
<div class="pull-left">
<i class="{{ 'stop-small'|icon }} fa-2x"></i>
</div>
@@ -174,13 +174,13 @@
<li class="messages-menu-empty" style="{% if hasActiveRecords %}display:none{% endif %}">
{% if active_limit == 1 %}
<div class="ddt-small ticktac-single ticktac-stopped">
<a href="{{ path('timesheet_create') }}" class="modal-ajax-form ticktac-start">
<a accesskey="n" href="{{ path('timesheet_create') }}" class="modal-ajax-form ticktac-start">
<i class="{{ 'start'|icon }} fa-2x"></i>
<span>{{ 0|duration }}</span>
</a>
</div>
{% else %}
<a href="{{ path('timesheet_create') }}" class="ddt-small ticktac-start modal-ajax-form">
<a accesskey="n" href="{{ path('timesheet_create') }}" class="ddt-small ticktac-start modal-ajax-form">
<i class="{{ 'start'|icon }} fa-2x"></i>
</a>
{% endif %}

View File

@@ -360,6 +360,7 @@
{% set disabled = false %}
{% set attr = {} %}
{% set label = null %}
{% set accesskey = null %}
{% set translation_domain = 'messages' %}
{% if type is same as (false) %}
{% set class = "" %}
@@ -397,6 +398,7 @@
{% set attr = values.attr ?? {} %}
{% set label = values.label ?? null %}
{% set translation_domain = values.translation_domain ?? translation_domain %}
{% set accesskey = values.accesskey ?? null %}
{% endif %}
{% if disabled is same as (true) %}
@@ -410,6 +412,7 @@
{%- if modal is not empty %} data-toggle="modal" data-target="{{ modal }}"{% endif %}
{%- if onclick is not empty %} onclick="{{ onclick }}"{% endif %}
{%- if target is not empty %} target="{{ target }}"{% endif %}
{%- if accesskey is not empty %} accesskey="{{ accesskey }}"{% endif %}
{%- if attr is not empty %}
{% for name, value in attr %}
{{ ' ' ~ name }}={% if '"' in value %}'{{ value|raw }}'{% else %}"{{ value|raw }}"{% endif %}

View File

@@ -95,12 +95,12 @@ class PageActionsEventTest extends TestCase
$this->assertEquals(8, $sut->countActions());
$expected = [
'search' => ['modal' => '#modal_search', 'label' => null],
'search' => ['modal' => '#modal_search', 'label' => null, 'accesskey' => 'q'],
'divider0' => null,
'back' => ['url' => 'foo1', 'translation_domain' => 'actions'],
'visibility' => ['modal' => '#foo2'],
'help' => ['url' => 'foo4', 'target' => '_blank'],
'create' => ['url' => 'foo5', 'class' => 'modal-ajax-form'],
'help' => ['url' => 'foo4', 'target' => '_blank', 'accesskey' => 'h'],
'create' => ['url' => 'foo5', 'class' => 'modal-ajax-form', 'accesskey' => 'a'],
'download' => ['url' => 'foo7', 'class' => 'toolbar-action'],
'trash' => ['url' => 'foo3', 'class' => 'modal-ajax-form text-red'],
];