-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from daveminer/settings-role
preload offices for setting page context
- Loading branch information
Showing
2 changed files
with
11 additions
and
1 deletion.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
lib/basket_web/controllers/settings/settings_controller.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters