Add user profile screen
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
class UsersController < ApplicationController
|
||||
require_unauthenticated_access
|
||||
require_unauthenticated_access only: %i[ new create ]
|
||||
|
||||
before_action :set_account_from_join_code
|
||||
before_action :set_user, only: :show
|
||||
before_action :set_account_from_join_code, only: %i[ new create ]
|
||||
|
||||
def new
|
||||
@user = @account.users.build
|
||||
@@ -13,11 +14,18 @@ class UsersController < ApplicationController
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
private
|
||||
def set_account_from_join_code
|
||||
@account = Account.find_by_join_code!(params[:join_code])
|
||||
end
|
||||
|
||||
def set_user
|
||||
@user = Current.account.users.active.find(params[:id])
|
||||
end
|
||||
|
||||
def user_params
|
||||
params.expect(user: [ :name, :email_address, :password ])
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<%= avatar_tag user, loading: :lazy, class: "flex-item-no-shrink" %>
|
||||
|
||||
<strong class="overflow-ellipsis">
|
||||
<%= user.name %>
|
||||
<%= link_to user.name, user_path(user) %>
|
||||
</strong>
|
||||
|
||||
<hr class="separator--horizontal flex-item-grow" style="--border-color: var(--color-subtle-dark); --border-style: dashed" aria-hidden="true">
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<% @page_title = @user.name %>
|
||||
|
||||
<% content_for :header do %>
|
||||
<nav>
|
||||
<%= link_to account_users_path, class: "btn flex-item-justify-start" do %>
|
||||
<%= image_tag "arrow-left.svg", aria: { hidden: true }, size: 24 %>
|
||||
<span class="for-screen-reader">Back</span>
|
||||
<% end %>
|
||||
</nav>
|
||||
<% end %>
|
||||
|
||||
<div class="panel shadow center txt-align-center">
|
||||
<div class="flex flex-column gap">
|
||||
<div class="avatar txt-xx-large center fill-white">
|
||||
<%= image_tag user_avatar_path(@user), alt: "Profile avatar for #{@user.name}", class: "avatar", size: 128 %>
|
||||
</div>
|
||||
<% if !@user.active? %>
|
||||
<div class="flex flex-column gap-half">
|
||||
<h1 class="txt-x-large txt-tight-lines margin-none"><%= @user.name %></h1>
|
||||
<div class="txt-medium"><%= mail_to @user.email_address %></div>
|
||||
</div>
|
||||
|
||||
<% if Current.user == @user %>
|
||||
<hr class="margin-block-start borderless">
|
||||
|
||||
<%#= render "users/profiles/transfer", user: @user %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="flex flex-column gap-half margin-block-end">
|
||||
<h1 class="txt-x-large margin-none"><%= @user.name %></h1>
|
||||
<div class="txt-medium"><%= @user.name %> is no longer on this account</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user