Improve sidebar template
This commit is contained in:
parent
ba0926900a
commit
5321c7d85f
@ -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)
|
||||
|
@ -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,
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,9 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="sidebar">
|
||||
{{template "sidebar" .}}
|
||||
{{block "sidebar" .}}
|
||||
{{template "budget-sidebar" .}}
|
||||
{{end}}
|
||||
</div>
|
||||
<div id="content">
|
||||
<div class="container" id="head">
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{define "sidebar"}}
|
||||
{{define "budget-sidebar"}}
|
||||
<ul>
|
||||
<li>Budget (Coming Soon)</li>
|
||||
<li>Reports (Coming Soon)</li>
|
||||
@ -8,7 +8,7 @@
|
||||
<ul class="two-valued">
|
||||
{{range .Accounts}}
|
||||
<li>
|
||||
<a href="/account/{{.ID}}">{{.Name}}</a>
|
||||
<a href="/budget/{{$.Budget.ID}}/account/{{.ID}}">{{.Name}}</a>
|
||||
<span class="right">{{printf "%.2f" .Balance.GetFloat64}}</span>
|
||||
</li>
|
||||
{{end}}
|
@ -6,6 +6,10 @@
|
||||
{{template "budget-new"}}
|
||||
{{end}}
|
||||
|
||||
{{define "sidebar"}}
|
||||
Please select a budget.
|
||||
{{end}}
|
||||
|
||||
{{template "base" .}}
|
||||
|
||||
{{define "main"}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user