diff --git a/app/assets/stylesheets/articles.scss b/app/assets/stylesheets/articles.scss index 2b3e6a33f..465681240 100644 --- a/app/assets/stylesheets/articles.scss +++ b/app/assets/stylesheets/articles.scss @@ -176,7 +176,7 @@ margin-right: 9px; padding-right: 9px; } - img.rainbowdevimage { + img.primary-sticker-image { width: 190px; height: 190px; margin: 18px auto 35px; diff --git a/app/assets/stylesheets/signup-modal.scss b/app/assets/stylesheets/signup-modal.scss index 125417130..f0a6ad4c9 100644 --- a/app/assets/stylesheets/signup-modal.scss +++ b/app/assets/stylesheets/signup-modal.scss @@ -68,7 +68,7 @@ vertical-align: calc(-0.1em - 2px); } } - .sloan { + .mascot-image { height: calc(7vw + 80px); margin-top: calc(6vh - 10px); } diff --git a/app/controllers/internal/configs_controller.rb b/app/controllers/internal/configs_controller.rb index da65eb3cd..f8c15c948 100644 --- a/app/controllers/internal/configs_controller.rb +++ b/app/controllers/internal/configs_controller.rb @@ -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 diff --git a/app/models/site_config.rb b/app/models/site_config.rb index 1cf074f16..b54b50ec9 100644 --- a/app/models/site_config.rb +++ b/app/models/site_config.rb @@ -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 diff --git a/app/views/internal/configs/show.html.erb b/app/views/internal/configs/show.html.erb index c4846a4a2..efb9f0513 100644 --- a/app/views/internal/configs/show.html.erb +++ b/app/views/internal/configs/show.html.erb @@ -37,6 +37,24 @@ +
+ <%= 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." %> +
Used in pre-login banners.
+
+ +
+ <%= 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." %> +
Used in signup modal.
+
+
Staff
@@ -193,11 +211,29 @@ main social image
-
-
Used as the primary sticker image
-
+
Used as the primary sticker image
+ + <%= f.label :mascot_image_url %> + <%= f.text_field :mascot_image_url, + class: "form-control", + value: SiteConfig.mascot_image_url, + placeholder: "https://image.url" %> +
+
+ <%= SiteConfig.mascot_image_description %> +
+
+
Used as the mascot image.
+
+
+ + <%= f.label :mascot_image_description %> + <%= f.text_field :mascot_image_description, + class: "form-control", + value: SiteConfig.mascot_image_description %> +
Used as the alt text for the mascot image
diff --git a/app/views/layouts/_signup_modal.html.erb b/app/views/layouts/_signup_modal.html.erb index a357fe6cf..acd931434 100644 --- a/app/views/layouts/_signup_modal.html.erb +++ b/app/views/layouts/_signup_modal.html.erb @@ -5,17 +5,11 @@
- <%= 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") %>

Join our <%= community_qualified_name %> :)

- We're a place where coders share, stay up-to-date and grow their careers. + <%= SiteConfig.tagline %>

<% if SiteConfig.auth_allowed?("twitter") %> diff --git a/app/views/stories/_sign_in_invitation.html.erb b/app/views/stories/_sign_in_invitation.html.erb index db4171521..1302c97e8 100644 --- a/app/views/stories/_sign_in_invitation.html.erb +++ b/app/views/stories/_sign_in_invitation.html.erb @@ -1,9 +1,11 @@

DEV is a community of
<%= number_with_delimiter User.estimated_count %> amazing humans who code. + <%= community_name %> is a community of
+ <%= number_with_delimiter User.estimated_count %> <%= SiteConfig.community_member_description %>

diff --git a/spec/requests/internal/configs_spec.rb b/spec/requests/internal/configs_spec.rb index 446282ab7..8955968d1 100644 --- a/spec/requests/internal/configs_spec.rb +++ b/spec/requests/internal/configs_spec.rb @@ -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 diff --git a/spec/views/layouts/signup_modal.html.erb_spec.rb b/spec/views/layouts/signup_modal.html.erb_spec.rb new file mode 100644 index 000000000..39e1f65f5 --- /dev/null +++ b/spec/views/layouts/signup_modal.html.erb_spec.rb @@ -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 diff --git a/spec/views/stories/sign_in_invitation.html.erb_spec.rb b/spec/views/stories/sign_in_invitation.html.erb_spec.rb new file mode 100644 index 000000000..3abc631ca --- /dev/null +++ b/spec/views/stories/sign_in_invitation.html.erb_spec.rb @@ -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