diff --git a/http/accounts.go b/http/accounts.go
index dddb8a2..09fe886 100644
--- a/http/accounts.go
+++ b/http/accounts.go
@@ -13,20 +13,21 @@ type AccountsData struct {
}
func (h *Handler) accounts(c *gin.Context) {
- base := c.MustGet("data").(AlwaysNeededData)
d := AccountsData{
- base,
+ c.MustGet("data").(AlwaysNeededData),
}
c.HTML(http.StatusOK, "accounts.html", d)
}
type AccountData struct {
+ AlwaysNeededData
Account *postgres.Account
Transactions []postgres.GetTransactionsForAccountRow
}
func (h *Handler) account(c *gin.Context) {
+
accountID := c.Param("accountid")
accountUUID, err := uuid.Parse(accountID)
if err != nil {
@@ -47,8 +48,9 @@ func (h *Handler) account(c *gin.Context) {
}
d := AccountData{
- Account: &account,
- Transactions: transactions,
+ c.MustGet("data").(AlwaysNeededData),
+ &account,
+ transactions,
}
c.HTML(http.StatusOK, "account.html", d)
diff --git a/http/budget.go b/http/budget.go
index bef1b8a..71560f3 100644
--- a/http/budget.go
+++ b/http/budget.go
@@ -15,7 +15,6 @@ type BudgetData struct {
}
func (h *Handler) budget(c *gin.Context) {
- base := c.MustGet("data").(AlwaysNeededData)
budgetID := c.Param("budgetid")
budgetUUID, err := uuid.Parse(budgetID)
if err != nil {
@@ -30,7 +29,7 @@ func (h *Handler) budget(c *gin.Context) {
}
d := BudgetData{
- base,
+ c.MustGet("data").(AlwaysNeededData),
transactions,
}
diff --git a/web/base.tpl b/web/base.tpl
index c6eb3cb..b2cca49 100644
--- a/web/base.tpl
+++ b/web/base.tpl
@@ -20,7 +20,9 @@
diff --git a/web/sidebar.tpl b/web/budget-sidebar.tpl
similarity index 83%
rename from web/sidebar.tpl
rename to web/budget-sidebar.tpl
index 44b1ed9..638b68d 100644
--- a/web/sidebar.tpl
+++ b/web/budget-sidebar.tpl
@@ -1,4 +1,4 @@
-{{define "sidebar"}}
+{{define "budget-sidebar"}}
- Budget (Coming Soon)
- Reports (Coming Soon)
@@ -8,7 +8,7 @@
{{range .Accounts}}
-
- {{.Name}}
+ {{.Name}}
{{printf "%.2f" .Balance.GetFloat64}}
{{end}}
diff --git a/web/dashboard.html b/web/dashboard.html
index d34b14c..878d99f 100644
--- a/web/dashboard.html
+++ b/web/dashboard.html
@@ -6,6 +6,10 @@
{{template "budget-new"}}
{{end}}
+{{define "sidebar"}}
+ Please select a budget.
+{{end}}
+
{{template "base" .}}
{{define "main"}}