diff --git a/app/controllers/internal/configs_controller.rb b/app/controllers/internal/configs_controller.rb index 283fa96d9..79e4fc496 100644 --- a/app/controllers/internal/configs_controller.rb +++ b/app/controllers/internal/configs_controller.rb @@ -25,7 +25,7 @@ class Internal::ConfigsController < Internal::ApplicationController campaign_sidebar_image main_social_image favicon_url logo_svg rate_limit_follow_count_daily - ga_view_id ga_fetch_rate + ga_view_id ga_fetch_rate community_description 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 fc513884d..69dd239f2 100644 --- a/app/models/site_config.rb +++ b/app/models/site_config.rb @@ -8,6 +8,9 @@ class SiteConfig < RailsSettings::Base # the cache, or call SiteConfig.clear_cache cache_prefix { "v1" } + # site content + field :community_description, type: :string, default: "A constructive and inclusive social network. Open source and radically transparent." + # staff account field :staff_user_id, type: :integer, default: 1 field :default_site_email, type: :string, default: "yo@dev.to" diff --git a/app/views/articles/feed.rss.builder b/app/views/articles/feed.rss.builder index 6f478fd0c..9394e353c 100644 --- a/app/views/articles/feed.rss.builder +++ b/app/views/articles/feed.rss.builder @@ -5,7 +5,7 @@ xml.rss version: "2.0" do xml.channel do xml.title @user ? @user.name : "DEV Community" xml.author @user ? @user.name : "DEV Community" - xml.description @user ? @user.summary : "Where programmers share ideas and help each other grow." + xml.description @user ? @user.summary : SiteConfig.community_description xml.link @user ? "https://dev.to" + @user.path : "https://dev.to" xml.language "en" diff --git a/app/views/articles/index.html.erb b/app/views/articles/index.html.erb index 25ee182a7..3cc401554 100644 --- a/app/views/articles/index.html.erb +++ b/app/views/articles/index.html.erb @@ -6,19 +6,19 @@ ) %> - + - + - + <%= auto_discovery_link_tag(:rss, "#{app_protocol_and_domain}/feed", title: "#{ApplicationConfig['COMMUNITY_NAME']} RSS Feed") %> diff --git a/app/views/articles/search/_meta.html.erb b/app/views/articles/search/_meta.html.erb index a3f54ae19..bfa9cab69 100644 --- a/app/views/articles/search/_meta.html.erb +++ b/app/views/articles/search/_meta.html.erb @@ -1,17 +1,17 @@ <% title "Search Results" %> /search" /> - + - + - + diff --git a/app/views/classified_listings/index.html.erb b/app/views/classified_listings/index.html.erb index 74fa7adf4..cc74ff123 100644 --- a/app/views/classified_listings/index.html.erb +++ b/app/views/classified_listings/index.html.erb @@ -2,13 +2,13 @@ <% title "Listings" %> - + <% if @displayed_classified_listing %> - + @@ -16,10 +16,10 @@ <% else %> - + - + <% end %> diff --git a/app/views/internal/configs/show.html.erb b/app/views/internal/configs/show.html.erb index fddf6e90b..64dcf67ab 100644 --- a/app/views/internal/configs/show.html.erb +++ b/app/views/internal/configs/show.html.erb @@ -22,6 +22,21 @@
<%= form_for(SiteConfig.new, url: internal_config_path) do |f| %> + +
+
Content
+
+
+ <%= f.label :community_description, "Community description" %> + <%= f.text_field :community_description, + class: "form-control", + value: SiteConfig.community_description, + placeholder: "A fabulous community of kind and welcoming people." %> +
Used in meta description tags etc.
+
+
+
+
Staff
diff --git a/app/views/service_worker/manifest.json.erb b/app/views/service_worker/manifest.json.erb index 0fe3d8eca..fb0e56571 100644 --- a/app/views/service_worker/manifest.json.erb +++ b/app/views/service_worker/manifest.json.erb @@ -1,7 +1,7 @@ { "name": "<%= ApplicationConfig["COMMUNITY_NAME"] %> Community", "short_name": "dev.to", - "description": "Where programmers share ideas, experiences, and help each other grow.", + "description": "<%= SiteConfig.community_description %>", "start_url": "/", "display": "standalone", "background_color": "#000000", diff --git a/app/views/videos/index.html.erb b/app/views/videos/index.html.erb index 553b8f90f..d74b42aa6 100644 --- a/app/views/videos/index.html.erb +++ b/app/views/videos/index.html.erb @@ -2,7 +2,7 @@ <% title "Videos" %> - + diff --git a/spec/requests/internal/configs_spec.rb b/spec/requests/internal/configs_spec.rb index ae0cf5eed..65d8bbb25 100644 --- a/spec/requests/internal/configs_spec.rb +++ b/spec/requests/internal/configs_spec.rb @@ -39,6 +39,14 @@ RSpec.describe "/internal/config", type: :request do sign_in(admin_plus_config) end + describe "content" do + it "updates the community_description" do + description = "Hey hey #{rand(100)}" + post "/internal/config", params: { site_config: { community_description: description }, confirmation: confirmation_message } + expect(SiteConfig.community_description).to eq(description) + end + end + describe "staff" do it "does not allow the staff_user_id to be updated" do expect(SiteConfig.staff_user_id).to eq(1) diff --git a/spec/requests/stories_index_spec.rb b/spec/requests/stories_index_spec.rb index 2f58f9ec0..d5933eb5c 100644 --- a/spec/requests/stories_index_spec.rb +++ b/spec/requests/stories_index_spec.rb @@ -9,6 +9,11 @@ RSpec.describe "StoriesIndex", type: :request do expect(response.body).to include(CGI.escapeHTML(article.title)) end + it "renders proper description" do + get "/" + expect(response.body).to include(SiteConfig.community_description) + end + it "renders page with min read" do get "/" expect(response.body).to include("min read")