Skip to content

Commit

Permalink
fix(dashboard): add parameter links in templates
Browse files Browse the repository at this point in the history
  • Loading branch information
vednoc committed Jul 20, 2021
1 parent 6d942bd commit 2e77bdd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions handlers/core/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func Dashboard(c *fiber.Ctx) error {
// TODO: Refactor.
// Get styles.
var styles []models.StyleCard
if c.Query("styles") != "" {
if c.Query("data") == "styles" {
s, err := models.GetAllAvailableStyles()
if err != nil {
return c.Render("err", fiber.Map{
Expand All @@ -82,7 +82,7 @@ func Dashboard(c *fiber.Ctx) error {
// Get users.
var userHistory string
var users []models.User
if c.Query("users") != "" {
if c.Query("data") == "users" {
u, err := models.FindAllUsers()
if err != nil {
return c.Render("err", fiber.Map{
Expand Down
8 changes: 6 additions & 2 deletions views/core/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,12 @@ <h2 class="td:d">Users</h2>
{{ end }}
</tbody>
</table>
{{ end }}
{{ else }}
<p class="fg:3">No users found.</p>
{{ end }}
{{ else }}
<a href="/dashboard?data=users">See all users</a>
{{ end }}
</section>

<section class="styles mt:l">
Expand All @@ -100,9 +102,11 @@ <h2 class="td:d">Styles</h2>
{{ template "partials/style-card" . }}
{{ end }}
</div>
{{ end }}
{{ else }}
<p class="fg:3">No userstyles found.</p>
{{ end }}
{{ else }}
<a href="/dashboard?data=styles">See all styles</a>
{{ end }}
</section>
</div>

0 comments on commit 2e77bdd

Please sign in to comment.