Add some placeholder pages (#7441)

* feat: add placeholders for some routes

* about_listings_url

* feat: tag-moderation

* chore: about_listings_url test

* chore: use post a job url

* chore: add pages methods

* chore: just reordered stuff

* oops forgot to save - oh man

* chore: change to single quotes

* chore: hopefully retrigger cc

* chore: update tests

* feat: PR suggestions:)

* chore: spec
This commit is contained in:
Ridhwana 2020-04-28 15:55:59 +02:00 committed by GitHub
parent fe375a04ee
commit 8140e46ceb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 98 additions and 37 deletions

View file

@ -13,10 +13,10 @@ class PagesController < ApplicationController
set_surrogate_key_header "about_page"
end
def faq
@page = Page.find_by(slug: "faq")
def about_listings
@page = Page.find_by(slug: "about-listings")
render :show if @page
set_surrogate_key_header "faq_page"
set_surrogate_key_header "about_listings_page"
end
def bounty
@ -25,6 +25,30 @@ class PagesController < ApplicationController
set_surrogate_key_header "bounty_page"
end
def community_moderation
@page = Page.find_by(slug: "community-moderation")
render :show if @page
set_surrogate_key_header "community_moderation_page"
end
def faq
@page = Page.find_by(slug: "faq")
render :show if @page
set_surrogate_key_header "faq_page"
end
def post_a_job
@page = Page.find_by(slug: "post-a-job")
render :show if @page
set_surrogate_key_header "post_a_job_page"
end
def tag_moderation
@page = Page.find_by(slug: "tag-moderation")
render :show if @page
set_surrogate_key_header "tag_moderation_page"
end
def badge
@html_variant = HtmlVariant.find_for_test([], "badge_landing_page")
render layout: false

View file

@ -11,11 +11,10 @@
<hr />
</ul>
<div>
👋 <b>Looking for work?</b> <a href="<%= app_url("/listings/jobs") %>">Browse job openings</a> or create an <a href="<%= app_url("/listings/forhire") %>">available for hire</a> listing.
<br />
🔍 <b>Hiring developers?</b> Post your position(s) on <a href="<%= app_url("/page/post-a-job") %>"><%= community_name %> Listings</a>.
🔍 <b>Hiring developers?</b> Post your position(s) on <a href="<%= app_url(page_post_a_job_url) %>"><%= community_name %> Listings</a>.
</div>
<center style="margin-top:50px;">

View file

@ -31,6 +31,6 @@
if you have anything you'd like to promote. 🎉
</p>
<p>
<strong><a href="<%= app_url("/about-listings") %>">More information about listings<a></strong>
<strong><a href="<%= app_url(about_listings_url) %>">More information about listings<a></strong>
</p>
</center>

View file

@ -10,4 +10,4 @@ You also get 5 new credits to use for community listings if you have anything yo
To manage your credits: visit: <%= credits_url %>
For more information about listings, visit: <%= app_url("/about-listings") %>
For more information about listings, visit: <%= app_url(about_listings_url) %>

View file

@ -17,7 +17,7 @@
</li>
</ul>
<p><strong>For details on how to access these features, visit our
<a href="<%= app_url("/tag-moderation") %>">tag moderation</a> page.</strong></p>
<a href="<%= app_url(tag_moderation_url) %>">tag moderation</a> page.</strong></p>
<p>
To aid in communication, weve added you to a tag moderator
<a href="<%= app_url("/connect/tag-moderators") %>"><%= community_name %> Connect channel</a>. You can use this channel to meet other tag moderators across site, and to coordinate with the <%= community_name %> team. When in doubt about how to exercise your new privileges, please ask!

View file

@ -6,7 +6,7 @@ As a tag moderator, you are now able to:
- Remove the tag if its been added to an irrelevant post.
- Update the the tag sidebar
For details on how to access these features, visit our tag moderation page: <%= app_url("/tag-moderation") %>.
For details on how to access these features, visit our tag moderation page: <%= app_url("tag_moderation_url") %>.
To aid in communication, weve added you to a tag moderator <%= community_name %> Connect channel: <%= app_url("/connect/tag-moderators") %>. You can use this channel to meet other tag moderators across site, and to coordinate with the <%= community_name %> team. When in doubt about how to exercise your new privileges, please ask!

View file

