Add settings page linking to clean and clear
This commit is contained in:
parent
e0eeaadc60
commit
8116238d48
@ -34,6 +34,18 @@ func (h *Handler) clearDatabase(c *gin.Context) {
|
|||||||
c.HTML(http.StatusOK, "admin.html", d)
|
c.HTML(http.StatusOK, "admin.html", d)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SettingsData struct {
|
||||||
|
AlwaysNeededData
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *Handler) settings(c *gin.Context) {
|
||||||
|
d := SettingsData{
|
||||||
|
c.MustGet("data").(AlwaysNeededData),
|
||||||
|
}
|
||||||
|
|
||||||
|
c.HTML(http.StatusOK, "settings.html", d)
|
||||||
|
}
|
||||||
|
|
||||||
func (h *Handler) clearBudget(c *gin.Context) {
|
func (h *Handler) clearBudget(c *gin.Context) {
|
||||||
budgetID := c.Param("budgetid")
|
budgetID := c.Param("budgetid")
|
||||||
budgetUUID, err := uuid.Parse(budgetID)
|
budgetUUID, err := uuid.Parse(budgetID)
|
||||||
|
@ -61,8 +61,9 @@ func (h *Handler) Serve() {
|
|||||||
withBudget.GET("/budget/:budgetid/all-accounts", h.allAccounts)
|
withBudget.GET("/budget/:budgetid/all-accounts", h.allAccounts)
|
||||||
withBudget.GET("/budget/:budgetid/accounts", h.accounts)
|
withBudget.GET("/budget/:budgetid/accounts", h.accounts)
|
||||||
withBudget.GET("/budget/:budgetid/account/:accountid", h.account)
|
withBudget.GET("/budget/:budgetid/account/:accountid", h.account)
|
||||||
withBudget.GET("/budget/:budgetid/clear", h.clearBudget)
|
withBudget.GET("/budget/:budgetid/settings", h.settings)
|
||||||
withBudget.GET("/budget/:budgetid/clean-negative", h.cleanNegativeBudget)
|
withBudget.GET("/budget/:budgetid/settings/clear", h.clearBudget)
|
||||||
|
withBudget.GET("/budget/:budgetid/settings/clean-negative", h.cleanNegativeBudget)
|
||||||
|
|
||||||
api := router.Group("/api/v1")
|
api := router.Group("/api/v1")
|
||||||
|
|
||||||
|
@ -35,7 +35,10 @@
|
|||||||
+ Add Account
|
+ Add Account
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/admin">Settings</a>
|
<a href="/budget/{{.Budget.ID}}/settings">Settings</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/admin">Admin</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{{end}}
|
{{end}}
|
17
web/settings.html
Normal file
17
web/settings.html
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{{define "title"}}
|
||||||
|
{{.Budget.Name}} - Settings
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{template "base" .}}
|
||||||
|
|
||||||
|
{{define "main"}}
|
||||||
|
<h1>Danger Zone</h1>
|
||||||
|
<div class="budget-item">
|
||||||
|
<a href="/budget/{{.Budget.ID}}/settings/clear">Clear database</a>
|
||||||
|
<p>This removes all data and starts from scratch. Not undoable!</p>
|
||||||
|
</div>
|
||||||
|
<div class="budget-item">
|
||||||
|
<a href="/budget/{{.Budget.ID}}/settings/clean-negative">Fix all historic negative category-balances</a>
|
||||||
|
<p>This restores YNABs functionality, that would substract any overspent categories' balances from next months inflows.</p>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
Loading…
x
Reference in New Issue
Block a user