Lesson 4 — Policy-driven UI
With the policy in place on the board view, we need to thread it down
to KanbanColumn and KanbanCard so UI controls appear or disappear
based on role.
Updating KanbanColumn
Add a policy prop and conditionally render edit/delete controls:
|
|
Updating KanbanCard
Add a policy prop and conditionally show edit and delete controls:
|
|
Passing policy down from Views::Boards::Show
Update render_board to pass the policy to each column:
|
|
The “Add column” link only appears for admins. Members see the board in read/card-edit mode.
Add this section to Lesson 4, after the policy-driven UI section and before Lesson 5:
Member avatars on the board
Members should be able to see who has access to the board without needing admin rights. A compact row of avatars with names on hover gives this at a glance — distinct from the presence bar which shows who’s online right now.
|
|
The -space-x-2 class overlaps the avatars slightly — the standard
stacked avatar pattern. Each avatar has a title attribute so hovering
shows the member’s name.
Add it to render_header in Views::Boards::Show, visible to all
members:
|
|
MemberAvatars shows everyone with access. PresenceBar shows who’s
currently online. Together they answer both questions — who can see
this board, and who’s here right now.