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
Branches
Tags
No related merge requests found
Pipeline #4067 failed
......@@ -120,6 +120,11 @@ function enableHotKeys()
{
handleKeyUpOrDown(false);
});
Mousetrap.bind('enter', function()
{
confirmTemplateSelection(false);
});
}
function handleKeyUpOrDown(isUp)
......@@ -215,3 +220,24 @@ function selectNextItemOnUp(templateItems, previousIndex)
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 @@
<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}/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 class="collapsible-body">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment