Allow orgs to be marked as sponsors (#2282)
* Allow orgs to be marked as sponsors * Remove community sponsor condition
This commit is contained in:
parent
9f4ab6d17a
commit
cc0e4b40dd
5 changed files with 49 additions and 45 deletions
|
|
@ -33,7 +33,10 @@ class OrganizationDashboard < Administrate::BaseDashboard
|
|||
approved: Field::Boolean,
|
||||
cta_button_text: Field::String,
|
||||
cta_button_url: Field::String,
|
||||
cta_body_markdown: Field::Text
|
||||
cta_body_markdown: Field::Text,
|
||||
sponsorship_url: Field::Text,
|
||||
sponsorship_tagline: Field::Text,
|
||||
is_gold_sponsor: Field::Boolean
|
||||
}.freeze
|
||||
|
||||
# COLLECTION_ATTRIBUTES
|
||||
|
|
@ -79,6 +82,9 @@ class OrganizationDashboard < Administrate::BaseDashboard
|
|||
cta_button_text
|
||||
cta_button_url
|
||||
cta_body_markdown
|
||||
sponsorship_url
|
||||
sponsorship_tagline
|
||||
is_gold_sponsor
|
||||
].freeze
|
||||
|
||||
def display_resource(organization)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<div id="sidebar-wrapper-left" class="sidebar-wrapper sidebar-wrapper-left">
|
||||
<div class="sidebar-bg" id="sidebar-bg-left"></div>
|
||||
<div class="side-bar">
|
||||
<% cache("main-sidebar-nav--#{user_signed_in?}", expires_in: 5.days) do %>
|
||||
<% cache("main-sidebar-nav--#{user_signed_in?}-#{ApplicationConfig['DEPLOYMENT_SIGNATURE']}", expires_in: 5.days) do %>
|
||||
<%= render "articles/sidebar_nav" %>
|
||||
<div class="widget sponsorship-widget <%= "showing" unless user_signed_in? %>" id="sponsorship-widget">
|
||||
<header>
|
||||
|
|
@ -10,49 +10,24 @@
|
|||
<img src="<%= asset_path "emoji/emoji-one-heart.png" %>" alt="emoji heart" />
|
||||
</span>
|
||||
</header>
|
||||
<div class="widget-body">
|
||||
<div class="sidebar-sponsor">
|
||||
<a class="partner-link" href="https://do.co/devto" target="_blank" data-details="digitalocean__image">
|
||||
<img src="<%= cloudinary("https://thepracticaldev.s3.amazonaws.com/i/85318v8gv77kzr8r2e58.png") %>" style="margin-bottom:8px;" alt="Digital Ocean logo" />
|
||||
</a>
|
||||
<div class="sponsor-tagline" style="display:inline;">
|
||||
The simplest cloud platform for developers & teams.
|
||||
<a class="partner-link sponsor-learn-more" href="https://do.co/devto" target="_blank" data-details="digitalocean__learn-more">
|
||||
Learn More
|
||||
</a>
|
||||
</div>
|
||||
<% @sponsors = Organization.where(is_gold_sponsor: true) %>
|
||||
<% if @sponsors.any? %>
|
||||
<div class="widget-body">
|
||||
<% @sponsors.each do |organization| %>
|
||||
<div class="sidebar-sponsor">
|
||||
<a class="partner-link" href="<%= organization.sponsorship_url %>" target="_blank" data-details="<%= organization.slug %>__image">
|
||||
<img src="<%= cloudinary(organization.nav_image_url) %>" style="margin-bottom:8px;" alt="Digital Ocean logo" />
|
||||
</a>
|
||||
<div class="sponsor-tagline" style="display:inline;">
|
||||
<%= organization.sponsorship_tagline %>
|
||||
<a class="partner-link sponsor-learn-more" href="<%= organization.sponsorship_url %>" target="_blank" data-details="<%= organization.slug %>__learn-more">
|
||||
Learn More
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="sidebar-sponsor">
|
||||
<a class="partner-link" href="https://triplebyte.com/a/YU8fSn0/homepage-tag" target="_blank" data-details="triplebyte__image">
|
||||
<img src="<%= cloudinary("https://thepracticaldev.s3.amazonaws.com/i/r50i600z08ty2sjwey4o.png") %>" alt="Triplebyte logo" />
|
||||
</a>
|
||||
<div class="sponsor-tagline">
|
||||
Do one coding quiz, get multiple job offers.
|
||||
<a class="partner-link sponsor-learn-more" href="https://triplebyte.com/a/YU8fSn0/homepage-tag" target="_blank" data-details="triplebyte__learn-more">
|
||||
Learn More
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sidebar-sponsor">
|
||||
<a class="partner-link" href="https://www.gocd.org/?utm_campaign=dev_to&utm_medium=dev_homepage&utm_source=logo_link&utm_content=gocd_homepage&utm_term=" target="_blank" data-details="gocd__image">
|
||||
<img src="<%= cloudinary("https://thepracticaldev.s3.amazonaws.com/i/ju8bfjsh7bcvw21p19nh.png") %>" alt="GoCD logo" />
|
||||
</a>
|
||||
<div class="sponsor-tagline">
|
||||
A Free and Open Source CI/CD Server.
|
||||
<a class="partner-link sponsor-learn-more" href="https://www.gocd.org/?utm_campaign=dev_to&utm_medium=dev_homepage&utm_source=logo_link&utm_content=gocd_homepage&utm_term=" target="_blank" data-details="gocd__learn-more">
|
||||
Learn More
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sponsors-love-message">
|
||||
We are grateful for wonderful sponsors who help sustain the dev community.
|
||||
</div>
|
||||
<div class="sponsor-footer">
|
||||
<p>
|
||||
<a href="/sponsorship-info">Sponsorship Info/Policy</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="widget">
|
||||
<header>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
class AddSponsorLinkToOrganizations < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_column :organizations, :sponsorship_url, :string
|
||||
add_column :organizations, :is_gold_sponsor, :boolean, default: false
|
||||
add_column :organizations, :sponsorship_tagline, :string
|
||||
add_column :organizations, :sponsorship_blurb_html, :text
|
||||
end
|
||||
end
|
||||
|
|
@ -10,8 +10,9 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20190327090030) do
|
||||
ActiveRecord::Schema.define(version: 20190401193017) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_stat_statements"
|
||||
enable_extension "plpgsql"
|
||||
|
||||
create_table "ahoy_messages", id: :serial, force: :cascade do |t|
|
||||
|
|
@ -500,6 +501,7 @@ ActiveRecord::Schema.define(version: 20190327090030) do
|
|||
t.text "cta_processed_html"
|
||||
t.string "email"
|
||||
t.string "github_username"
|
||||
t.boolean "is_gold_sponsor", default: false
|
||||
t.string "jobs_email"
|
||||
t.string "jobs_url"
|
||||
t.datetime "last_article_at", default: "2017-01-01 05:00:00"
|
||||
|
|
@ -513,6 +515,9 @@ ActiveRecord::Schema.define(version: 20190327090030) do
|
|||
t.text "proof"
|
||||
t.string "secret"
|
||||
t.string "slug"
|
||||
t.text "sponsorship_blurb_html"
|
||||
t.string "sponsorship_tagline"
|
||||
t.string "sponsorship_url"
|
||||
t.string "state"
|
||||
t.string "story"
|
||||
t.text "summary"
|
||||
|
|
|
|||
|
|
@ -35,6 +35,16 @@ RSpec.describe "StoriesIndex", type: :request do
|
|||
get "/"
|
||||
expect(response.body).not_to include(ad.processed_html)
|
||||
end
|
||||
it "has sponsors displayed" do
|
||||
org = create(:organization, is_gold_sponsor: true, sponsorship_tagline: "Oh Yeah!!!")
|
||||
get "/"
|
||||
expect(response.body).to include(org.sponsorship_tagline)
|
||||
end
|
||||
it "does not display non-sponsor org" do
|
||||
org = create(:organization, is_gold_sponsor: false, sponsorship_tagline: "Oh Yeah!!!")
|
||||
get "/"
|
||||
expect(response.body).not_to include(org.sponsorship_tagline)
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET query page" do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue