Skip to content

Commit

Permalink
Merge pull request #28 from daveminer/settings-role
Browse files Browse the repository at this point in the history
preload offices for setting page context
  • Loading branch information
daveminer authored Oct 23, 2024
2 parents 45d4232 + d199316 commit 6f316a3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lib/basket_web/controllers/settings/settings_controller.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
defmodule BasketWeb.SettingsController do
use BasketWeb, :controller

alias Basket.Repo

def index(conn, _params) do
conn =
if user = Pow.Plug.current_user(conn) do
user = Repo.preload(user, :offices)
assign(conn, :current_user, user)
else
conn
end

render(assign(conn, :form, %{}), "index.html")
end
end
2 changes: 1 addition & 1 deletion lib/basket_web/controllers/settings/settings_html.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule BasketWeb.SettingsHTML do
<div class="flex-col p-4">
<NavRow.render id="nav-row" />
<%= if @officer do %>
<%= if @current_user.offices > 0 do %>
<.form for={@form} class="flex flex-col" action="/invitations" method="post">
<span class="mr-2">
Send a club invite
Expand Down

0 comments on commit 6f316a3

Please sign in to comment.