diff --git a/src/main/resources/languages/base_de.properties b/src/main/resources/languages/base_de.properties index 3f2651f2f166b5cb4ef0e64fb3da97c112293c10..38295f0c5c414a9680c3a944783f9f9adc89a5c7 100644 --- a/src/main/resources/languages/base_de.properties +++ b/src/main/resources/languages/base_de.properties @@ -414,6 +414,7 @@ home.first.use.step.5.sub.4=und vieles mehr... home.first.use.home=Los geht's! # hotkeys +hotkeys.general=Allgemein hotkeys.transactions.new.normal=Neue Buchung anlegen hotkeys.transactions.new.normal.key=n hotkeys.transactions.new.repeating=Neue wiederholende Buchung anlegen @@ -429,6 +430,13 @@ hotkeys.transactions.filter=Filtern hotkeys.transactions.filter.key=f hotkeys.search=Suchen hotkeys.search.key=s +hotkeys.global.datepicker=Monatsauswahl +hotkeys.global.datepicker.previous.month.key=Pfeiltaste links +hotkeys.global.datepicker.previous.month=Vorheriger Monat +hotkeys.global.datepicker.next.month.key=Pfeiltaste rechts +hotkeys.global.datepicker.next.month=Nächster Monat +hotkeys.global.datepicker.today.key=0 +hotkeys.global.datepicker.today=Aktueller Monat # charts diff --git a/src/main/resources/languages/base_en.properties b/src/main/resources/languages/base_en.properties index d5e7145c0dd7d077dfbdc624bca9711c7fb59e4f..96de84523342236dc34feb4c700979aac69544ba 100644 --- a/src/main/resources/languages/base_en.properties +++ b/src/main/resources/languages/base_en.properties @@ -414,6 +414,7 @@ home.first.use.step.5.sub.4=and much more... home.first.use.home=Let''s go! # hotkeys +hotkeys.general=General hotkeys.transactions.new.normal=Create a transaction hotkeys.transactions.new.normal.key=n hotkeys.transactions.new.repeating=Create a recuring transaction @@ -429,6 +430,13 @@ hotkeys.transactions.filter=Filter hotkeys.transactions.filter.key=f hotkeys.search=Search hotkeys.search.key=s +hotkeys.global.datepicker=Month selection +hotkeys.global.datepicker.previous.month.key=Left arrow key +hotkeys.global.datepicker.previous.month=Previous month +hotkeys.global.datepicker.next.month.key=Right arrow key +hotkeys.global.datepicker.next.month=Next month +hotkeys.global.datepicker.today.key=0 +hotkeys.global.datepicker.today=Current month # charts charts.default.accountSumPerDay=Account sum per day diff --git a/src/main/resources/static/js/globalDatePicker.js b/src/main/resources/static/js/globalDatePicker.js index facf79b1a4c0d1115251ad92345a39fe34401faa..a7ec249b199b882bc86198c60f69660dc1d930c6 100644 --- a/src/main/resources/static/js/globalDatePicker.js +++ b/src/main/resources/static/js/globalDatePicker.js @@ -26,6 +26,8 @@ $(document).ready(function() { selectMonth($("#global-datepicker-select-month .global-datepicker-item").index(this) + 1); }); + + enableGlobalDatePickerHotKeys(); }); let year; @@ -52,7 +54,8 @@ function updateYearGrid(modifier, currentYear) if(items[i].innerText === currentYear) { items[i].classList.add("global-datepicker-selected"); - } else + } + else { items[i].classList.remove("global-datepicker-selected"); } @@ -76,4 +79,22 @@ function selectMonth(selectedMonth) let dateString = "01." + selectedMonth + "." + year; document.cookie = "currentDate=" + dateString; document.getElementById('buttonChooseDate').click(); -} \ No newline at end of file +} + +function enableGlobalDatePickerHotKeys() +{ + Mousetrap.bind('left', function() + { + document.getElementById('global-datepicker-previous-month').click(); + }); + + Mousetrap.bind('right', function() + { + document.getElementById('global-datepicker-next-month').click(); + }); + + Mousetrap.bind('0', function() + { + document.getElementById('global-datepicker-today').click(); + }); +} diff --git a/src/main/resources/templates/helpers/globalDatePicker.ftl b/src/main/resources/templates/helpers/globalDatePicker.ftl index ad2cf86c7994803d4e4e205f7c33c0a3b4926b20..618f90a3661dfecf51454892da44bfe024e900dd 100644 --- a/src/main/resources/templates/helpers/globalDatePicker.ftl +++ b/src/main/resources/templates/helpers/globalDatePicker.ftl @@ -2,10 +2,10 @@ <#import "/spring.ftl" as s> <div class="container"> <div class="section center-align"> - <a href="<@s.url '/previousMonth?target=${target}'/>" class="waves-effect text-color"><i class="material-icons icon-chevron">chevron_left</i></a> + <a href="<@s.url '/previousMonth?target=${target}'/>" id="global-datepicker-previous-month" class="waves-effect text-color"><i class="material-icons icon-chevron">chevron_left</i></a> <a href="#modalDate" class="waves-effect headline-date modal-trigger text-color datePicker-fixed-width">${dateService.getDateStringWithMonthAndYear(fullDate)}</a> - <a href="<@s.url '/nextMonth?target=${target}'/>" class="waves-effect text-color"><i class="material-icons icon-chevron">chevron_right</i></a> - <a href="<@s.url '/today?target=${target}'/>" class="waves-effect text-color"><i class="material-icons icon-today">event</i></a> + <a href="<@s.url '/nextMonth?target=${target}'/>" id="global-datepicker-next-month" class="waves-effect text-color"><i class="material-icons icon-chevron">chevron_right</i></a> + <a href="<@s.url '/today?target=${target}'/>" id="global-datepicker-today" class="waves-effect text-color"><i class="material-icons icon-today">event</i></a> </div> </div> <!-- modal to select specific month and year --> diff --git a/src/main/resources/templates/hotkeys.ftl b/src/main/resources/templates/hotkeys.ftl index 6a32394a0af6434b4958ac60bd237f2e50ebe827..badb03bcc6ca2267b6de003af88af13c860088f0 100644 --- a/src/main/resources/templates/hotkeys.ftl +++ b/src/main/resources/templates/hotkeys.ftl @@ -19,6 +19,10 @@ <br> + <div class="row"> + <div class="col s12 headline center-align">${locale.getString("hotkeys.general")}</div> + </div> + <div class="row"> <@cellKey locale.getString("hotkeys.transactions.new.normal.key")/> <div class="col s8 m5 l5">${locale.getString("hotkeys.transactions.new.normal")}</div> @@ -47,6 +51,22 @@ <@cellKey locale.getString("hotkeys.search.key")/> <div class="col s8 m5 l5">${locale.getString("hotkeys.search")}</div> </div> + + <div class="row"> + <div class="col s12 headline center-align">${locale.getString("hotkeys.global.datepicker")}</div> + </div> + <div class="row"> + <@cellKey locale.getString("hotkeys.global.datepicker.previous.month.key")/> + <div class="col s8 m5 l5">${locale.getString("hotkeys.global.datepicker.previous.month")}</div> + </div> + <div class="row"> + <@cellKey locale.getString("hotkeys.global.datepicker.next.month.key")/> + <div class="col s8 m5 l5">${locale.getString("hotkeys.global.datepicker.next.month")}</div> + </div> + <div class="row"> + <@cellKey locale.getString("hotkeys.global.datepicker.today.key")/> + <div class="col s8 m5 l5">${locale.getString("hotkeys.global.datepicker.today")}</div> + </div> </div> </main>