From c8759d84f05801291f5f6c48a65098a999adfaeb Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Tue, 1 Jul 2025 18:44:10 +0300 Subject: [PATCH] Add user profile sidebar section template --- app/views/users/_sidebar_section.html.erb | 7 ++++ app/views/users/show.html.erb | 49 ++++++++++------------- config/locales/en.yml | 7 ++-- 3 files changed, 33 insertions(+), 30 deletions(-) create mode 100644 app/views/users/_sidebar_section.html.erb diff --git a/app/views/users/_sidebar_section.html.erb b/app/views/users/_sidebar_section.html.erb new file mode 100644 index 000000000..a0a4c354f --- /dev/null +++ b/app/views/users/_sidebar_section.html.erb @@ -0,0 +1,7 @@ +<% if present %> +
+
+ <%= yield %> +
+
+<% end %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index edc744f83..51d256fc6 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -238,37 +238,32 @@ <% if @user.home_location_name&.strip.present? || @user.company&.strip.present? || !@user.social_links.empty? || owned %>
- <% if @user.home_location_name&.strip.present? %> -
- + <%= render "sidebar_section", :present => @user.home_location_name&.strip.present? do %> + <% end %> - <% if @user.company&.strip.present? %> -
- + + <%= render "sidebar_section", :present => @user.company&.strip.present? do %> + <% end %> - <% unless @user.social_links.empty? %> -
- <%= render "social_links/show", - :social_links => @user.social_links %> -
+ + <%= render "sidebar_section", :present => !@user.social_links.empty? do %> + <%= render "social_links/show", :social_links => @user.social_links %> <% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index 95e109dc3..d48f31fda 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3038,9 +3038,6 @@ en: follow: Follow mapper since: "Mapper since:" last map edit: "Last map edit:" - home location: "Home location" - company: "Company" - company tooltip: "The company affiliation is self-reported and not verified" no activity yet: "No activity yet" uid: "User id:" ct status: "Contributor terms:" @@ -3080,6 +3077,10 @@ en: contributions: one: "%{count} contribution in the last year" other: "%{count} contributions in the last year" + sidebar_section: + home_location: "Home location" + company: "Company" + company_tooltip: "The company affiliation is self-reported and not verified" go_public: flash success: "All your edits are now public, and you are now allowed to edit." issued_blocks: -- 2.39.5