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

#563 - refactoring: use button macros on templates pages

parent 3ef6c0ac
No related branches found
No related tags found
No related merge requests found
......@@ -125,6 +125,10 @@ function openChangeTransactionTypeModal(item)
success: function(data)
{
createAndOpenModalSelectNewType(data)
},
error: function(data)
{
console.log(data);
}
});
}
......
......@@ -370,7 +370,7 @@ function validateForm(allowEmptyAmount = false)
let datePickerId = 'transaction-datepicker';
if(document.getElementById(datePickerId) !== null)
{
let isValidDate = validateDate();
let isValidDate = validateDate(datePickerId);
if(!isValidDate)
{
return false;
......
......@@ -60,12 +60,17 @@
</body>
</#macro>
<#macro buttonLink url icon localizationKey id="" color="background-blue" classes="">
<a href="<@s.url url/>" id="${id}" class="waves-effect waves-light btn ${color} ${classes}"><i class="material-icons left">${icon}</i><#if localizationKey?has_content>${locale.getString(localizationKey)}</#if></a>
<#macro buttonLink url icon localizationKey id="" color="background-blue" classes="" isDataUrl=false>
<a <#if !isDataUrl>href="<@s.url url/>"</#if>
id="${id}"
class="waves-effect waves-light btn ${color} ${classes}"
<#if isDataUrl>data-url="${url}"</#if>>
<i class="material-icons left <#if !localizationKey?has_content>no-margin</#if>">${icon}</i><#if localizationKey?has_content>${locale.getString(localizationKey)}</#if>
</a>
</#macro>
<#macro buttonSubmit name icon localizationKey id="" color="background-blue" classes="" disabled=false>
<button id="${id}" class="btn waves-effect waves-light ${color} ${classes}" type="submit" name="${name}" <#if disabled>disabled</#if>>
<i class="material-icons left">${icon}</i><#if localizationKey?has_content>${locale.getString(localizationKey)}</#if>
<i class="material-icons left <#if !localizationKey?has_content>no-margin</#if>">${icon}</i><#if localizationKey?has_content>${locale.getString(localizationKey)}</#if>
</button>
</#macro>
\ No newline at end of file
<#global locale = static["de.thecodelabs.utils.util.Localization"]>
<#import "/spring.ftl" as s>
<#import "../helpers/header.ftl" as header>
<div id="modalCreateFromTransaction" class="modal background-color">
<div class="modal-content">
......@@ -25,8 +26,8 @@
</div>
</div>
<div class="modal-footer background-color">
<a class="modal-action modal-close waves-effect waves-light red btn-flat white-text">${locale.getString("cancel")}</a>
<a id="buttonCreateTemplate" class="modal-action waves-effect waves-light green btn-flat white-text" data-url="<@s.url '/templates/fromTransaction'/>">${locale.getString("save.as.template")}</a>
<@header.buttonLink url='' icon='clear' localizationKey='cancel' color='red' classes='modal-action modal-close text-white'/>
<@header.buttonLink url='/templates/fromTransaction' icon='file_copy' localizationKey='save.as.template' color='green' id='buttonCreateTemplate' classes='"modal-action modal-close text-white' isDataUrl=true/>
</div>
<script>
......
......@@ -2,8 +2,7 @@
<#import "../helpers/validation.ftl" as validation>
<#macro buttonNew>
<a href="<@s.url '/templates/newTemplate'/>" class="waves-effect waves-light btn background-blue"><i
class="material-icons left">add</i>${locale.getString("title.template.new")}</a>
<@header.buttonLink url='/templates/newTemplate' icon='add' localizationKey='title.template.new'/>
</#macro>
<#macro buttons>
......@@ -26,7 +25,7 @@
<div class="collapsible-header-button">
<a href="<@s.url '/templates/${template.ID?c}/edit'/>" class="btn-flat no-padding text-default"><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-default"><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 background-blue button-select-template"><i class="material-icons left no-margin">note_add</i></a>
<@header.buttonLink url='/templates/' + template.ID?c + '/select' icon='note_add' localizationKey='' classes='button-select-template'/>
</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