[deploy] Site Config: Get Started Section and Show Required Fields (#9289)
* chore: spike * fix: update doesnt get to symbol * spelling * chore: some suggestions * chore: change name * chore: content tag and safe join * chore: keep this open for now * chore: code climate * more code climate stuff * chore: remove commas * fix: tests * feat: update the descriptions and placeholders * chore: update all the variables * chore: update lines * feat: update "" * chore: length line * feat: content_tag * chore: disable rubocop:disable Rails/OutputSafety * feat: collapse the get started section if everything is filled out * chore: comment * some cleanup * codeclimate :(
This commit is contained in:
parent
3addb64326
commit
4359d5b09a
6 changed files with 351 additions and 77 deletions
|
|
@ -83,3 +83,17 @@
|
|||
body {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.site-config__required {
|
||||
background: #dc3545;
|
||||
border-radius: 19px;
|
||||
padding: 5px 15px;
|
||||
color: white;
|
||||
text-align: right;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.site-config__label {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
module VerifySetupCompleted
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
module_function
|
||||
|
||||
MANDATORY_CONFIGS = %i[
|
||||
community_description
|
||||
community_action
|
||||
|
|
@ -24,6 +26,10 @@ module VerifySetupCompleted
|
|||
# rubocop:enable Rails/LexicallyScopedActionFilter
|
||||
end
|
||||
|
||||
def setup_completed?
|
||||
MANDATORY_CONFIGS.all? { |config| SiteConfig.public_send(config).present? }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def verify_setup_completed
|
||||
|
|
@ -35,10 +41,6 @@ module VerifySetupCompleted
|
|||
# rubocop:enable Rails/OutputSafety
|
||||
end
|
||||
|
||||
def setup_completed?
|
||||
MANDATORY_CONFIGS.all? { |config| SiteConfig.public_send(config).present? }
|
||||
end
|
||||
|
||||
def config_path?
|
||||
request.env["PATH_INFO"] == internal_config_path
|
||||
end
|
||||
|
|
|
|||
|
|
@ -249,9 +249,14 @@ module ApplicationHelper
|
|||
HTMLEntities.new.decode(sanitize(str).to_str)
|
||||
end
|
||||
|
||||
# rubocop:disable Rails/OutputSafety
|
||||
def internal_config_label(method, content = nil)
|
||||
content ||= method.to_s.humanize
|
||||
content << "*" if method.in?(VerifySetupCompleted::MANDATORY_CONFIGS)
|
||||
label_tag("site_config_#{method}", content)
|
||||
content ||= raw("<span>#{method.to_s.humanize}</span>")
|
||||
if method.to_sym.in?(VerifySetupCompleted::MANDATORY_CONFIGS)
|
||||
content = safe_join([content, raw("<span class='site-config__required'>Required</span>")])
|
||||
end
|
||||
|
||||
tag.label(content, class: "site-config__label", for: "site_config_#{method}")
|
||||
end
|
||||
# rubocop:enable Rails/OutputSafety
|
||||
end
|
||||
|
|
|
|||
|
|
@ -69,4 +69,193 @@ module Constants
|
|||
"wikitetas.club",
|
||||
"xoxo.zone",
|
||||
].freeze
|
||||
|
||||
SITE_CONFIG_DETAILS = {
|
||||
authentication_providers: {
|
||||
description: "How can users sign in?",
|
||||
placeholder: ""
|
||||
},
|
||||
campaign_hero_html_variant_name: {
|
||||
description: "Hero HtmlVariant name",
|
||||
placeholder: ""
|
||||
},
|
||||
campaign_articles_require_approval: {
|
||||
description: "",
|
||||
placeholder: "Campaign stories show up on sidebar with approval?"
|
||||
},
|
||||
campaign_sidebar_enabled: {
|
||||
description: "",
|
||||
placeholder: "Campaign sidebar enabled or not"
|
||||
},
|
||||
campaign_sidebar_image: {
|
||||
description: "https://image.url",
|
||||
placeholder: "Used at the top of the campaign sidebar"
|
||||
},
|
||||
campaign_url: {
|
||||
description: "https://url.com/lander",
|
||||
placeholder: "URL campaign sidebar image will link to"
|
||||
},
|
||||
campaign_featured_tags: {
|
||||
description: "Posts with which tags will be featured in the campaign sidebar (comma separated, letters only)",
|
||||
placeholder: "List of campaign tags: comma separated, letters only e.g. shecoded,theycoded"
|
||||
},
|
||||
community_description: {
|
||||
description: "Used in meta description tags etc.",
|
||||
placeholder: "A fabulous community of kind and welcoming people."
|
||||
},
|
||||
community_member_label: {
|
||||
description: "Used to determine what a member will be called e.g developer, hobbyist etc.",
|
||||
placeholder: "user"
|
||||
},
|
||||
community_action: {
|
||||
description: "Used to determine the action of community e.g coding, reading, training etc.",
|
||||
placeholder: ""
|
||||
},
|
||||
tagline: {
|
||||
description: "Used in signup modal.",
|
||||
placeholder: "We're a place where coders share, stay up-to-date and grow their careers."
|
||||
},
|
||||
email_addresses: {
|
||||
description: "Email address",
|
||||
placeholder: ""
|
||||
},
|
||||
periodic_email_digest_max: {
|
||||
description: "Determines the maximum for the periodic email digest",
|
||||
placeholder: 0
|
||||
},
|
||||
periodic_email_digest_min: {
|
||||
description: "Determines the mininum for the periodic email digest",
|
||||
placeholder: 2
|
||||
},
|
||||
jobs_url: {
|
||||
description: "URL of the website where open positions are posted",
|
||||
placeholder: "Jobs URL"
|
||||
},
|
||||
display_jobs_banner: {
|
||||
description: "Display a jobs banner that points users to the jobs page when they type 'job'" \
|
||||
"or 'jobs' in the search box",
|
||||
placeholder: ""
|
||||
},
|
||||
ga_view_id: {
|
||||
description: "Google Analytics Reporting API v4 - View ID",
|
||||
placeholder: ""
|
||||
},
|
||||
ga_fetch_rate: {
|
||||
description: "Determines how often the site updates its Google Analytics stats",
|
||||
placeholder: 1
|
||||
},
|
||||
main_social_image: {
|
||||
description: "Used as the main image in social networks and OpenGraph",
|
||||
placeholder: "https://image.url"
|
||||
},
|
||||
favicon_url: {
|
||||
description: "Used as the site favicon",
|
||||
placeholder: "https://image.url"
|
||||
},
|
||||
logo_png: {
|
||||
description: "Minimum 1024px, used for PWA etc.",
|
||||
placeholder: "https://image.url/image.png"
|
||||
},
|
||||
logo_svg: {
|
||||
description: "Used as the SVG logo of the community",
|
||||
placeholder: "<svg ...></svg>"
|
||||
},
|
||||
secondary_logo_url: {
|
||||
description: "Used as the secondary logo",
|
||||
placeholder: "https://image.url"
|
||||
},
|
||||
left_navbar_svg_icon: {
|
||||
description: "The SVG icon used to expand the left navbar navigation menu. Should be a max of 24x24px.",
|
||||
placeholder: "<svg ...></svg>"
|
||||
},
|
||||
right_navbar_svg_icon: {
|
||||
description: "The SVG icon used to expand the right navbar navigation menu. Should be a max of 24x24px.",
|
||||
placeholder: "<svg ...></svg>"
|
||||
},
|
||||
mascot_user_id: {
|
||||
description: "User ID of the Mascot account",
|
||||
placeholder: "1"
|
||||
},
|
||||
mascot_image_url: {
|
||||
description: "Used as the mascot image.",
|
||||
placeholder: "https://image.url"
|
||||
},
|
||||
mascot_footer_image_url: {
|
||||
description: "Special cute mascot image used in the footer.",
|
||||
placeholder: "https://image.url"
|
||||
},
|
||||
mascot_image_description: {
|
||||
description: "Used as the alt text for the mascot image",
|
||||
placeholder: ""
|
||||
},
|
||||
meta_keywords: {
|
||||
description: "",
|
||||
placeholder: "List of valid keywords: comma separated, letters only e.g. engineering, development"
|
||||
},
|
||||
shop_url: {
|
||||
description: "Used as the shop url of the community",
|
||||
placeholder: "https://shop.url"
|
||||
},
|
||||
payment_pointer: {
|
||||
description: "Used for site-wide web monetization. " \
|
||||
"See: https://github.com/thepracticaldev/dev.to/pull/6345",
|
||||
placeholder: "$pay.somethinglikethis.co/value"
|
||||
},
|
||||
mailchimp_newsletter_id: {
|
||||
description: "Main Newsletter ID",
|
||||
placeholder: ""
|
||||
},
|
||||
mailchimp_sustaining_members_id: {
|
||||
description: "Sustaining Members Newsletter ID",
|
||||
placeholder: ""
|
||||
},
|
||||
mailchimp_tag_moderators_id: {
|
||||
description: "Tag Moderators Newsletter ID",
|
||||
placeholder: ""
|
||||
},
|
||||
mailchimp_community_moderators_id: {
|
||||
description: "Community Moderators Newsletter ID",
|
||||
placeholder: ""
|
||||
},
|
||||
onboarding_logo_image: {
|
||||
description: "Main onboarding display logo image",
|
||||
placeholder: "https://image.url"
|
||||
},
|
||||
onboarding_background_image: {
|
||||
description: "Background for onboarding splash page",
|
||||
placeholder: "https://image.url"
|
||||
},
|
||||
onboarding_taskcard_image: {
|
||||
description: "Used as the onboarding task-card image",
|
||||
placeholder: "https://image.url"
|
||||
},
|
||||
suggested_tags: {
|
||||
description: "Determines which tags are suggested to new users during onboarding (comma
|
||||
separated, letters only)",
|
||||
placeholder: "List of valid tags: comma separated, letters only e.g. beginners,javascript,ruby,swift,kotlin"
|
||||
},
|
||||
suggested_users: {
|
||||
description: "Determines which users are suggested to follow to new users during onboarding (comma" \
|
||||
"separated, letters only). Please note that these users will be shown as a fallback if no" \
|
||||
"recently-active commenters or producers can be suggested",
|
||||
placeholder: "List of valid usernames: comma separated, letters only e.g. ben,jess,peter,maestromac,andy,liana"
|
||||
},
|
||||
twitter_hashtag: {
|
||||
description: "Used as the twitter hashtag of the community",
|
||||
placeholder: "#DEVCommunity"
|
||||
},
|
||||
sponsor_headline: {
|
||||
description: "Determines the heading text of the main sponsors sidebar above the list of sponsors.",
|
||||
placeholder: "Community Sponsors"
|
||||
},
|
||||
sidebar_tags: {
|
||||
description: "Determines which tags are shown on the homepage righthand sidebar",
|
||||
placeholder: "List of valid tags: comma separated, letters only e.g. help,discuss,explainlikeimfive,meta"
|
||||
},
|
||||
feed_style: {
|
||||
description: "Determines which default feed the users sees (rich content, more minimal, etc.)",
|
||||
placeholder: "basic, rich, or compact"
|
||||
}
|
||||
# Dynamic values ommitted: configurable_rate_limits and social_media_handles
|
||||
}.freeze
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<div class="alert alert-warning" role="alert">
|
||||
<p>
|
||||
Only admins with explicit <strong>single resource admin</strong> role may make changes to site config. Even super admins require this permission.
|
||||
<p>
|
||||
</p>
|
||||
<h2>
|
||||
<% if current_user.has_role?(:single_resource_admin, Config) %>
|
||||
<div class="alert alert-primary">You have permission to make config changes. Do so with care.</div>
|
||||
|
|
@ -11,16 +11,83 @@
|
|||
</h2>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row my-3" id="getStarted">
|
||||
<div class="card w-100">
|
||||
<div class="card-header" id="getStartedHeader" data-toggle="collapse"
|
||||
data-target="#getStartedBodyContainer" aria-expanded="true" aria-controls="getStartedBodyContainer">
|
||||
<h2 class="d-inline">Get Started</h2>
|
||||
<button class="btn btn-secondary float-right" type="button">
|
||||
Toggle Get Started
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="getStartedBodyContainer" class="<%= VerifySetupCompleted.setup_completed? ? 'hide collapse': 'show expand' %> p-3" aria-labelledby="siteConfigHeader">
|
||||
<%= form_for(SiteConfig.new, url: internal_config_path) do |f| %>
|
||||
|
||||
<% VerifySetupCompleted::MANDATORY_CONFIGS.each do |config_key| %>
|
||||
<!-- we need to list the config as separate fields if the data structure is a Hash -->
|
||||
<% if SiteConfig.public_send(config_key).is_a?(Hash) %>
|
||||
<%= internal_config_label "#{config_key.to_s}" %>
|
||||
<div class="form-group">
|
||||
<%= f.fields_for config_key do |a_field| %>
|
||||
<% SiteConfig.public_send(config_key).each do |key, value| %>
|
||||
<div>
|
||||
<%= internal_config_label "#{key}" %>
|
||||
<%= a_field.text_field key,
|
||||
class: "form-control",
|
||||
value: SiteConfig.public_send(config_key)[key],
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[config_key][:placeholder] %>
|
||||
<div class="alert alert-info"><%= "#{key} #{config_key.to_s.gsub! '_', ' '}" %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% elsif SiteConfig.public_send(config_key).is_a?(Array) %>
|
||||
<div class="form-group">
|
||||
<%= internal_config_label config_key %>
|
||||
<%= f.text_field config_key,
|
||||
class: "form-control",
|
||||
value: SiteConfig.public_send(config_key).join(","),
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[config_key][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[config_key][:description] %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="form-group">
|
||||
<%= internal_config_label config_key %>
|
||||
<%= f.text_field config_key,
|
||||
class: "form-control",
|
||||
value: SiteConfig.public_send(config_key),
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[config_key][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[config_key][:description] %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if current_user.has_role?(:single_resource_admin, Config) %>
|
||||
<div class="form-group">
|
||||
<%= label_tag "Please type out the sentence below to submit:" %>
|
||||
<%= text_field_tag :confirmation, nil, class: "form-control", placeholder: "Confirmation text", autocomplete: "off" %>
|
||||
<div class="alert alert-info">Type the sentence: My username is @your_username and this action is 100% safe and appropriate.</div>
|
||||
<%= f.submit "Update Site Configuration", class: "btn btn-danger btn-lg" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row my-3" id="siteConfig">
|
||||
<div class="card w-100">
|
||||
<div class="card-header" id="siteConfigHeader" data-toggle="collapse"
|
||||
data-target="#siteConfigBodyContainer" aria-expanded="true" aria-controls="siteConfigBodyContainer">
|
||||
<h2 class="d-inline">Site Configuration</h2>
|
||||
data-target="#siteConfigBodyContainer" aria-expanded="false" aria-controls="siteConfigBodyContainer">
|
||||
<h2 class="d-inline">All Site Configuration</h2>
|
||||
<button class="btn btn-secondary float-right" type="button">
|
||||
Toggle Site Configuration
|
||||
</button>
|
||||
</div>
|
||||
<div id="siteConfigBodyContainer" class="collapse show hide p-3" aria-labelledby="siteConfigHeader">
|
||||
<div id="siteConfigBodyContainer" class="collapse hide hide p-3" aria-labelledby="siteConfigHeader">
|
||||
<%= form_for(SiteConfig.new, url: internal_config_path) do |f| %>
|
||||
|
||||
<div class="card mt-3">
|
||||
|
|
@ -204,7 +271,7 @@
|
|||
class: "form-control",
|
||||
value: SiteConfig.email_addresses[type],
|
||||
placeholder: "" %>
|
||||
<div class="alert alert-info"><%= type.capitalize %> Email</div>
|
||||
<div class="alert alert-info"><%= type.capitalize %>Email</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
@ -226,8 +293,8 @@
|
|||
<%= f.number_field :periodic_email_digest_max,
|
||||
class: "form-control",
|
||||
value: SiteConfig.periodic_email_digest_max,
|
||||
placeholder: 0 %>
|
||||
<div class="alert alert-info">Determines the maximum for the periodic email digest</div>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:periodic_email_digest_max][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:periodic_email_digest_max][:description] %></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
@ -235,8 +302,8 @@
|
|||
<%= f.number_field :periodic_email_digest_min,
|
||||
class: "form-control",
|
||||
value: SiteConfig.periodic_email_digest_min,
|
||||
placeholder: 2 %>
|
||||
<div class="alert alert-info">Determines the mininum for the periodic email digest</div>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:periodic_email_digest_max][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:periodic_email_digest_max][:description] %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -255,13 +322,13 @@
|
|||
<%= f.text_field :jobs_url,
|
||||
class: "form-control",
|
||||
value: SiteConfig.jobs_url,
|
||||
placeholder: "Jobs URL" %>
|
||||
<div class="alert alert-info">URL of the website where open positions are posted.</div>
|
||||
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:jobs_url][:placeholder] %>
|
||||
<div class="alert alert-info"><%=Constants::SITE_CONFIG_DETAILS[:jobs_url][:description] %></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= internal_config_label :display_jobs_banner %>
|
||||
<%= f.check_box :display_jobs_banner, checked: SiteConfig.display_jobs_banner %>
|
||||
<div class="alert alert-info">Display a jobs banner that points users to the <%= community_name %> jobs page when they type "job" or "jobs" in the search box</div>
|
||||
<div class="alert alert-info"><%=Constants::SITE_CONFIG_DETAILS[:display_jobs_banner][:description] %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -280,7 +347,7 @@
|
|||
<%= f.text_field :ga_view_id,
|
||||
class: "form-control",
|
||||
value: SiteConfig.ga_view_id %>
|
||||
<div class="alert alert-info">Google Analytics Reporting API v4 - View ID</div>
|
||||
<div class="alert alert-info"><%=Constants::SITE_CONFIG_DETAILS[:ga_view_id][:description] %></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
@ -289,8 +356,8 @@
|
|||
class: "form-control",
|
||||
value: SiteConfig.ga_fetch_rate,
|
||||
min: 1,
|
||||
placeholder: 1 %>
|
||||
<div class="alert alert-info">Determines how often the site updates its Google Analytics stats</div>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:ga_fetch_rate][:placeholder] %>
|
||||
<div class="alert alert-info"><%=Constants::SITE_CONFIG_DETAILS[:ga_fetch_rate][:description] %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -309,8 +376,8 @@
|
|||
<%= f.text_field :main_social_image,
|
||||
class: "form-control",
|
||||
value: SiteConfig.main_social_image,
|
||||
placeholder: "https://image.url" %>
|
||||
<div class="alert alert-info">Used as the main image in social networks and OpenGraph </div>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:main_social_image][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:main_social_image][:description] %></div>
|
||||
<% if SiteConfig.main_social_image.present? %>
|
||||
<img alt="main social image" class="img-fluid" src="<%= SiteConfig.main_social_image %>" />
|
||||
<% end %>
|
||||
|
|
@ -320,8 +387,8 @@
|
|||
<%= f.text_field :favicon_url,
|
||||
class: "form-control",
|
||||
value: SiteConfig.favicon_url,
|
||||
placeholder: "https://image.url" %>
|
||||
<div class="alert alert-info">Used as the site favicon</div>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:favicon_url][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:favicon_url][:description] %></div>
|
||||
<img alt="favicon" class="preview" src="<%= SiteConfig.favicon_url %>" />
|
||||
</div>
|
||||
|
||||
|
|
@ -330,8 +397,8 @@
|
|||
<%= f.text_field :logo_png,
|
||||
class: "form-control",
|
||||
value: SiteConfig.logo_png,
|
||||
placeholder: "https://image.url/image.png" %>
|
||||
<div class="alert alert-info">Minimum 1024px, used for PWA etc.</div>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:logo_png][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:logo_png][:description] %></div>
|
||||
<% if SiteConfig.logo_png.present? %>
|
||||
<img class="preview" src="<%= SiteConfig.logo_png %>" />
|
||||
<% end %>
|
||||
|
|
@ -343,8 +410,8 @@
|
|||
class: "form-control",
|
||||
value: SiteConfig.logo_svg,
|
||||
rows: 6,
|
||||
placeholder: "<svg ...></svg>" %>
|
||||
<div class="alert alert-info">Used as the SVG logo of the community</div>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:logo_svg][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:logo_svg][:description] %></div>
|
||||
<% if SiteConfig.logo_svg.present? %>
|
||||
<%= SiteConfig.logo_svg.html_safe %>
|
||||
<% end %>
|
||||
|
|
@ -355,8 +422,8 @@
|
|||
<%= f.text_field :secondary_logo_url,
|
||||
class: "form-control",
|
||||
value: SiteConfig.secondary_logo_url,
|
||||
placeholder: "https://image.url" %>
|
||||
<div class="alert alert-info">Used as the secondary logo </div>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:secondary_logo_url][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:secondary_logo_url][:description] %></div>
|
||||
<% if SiteConfig.secondary_logo_url.present? %>
|
||||
<img alt="secondary logo image" class="img-fluid" src="<%= SiteConfig.secondary_logo_url %>" />
|
||||
<% end %>
|
||||
|
|
@ -368,8 +435,8 @@
|
|||
class: "form-control",
|
||||
value: SiteConfig.left_navbar_svg_icon,
|
||||
rows: 6,
|
||||
placeholder: "<svg ...></svg>" %>
|
||||
<div class="alert alert-info">The SVG icon used to expand the left navbar navigation menu. Should be a max of 24x24px.</div>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:left_navbar_svg_icon][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:left_navbar_svg_icon][:description] %></div>
|
||||
<%= SiteConfig.left_navbar_svg_icon.html_safe %>
|
||||
</div>
|
||||
|
||||
|
|
@ -379,8 +446,8 @@
|
|||
class: "form-control",
|
||||
value: SiteConfig.right_navbar_svg_icon,
|
||||
rows: 6,
|
||||
placeholder: "<svg ...></svg>" %>
|
||||
<div class="alert alert-info">The SVG icon used to expand the right navbar navigation menu. Should be a max of 24x24px.</div>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:right_navbar_svg_icon][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:right_navbar_svg_icon][:description] %></div>
|
||||
<%= SiteConfig.right_navbar_svg_icon.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -402,8 +469,8 @@
|
|||
class: "form-control",
|
||||
value: SiteConfig.mascot_user_id,
|
||||
min: 1,
|
||||
placeholder: "1" %>
|
||||
<div class="alert alert-info">User ID of the Mascot account</div>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:mascot_user_id][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:mascot_user_id][:description] %></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
@ -411,13 +478,13 @@
|
|||
<%= f.text_field :mascot_image_url,
|
||||
class: "form-control",
|
||||
value: SiteConfig.mascot_image_url,
|
||||
placeholder: "https://image.url" %>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:mascot_image_url][:placeholder] %>
|
||||
|
||||
<div class="col-12">
|
||||
<img alt="<%= SiteConfig.mascot_image_description %>" class="img-fluid" src="<%= SiteConfig.mascot_image_url %>" />
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info"> Used as the mascot image. </div>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:mascot_image_url][:description] %></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
@ -425,13 +492,13 @@
|
|||
<%= f.text_field :mascot_footer_image_url,
|
||||
class: "form-control",
|
||||
value: SiteConfig.mascot_footer_image_url,
|
||||
placeholder: "https://image.url" %>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:mascot_footer_image_url][:placeholder] %>
|
||||
|
||||
<div class="col-12">
|
||||
<img alt="<%= SiteConfig.mascot_image_description %>" class="img-fluid" src="<%= SiteConfig.mascot_footer_image_url %>" />
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info"> Special cute mascot image used in the footer. </div>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:mascot_footer_image_url][:description] %></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
@ -439,8 +506,7 @@
|
|||
<%= 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 class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:mascot_image_description][:description] %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -462,7 +528,7 @@
|
|||
<%= meta_keywords_field.text_field area,
|
||||
class: "form-control",
|
||||
value: SiteConfig.meta_keywords[area],
|
||||
placeholder: "" %>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:meta_keywords][:placeholder] %>
|
||||
<div class="alert alert-info"><%= area.capitalize %><%= " page" unless area == "default" %> keywords</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
@ -485,8 +551,8 @@
|
|||
<%= f.text_field :shop_url,
|
||||
class: "form-control",
|
||||
value: SiteConfig.shop_url,
|
||||
placeholder: "Shop url" %>
|
||||
<div class="alert alert-info">Used as the shop url of the community</div>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:shop_url][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:shop_url][:description] %></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
@ -494,8 +560,8 @@
|
|||
<%= f.text_field :payment_pointer,
|
||||
class: "form-control",
|
||||
value: SiteConfig.payment_pointer,
|
||||
placeholder: "$pay.somethinglikethis.co/value" %>
|
||||
<div class="alert alert-info">Used for site-wide web monetization (<a href="https://github.com/thepracticaldev/dev.to/pull/6345">experimental</a>)</div>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:payment_pointer][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:payment_pointer][:description] %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -514,7 +580,7 @@
|
|||
<%= f.text_field :mailchimp_newsletter_id,
|
||||
class: "form-control",
|
||||
value: SiteConfig.mailchimp_newsletter_id %>
|
||||
<div class="alert alert-info">Main Newsletter ID</div>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:mailchimp_newsletter_id][:description] %></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
@ -522,7 +588,7 @@
|
|||
<%= f.text_field :mailchimp_sustaining_members_id,
|
||||
class: "form-control",
|
||||
value: SiteConfig.mailchimp_sustaining_members_id %>
|
||||
<div class="alert alert-info">Sustaining Members Newsletter ID</div>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:mailchimp_sustaining_members_id][:description] %></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
@ -530,7 +596,7 @@
|
|||
<%= f.text_field :mailchimp_tag_moderators_id,
|
||||
class: "form-control",
|
||||
value: SiteConfig.mailchimp_tag_moderators_id %>
|
||||
<div class="alert alert-info">Tag Moderators Newsletter ID</div>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:mailchimp_tag_moderators_id][:description] %></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
@ -538,7 +604,7 @@
|
|||
<%= f.text_field :mailchimp_community_moderators_id,
|
||||
class: "form-control",
|
||||
value: SiteConfig.mailchimp_community_moderators_id %>
|
||||
<div class="alert alert-info">Community Moderators Newsletter ID</div>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:mailchimp_community_moderators_id][:description] %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -557,13 +623,13 @@
|
|||
<%= f.text_field :onboarding_logo_image,
|
||||
class: "form-control",
|
||||
value: SiteConfig.onboarding_logo_image,
|
||||
placeholder: "https://image.url" %>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:onboarding_logo_image][:placeholder] %>
|
||||
<div class="row mt-2">
|
||||
<div class="col-12">
|
||||
<img alt="main social image" class="img-fluid" src="<%= SiteConfig.onboarding_logo_image %>" />
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="alert alert-info"> Main onboarding display logo image </div>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:onboarding_logo_image][:description] %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -573,13 +639,13 @@
|
|||
<%= f.text_field :onboarding_background_image,
|
||||
class: "form-control",
|
||||
value: SiteConfig.onboarding_background_image,
|
||||
placeholder: "https://image.url" %>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:onboarding_background_image][:placeholder] %>
|
||||
<div class="row mt-2">
|
||||
<div class="col-12">
|
||||
<img alt="main social image" class="img-fluid" src="<%= SiteConfig.onboarding_background_image %>" />
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="alert alert-info"> Background for onboarding splash page </div>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:onboarding_background_image][:description] %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -589,13 +655,13 @@
|
|||
<%= f.text_field :onboarding_taskcard_image,
|
||||
class: "form-control",
|
||||
value: SiteConfig.onboarding_taskcard_image,
|
||||
placeholder: "https://image.url" %>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:onboarding_taskcard_image][:placeholder] %>
|
||||
<div class="row mt-2">
|
||||
<div class="col-12">
|
||||
<img alt="main social image" class="img-fluid" src="<%= SiteConfig.onboarding_taskcard_image %>" />
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="alert alert-info"> Used as the onboarding task-card image </div>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:onboarding_taskcard_image][:description] %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -605,9 +671,8 @@
|
|||
<%= f.text_field :suggested_users,
|
||||
class: "form-control",
|
||||
value: SiteConfig.suggested_users.join(","),
|
||||
placeholder: "List of valid usernames: comma separated, letters only e.g. ben,jess,peter,maestromac,andy,liana" %>
|
||||
<div class="alert alert-info">Determines which users are suggested to follow to new users during onboarding (comma
|
||||
separated, letters only). Please note that these users will be shown as a fallback if no recently-active commenters or producers can be suggested.</div>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:suggested_users][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:suggested_users][:description] %></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
@ -615,9 +680,8 @@
|
|||
<%= f.text_field :suggested_tags,
|
||||
class: "form-control",
|
||||
value: SiteConfig.suggested_tags.join(","),
|
||||
placeholder: "List of valid tags: comma separated, letters only e.g. beginners,javascript,ruby,swift,kotlin" %>
|
||||
<div class="alert alert-info">Determines which tags are suggested to new users during onboarding (comma
|
||||
separated, letters only)</div>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:suggested_tags][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:suggested_tags][:description] %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -636,7 +700,7 @@
|
|||
<%= internal_config_label key %>
|
||||
<%= f.number_field key,
|
||||
class: "form-control",
|
||||
value: SiteConfig.send(key),
|
||||
value: SiteConfig.public_send(key),
|
||||
min: field_hash[:min],
|
||||
placeholder: field_hash[:placeholder] %>
|
||||
<div class="alert alert-info"><%= field_hash[:description] %></div>
|
||||
|
|
@ -659,8 +723,8 @@
|
|||
<%= f.text_field :twitter_hashtag,
|
||||
class: "form-control",
|
||||
value: SiteConfig.twitter_hashtag.to_s,
|
||||
placeholder: "#DEVCommunity" %>
|
||||
<div class="alert alert-info">Used as the twitter hashtag of the community</div>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:twitter_hashtag][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:twitter_hashtag][:description] %></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.fields_for :social_media_handles do |social_media_field| %>
|
||||
|
|
@ -693,8 +757,8 @@
|
|||
<%= f.text_field :sponsor_headline,
|
||||
class: "form-control",
|
||||
value: SiteConfig.sponsor_headline,
|
||||
placeholder: "Community Sponsors" %>
|
||||
<div class="alert alert-info">Determines the heading text of the main sponsors sidebar above the list of sponsors.</div>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:sponsor_headline][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:sponsor_headline][:description] %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -713,8 +777,8 @@
|
|||
<%= f.text_field :sidebar_tags,
|
||||
class: "form-control",
|
||||
value: SiteConfig.sidebar_tags.join(","),
|
||||
placeholder: "List of valid tags: comma separated, letters only e.g. help,discuss,explainlikeimfive,meta" %>
|
||||
<div class="alert alert-info">Determines which tags are shown on the homepage righthand sidebar</div>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:sidebar_tags][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:sidebar_tags][:description] %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -733,8 +797,8 @@
|
|||
<%= f.text_field :feed_style,
|
||||
class: "form-control",
|
||||
value: SiteConfig.feed_style,
|
||||
placeholder: "basic, rich, or compact" %>
|
||||
<div class="alert alert-info">Determines which default feed the users sees (rich content, more minimal, etc.)</div>
|
||||
placeholder: Constants::SITE_CONFIG_DETAILS[:feed_style][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:feed_style][:description] %></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= internal_config_label :public %>
|
||||
|
|
@ -751,7 +815,7 @@
|
|||
<div class="form-group">
|
||||
<%= label_tag :confirmation %>
|
||||
<%= text_field_tag :confirmation, nil, class: "form-control", placeholder: "Confirmation text", autocomplete: "off" %>
|
||||
<div class="alert alert-info">Type: My username is @your_username and this action is 100% safe and appropriate.</div>
|
||||
<div class="alert alert-info">Type the sentence: My username is @your_username and this action is 100% safe and appropriate.</div>
|
||||
<%= f.submit "Update Site Configuration", class: "btn btn-danger btn-lg" %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ RSpec.describe "Admin manages configuration", type: :system do
|
|||
(VerifySetupCompleted::MANDATORY_CONFIGS - [:meta_keywords]).each do |option|
|
||||
it "marks #{option} as required" do
|
||||
selector = "label[for='site_config_#{option}']"
|
||||
expect(find(selector).text).to end_with("*")
|
||||
expect(first(selector).text).to include("Required")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue