From b3c993410ba86bc46c468ede9e856ea8578b6590 Mon Sep 17 00:00:00 2001 From: Anna Buianova Date: Thu, 3 Aug 2023 13:28:23 +0300 Subject: [PATCH] Rename display ads vars in the views (#19877) * Renamed display_ads vars to billboards * Rename local vars in the feed view * Renamed display-ad in the comment Co-authored-by: Rajat Talesra * Renamed variables in the views --------- Co-authored-by: Rajat Talesra --- .../articles/__tests__/Feed.test.jsx | 4 +-- app/views/articles/index.html.erb | 2 +- app/views/billboards/show.html.erb | 4 +-- ...isplay_ad.html.erb => _billboard.html.erb} | 28 +++++++-------- ...er.html.erb => _billboard_header.html.erb} | 16 ++++----- app/views/sidebars/_homepage_content.html.erb | 6 ++-- app/views/stories/_main_stories_feed.html.erb | 36 +++++++++---------- 7 files changed, 48 insertions(+), 48 deletions(-) rename app/views/shared/{_display_ad.html.erb => _billboard.html.erb} (60%) rename app/views/shared/{_display_ad_header.html.erb => _billboard_header.html.erb} (70%) diff --git a/app/javascript/articles/__tests__/Feed.test.jsx b/app/javascript/articles/__tests__/Feed.test.jsx index 6f543caf9..8e4214d26 100644 --- a/app/javascript/articles/__tests__/Feed.test.jsx +++ b/app/javascript/articles/__tests__/Feed.test.jsx @@ -210,7 +210,7 @@ describe(' component', () => { const lastCallbackResult = callback.mock.calls[callback.mock.calls.length - 1][0]; expect(lastCallbackResult.feedItems[0]).toEqual(firstBillboard); - // there is no second bilboard so podcasts get rendered in 4th place + // there is no second billboard so podcasts get rendered in 4th place expect(lastCallbackResult.feedItems[3]).toEqual(podcastEpisodes); expect(lastCallbackResult.feedItems[8]).toEqual(thirdBillboard); }); @@ -249,7 +249,7 @@ describe(' component', () => { const pinnedItem = feedPosts.find((o) => o.pinned === true); // there is no first billboard expect(lastCallbackResult.feedItems[0]).toEqual(pinnedItem); - // there is no second bilboard so podcasts get rendered in 3rd place + // there is no second billboard so podcasts get rendered in 3rd place expect(lastCallbackResult.feedItems[2]).toEqual(podcastEpisodes); expect(lastCallbackResult.feedItems[7]).toEqual(thirdBillboard); }); diff --git a/app/views/articles/index.html.erb b/app/views/articles/index.html.erb index ffaa9aa54..a033fa553 100644 --- a/app/views/articles/index.html.erb +++ b/app/views/articles/index.html.erb @@ -27,7 +27,7 @@ <%= javascript_packs_with_chunks_tag "homePage", defer: true %> <% cache(release_adjusted_cache_key("main-stories-index-#{params}-#{user_signed_in?}"), expires_in: 90.seconds) do %> <% if @hero_billboard && FeatureFlag.enabled?(:hero_billboard) %> - <%= render partial: "shared/display_ad", locals: { display_ad: @hero_billboard, data_context_type: BillboardEvent::CONTEXT_TYPE_HOME } %> + <%= render partial: "shared/billboard", locals: { billboard: @hero_billboard, data_context_type: BillboardEvent::CONTEXT_TYPE_HOME } %> <% end %>
" data-which="<%= @list_of %>" diff --git a/app/views/billboards/show.html.erb b/app/views/billboards/show.html.erb index 37124916d..b2f3e221a 100644 --- a/app/views/billboards/show.html.erb +++ b/app/views/billboards/show.html.erb @@ -1,9 +1,9 @@ <% if @billboard %> <% if user_signed_in? %> - <%= render partial: "shared/display_ad", locals: { display_ad: @billboard, data_context_type: BillboardEvent::CONTEXT_TYPE_ARTICLE } %> + <%= render partial: "shared/billboard", locals: { billboard: @billboard, data_context_type: BillboardEvent::CONTEXT_TYPE_ARTICLE } %> <% else %> <% cache([params[:username], params[:slug], params[:placement_area]], expires_in: 15.minutes) do %> - <%= render partial: "shared/display_ad", locals: { display_ad: @billboard, data_context_type: BillboardEvent::CONTEXT_TYPE_ARTICLE } %> + <%= render partial: "shared/billboard", locals: { billboard: @billboard, data_context_type: BillboardEvent::CONTEXT_TYPE_ARTICLE } %> <% end %> <% end %> <% end %> diff --git a/app/views/shared/_display_ad.html.erb b/app/views/shared/_billboard.html.erb similarity index 60% rename from app/views/shared/_display_ad.html.erb rename to app/views/shared/_billboard.html.erb index e5bec2c63..cd7880ecb 100644 --- a/app/views/shared/_display_ad.html.erb +++ b/app/views/shared/_billboard.html.erb @@ -1,43 +1,43 @@ -<% if display_ad.placement_area.start_with?("feed_") %> +<% if billboard.placement_area.start_with?("feed_") %>
+ data-type-of="<%= billboard.type_of %>">
- <%= render partial: "shared/display_ad_header", locals: { display_ad: display_ad } %> + <%= render partial: "shared/billboard_header", locals: { billboard: billboard } %>
- <%= display_ad.processed_html.html_safe %> + <%= billboard.processed_html.html_safe %>
-<% elsif display_ad.placement_area == "home_hero" %> +<% elsif billboard.placement_area == "home_hero" %>
- <%= render partial: "shared/display_ad_header", locals: { display_ad: display_ad } %> + data-type-of="<%= billboard.type_of %>"> + <%= render partial: "shared/billboard_header", locals: { billboard: billboard } %>
- <%= display_ad.processed_html.html_safe %> + <%= billboard.processed_html.html_safe %>
<% else %>
- <%= render partial: "shared/display_ad_header", locals: { display_ad: display_ad } %> + data-type-of="<%= billboard.type_of %>"> + <%= render partial: "shared/billboard_header", locals: { billboard: billboard } %>
- <%= display_ad.processed_html.html_safe %> + <%= billboard.processed_html.html_safe %>
<% end %> diff --git a/app/views/shared/_display_ad_header.html.erb b/app/views/shared/_billboard_header.html.erb similarity index 70% rename from app/views/shared/_display_ad_header.html.erb rename to app/views/shared/_billboard_header.html.erb index fdc1402d8..430ede8d7 100644 --- a/app/views/shared/_display_ad_header.html.erb +++ b/app/views/shared/_billboard_header.html.erb @@ -1,11 +1,11 @@
- <% if display_ad.organization_id? && (display_ad.type_of == "community" || display_ad.type_of == "external") %> + <% if billboard.organization_id? && (billboard.type_of == "community" || billboard.type_of == "external") %>
- - profile -
<%= display_ad.organization.name %>
+
+ profile +
<%= billboard.organization.name %>
- <% if display_ad.type_of == "external" %> + <% if billboard.type_of == "external" %> <%= I18n.t("display_ad.promoted") %> <% end %>
@@ -13,13 +13,13 @@
<%= Settings::Community.community_name %>
<% end %> - -
+
  • @@ -35,7 +35,7 @@

  • - + <%= crayons_icon_tag("flag", width: 16, height: 16, aria_hidden: true, class: "c-btn__icon") %> <%= I18n.t("display_ad.menu.report_billboard") %> diff --git a/app/views/sidebars/_homepage_content.html.erb b/app/views/sidebars/_homepage_content.html.erb index 763a2a569..129d14c4d 100644 --- a/app/views/sidebars/_homepage_content.html.erb +++ b/app/views/sidebars/_homepage_content.html.erb @@ -1,8 +1,8 @@