@ -77,7 +77,7 @@
<div class="mod-index-footer">
<a href="/community-moderation" class="mod-link">Community Moderation Guide</a>
<% if current_user.moderator_for_tags.any? %>
・ <a href="/tag-moderation" class="mod-link">Tag Moderation Guide</a>
・ <a href="<%= tag_moderation_url %>" class="mod-link">Tag Moderation Guide</a>
<% end %>
</div>
<% else %>

View file

@ -25,6 +25,6 @@
if you have anything you'd like to promote. 🎉
</p>
<p class="badge-credit-message">
<strong><a href="/about-listings">More information about listings<a></strong>
<strong><a href="<%= about_listings_url %>">More information about listings<a></strong>
</p>
</div>

View file

@ -0,0 +1 @@
<%= render partial: "placeholder", locals: { title: "About #{community_name} Listings" } %>

View file

@ -0,0 +1 @@
<%= render partial: "placeholder", locals: { title: "Community Moderation Guide" } %>

View file

@ -0,0 +1 @@
<%= render partial: "placeholder", locals: { title: "Posting a Job on #{community_name} Listings" } %>

View file

@ -0,0 +1 @@
<%= render partial: "placeholder", locals: { title: "Tag Moderation Guide" } %>

View file

@ -297,7 +297,6 @@ Rails.application.routes.draw do
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root
get "/about" => "pages#about"
get "/robots.:format" => "pages#robots"
get "/api", to: redirect("https://docs.dev.to/api")
get "/privacy" => "pages#privacy"
@ -310,13 +309,11 @@ Rails.application.routes.draw do
get "/rly" => "pages#rlyweb"
get "/code-of-conduct" => "pages#code_of_conduct"
get "/report-abuse" => "pages#report_abuse"
get "/faq" => "pages#faq"
get "/welcome" => "pages#welcome"
get "/challenge" => "pages#challenge"
get "/checkin" => "pages#checkin"
get "/badge" => "pages#badge"
get "/💸", to: redirect("t/hiring")
get "/security", to: "pages#bounty"
get "/survey", to: redirect("https://dev.to/ben/final-thoughts-on-the-state-of-the-web-survey-44nn")
get "/events" => "events#index"
get "/workshops", to: redirect("events")
@ -326,6 +323,15 @@ Rails.application.routes.draw do
post "comments/preview" => "comments#preview"
get "/stories/warm_comments/:username/:slug" => "stories#warm_comments"
# These routes are required by links in the sites and will most likely to be replaced by a db page
get "/about" => "pages#about"
get "/about-listings" => "pages#about_listings"
get "/security", to: "pages#bounty"
get "/community-moderation" => "pages#community_moderation"
get "/faq" => "pages#faq"
get "/page/post-a-job" => "pages#post_a_job"
get "/tag-moderation" => "pages#tag_moderation"
# NOTE: can't remove the hardcoded URL here as SiteConfig is not available here, we should eventually
# setup dynamic redirects, see <https://github.com/thepracticaldev/dev.to/issues/7267>
get "/shop", to: redirect("https://shop.dev.to")

View file

@ -15,7 +15,7 @@ RSpec.describe DigestMailer, type: :mailer do
expect(email.subject).not_to be_nil
expect(email.to).to eq([user.email])
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Digest <#{SiteConfig.email_addresses[:default]}>")
expect(email["from"].value).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Digest <#{SiteConfig.email_addresses[:default]}>")
end
it "includes the tracking pixel" do

View file

