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

Refactoring: creatdd macro for modals to confrm deletion

parent dd593d5c
No related branches found
No related tags found
No related merge requests found
...@@ -56,17 +56,9 @@ ...@@ -56,17 +56,9 @@
</main> </main>
<#if currentAccount??> <#if currentAccount??>
<!-- confirm delete modal --> <@header.modalConfirmDelete title=locale.getString("info.title.account.delete") confirmUrl='/accounts' cancelUrlBase="/accounts" itemId=currentAccount.getID() confirmButtonText=locale.getString("info.button.account.delete")>
<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> <p>${locale.getString("info.text.account.delete", currentAccount.getName(), currentAccount.getReferringTransactions()?size)}</p>
</div> </@header.modalConfirmDelete>
<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>
</#if> </#if>
<#if accountNotDeletable??> <#if accountNotDeletable??>
......
...@@ -57,17 +57,9 @@ ...@@ -57,17 +57,9 @@
</div> </div>
<#if currentChart??> <#if currentChart??>
<!-- confirm delete modal --> <@header.modalConfirmDelete title=locale.getString("info.title.chart.delete") confirmUrl='/charts/manage' cancelUrlBase='/charts' itemId=currentChart.getID() confirmButtonText=locale.getString("info.title.chart.delete")>
<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> <p>${locale.getString("info.text.chart.delete", currentChart.getName())}</p>
</div> </@header.modalConfirmDelete>
<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>
</#if> </#if>
</main> </main>
......
...@@ -39,3 +39,17 @@ ...@@ -39,3 +39,17 @@
<img class="${classes}" id="${id}" src="<@s.url '/images/Logo_with_text_medium_res.png'/>"> <img class="${classes}" id="${id}" src="<@s.url '/images/Logo_with_text_medium_res.png'/>">
</#if> </#if>
</#macro> </#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
...@@ -41,17 +41,9 @@ ...@@ -41,17 +41,9 @@
</div> </div>
<#if currentTemplate??> <#if currentTemplate??>
<!-- confirm delete modal --> <@header.modalConfirmDelete title=locale.getString("info.title.template.delete") confirmUrl='/templates' cancelUrlBase='/templates' itemId=currentTemplate.getID() confirmButtonText=locale.getString("info.title.template.delete")>
<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> <p>${locale.getString("info.text.template.delete", currentTemplate.getTemplateName())}</p>
</div> </@header.modalConfirmDelete>
<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>
</#if> </#if>
</main> </main>
......
...@@ -88,7 +88,13 @@ ...@@ -88,7 +88,13 @@
</div> </div>
<#if currentTransaction??> <#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> </#if>
<@filterMacros.filterModal filterConfiguration/> <@filterMacros.filterModal filterConfiguration/>
......
...@@ -91,23 +91,6 @@ ...@@ -91,23 +91,6 @@
</#if> </#if>
</#macro> </#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> <#macro buttons isFilterActive>
<div class="row hide-on-small-only valign-wrapper"> <div class="row hide-on-small-only valign-wrapper">
<div class="col s6 right-align transactions-buttons-col"> <div class="col s6 right-align transactions-buttons-col">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment