Skip to content
Snippets Groups Projects
Commit a25b95f4 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

#533 - confirm selection and redirect to new transaction form template page

parent d27fcca6
No related branches found
No related tags found
No related merge requests found
Pipeline #4067 failed
...@@ -120,6 +120,11 @@ function enableHotKeys() ...@@ -120,6 +120,11 @@ function enableHotKeys()
{ {
handleKeyUpOrDown(false); handleKeyUpOrDown(false);
}); });
Mousetrap.bind('enter', function()
{
confirmTemplateSelection(false);
});
} }
function handleKeyUpOrDown(isUp) function handleKeyUpOrDown(isUp)
...@@ -215,3 +220,24 @@ function selectNextItemOnUp(templateItems, previousIndex) ...@@ -215,3 +220,24 @@ function selectNextItemOnUp(templateItems, previousIndex)
selectItem(templateItems, previousIndex - 1); selectItem(templateItems, previousIndex - 1);
} }
} }
function confirmTemplateSelection()
{
let templateItems = document.querySelectorAll('.template-item:not(.hidden)');
if(templateItems.length === 0)
{
selectedTemplateName = null;
return;
}
let index = getIndexOfTemplateName(templateItems, selectedTemplateName);
let indexItemNoLongerInList = index === null;
let noItemSelected = selectedTemplateName === null;
if(noItemSelected || indexItemNoLongerInList)
{
return;
}
templateItems[index].getElementsByClassName('button-select-template')[0].click();
}
\ No newline at end of file
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<div class="collapsible-header-button"> <div class="collapsible-header-button">
<a href="<@s.url '/templates/${template.ID?c}/edit'/>" class="btn-flat no-padding text-color"><i class="material-icons left no-margin">edit</i></a> <a href="<@s.url '/templates/${template.ID?c}/edit'/>" class="btn-flat no-padding text-color"><i class="material-icons left no-margin">edit</i></a>
<a href="<@s.url '/templates/${template.ID?c}/requestDelete'/>" class="btn-flat no-padding text-color"><i class="material-icons left no-margin">delete</i></a> <a href="<@s.url '/templates/${template.ID?c}/requestDelete'/>" class="btn-flat no-padding text-color"><i class="material-icons left no-margin">delete</i></a>
<a href="<@s.url '/templates/${template.ID?c}/select'/>" class="waves-effect waves-light btn budgetmaster-blue"><i class="material-icons left no-margin">note_add</i></a> <a href="<@s.url '/templates/${template.ID?c}/select'/>" class="waves-effect waves-light btn budgetmaster-blue button-select-template"><i class="material-icons left no-margin">note_add</i></a>
</div> </div>
</div> </div>
<div class="collapsible-body"> <div class="collapsible-body">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment