Add community_member_description, tagline and mascot_image_url to SiteConfig. Enable Cloudinary for primary_sticker_image (#7056) [deploy]
* Add community_member_description, tagline and mascot_image_url to SiteConfig * extra space * Add mascot_image_description field to SiteConfig * Fix test
This commit is contained in:
parent
cbe6b3bd70
commit
17037761a8
10 changed files with 94 additions and 16 deletions
|
|
@ -176,7 +176,7 @@
|
|||
margin-right: 9px;
|
||||
padding-right: 9px;
|
||||
}
|
||||
img.rainbowdevimage {
|
||||
img.primary-sticker-image {
|
||||
width: 190px;
|
||||
height: 190px;
|
||||
margin: 18px auto 35px;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
vertical-align: calc(-0.1em - 2px);
|
||||
}
|
||||
}
|
||||
.sloan {
|
||||
.mascot-image {
|
||||
height: calc(7vw + 80px);
|
||||
margin-top: calc(6vh - 10px);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,10 @@ class Internal::ConfigsController < Internal::ApplicationController
|
|||
campaign_hero_html_variant_name campaign_sidebar_enabled campaign_featured_tags
|
||||
campaign_sidebar_image
|
||||
main_social_image favicon_url logo_svg logo_png primary_sticker_image_url
|
||||
mascot_image_url mascot_image_description
|
||||
rate_limit_follow_count_daily
|
||||
ga_view_id ga_fetch_rate community_description authentication_providers
|
||||
community_member_description tagline
|
||||
mailchimp_newsletter_id mailchimp_sustaining_members_id
|
||||
mailchimp_tag_moderators_id mailchimp_community_moderators_id
|
||||
periodic_email_digest_max periodic_email_digest_min suggested_tags
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ class SiteConfig < RailsSettings::Base
|
|||
|
||||
# site content
|
||||
field :community_description, type: :string, default: "A constructive and inclusive social network. Open source and radically transparent."
|
||||
field :community_member_description, type: :string, default: "amazing humans who code."
|
||||
field :tagline, type: :string, default: "We're a place where coders share, stay up-to-date and grow their careers."
|
||||
|
||||
# staff account
|
||||
field :staff_user_id, type: :integer, default: 1
|
||||
|
|
@ -40,6 +42,8 @@ class SiteConfig < RailsSettings::Base
|
|||
field :logo_png, type: :string, default: "https://practicaldev-herokuapp-com.freetls.fastly.net/assets/devlogo-pwa-512.png"
|
||||
field :logo_svg, type: :string, default: ""
|
||||
field :primary_sticker_image_url, type: :string, default: "https://practicaldev-herokuapp-com.freetls.fastly.net/assets/rainbowdev.svg"
|
||||
field :mascot_image_url, type: :string, default: "https://practicaldev-herokuapp-com.freetls.fastly.net/assets/sloan.png"
|
||||
field :mascot_image_description, type: :string, default: "Sloan, the sloth mascot"
|
||||
|
||||
# rate limits
|
||||
field :rate_limit_follow_count_daily, type: :integer, default: 500
|
||||
|
|
|
|||
|
|
@ -37,6 +37,24 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.label :community_member_description, "Community member description" %>
|
||||
<%= f.text_field :community_member_description,
|
||||
class: "form-control",
|
||||
value: SiteConfig.community_member_description,
|
||||
placeholder: "amazing humans who code." %>
|
||||
<div class="alert alert-info">Used in pre-login banners.</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.label :tagline, "Tagline" %>
|
||||
<%= f.text_field :tagline,
|
||||
class: "form-control",
|
||||
value: SiteConfig.tagline,
|
||||
placeholder: "We're a place where coders share, stay up-to-date and grow their careers." %>
|
||||
<div class="alert alert-info">Used in signup modal.</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">Staff</div>
|
||||
<div class="card-body">
|
||||
|
|
@ -193,11 +211,29 @@
|
|||
<img alt="main social image" class="img-fluid" src="<%= SiteConfig.primary_sticker_image_url %>" />
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="alert alert-info">
|
||||
<h5>Used as the primary sticker image</h5>
|
||||
</div>
|
||||
<div class="alert alert-info"> Used as the primary sticker image </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.label :mascot_image_url %>
|
||||
<%= f.text_field :mascot_image_url,
|
||||
class: "form-control",
|
||||
value: SiteConfig.mascot_image_url,
|
||||
placeholder: "https://image.url" %>
|
||||
<div class="row mt-2">
|
||||
<div class="col-12">
|
||||
<img alt="<%= SiteConfig.mascot_image_description %>" class="img-fluid" src="<%= SiteConfig.mascot_image_url %>" />
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="alert alert-info"> Used as the mascot image. </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.label :mascot_image_description %>
|
||||
<%= f.text_field :mascot_image_description,
|
||||
class: "form-control",
|
||||
value: SiteConfig.mascot_image_description %>
|
||||
<div class="alert alert-info">Used as the alt text for the mascot image </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -5,17 +5,11 @@
|
|||
</button>
|
||||
</div>
|
||||
<div class="global-signup-modal--inner-a">
|
||||
<%= image_tag(cl_image_path(asset_path("/assets/sloan.png"),
|
||||
type: "fetch",
|
||||
width: 300,
|
||||
crop: "imagga_scale",
|
||||
quality: "auto",
|
||||
flags: "progressive",
|
||||
fetch_format: "auto",
|
||||
sign_url: true), class: "sloan", alt: "Sloan, the sloth mascot", loading: "lazy") %>
|
||||
<%= image_tag(cloudinary(SiteConfig.mascot_image_url, 300),
|
||||
class: "mascot-image", alt: SiteConfig.mascot_image_description, loading: "lazy") %>
|
||||
<h1>Join our <%= community_qualified_name %> :)</h1>
|
||||
<p>
|
||||
We're a place where coders share, stay up-to-date and grow their careers.
|
||||
<%= SiteConfig.tagline %>
|
||||
</p>
|
||||
<% if SiteConfig.auth_allowed?("twitter") %>
|
||||
<a href="/users/auth/twitter?callback_url=<%= app_url %>/users/auth/twitter/callback" class="sign-up-link cta" data-no-instant>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
<div class="single-article single-article-small-pic feed-cta" id="in-feed-cta">
|
||||
<div class="cta-container" id="cta-content">
|
||||
<img class="rainbowdevimage" src="<%= SiteConfig.primary_sticker_image_url %>" alt="rainbow DEV logo" />
|
||||
<img class="primary-sticker-image" src="<%= cloudinary(SiteConfig.primary_sticker_image_url, 190) %>"
|
||||
alt="Primary <%= community_qualified_name %> logo" />
|
||||
|
||||
<h2>
|
||||
<a href="/">DEV</a> is a community of <br /><%= number_with_delimiter User.estimated_count %> amazing humans who code.
|
||||
<a href="/"><%= community_name %></a> is a community of <br />
|
||||
<%= number_with_delimiter User.estimated_count %> <%= SiteConfig.community_member_description %>
|
||||
</h2>
|
||||
|
||||
<h3>
|
||||
|
|
|
|||
|
|
@ -45,6 +45,18 @@ RSpec.describe "/internal/config", type: :request do
|
|||
post "/internal/config", params: { site_config: { community_description: description }, confirmation: confirmation_message }
|
||||
expect(SiteConfig.community_description).to eq(description)
|
||||
end
|
||||
|
||||
it "updates the community_member_description" do
|
||||
description = "Hey hey #{rand(100)}"
|
||||
post "/internal/config", params: { site_config: { community_member_description: description }, confirmation: confirmation_message }
|
||||
expect(SiteConfig.community_member_description).to eq(description)
|
||||
end
|
||||
|
||||
it "updates the tagline" do
|
||||
description = "Hey hey #{rand(100)}"
|
||||
post "/internal/config", params: { site_config: { tagline: description }, confirmation: confirmation_message }
|
||||
expect(SiteConfig.tagline).to eq(description)
|
||||
end
|
||||
end
|
||||
|
||||
describe "staff" do
|
||||
|
|
@ -108,6 +120,18 @@ RSpec.describe "/internal/config", type: :request do
|
|||
expect(SiteConfig.primary_sticker_image_url).to eq(expected_image_url)
|
||||
end
|
||||
|
||||
it "updates mascot_image_url" do
|
||||
expected_image_url = "https://dummyimage.com/300x300"
|
||||
post "/internal/config", params: { site_config: { mascot_image_url: expected_image_url }, confirmation: confirmation_message }
|
||||
expect(SiteConfig.mascot_image_url).to eq(expected_image_url)
|
||||
end
|
||||
|
||||
it "updates mascot_image_description" do
|
||||
description = "Hey hey #{rand(100)}"
|
||||
post "/internal/config", params: { site_config: { mascot_image_description: description }, confirmation: confirmation_message }
|
||||
expect(SiteConfig.mascot_image_description).to eq(description)
|
||||
end
|
||||
|
||||
it "rejects update without proper confirmation" do
|
||||
expected_image_url = "https://dummyimage.com/300x300"
|
||||
expect { post "/internal/config", params: { site_config: { logo_svg: expected_image_url }, confirmation: "Incorrect yo!" } }.to raise_error Pundit::NotAuthorizedError
|
||||
|
|
|
|||
8
spec/views/layouts/signup_modal.html.erb_spec.rb
Normal file
8
spec/views/layouts/signup_modal.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
require "rails_helper"
|
||||
|
||||
RSpec.describe "layouts/_signup_modal.html.erb", type: :view do
|
||||
it "has the tagline" do
|
||||
render
|
||||
expect(rendered).to have_text(SiteConfig.tagline)
|
||||
end
|
||||
end
|
||||
8
spec/views/stories/sign_in_invitation.html.erb_spec.rb
Normal file
8
spec/views/stories/sign_in_invitation.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
require "rails_helper"
|
||||
|
||||
RSpec.describe "stories/_sign_in_invitation.html.erb", type: :view do
|
||||
it "has the community member description" do
|
||||
render
|
||||
expect(rendered).to have_text(SiteConfig.community_member_description)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue