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

#626 - added button to settings page to reset all dismissed hints

parent aa5685ac
No related branches found
No related tags found
No related merge requests found
......@@ -2,12 +2,17 @@ package de.deadlocker8.budgetmaster.hints;
import de.deadlocker8.budgetmaster.controller.BaseController;
import de.deadlocker8.budgetmaster.utils.Mappings;
import de.deadlocker8.budgetmaster.utils.WebRequestUtils;
import de.deadlocker8.budgetmaster.utils.notification.Notification;
import de.deadlocker8.budgetmaster.utils.notification.NotificationType;
import de.thecodelabs.utils.util.Localization;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.context.request.WebRequest;
@Controller
......@@ -28,4 +33,13 @@ public class HintController extends BaseController
{
hintService.dismiss(ID);
}
@RequestMapping("/resetAll")
public String resetAll(WebRequest request)
{
hintService.resetAll();
WebRequestUtils.putNotification(request, new Notification(Localization.getString("notification.hints.reset"), NotificationType.SUCCESS));
return "redirect:/settings";
}
}
\ No newline at end of file
......@@ -36,6 +36,15 @@ public class HintService implements Resettable
hint.setDismissed(true);
}
@Transactional
public void resetAll()
{
for(Hint hint : hintRepository.findAll())
{
hint.setDismissed(false);
}
}
@Override
public void deleteAll()
{
......
headline.hints=Tipps
button.hints.reset=Alle Tipps zurücksetzen
notification.hints.reset=Alle Tipps zurückgesetzt
hint.first.use.teaser=Neu im BudgetMaster? Sieh dir die Einführung an!
headline.hints=Hints
button.hints.reset=Reset all hints
notification.hints.reset=All hints reset
hint.first.use.teaser=New to BudgetMaster? Check out the first use guide!
\ No newline at end of file
......@@ -225,6 +225,19 @@
</div>
</div>
<hr>
<#-- hints -->
<div class="container">
<div class="section center-align">
<div class="headline">${locale.getString("headline.hints")}</div>
</div>
</div>
<div class="row">
<div class="col s12 center-align">
<@header.buttonLink url='/hints/resetAll' icon='restore' localizationKey='button.hints.reset'/>
</div>
</div>
<hr>
<#-- database -->
<div class="container">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment