Sponsorship Updates (#3719)
* show blurb for tag sponsors * check that sponsorhip is live and account for expiration time * automatically add expiration date to tags * update tag offering * rewrite tag auto expiration * night mode compatibility for sponsor logos * fix spec * update specs * Small css adjustment
This commit is contained in:
parent
df301c8290
commit
66a4424f5b
11 changed files with 24 additions and 19 deletions
|
|
@ -1325,9 +1325,6 @@
|
|||
width: 98%;
|
||||
min-height: 35px;
|
||||
border-radius: 8px;
|
||||
&.partner-image-dark-mode {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.sponsor-tagline {
|
||||
margin: 10px auto;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,10 @@ $bold-shadow: 1px 1px 0px darken($light-medium-gray, 10%);
|
|||
$ease-in-cubic : cubic-bezier(0.55, 0.055, 0.675, 0.19);
|
||||
$ease-out-cubic : cubic-bezier(0.215, 0.61, 0.355, 1);
|
||||
|
||||
.partner-image-dark-mode {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
body.night-theme {
|
||||
.on-page-nav-butt img, .icon-img, .dropdown-icon, .reaction-button:not(.reacted) img, .image-upload-button button, .icon-image,
|
||||
.dev-badge, .chatchannels__config img, .external-link-img, .group-img {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,10 @@ class PartnershipsController < ApplicationController
|
|||
status: :pending,
|
||||
expires_at: expires_at
|
||||
}
|
||||
create_params[:sponsorable] = sponsorable if sponsorable
|
||||
if sponsorable
|
||||
create_params[:sponsorable] = sponsorable
|
||||
create_params[:expires_at] = 1.month.from_now
|
||||
end
|
||||
|
||||
if sponsorship_params[:instructions]
|
||||
create_params[:instructions] = sponsorship_params[:instructions]
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<img src="<%= cloudinary(organization.dark_nav_image_url || organization.nav_image_url) %>" style="margin-bottom:8px;" alt="<%= organization.name %> logo" loading="lazy" class="partner-image-dark-mode" />
|
||||
</a>
|
||||
<div class="sponsor-tagline" style="display:inline;">
|
||||
<%= sponsorship.tagline %>
|
||||
<%= sponsorship.sponsorable_type == "ActsAsTaggableOn::Tag" ? sponsorship.blurb_html.html_safe : sponsorship.tagline %>
|
||||
<a class="partner-link sponsor-learn-more" href="<%= sponsorship.url %>" target="_blank" data-details="<%= organization.slug %>__learn-more">
|
||||
Learn More
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @tag_model.sponsorship && @tag_model.sponsorship.status == "live" %>
|
||||
<% if @tag_model.sponsorship && @tag_model.sponsorship.status == "live" && @tag_model.sponsorship.expires_at > Time.current %>
|
||||
<div class="widget">
|
||||
<header>
|
||||
<h4><%= @tag %> is sponsored by</h4>
|
||||
|
|
|
|||
2
app/views/pages/_sponsor_image.html.erb
Normal file
2
app/views/pages/_sponsor_image.html.erb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<img src="<%= cloudinary(sponsorship.organization.nav_image_url, 250) %>" alt="<%= sponsorship.organization.name %> logo" loading="lazy" class="partner-image-light-mode">
|
||||
<img src="<%= cloudinary((sponsorship.organization.dark_nav_image_url || sponsorship.organization.nav_image_url), 250) %>" alt="<%= sponsorship.organization.name %> logo" loading="lazy" class="partner-image-dark-mode">
|
||||
|
|
@ -35,8 +35,8 @@
|
|||
<img src="<%= cloudinary("https://thepracticaldev.s3.amazonaws.com/i/2zmukvll98je8qsdyewq.png", 30) %>" alt="golden badge">
|
||||
</h4>
|
||||
<div id="gold-sponsors">
|
||||
<% Sponsorship.gold.includes(:organization).order(featured_number: :asc).each do |sponsorship| %>
|
||||
<a href="<%= sponsorship.url %>"><img src="<%= cloudinary(sponsorship.organization.nav_image_url, 250) %>"></a>
|
||||
<% Sponsorship.gold.live.includes(:organization).order(featured_number: :asc).each do |sponsorship| %>
|
||||
<a href="<%= sponsorship.url %>"><%= render "sponsor_image", sponsorship: sponsorship %></a>
|
||||
<p>
|
||||
<%= sponsorship.blurb_html&.html_safe %>
|
||||
</p>
|
||||
|
|
@ -50,8 +50,8 @@
|
|||
<img src="<%= cloudinary("https://thepracticaldev.s3.amazonaws.com/i/2zmukvll98je8qsdyewq.png", 30) %>" alt="silver badge">
|
||||
</h4>
|
||||
<div id="silver-sponsors">
|
||||
<% Sponsorship.silver.includes(:organization).order(featured_number: :asc).each do |sponsorship| %>
|
||||
<a href="<%= sponsorship.url %>"><img src="<%= cloudinary(sponsorship.organization.nav_image_url, 250) %>"></a>
|
||||
<% Sponsorship.where(status: "live", level: "silver").where("expires_at > ?", Time.current).includes(:organization).order(featured_number: :asc).each do |sponsorship| %>
|
||||
<a href="<%= sponsorship.url %>"><%= render "sponsor_image", sponsorship: sponsorship %></a>
|
||||
<p>
|
||||
<%= sponsorship.blurb_html&.html_safe %>
|
||||
</p>
|
||||
|
|
@ -65,8 +65,8 @@
|
|||
<img src="<%= cloudinary("https://thepracticaldev.s3.amazonaws.com/i/2zmukvll98je8qsdyewq.png", 30) %>" alt="bronze badge">
|
||||
</h4>
|
||||
<div id="bronze-sponsors">
|
||||
<% Sponsorship.bronze.includes(:organization).order(featured_number: :asc).find_each do |sponsorship| %>
|
||||
<a href="<%= sponsorship.url %>"><img src="<%= cloudinary(sponsorship.organization.nav_image_url, 250) %>"></a>
|
||||
<% Sponsorship.bronze.live.where("expires_at > ?", Time.current).includes(:organization).order(featured_number: :asc).find_each do |sponsorship| %>
|
||||
<a href="<%= sponsorship.url %>"><%= render "sponsor_image", sponsorship: sponsorship %></a>
|
||||
<hr />
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ Target your messaging with a tag sponsorship. This is a great way to increase y
|
|||
Logo + dedicated information area on the tag sidebar
|
||||
</h3>
|
||||
<p>
|
||||
Each tag features a dedicated sidebar, listing the section’s submission guidelines, rules, key information, and tag moderators. As a tag sponsor, you will receive prominent logo placement directly in that sidebar, along with a call-to-action to follow your organization’s profile.
|
||||
Each tag features a dedicated sidebar, listing the section’s submission guidelines, rules, key information, and tag moderators. As a tag sponsor, you will receive prominent logo placement directly in that sidebar.
|
||||
</p>
|
||||
<p>
|
||||
You’ll also receive access to a dedicated content box directly in that sidebar, where you’ll be able to offer a short blurb about your company or service. This combo provides contextual exposure, and long-lasting value as more fans of the tag engage with and follow your company.
|
||||
You’ll also receive access to a dedicated content box directly in that sidebar, where you’ll be able to offer a short blurb about your company or service. This combo provides contextual exposure, and long-lasting value as more fans of the tag engage with your company.
|
||||
</p>
|
||||
<h3>
|
||||
Placement on our tag overview page
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
<div class="tag-list-container" style="background:<%= tag.bg_color_hex %>;">
|
||||
<a class="tag-show-link" href="/t/<%= tag.name %>" style="color:<%= tag.text_color_hex || "#fff" %>;">
|
||||
<h2>#<%= tag.name %></h2>
|
||||
<% if tag.sponsorship && tag.sponsorship.status == "live" %>
|
||||
<% if tag.sponsorship && tag.sponsorship.status == "live" && tag.sponsorship.expires_at > Time.current %>
|
||||
<h4>Sponsored by <%= tag.sponsorship.organization.name %> ❤️</h4>
|
||||
<% end %>
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ RSpec.describe "Pages", type: :request do
|
|||
post "/partnerships", params: params
|
||||
sponsorship = org.sponsorships.tag.last
|
||||
expect(sponsorship.status).to eq("pending")
|
||||
expect(sponsorship.expires_at).to be(nil)
|
||||
expect(sponsorship.expires_at.to_i).to eq(1.month.from_now.to_i)
|
||||
expect(sponsorship.sponsorable).not_to be(nil)
|
||||
expect(sponsorship.instructions).to be_blank
|
||||
expect(sponsorship.instructions_updated_at).to be(nil)
|
||||
|
|
|
|||
|
|
@ -122,11 +122,10 @@ RSpec.describe "StoriesIndex", type: :request do
|
|||
|
||||
it "renders live sponsor" do
|
||||
org = create(:organization)
|
||||
sponsorship = create(:sponsorship, level: :tag, tagline: "Oh Yeah!!!", status: "live", organization: org, sponsorable: tag)
|
||||
|
||||
sponsorship = create(:sponsorship, level: :tag, blurb_html: "<p>Oh Yeah!!!</p>", status: "live", organization: org, sponsorable: tag, expires_at: 30.days.from_now)
|
||||
get "/t/#{tag.name}"
|
||||
expect(response.body).to include("is sponsored by")
|
||||
expect(response.body).to include(sponsorship.tagline)
|
||||
expect(response.body).to include(sponsorship.blurb_html)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue