Skip to content

Commit

Permalink
Add support for switching between boards.
Browse files Browse the repository at this point in the history
  • Loading branch information
bilus committed Sep 1, 2020
1 parent 8f2388c commit da8418e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,19 @@ Good luck!
- [X] Board resource
- [X] User can create a new board
- [X] Posts are associated with a board
- [ ] Refactor
- [ ] Board#index - show posts
- [ ] Posts#index - just for drafts (and management later)
- [ ] Switching between boards
- [X] Switching between boards
- [ ] Remove drafts
- [ ] Remove unnecessary routes, handlers
Leave listing posts for administrative purposes but remove route for now.
- [ ] Remember last dashboard
- [ ] Vote budget is per-board, not global
- [ ] When creating board, you specify voting policy
- [ ] Vote refill schedule + num votes
- [ ] Vote limit can be turned off
- [ ] Home dashboard
- [ ] Style everything
- [ ] Test everything
- [ ] Can take votes back for X minutes
- [ ] Board management
- [ ] Board owner can delete the board (= creator)
- [ ] Owners can add other owners
Expand Down
8 changes: 8 additions & 0 deletions actions/boards.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,20 @@ func (v BoardsResource) Show(c buffalo.Context) error {
return err
}

boards := &models.Boards{}

// Retrieve all Boards from the DB
if err := tx.All(boards); err != nil {
return err
}

return responder.Wants("html", func(c buffalo.Context) error {
c.Set("board", board)
c.Set("pagination", q.Paginator)

c.Set("posts", posts)
c.Set("sidebar", board.Description.String != "")
c.Set("boards", boards)

return c.Render(http.StatusOK, r.HTML("/boards/show.plush.html"))
}).Wants("json", func(c buffalo.Context) error {
Expand Down
14 changes: 13 additions & 1 deletion templates/application.plush.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,19 @@
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav mr-auto mr-2 mt-lg-0">
<li class="nav-item">
<%= linkTo(postsPath(), {body: "Pains & WTFs", class: "nav-link"}) %>
<%= if (board && boards) { %>
<div class="dropdown">
<a class="btn btn-primary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<%= board.Name %>
</a>

<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<%= for (board) in boards { %>
<%= linkTo(boardPath({ board_id: board.ID }), { body: board.Name, class: "dropdown-item" }) %>
<% } %>
</div>
</div>
<% } %>
</li>
</ul>

Expand Down

0 comments on commit da8418e

Please sign in to comment.