diff --git a/http/admin.go b/http/admin.go index c2cf9e8..5bfe998 100644 --- a/http/admin.go +++ b/http/admin.go @@ -34,6 +34,18 @@ func (h *Handler) clearDatabase(c *gin.Context) { 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) { budgetID := c.Param("budgetid") budgetUUID, err := uuid.Parse(budgetID) diff --git a/http/http.go b/http/http.go index b01232f..26c022a 100644 --- a/http/http.go +++ b/http/http.go @@ -61,8 +61,9 @@ func (h *Handler) Serve() { withBudget.GET("/budget/:budgetid/all-accounts", h.allAccounts) withBudget.GET("/budget/:budgetid/accounts", h.accounts) withBudget.GET("/budget/:budgetid/account/:accountid", h.account) - withBudget.GET("/budget/:budgetid/clear", h.clearBudget) - withBudget.GET("/budget/:budgetid/clean-negative", h.cleanNegativeBudget) + withBudget.GET("/budget/:budgetid/settings", h.settings) + withBudget.GET("/budget/:budgetid/settings/clear", h.clearBudget) + withBudget.GET("/budget/:budgetid/settings/clean-negative", h.cleanNegativeBudget) api := router.Group("/api/v1") diff --git a/web/budget-sidebar.tpl b/web/budget-sidebar.tpl index 6b48d1f..0423fce 100644 --- a/web/budget-sidebar.tpl +++ b/web/budget-sidebar.tpl @@ -35,7 +35,10 @@ + Add Account
  • - Settings + Settings +
  • +
  • + Admin
  • {{end}} \ No newline at end of file diff --git a/web/settings.html b/web/settings.html new file mode 100644 index 0000000..99c4c9e --- /dev/null +++ b/web/settings.html @@ -0,0 +1,17 @@ +{{define "title"}} + {{.Budget.Name}} - Settings +{{end}} + +{{template "base" .}} + +{{define "main"}} +

    Danger Zone

    +
    + Clear database +

    This removes all data and starts from scratch. Not undoable!

    +
    +
    + Fix all historic negative category-balances +

    This restores YNABs functionality, that would substract any overspent categories' balances from next months inflows.

    +
    +{{end}} \ No newline at end of file