Allow community admins to alter site description (#6662) [deploy]
* Allow community admins to alter site description * Fix typo
This commit is contained in:
parent
066e2885e8
commit
de27e7ed34
11 changed files with 45 additions and 14 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -6,19 +6,19 @@
|
|||
) %>
|
||||
|
||||
<link rel="canonical" href="<%= app_protocol_and_domain %><%= request.path %>" />
|
||||
<meta name="description" content="Where programmers share ideas and help each other grow.">
|
||||
<meta name="description" content="<%= SiteConfig.community_description %>">
|
||||
<meta name="keywords" content="software development,engineering,rails,javascript,ruby">
|
||||
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="<%= app_protocol_and_domain %><%= request.path %>" />
|
||||
<meta property="og:title" content="<%= title_with_timeframe(page_title: community_qualified_name, timeframe: params[:timeframe]) %>" />
|
||||
<meta property="og:image" content="<%= SiteConfig.main_social_image %>">
|
||||
<meta property="og:description" content="Where programmers share ideas and help each other grow." />
|
||||
<meta property="og:description" content="<%= SiteConfig.community_description %>" />
|
||||
<meta property="og:site_name" content="<%= community_qualified_name %>" />
|
||||
|
||||
<meta name="twitter:site" content="@<%= SiteConfig.social_networks_handle %>">
|
||||
<meta name="twitter:title" content="<%= title_with_timeframe(page_title: community_qualified_name, timeframe: params[:timeframe]) %>">
|
||||
<meta name="twitter:description" content="Where programmers share ideas, experiences, and help each other grow.">
|
||||
<meta name="twitter:description" content="<%= SiteConfig.community_description %>">
|
||||
<meta name="twitter:image:src" content="<%= SiteConfig.main_social_image %>">
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<%= auto_discovery_link_tag(:rss, "#{app_protocol_and_domain}/feed", title: "#{ApplicationConfig['COMMUNITY_NAME']} RSS Feed") %>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
<% title "Search Results" %>
|
||||
<link rel="canonical" href="https://<%= ApplicationConfig["APP_DOMAIN"] %>/search" />
|
||||
<meta name="description" content="Where programmers share ideas and help each other grow.">
|
||||
<meta name="description" content="<%= SiteConfig.community_description %>">
|
||||
<meta name="keywords" content="software development,engineering,rails,javascript,ruby">
|
||||
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="DEV => Search Results" />
|
||||
<meta property="og:title" content="The DEV Community" />
|
||||
<meta property="og:image" content="<%= SiteConfig.main_social_image %>">
|
||||
<meta property="og:description" content="Where programmers share ideas and help each other grow." />
|
||||
<meta property="og:description" content="<%= SiteConfig.community_description %>">
|
||||
<meta property="og:site_name" content="The DEV Community" />
|
||||
|
||||
<meta name="twitter:site" content="@<%= SiteConfig.social_networks_handle %>">
|
||||
<meta name="twitter:title" content="DEV => Search Results">
|
||||
<meta name="twitter:description" content="Where programmers share ideas, experiences, and help each other grow.">
|
||||
<meta name="twitter:description" content="<%= SiteConfig.community_description %>">
|
||||
<meta name="twitter:image:src" content="<%= SiteConfig.main_social_image %>">
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
<% title "Listings" %>
|
||||
|
||||
<link rel="canonical" href="https://dev.to<%= request.path %>" />
|
||||
<meta name="description" content="Where programmers share ideas and help each other grow.">
|
||||
<meta name="description" content="<%= SiteConfig.community_description %>">
|
||||
<meta name="keywords" content="software development,engineering,rails,javascript,ruby">
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="https://dev.to<%= request.path %>" />
|
||||
<meta property="og:site_name" content="<%= community_qualified_name %>" />
|
||||
<% if @displayed_classified_listing %>
|
||||
<meta property="og:title" content="<%= truncate @displayed_classified_listing.title, length: 54 %>" />
|
||||
<meta property="og:title" content="<%= truncate @displayed_classified_listing.title, length: 54 %>">
|
||||
<meta property="og:description" content="DEV Listing" />
|
||||
<meta property="og:image" content="<%= listing_social_image_url @displayed_classified_listing %>">
|
||||
<meta name="twitter:title" content="<%= truncate @displayed_classified_listing.title, length: 54 %>">
|
||||
|
|
@ -16,10 +16,10 @@
|
|||
<meta name="twitter:image:src" content="<%= listing_social_image_url @displayed_classified_listing %>">
|
||||
<% else %>
|
||||
<meta property="og:title" content="Listings" />
|
||||
<meta property="og:description" content="Where programmers share ideas and help each other grow." />
|
||||
<meta property="og:description" content="<%= SiteConfig.community_description %>" />
|
||||
<meta property="og:image" content="https://thepracticaldev.s3.amazonaws.com/i/sa3xjflbtvt9zw0xpan5.png">
|
||||
<meta name="twitter:title" content="Listings">
|
||||
<meta name="twitter:description" content="Where programmers share ideas, experiences, and help each other grow.">
|
||||
<meta name="twitter:description" content="<%= SiteConfig.community_description %>">
|
||||
<meta name="twitter:image:src" content="https://thepracticaldev.s3.amazonaws.com/i/sa3xjflbtvt9zw0xpan5.png">
|
||||
<% end %>
|
||||
<meta name="twitter:site" content="@<%= SiteConfig.social_networks_handle %>">
|
||||
|
|
|
|||
|
|
@ -22,6 +22,21 @@
|
|||
</div>
|
||||
<div id="siteConfigBodyContainer" class="collapse show hide" aria-labelledby="siteConfigHeader">
|
||||
<%= form_for(SiteConfig.new, url: internal_config_path) do |f| %>
|
||||
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">Content</div>
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<%= 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." %>
|
||||
<div class="alert alert-info">Used in meta description tags etc.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">Staff</div>
|
||||
<div class="card-body">
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<% title "Videos" %>
|
||||
|
||||
<link rel="canonical" href="https://dev.to<%= request.path %>" />
|
||||
<meta name="description" content="Where programmers share ideas and help each other grow.">
|
||||
<meta name="description" content="<%= SiteConfig.community_description %>">
|
||||
<meta name="keywords" content="software development,engineering,rails,javascript,ruby">
|
||||
|
||||
<meta property="og:type" content="website" />
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue