feat: update the DEV Digest to be fully dynamic (#8213)

This commit is contained in:
Ridhwana 2020-06-01 19:56:29 +02:00 committed by GitHub
parent 5fd308c3c0
commit 02109e8e9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 7 deletions

View file

@ -89,6 +89,7 @@ class Internal::ConfigsController < Internal::ApplicationController
community_description
community_member_description
community_member_label
community_action
tagline
]
end

View file

@ -29,6 +29,7 @@ class SiteConfig < RailsSettings::Base
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 :community_member_label, type: :string, default: "user"
field :community_action, type: :string, default: "coding"
field :tagline, type: :string, default: "We're a place where coders share, stay up-to-date and grow their careers."
# Emails

View file

@ -170,6 +170,15 @@
<div class="alert alert-info">Used to determine what a member will be called e.g developer, hobbyist etc.</div>
</div>
<div class="form-group">
<%= f.label :community_action, "Community action" %>
<%= f.text_field :community_action,
class: "form-control",
value: SiteConfig.community_action,
placeholder: "" %>
<div class="alert alert-info">Used to determine the action of community e.g coding, reading, training etc.</div>
</div>
<div class="form-group">
<%= f.label :tagline, "Tagline" %>
<%= f.text_field :tagline,

View file

@ -21,18 +21,18 @@
<em>
<% if @user.experience_level == nil %>
<b>
You can now add your coding experience level to your account in order to receive more relevant content.
You can now add your <%= SiteConfig.community_action %> experience level to your account in order to receive more relevant content.
</b>
<br /><br />
Visit <b><a href="<%= app_url(user_settings_path(:misc)) %>" style="text-decoration: none;">your settings</a></b> to enter your experience level on a scale of 1-10.
<br /><br />
You can change it any time in the future. Happy coding!
You can change it any time in the future. Happy <%= SiteConfig.community_action %>!
<% elsif @user.follows.size == 0 %>
<b>
<%= community_name %> Digest is a new periodic email featuring the best posts from our community of <%= community_members_label %>.
</b>
<br /><br />
Your digest is not yet customized. Follow the people and technologies on
Your digest is not yet customized. Follow <%= community_members_label %> on
<a href="<%= app_url %>" style="text-decoration: none;"><%= community_name %></a> that interest you in order to receive the most relevant posts in your inbox.
<% else %>
<% tip_rand = rand(5) %>
@ -41,9 +41,9 @@
<% elsif tip_rand == 1 %>
Follow the authors you want to see more of!
<% elsif tip_rand == 2 %>
And there's so much more dev goodness to discover.
And there's so much more <%= community_name %> goodness to discover.
<% elsif tip_rand == 3 %>
You're a better dev today than you were yesterday.
You're a better <%= SiteConfig.community_member_label %> today than you were yesterday.
<% elsif tip_rand == 4 %>
<% if @user.articles.published.any? %>
Can't wait to see <b>your</b> next <%= community_name %> post!

View file

@ -14,7 +14,7 @@
<b><a href="<%= app_url("/community-moderation") %>">Click here for full details about basic mod privileges.</b></a>
</p>
<p>
Happy Coding!
Happy <%= SiteConfig.community_action %>!
<br>
- <%= community_name %> Team
</p>

View file

@ -8,6 +8,6 @@ You'll occasionally get on-site notifications asking you to take an action. You
Visit <%= app_url("/community-moderation") %> for full details of what you can do with these new privileges.
Happy Coding!
Happy <%= SiteConfig.community_action %>!
- <%= community_name %> Team

View file

@ -81,6 +81,12 @@ RSpec.describe "/internal/config", type: :request do
expect(SiteConfig.community_member_label).to eq(name)
end
it "updates the community_action" do
action = "reading"
post "/internal/config", params: { site_config: { community_member_label: action }, confirmation: confirmation_message }
expect(SiteConfig.community_member_label).to eq(action)
end
it "updates the tagline" do
description = "Hey hey #{rand(100)}"
post "/internal/config", params: { site_config: { tagline: description }, confirmation: confirmation_message }