Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion app/views/people/_hidden_from_profile_card.html.erb
Original file line number Diff line number Diff line change
@@ -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" %>
<div id="hidden_from_profile"
Expand Down Expand Up @@ -73,6 +74,11 @@
<h3 class="mb-3 font-display text-xl text-gray-900">Bio</h3>
<%= render "people/profile_pieces/bio", person: person %>
</div>
<% elsif bio_prompt %>
<div>
<h3 class="mb-2 font-display text-xl text-gray-900">Bio</h3>
<%= render "people/profile_pieces/bio_prompt", person: person %>
</div>
<% end %>
<% %i[workshops workshop_variations stories resources].each do |section| %>
<% if pieces.include?(:"profile_show_#{section}") %>
Expand Down
4 changes: 4 additions & 0 deletions app/views/people/profile_pieces/_bio_prompt.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<p class="text-gray-700">You haven't added a bio yet. A few sentences about you and your work helps others get to know you.</p>
<div class="mt-3">
<%= render "people/profile_section_action", person: person, anchor: "bio", label: "Add a bio" %>
</div>
9 changes: 3 additions & 6 deletions app/views/people/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,10 @@
</div>
<%= render "people/profile_pieces/bio", person: @person %>
</div>
<% elsif @person.bio.blank? && own_profile %>
<% elsif @person.bio.blank? && @person.profile_show_bio? && own_profile %>
<div class="rounded-2xl border-2 border-dashed p-5 sm:p-6 <%= DomainTheme.border_class_for(:person_bio) %>">
<h2 class="font-display text-2xl text-gray-900">Bio</h2>
<p class="mt-2 text-gray-700">You haven't added a bio yet. A few sentences about you and your work helps others get to know you.</p>
<div class="mt-3">
<%= render "people/profile_section_action", person: @person, anchor: "bio", label: "Add a bio" %>
</div>
<h2 class="mb-2 font-display text-2xl text-gray-900">Bio</h2>
<%= render "people/profile_pieces/bio_prompt", person: @person %>
</div>
<% end %>
<!-- AUTHORED SECTION -->
Expand Down
10 changes: 10 additions & 0 deletions spec/requests/people_own_profile_hub_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Loading