From 3f8cf322723750aa4c8d062d4a727f9107ceccb4 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Thu, 12 Aug 2021 15:59:07 +0100 Subject: [PATCH] Refactor the profile page to move the profile information out of the header This makes it look like other normal pages, along with removing the unusual full-width class. --- app/assets/stylesheets/common.scss | 11 ---- app/views/users/show.html.erb | 93 +++++++++++++++--------------- 2 files changed, 45 insertions(+), 59 deletions(-) diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 42090e733..16624dda1 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -1096,17 +1096,6 @@ tr.turn:hover { /* Rules for the user profile page */ -#userinformation { - min-height: 100px; - .userinformation-inner { - float: left; - } - .user-description { - width: 100%; - clear: both; - } -} - .admin-user-info small { margin-bottom: $lineheight/2; display: inline; diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 95abbdc3c..0ea411811 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,7 +1,9 @@ <% content_for :heading do %> -
- <%= user_image @user %> -
+
+
+ <%= user_image @user, :class => "" %> +
+

<%= @user.display_name %> <%= role_icons(@user) %>

<% if current_user and @user.id == current_user.id %> @@ -108,45 +110,8 @@ <% end %> - <% end %> - <% if can?(:set_status, User) || can?(:destroy, User) %> - -
    - <% if can? :set_status, User %> - <% if ["active", "confirmed"].include? @user.status %> -
  • - <%= link_to t(".deactivate_user"), set_status_user_path(:status => "pending", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %> -
  • - <% elsif ["pending"].include? @user.status %> -
  • - <%= link_to t(".activate_user"), set_status_user_path(:status => "active", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %> -
  • - <% end %> - - <% if ["active", "suspended"].include? @user.status %> -
  • - <%= link_to t(".confirm_user"), set_status_user_path(:status => "confirmed", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %> -
  • - <% end %> -
  • - <% if ["pending", "active", "confirmed", "suspended"].include? @user.status %> - <%= link_to t(".hide_user"), set_status_user_path(:status => "deleted", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %> - <% else %> - <%= link_to t(".unhide_user"), set_status_user_path(:status => "active", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %> -
  • - <% end %> - <% end %> - <% if can? :destroy, User %> -
  • - <%= link_to t(".delete_user"), user_path(:display_name => @user.display_name), :method => :delete, :data => { :confirm => t(".confirm") } %> -
  • - <% end %> -
- - <% end %> -

<%= t ".mapper since" %> <%= l @user.creation_time.to_date, :format => :long %> @@ -162,16 +127,41 @@

+
-
<%= @user.description.to_html %>
- - <% if current_user and @user.id == current_user.id %> -
- <%= link_to t(".edit_profile"), edit_profile_path, :class => "btn btn-outline-primary" %> -
- <% end %> + <% if can?(:set_status, User) || can?(:destroy, User) %> +
    + <% if can? :set_status, User %> + <% if ["active", "confirmed"].include? @user.status %> +
  • + <%= link_to t(".deactivate_user"), set_status_user_path(:status => "pending", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %> +
  • + <% elsif ["pending"].include? @user.status %> +
  • + <%= link_to t(".activate_user"), set_status_user_path(:status => "active", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %> +
  • + <% end %> -
+ <% if ["active", "suspended"].include? @user.status %> +
  • + <%= link_to t(".confirm_user"), set_status_user_path(:status => "confirmed", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %> +
  • + <% end %> +
  • + <% if ["pending", "active", "confirmed", "suspended"].include? @user.status %> + <%= link_to t(".hide_user"), set_status_user_path(:status => "deleted", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %> + <% else %> + <%= link_to t(".unhide_user"), set_status_user_path(:status => "active", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %> +
  • + <% end %> + <% end %> + <% if can? :destroy, User %> +
  • + <%= link_to t(".delete_user"), user_path(:display_name => @user.display_name), :method => :delete, :data => { :confirm => t(".confirm") } %> +
  • + <% end %> + + <% end %> <% if current_user and current_user.administrator? -%> <% end -%> +<% end %> +
    <%= @user.description.to_html %>
    + +<% if current_user and @user.id == current_user.id %> +
    + <%= link_to t(".edit_profile"), edit_profile_path, :class => "btn btn-outline-primary" %> +
    <% end %> -- 2.43.2