diff --git a/src/main/resources/templates/accounts/accounts.ftl b/src/main/resources/templates/accounts/accounts.ftl index 0e6d3e35105fef9188eb752ac1bde7eefcf9a5ed..abfa22914d5c69b7bde5a7222b4eeb44a99503fd 100644 --- a/src/main/resources/templates/accounts/accounts.ftl +++ b/src/main/resources/templates/accounts/accounts.ftl @@ -56,17 +56,9 @@ </main> <#if currentAccount??> - <!-- confirm delete modal --> - <div id="modalConfirmDelete" class="modal background-color"> - <div class="modal-content"> - <h4>${locale.getString("info.title.account.delete")}</h4> - <p>${locale.getString("info.text.account.delete", currentAccount.getName(), currentAccount.getReferringTransactions()?size)}</p> - </div> - <div class="modal-footer background-color"> - <a href="<@s.url '/accounts'/>" class="modal-action modal-close waves-effect waves-light red btn-flat white-text">${locale.getString("cancel")}</a> - <a href="<@s.url '/accounts/${currentAccount.getID()?c}/delete'/>" class="modal-action modal-close waves-effect waves-light green btn-flat white-text">${locale.getString("info.button.account.delete")}</a> - </div> - </div> + <@header.modalConfirmDelete title=locale.getString("info.title.account.delete") confirmUrl='/accounts' cancelUrlBase="/accounts" itemId=currentAccount.getID() confirmButtonText=locale.getString("info.button.account.delete")> + <p>${locale.getString("info.text.account.delete", currentAccount.getName(), currentAccount.getReferringTransactions()?size)}</p> + </@header.modalConfirmDelete> </#if> <#if accountNotDeletable??> @@ -87,4 +79,4 @@ <@scripts.scripts/> <script src="<@s.url '/js/accounts.js'/>"></script> </body> -</html> \ No newline at end of file +</html> diff --git a/src/main/resources/templates/charts/manage.ftl b/src/main/resources/templates/charts/manage.ftl index a6add3c532aa18e9e75973c08090221b0bd00fe5..f6c107af19fc1c911beff039e01d2cf745400538 100644 --- a/src/main/resources/templates/charts/manage.ftl +++ b/src/main/resources/templates/charts/manage.ftl @@ -57,17 +57,9 @@ </div> <#if currentChart??> - <!-- confirm delete modal --> - <div id="modalConfirmDelete" class="modal background-color"> - <div class="modal-content"> - <h4>${locale.getString("info.title.chart.delete")}</h4> - <p>${locale.getString("info.text.chart.delete", currentChart.getName())}</p> - </div> - <div class="modal-footer background-color"> - <a href="<@s.url '/charts/manage'/>" class="modal-action modal-close waves-effect waves-light red btn-flat white-text">${locale.getString("cancel")}</a> - <a href="<@s.url '/charts/${currentChart.getID()?c}/delete'/>" class="modal-action modal-close waves-effect waves-light green btn-flat white-text">${locale.getString("info.title.chart.delete")}</a> - </div> - </div> + <@header.modalConfirmDelete title=locale.getString("info.title.chart.delete") confirmUrl='/charts/manage' cancelUrlBase='/charts' itemId=currentChart.getID() confirmButtonText=locale.getString("info.title.chart.delete")> + <p>${locale.getString("info.text.chart.delete", currentChart.getName())}</p> + </@header.modalConfirmDelete> </#if> </main> diff --git a/src/main/resources/templates/helpers/header.ftl b/src/main/resources/templates/helpers/header.ftl index 287f7e0196edb1b191c931898a7b174f8332db8b..4a205ba9b15e1c02ed8362eac5d1699198826dfd 100644 --- a/src/main/resources/templates/helpers/header.ftl +++ b/src/main/resources/templates/helpers/header.ftl @@ -38,4 +38,18 @@ <#else> <img class="${classes}" id="${id}" src="<@s.url '/images/Logo_with_text_medium_res.png'/>"> </#if> +</#macro> + +<#macro modalConfirmDelete title confirmUrl cancelUrlBase itemId confirmButtonText id="modalConfirmDelete" classes=""> + <div id="${id}" class="modal background-color ${classes}"> + <div class="modal-content"> + <h4>${title}</h4> + + <#nested> + </div> + <div class="modal-footer background-color"> + <a href="<@s.url confirmUrl/>" class="modal-action modal-close waves-effect waves-light red btn-flat white-text">${locale.getString("cancel")}</a> + <a href="<@s.url cancelUrlBase + "/" + itemId?c + "/delete" />" class="modal-action modal-close waves-effect waves-light green btn-flat white-text">${confirmButtonText}</a> + </div> + </div> </#macro> \ No newline at end of file diff --git a/src/main/resources/templates/helpers/scripts.ftl b/src/main/resources/templates/helpers/scripts.ftl index eb063fabd35ea8a0dba7f9ea4b09a9b907616bf1..50cff78a5e150f5fe5f093151f7dcc76c707e74c 100644 --- a/src/main/resources/templates/helpers/scripts.ftl +++ b/src/main/resources/templates/helpers/scripts.ftl @@ -1,14 +1,14 @@ <#macro scripts> -<#import "/spring.ftl" as s> -<script src="<@s.url '/webjars/jquery/3.5.1/jquery.min.js'/>"></script> -<script src="<@s.url '/webjars/materializecss/1.0.0/js/materialize.min.js'/>"></script> -<script src="<@s.url '/webjars/mousetrap/1.6.5/mousetrap.js'/>"></script> -<script> - rootURL = "<@s.url ''/>" -</script> -<script src="<@s.url '/js/hotkeys.js'/>"></script> -<script src="<@s.url '/js/main.js'/>"></script> -<script> - accountPlaceholderName = "${locale.getString("account.all")}"; -</script> + <#import "/spring.ftl" as s> + <script src="<@s.url '/webjars/jquery/3.5.1/jquery.min.js'/>"></script> + <script src="<@s.url '/webjars/materializecss/1.0.0/js/materialize.min.js'/>"></script> + <script src="<@s.url '/webjars/mousetrap/1.6.5/mousetrap.js'/>"></script> + <script> + rootURL = "<@s.url ''/>" + </script> + <script src="<@s.url '/js/hotkeys.js'/>"></script> + <script src="<@s.url '/js/main.js'/>"></script> + <script> + accountPlaceholderName = "${locale.getString("account.all")}"; + </script> </#macro> \ No newline at end of file diff --git a/src/main/resources/templates/templates/templates.ftl b/src/main/resources/templates/templates/templates.ftl index 7e26c9a111d5cf9e92ae0a26dd13a4ecab559c01..1e07873aff3dfff0dd13faf3d209196ccbf32e2e 100644 --- a/src/main/resources/templates/templates/templates.ftl +++ b/src/main/resources/templates/templates/templates.ftl @@ -41,17 +41,9 @@ </div> <#if currentTemplate??> - <!-- confirm delete modal --> - <div id="modalConfirmDelete" class="modal background-color"> - <div class="modal-content"> - <h4>${locale.getString("info.title.template.delete")}</h4> - <p>${locale.getString("info.text.template.delete", currentTemplate.getTemplateName())}</p> - </div> - <div class="modal-footer background-color"> - <a href="<@s.url '/templates'/>" class="modal-action modal-close waves-effect waves-light red btn-flat white-text">${locale.getString("cancel")}</a> - <a href="<@s.url '/templates/${currentTemplate.getID()?c}/delete'/>" class="modal-action modal-close waves-effect waves-light green btn-flat white-text">${locale.getString("info.title.template.delete")}</a> - </div> - </div> + <@header.modalConfirmDelete title=locale.getString("info.title.template.delete") confirmUrl='/templates' cancelUrlBase='/templates' itemId=currentTemplate.getID() confirmButtonText=locale.getString("info.title.template.delete")> + <p>${locale.getString("info.text.template.delete", currentTemplate.getTemplateName())}</p> + </@header.modalConfirmDelete> </#if> </main> diff --git a/src/main/resources/templates/transactions/transactions.ftl b/src/main/resources/templates/transactions/transactions.ftl index 18c9a7cffaa99ba7b33671624446d49aad7d7384..92ddb4087c31fc5816b4a96fb850b292f037d50e 100644 --- a/src/main/resources/templates/transactions/transactions.ftl +++ b/src/main/resources/templates/transactions/transactions.ftl @@ -88,7 +88,13 @@ </div> <#if currentTransaction??> - <@transactionsMacros.deleteModal currentTransaction/> + <@header.modalConfirmDelete title=locale.getString("info.title.transaction.delete") confirmUrl='/transactions' cancelUrlBase='/transactions' itemId=currentTransaction.getID() confirmButtonText=locale.getString("delete")> + <#if currentTransaction.isRepeating()> + <p>${locale.getString("info.text.transaction.repeating.delete", currentTransaction.name)}</p> + <#else> + <p>${locale.getString("info.text.transaction.delete", currentTransaction.name)}</p> + </#if> + </@header.modalConfirmDelete> </#if> <@filterMacros.filterModal filterConfiguration/> diff --git a/src/main/resources/templates/transactions/transactionsMacros.ftl b/src/main/resources/templates/transactions/transactionsMacros.ftl index 7b0beadbad5eaca799d51b33893a910be3894228..1fb1bc9475e4ff2ffcb63a5f2842bd1818d36028 100644 --- a/src/main/resources/templates/transactions/transactionsMacros.ftl +++ b/src/main/resources/templates/transactions/transactionsMacros.ftl @@ -91,23 +91,6 @@ </#if> </#macro> -<#macro deleteModal transaction> - <div id="modalConfirmDelete" class="modal background-color"> - <div class="modal-content"> - <h4>${locale.getString("info.title.transaction.delete")}</h4> - <#if currentTransaction.isRepeating()> - <p>${locale.getString("info.text.transaction.repeating.delete", transaction.name)}</p> - <#else> - <p>${locale.getString("info.text.transaction.delete", transaction.name)}</p> - </#if> - </div> - <div class="modal-footer background-color"> - <a href="<@s.url '/transactions'/>" class="modal-action modal-close waves-effect waves-light red btn-flat white-text">${locale.getString("cancel")}</a> - <a href="<@s.url '/transactions/${transaction.ID?c}/delete'/>" class="modal-action modal-close waves-effect waves-light green btn-flat white-text">${locale.getString("delete")}</a> - </div> - </div> -</#macro> - <#macro buttons isFilterActive> <div class="row hide-on-small-only valign-wrapper"> <div class="col s6 right-align transactions-buttons-col">