Create primary_sticker_image_url in SiteConfig (#6746) [deploy]
* Create primary_sticker_image_url in SiteConfig * Adding test for updating primary_sticker_image_url * typo Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
This commit is contained in:
parent
be3a1be10f
commit
a91cb9f8f4
5 changed files with 25 additions and 2 deletions
|
|
@ -23,7 +23,7 @@ class Internal::ConfigsController < Internal::ApplicationController
|
|||
default_site_email social_networks_handle mascot_user_id
|
||||
campaign_hero_html_variant_name campaign_sidebar_enabled campaign_featured_tags
|
||||
campaign_sidebar_image
|
||||
main_social_image favicon_url logo_svg logo_png
|
||||
main_social_image favicon_url logo_svg logo_png primary_sticker_image_url
|
||||
rate_limit_follow_count_daily
|
||||
ga_view_id ga_fetch_rate community_description authentication_providers
|
||||
mailchimp_newsletter_id mailchimp_sustaining_members_id
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ class SiteConfig < RailsSettings::Base
|
|||
field :favicon_url, type: :string, default: "favicon.ico"
|
||||
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"
|
||||
|
||||
# rate limits
|
||||
field :rate_limit_follow_count_daily, type: :integer, default: 500
|
||||
|
|
|
|||
|
|
@ -182,6 +182,22 @@
|
|||
<div class="alert alert-info">Used as the SVG logo of the community</div>
|
||||
<%= @logo_svg %>
|
||||
</div>
|
||||
|
||||
<%= f.label :primary_sticker_image_url %>
|
||||
<%= f.text_field :primary_sticker_image_url,
|
||||
class: "form-control",
|
||||
value: SiteConfig.primary_sticker_image_url,
|
||||
placeholder: "https://image.url" %>
|
||||
<div class="row mt-2">
|
||||
<div class="col-12">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<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="<%= asset_path "rainbowdev.svg" %>" alt="rainbow DEV logo" />
|
||||
<img class="rainbowdevimage" src="<%= SiteConfig.primary_sticker_image_url %>" alt="rainbow DEV logo" />
|
||||
|
||||
<h2>
|
||||
<a href="/">DEV</a> is a community of <br /><%= number_with_delimiter User.estimated_count %> amazing humans who code.
|
||||
|
|
|
|||
|
|
@ -102,6 +102,12 @@ RSpec.describe "/internal/config", type: :request do
|
|||
expect(SiteConfig.logo_svg).to eq(expected_image_url)
|
||||
end
|
||||
|
||||
it "updates primary_sticker_image_url" do
|
||||
expected_image_url = "https://dummyimage.com/300x300"
|
||||
post "/internal/config", params: { site_config: { primary_sticker_image_url: expected_image_url }, confirmation: confirmation_message }
|
||||
expect(SiteConfig.primary_sticker_image_url).to eq(expected_image_url)
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue