diff --git a/app/views/people/_hidden_from_profile_card.html.erb b/app/views/people/_hidden_from_profile_card.html.erb index 629e590aaf..a677ce6f27 100644 --- a/app/views/people/_hidden_from_profile_card.html.erb +++ b/app/views/people/_hidden_from_profile_card.html.erb @@ -1,6 +1,7 @@ <%# Profile pieces the person turned off, shown open (and collapsible) to them and admins. %> <% pieces = person.hidden_profile_pieces %> -<% return if pieces.empty? %> +<% bio_prompt = !person.profile_show_bio? && person.bio.blank? && allowed_to?(:edit_own_profile?, person) %> +<% return if pieces.empty? && !bio_prompt %> <% contact_pieces = pieces & %i[profile_show_credentials profile_show_pronouns profile_show_member_since profile_show_email profile_show_phone profile_show_social_media] %> <% chip_class = "inline-flex items-center gap-1.5 rounded-full border border-black/5 bg-white px-3 py-1 text-gray-700" %>
Bio <%= render "people/profile_pieces/bio", person: person %>
+ <% elsif bio_prompt %> +
+

Bio

+ <%= render "people/profile_pieces/bio_prompt", person: person %> +
<% end %> <% %i[workshops workshop_variations stories resources].each do |section| %> <% if pieces.include?(:"profile_show_#{section}") %> diff --git a/app/views/people/profile_pieces/_bio_prompt.html.erb b/app/views/people/profile_pieces/_bio_prompt.html.erb new file mode 100644 index 0000000000..3e7fad770b --- /dev/null +++ b/app/views/people/profile_pieces/_bio_prompt.html.erb @@ -0,0 +1,4 @@ +

You haven't added a bio yet. A few sentences about you and your work helps others get to know you.

+
+ <%= render "people/profile_section_action", person: person, anchor: "bio", label: "Add a bio" %> +
diff --git a/app/views/people/show.html.erb b/app/views/people/show.html.erb index ff10fc22bc..e4e59228ea 100644 --- a/app/views/people/show.html.erb +++ b/app/views/people/show.html.erb @@ -212,13 +212,10 @@ <%= render "people/profile_pieces/bio", person: @person %> - <% elsif @person.bio.blank? && own_profile %> + <% elsif @person.bio.blank? && @person.profile_show_bio? && own_profile %>
-

Bio

-

You haven't added a bio yet. A few sentences about you and your work helps others get to know you.

-
- <%= render "people/profile_section_action", person: @person, anchor: "bio", label: "Add a bio" %> -
+

Bio

+ <%= render "people/profile_pieces/bio_prompt", person: @person %>
<% end %> diff --git a/spec/requests/people_own_profile_hub_spec.rb b/spec/requests/people_own_profile_hub_spec.rb index 8012a72743..7450b0a947 100644 --- a/spec/requests/people_own_profile_hub_spec.rb +++ b/spec/requests/people_own_profile_hub_spec.rb @@ -43,6 +43,16 @@ expect(response.body).to include(details_person_path(person, anchor: "bio")) end + it "prompts for a hidden bio inside the hidden card, not as its own section" do + person.update!(bio: nil, profile_show_bio: false) + + get person_path(person) + + page = Capybara.string(response.body) + expect(page).to have_css("#hidden_from_profile", text: "Add a bio") + expect(page).to have_text("Add a bio", count: 1) + end + it "lists pending change requests" do request = create(:profile_change_request, :primary_email, person: person, requested_by: owner_user, requested_value: "new@example.com")