docbrown/app/views/shared/_display_ad_header.html.erb
Ridhwana 0771a5cd2e
Load post_comments billboard asynchronously (#19285)
* feat: add a route to the async_info for display ads

* feat: load the billboard asyncronously

* feat: move the methods to the display_ads controller

* feat: handle params better

* feat: cache control headers

* feat: test fastly caching headers on display ads

* fix: surrogate key test

* feat: use safe navigation operator to handle cases where there is no article id

* fix: article id present then find the article

* feat: add a response test

* Fragment caching

* feat: update the article decorator

* feat: update cache keys for fragment

* feat: remove an empty line

* feat: add article id

* feat: bust cache

* feat: setup dropdown for billboard

* chore: add chunk to same line

* feat: add to safe params for caching

* Update app/controllers/display_ads_controller.rb

Co-authored-by: Joshua Wehner <joshua@forem.com>

* feat: remove the cache deletion

* feat: update the routes to follow a new scope

* feat: update the cache params

---------

Co-authored-by: Joshua Wehner <joshua@forem.com>
2023-04-12 18:15:15 +02:00

45 lines
2.3 KiB
Text

<div class="crayons-sponsorship__header relative">
<% if display_ad.organization_id? && (display_ad.type_of == "community" || display_ad.type_of == "external") %>
<div class="flex align-center">
<img width="24" height="24" class="radius-default crayons-sponsorship__image" src="<%= display_ad.organization.profile_image_url_for(length: 64) %>" alt="profile" loading="lazy" />
<div class="crayons-sponsorship__title ml-2 fs-s fw-medium"><%= display_ad.organization.name %></div>
<% if display_ad.type_of == "external" %>
<span class="crayons-sponsorship__indicator c-indicator c-indicator--subtle c-indicator--round fs-xs fw-medium ml-2 py-1 px-2"> <%= I18n.t("display_ad.promoted") %></span>
<% end %>
</div>
<% else %>
<div class="crayons-sponsorship__title"><%= Settings::Community.community_name %></div>
<% end %>
<button id="sponsorship-dropdown-trigger-<%= display_ad.id %>" aria-controls="sponsorship-dropdown-<%= display_ad.id %>" aria-expanded="false" aria-haspopup="true"
class="dropBtn crayons-sponsorship__dropdown crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon"
aria-label="<%= t("display_ad.menu.aria_label") %>">
<%= crayons_icon_tag("small-overflow-horizontal", class: "pointer-events-none", title: t("display_ad.menu.icon")) %>
</button>
<div id="sponsorship-dropdown-<%= display_ad.id %>" class="crayons-dropdown right-0">
<ul class="list-none m-0">
<% if Page.exists?(slug: "billboards") %>
<li>
<a class="crayons-link crayons-link--block" href='/billboards'>
<%= crayons_icon_tag("info", aria_hidden: true, class: "c-btn__icon") %>
<%= I18n.t("display_ad.menu.what_is_a_billboard") %>
</a>
</li>
<% end %>
<li>
<a class="crayons-link crayons-link--block" href='/settings/customization#sponsors'>
<%= crayons_icon_tag("setting", aria_hidden: true, class: "c-btn__icon") %>
<%= I18n.t("display_ad.menu.manage_preferences") %>
</a>
</li>
<hr />
<li>
<a class="crayons-link crayons-link--block" href="/report-abuse?billboard=<%= display_ad.id %>">
<%= crayons_icon_tag("flag", aria_hidden: true, class: "c-btn__icon") %>
<%= I18n.t("display_ad.menu.report_billboard") %>
</a>
</li>
</ul>
</div>
</div>