-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#764 - add new settings option to enable/disable account end date rem…
…inders
- Loading branch information
1 parent
e0b15e4
commit 37a8fce
Showing
8 changed files
with
190 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
.../main/java/de/deadlocker8/budgetmaster/settings/containers/AccountsSettingsContainer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package de.deadlocker8.budgetmaster.settings.containers; | ||
|
||
import de.deadlocker8.budgetmaster.settings.Settings; | ||
import de.deadlocker8.budgetmaster.settings.SettingsService; | ||
import org.springframework.validation.Errors; | ||
|
||
public final class AccountsSettingsContainer implements SettingsContainer | ||
{ | ||
private Boolean accountEndDateReminderActivated; | ||
|
||
public AccountsSettingsContainer(Boolean accountEndDateReminderActivated) | ||
{ | ||
this.accountEndDateReminderActivated = accountEndDateReminderActivated; | ||
} | ||
|
||
@Override | ||
public void validate(Errors errors) | ||
{ | ||
// nothing to do | ||
} | ||
|
||
@Override | ||
public void fixBooleans() | ||
{ | ||
// nothing to do | ||
} | ||
|
||
@Override | ||
public String getErrorLocalizationKey() | ||
{ | ||
return "notification.settings.accounts.error"; | ||
} | ||
|
||
@Override | ||
public String getSuccessLocalizationKey() | ||
{ | ||
return "notification.settings.accounts.saved"; | ||
} | ||
|
||
@Override | ||
public String getTemplatePath() | ||
{ | ||
return "settings/containers/settingsAccounts"; | ||
} | ||
|
||
@Override | ||
public Settings updateSettings(SettingsService settingsService) | ||
{ | ||
final Settings settings = settingsService.getSettings(); | ||
|
||
if(accountEndDateReminderActivated == null) | ||
{ | ||
accountEndDateReminderActivated = false; | ||
} | ||
|
||
settings.setAccountEndDateReminderActivated(accountEndDateReminderActivated); | ||
return settings; | ||
} | ||
|
||
@Override | ||
public void persistChanges(SettingsService settingsService, Settings previousSettings, Settings settings) | ||
{ | ||
settingsService.updateSettings(settings); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
BudgetMasterServer/src/main/resources/templates/settings/containers/settingsAccounts.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<#import "/spring.ftl" as s> | ||
<#import "../../helpers/validation.ftl" as validation> | ||
<#import "../../helpers/header.ftl" as header> | ||
<@header.globals/> | ||
|
||
<#import "settingsContainer.ftl" as settingsContainerMacros> | ||
<#import "../settingsMacros.ftl" as settingsMacros> | ||
|
||
<#macro accountsSettingsContainer importScripts settings> | ||
<@settingsContainerMacros.settingsContainer 'AccountsSettingsContainer' 'accountsSettingsContainer' importScripts '/settings/save/accounts'> | ||
<div class="row"> | ||
<div class="col s12"> | ||
<div class="table-container"> | ||
<div class="table-cell"> | ||
<div class="switch-cell-margin">${locale.getString("settings.accountEndDateReminder")}</div> | ||
</div> | ||
<div class="table-cell table-cell-spacer"></div> | ||
<div class="table-cell"> | ||
<@settingsMacros.switch "accountEndDateReminder" "accountEndDateReminderActivated" settings.getAccountEndDateReminderActivated()/> | ||
</div> | ||
<div class="table-cell table-cell-spacer"></div> | ||
<div class="table-cell"> | ||
<div class="switch-cell-margin"> | ||
<a class="btn btn-flat tooltipped text-default" data-position="bottom" data-tooltip="${locale.getString("settings.accountEndDateReminder.description")}"><i class="material-icons">help_outline</i></a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col s12 center-align"> | ||
<@header.buttonSubmit name='action' icon='save' localizationKey='save' color='background-green' onclick='return validateAccountsForm()'/> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
function validateAccountsForm() | ||
{ | ||
return true; | ||
} | ||
// toggle unsaved changes warning | ||
$('input[name="accountEndDateReminderActivated"]').change(function() | ||
{ | ||
toggleSettingsContainerHeader('accountsSettingsContainerHeader', false); | ||
}); | ||
</script> | ||
</@settingsContainerMacros.settingsContainer> | ||
</#macro> | ||
|
||
<@accountsSettingsContainer importScripts=true settings=settings/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters