Browse Source

feat: add user overview page

main
Inhji Y. 8 months ago
parent
commit
3ab35fcc18
  1. 44
      assets/css/app.scss
  2. 9
      lib/mirage_web/controllers/user_controller.ex
  3. 36
      lib/mirage_web/router.ex
  4. 7
      lib/mirage_web/templates/user/index.html.eex
  5. 3
      lib/mirage_web/views/user_view.ex

44
assets/css/app.scss

@ -94,6 +94,10 @@ footer {
padding: 2rem;
}
.padding {
padding: 2rem;
}
section:not(.hero) + section,
div + section {
margin-top: 2rem;
@ -130,15 +134,41 @@ nav[role=navigation] {
font-weight: bold;
}
li a {
display: block;
padding: 1rem;
text-decoration: none;
transition: all 0.3s;
li {
a {
display: block;
padding: 1rem;
text-decoration: none;
transition: all 0.3s;
&:hover {
background: #3a3a3a;
}
}
}
}
li a:hover {
background: #3a3a3a;
aside.menu {
width: 10rem;
ul {
li {
margin-right: 2rem;
background: $bg-content;
a {
display: inline-block;
width: 100%;
padding: 1rem;
transition: all 0.3s;
text-decoration: none;
&:hover {
background: #3a3a3a;
}
}
}
}
}

9
lib/mirage_web/controllers/user_controller.ex

@ -0,0 +1,9 @@
defmodule MirageWeb.UserController do
use MirageWeb, :controller
plug :put_layout, :user
def index(conn, _params) do
render(conn, "index.html")
end
end

36
lib/mirage_web/router.ex

@ -35,6 +35,12 @@ defmodule MirageWeb.Router do
live "/notes/:id", ShowNoteLive
end
scope "/user", MirageWeb do
pipe_through [:browser, :require_authenticated_user]
get "/", UserController, :index
end
# Other scopes may use custom stacks.
# scope "/api", MirageWeb do
# pipe_through :api
@ -64,30 +70,30 @@ defmodule MirageWeb.Router do
scope "/", MirageWeb do
pipe_through [:browser, :redirect_if_user_is_authenticated]
get "/users/register", UserRegistrationController, :new
post "/users/register", UserRegistrationController, :create
get "/users/log_in", UserSessionController, :new
post "/users/log_in", UserSessionController, :create
get "/users/reset_password", UserResetPasswordController, :new
post "/users/reset_password", UserResetPasswordController, :create
get "/users/reset_password/:token", UserResetPasswordController, :edit
put "/users/reset_password/:token", UserResetPasswordController, :update
get "/user/register", UserRegistrationController, :new
post "/user/register", UserRegistrationController, :create
get "/user/log_in", UserSessionController, :new
post "/user/log_in", UserSessionController, :create
get "/user/reset_password", UserResetPasswordController, :new
post "/user/reset_password", UserResetPasswordController, :create
get "/user/reset_password/:token", UserResetPasswordController, :edit
put "/user/reset_password/:token", UserResetPasswordController, :update
end
scope "/", MirageWeb do
pipe_through [:browser, :require_authenticated_user]
get "/users/settings", UserSettingsController, :edit
put "/users/settings", UserSettingsController, :update
get "/users/settings/confirm_email/:token", UserSettingsController, :confirm_email
get "/user/settings", UserSettingsController, :edit
put "/user/settings", UserSettingsController, :update
get "/user/settings/confirm_email/:token", UserSettingsController, :confirm_email
end
scope "/", MirageWeb do
pipe_through [:browser]
delete "/users/log_out", UserSessionController, :delete
get "/users/confirm", UserConfirmationController, :new
post "/users/confirm", UserConfirmationController, :create
get "/users/confirm/:token", UserConfirmationController, :confirm
delete "/user/log_out", UserSessionController, :delete
get "/user/confirm", UserConfirmationController, :new
post "/user/confirm", UserConfirmationController, :create
get "/user/confirm/:token", UserConfirmationController, :confirm
end
end

7
lib/mirage_web/templates/user/index.html.eex

@ -0,0 +1,7 @@
<div class="hero">
<h1>User</h1>
</div>
<section>
<p>hello world!</p>
</section>

3
lib/mirage_web/views/user_view.ex

@ -0,0 +1,3 @@
defmodule MirageWeb.UserView do
use MirageWeb, :view
end
Loading…
Cancel
Save