@ -16,7 +16,7 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.email_addresses[:default]}>")
expect(email["from"].value).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>")
end
it "renders proper receiver" do
@ -40,12 +40,12 @@ RSpec.describe NotifyMailer, type: :mailer do
before { user2.follow(user) }
it "renders proper subject" do
expect(email.subject).to eq("#{user2.name} just followed you on #{ApplicationConfig["COMMUNITY_NAME"]}")
expect(email.subject).to eq("#{user2.name} just followed you on #{ApplicationConfig['COMMUNITY_NAME']}")
end
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.email_addresses[:default]}>")
expect(email["from"].value).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>")
end
it "renders proper receiver" do
@ -73,7 +73,7 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.email_addresses[:default]}>")
expect(email["from"].value).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>")
end
it "renders proper receiver" do
@ -95,12 +95,12 @@ RSpec.describe NotifyMailer, type: :mailer do
let(:email) { described_class.unread_notifications_email(user) }
it "renders proper subject" do
expect(email.subject).to eq("🔥 You have 0 unread notifications on #{ApplicationConfig["COMMUNITY_NAME"]}")
expect(email.subject).to eq("🔥 You have 0 unread notifications on #{ApplicationConfig['COMMUNITY_NAME']}")
end
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.email_addresses[:default]}>")
expect(email["from"].value).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>")
end
it "renders proper receiver" do
@ -127,7 +127,7 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.email_addresses[:default]}>")
expect(email["from"].value).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>")
end
it "renders proper receiver" do
@ -165,7 +165,7 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.email_addresses[:default]}>")
expect(email["from"].value).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>")
end
it "renders proper receiver" do
@ -197,7 +197,7 @@ RSpec.describe NotifyMailer, type: :mailer do
it "includes the about listings URL" do
expect(email.html_part.body).to include(
CGI.escape(URL.url("/about-listings")),
CGI.escape(Rails.application.routes.url_helpers.about_listings_url),
)
end
@ -233,7 +233,7 @@ RSpec.describe NotifyMailer, type: :mailer do
end
it "includes the about listings URL" do
expect(email.text_part.body).to include(URL.url("/about-listings"))
expect(email.text_part.body).to include(Rails.application.routes.url_helpers.about_listings_url)
end
it "includes the rewarding_context_message in the email" do
@ -262,7 +262,7 @@ RSpec.describe NotifyMailer, type: :mailer do
let(:email_params) do
{
email_to: user.email,
email_subject: "#{ApplicationConfig["COMMUNITY_NAME"]} Report Status Update",
email_subject: "#{ApplicationConfig['COMMUNITY_NAME']} Report Status Update",
email_body: "You've violated our code of conduct",
email_type: "Reporter",
feedback_message_id: feedback_message.id
@ -271,12 +271,12 @@ RSpec.describe NotifyMailer, type: :mailer do
let(:email) { described_class.feedback_message_resolution_email(email_params) }
it "renders proper subject" do
expect(email.subject).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Report Status Update")
expect(email.subject).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Report Status Update")
end
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.email_addresses[:default]}>")
expect(email["from"].value).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>")
end
it "renders proper receiver" do
@ -318,7 +318,7 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.email_addresses[:default]}>")
expect(email["from"].value).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>")
end
it "renders proper receiver" do
@ -345,7 +345,7 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.email_addresses[:default]}>")
expect(email["from"].value).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>")
end
it "renders proper receiver" do
@ -367,12 +367,12 @@ RSpec.describe NotifyMailer, type: :mailer do
let(:email) { described_class.account_deleted_email(user) }
it "renders proper subject" do
expect(email.subject).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} - Account Deletion Confirmation")
expect(email.subject).to eq("#{ApplicationConfig['COMMUNITY_NAME']} - Account Deletion Confirmation")
end
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.email_addresses[:default]}>")
expect(email["from"].value).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>")
end
it "renders proper receiver" do
@ -399,7 +399,7 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.email_addresses[:default]}>")
expect(email["from"].value).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>")
end
it "renders proper receiver" do
@ -436,7 +436,7 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.email_addresses[:default]}>")
expect(email["from"].value).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>")
end
it "renders proper receiver" do
@ -464,7 +464,7 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.email_addresses[:default]}>")
expect(email["from"].value).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>")
end
it "renders proper receiver" do
@ -495,9 +495,9 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(moderator_email.from).to eq([SiteConfig.email_addresses[:default]])
expect(moderator_email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.email_addresses[:default]}>")
expect(moderator_email["from"].value).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>")
expect(member_email.from).to eq([SiteConfig.email_addresses[:default]])
expect(member_email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.email_addresses[:default]}>")
expect(member_email["from"].value).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>")
end
it "renders proper receiver" do

View file

@ -25,6 +25,34 @@ RSpec.describe "Pages", type: :request do
end
end
describe "GET /about-listings" do
it "has proper headline" do
get "/about-listings"
expect(response.body).to include("About #{ApplicationConfig['COMMUNITY_NAME']} Listings")
end
end
describe "GET /community-moderation" do
it "has proper headline" do
get "/community-moderation"
expect(response.body).to include("Community Moderation Guide")
end
end
describe "GET /tag-moderation" do
it "has proper headline" do
get "/tag-moderation"
expect(response.body).to include("Tag Moderation Guide")
end
end
describe "GET /page/post-a-job" do
it "has proper headline" do
get "/page/post-a-job"
expect(response.body).to include("Posting a Job on #{ApplicationConfig['COMMUNITY_NAME']} Listings")
end
end
describe "GET /api" do
it "redirects to the API docs" do
get "/api"