Add menu to user show and edit pages

This commit is contained in:
Andy Smith
2025-08-27 14:07:21 -05:00
parent ef661b4c23
commit ff0e74bbb0
4 changed files with 16 additions and 13 deletions
+6
View File
@@ -0,0 +1,6 @@
@layer components {
.user-edit-link {
inset: 0 0 auto auto;
position: absolute;
}
}
+4
View File
@@ -5,6 +5,10 @@ class UsersController < ApplicationController
before_action :ensure_join_code_is_valid, only: %i[ new create ]
before_action :ensure_permission_to_change_user, only: %i[ update destroy ]
include FilterScoped
enable_collection_filtering only: [:edit, :show]
def new
@user = User.new
end
+1 -4
View File
@@ -1,10 +1,7 @@
<% @page_title = "Edit your profile" %>
<% content_for :header do %>
<div class="header__actions header__actions--start">
<%= link_to_back fallback_path: user_path(@user) %>
</div>
<div class="header__actions header__actions--end"></div>
<%= render "filters/menu", user_filtering: @user_filtering %>
<% end %>
<div class="panel shadow center">
+5 -9
View File
@@ -1,22 +1,18 @@
<% @page_title = @user.name %>
<% content_for :header do %>
<div class="header__actions header__actions--start">
<%= link_to_back %>
</div>
<%= render "filters/menu", user_filtering: @user_filtering %>
<% end %>
<div class="header__actions header__actions--end">
<div class="panel shadow center txt-align-center margin-block-end-double">
<div class="flex flex-column gap position-relative">
<% if Current.user == @user %>
<%= link_to edit_user_path(@user), class: "btn" do %>
<%= link_to edit_user_path(@user), class: "user-edit-link btn" do %>
<%= icon_tag "pencil" %>
<span class="for-screen-reader">Edit</span>
<% end %>
<% end %>
</div>
<% end %>
<div class="panel shadow center txt-align-center margin-block-end-double">
<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}", size: 128 %>
</div>