docbrown/app/views/shared/_profile_card_content.html.erb
Suzanne Aitchison 80096f63a7
Add author profile preview cards to feed (#14340)
* Add the preview card to logged out feed initial content

* initialise the initial dropdowns added on the logged out feed

* minor tweak to selector

* flip the follow button and the summary

* add minimal preview card to build article HTML

* WIP: data fetched an inserted into card on logged out feed

* WIP: cards added to logged in feed

* create separate profile preview card component

* small style tweak, import pack on each page that shows feed cards

* rename

* tweak some styling issues

* make sure follow buttons init in cards

* populate all matching metadata placeholders after fetch

* don't render full preview card upfront on logged out feed

* refactors from PR comments

* fix issue in person search results

* remove check for article author link that will be superseded by cypress test for preview card

* Revert "remove check for article author link that will be superseded by cypress test for preview card"

This reverts commit 9b42804ffd0f051891c87293d0b791ed2bb0367f.

* Revert "fix issue in person search results"

This reverts commit 04941e3520c0895212141193b60f2933faed5ca1.

* only show the preview cards on story cards for Posts (not users etc in search results)

* correct display on collections view

* remove link check that will be replaced by cypress test

* tweaks to small issues, add a test for the logged out feed

* add tests for logged in home feed, logged out tag index

* add search test and tag index logged in test

* fixes to preview profile spec

* tweak to followauthor spec

* add cypress test for preview on series page

* use a unique test user for series test

* correct the jsdoc comments

* tweaks following PR review

* allow feed preview cards to reposition

* move to separate file from pack
2021-08-13 10:55:43 +07:00

76 lines
2.5 KiB
Text

<div class="-mt-4">
<a href="<%= actor.path %>" class="flex">
<span class="<% if actor.class.name == "User" %>crayons-avatar crayons-avatar--xl<% elsif actor.class.name == "Organization" %>crayons-logo crayons-logo--xl<% end %> mr-2 shrink-0">
<img src="<%= Images::Profile.call(actor.profile_image_url, length: 90) %>" class="<% if actor.class.name == "User" %>crayons-avatar__image<% elsif actor.class.name == "Organization" %>crayons-logo__image<% end %>" alt="" loading="lazy" />
</span>
<span class="crayons-link crayons-subtitle-2 mt-5"><%= actor.name %></span>
</a>
</div>
<div class="print-hidden">
<%= follow_button(actor, style = "", classes = "w-100") %>
</div>
<% if actor.tag_line.present? %>
<div class="color-base-70">
<%= truncate (actor.tag_line || actor.summary || "Posts in this tag"), length: 200 %>
</div>
<% end %>
<% if actor.class.name == "User" %>
<div class="user-metadata-details">
<ul class="user-metadata-details-inner">
<% if actor.setting.display_email_on_profile && context != "sidebar" %>
<li>
<div class="key">
Email
</div>
<div class="value">
<a href="mailto:<%= actor.email %>"><%= actor.email %></a>
</div>
</li>
<% end %>
<% if actor.location.present? %>
<li>
<div class="key">
Location
</div>
<div class="value">
<%= actor.location %>
</div>
</li>
<% end %>
<% if (header_fields = actor.profile.decorate.ui_attributes_for(area: :header)).present? %>
<% header_fields.sort.each do |title, value| %>
<% next if Profile.special_attributes.include?(title) %>
<li>
<div class="key">
<%= title %>
</div>
<div class="value">
<%= value %>
</div>
</li>
<% end %>
<% end %>
<li>
<div class="key">
Joined
</div>
<div class="value">
<%= local_date(actor.created_at) %>
</div>
</li>
</ul>
</div>
<% elsif actor.class.name == "Organization" && actor.approved_and_filled_out_cta? %>
<div>
<%= sanitize_rendered_markdown(actor.cta_processed_html) %>
</div>
<% if actor.cta_button_text.present? && actor.cta_button_url.present? %>
<div>
<a href="<%= actor.cta_button_url || "Learn more" %>" class="crayons-btn crayons-btn--outlined w-100">
<%= actor.cta_button_text %>
</a>
</div>
<% end %>
<% end %>