diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 24db4bfdf..0d6b7105c 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -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 diff --git a/app/views/mailers/digest_mailer/digest_email.html.erb b/app/views/mailers/digest_mailer/digest_email.html.erb index 8b4a2932b..f4f5ea8e1 100644 --- a/app/views/mailers/digest_mailer/digest_email.html.erb +++ b/app/views/mailers/digest_mailer/digest_email.html.erb @@ -11,11 +11,10 @@
-
πŸ‘‹ Looking for work? ">Browse job openings or create an ">available for hire listing.
- πŸ” Hiring developers? Post your position(s) on "><%= community_name %> Listings. + πŸ” Hiring developers? Post your position(s) on <%= community_name %> Listings.
diff --git a/app/views/mailers/notify_mailer/new_badge_email.html.erb b/app/views/mailers/notify_mailer/new_badge_email.html.erb index 69b1af71b..e1abf4485 100644 --- a/app/views/mailers/notify_mailer/new_badge_email.html.erb +++ b/app/views/mailers/notify_mailer/new_badge_email.html.erb @@ -31,6 +31,6 @@ if you have anything you'd like to promote. πŸŽ‰

- ">More information about listings + More information about listings

diff --git a/app/views/mailers/notify_mailer/new_badge_email.text.erb b/app/views/mailers/notify_mailer/new_badge_email.text.erb index 5685532c8..36f074f17 100644 --- a/app/views/mailers/notify_mailer/new_badge_email.text.erb +++ b/app/views/mailers/notify_mailer/new_badge_email.text.erb @@ -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) %> diff --git a/app/views/mailers/notify_mailer/tag_moderator_confirmation_email.html.erb b/app/views/mailers/notify_mailer/tag_moderator_confirmation_email.html.erb index 375977696..bd8ad493d 100644 --- a/app/views/mailers/notify_mailer/tag_moderator_confirmation_email.html.erb +++ b/app/views/mailers/notify_mailer/tag_moderator_confirmation_email.html.erb @@ -17,7 +17,7 @@

For details on how to access these features, visit our - ">tag moderation page.

+ tag moderation page.

To aid in communication, we’ve added you to a tag moderator "><%= community_name %> Connect channel. 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! diff --git a/app/views/mailers/notify_mailer/tag_moderator_confirmation_email.text.erb b/app/views/mailers/notify_mailer/tag_moderator_confirmation_email.text.erb index 7b2109da7..3ac7ae252 100644 --- a/app/views/mailers/notify_mailer/tag_moderator_confirmation_email.text.erb +++ b/app/views/mailers/notify_mailer/tag_moderator_confirmation_email.text.erb @@ -6,7 +6,7 @@ As a tag moderator, you are now able to: - Remove the tag if it’s 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, we’ve 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! diff --git a/app/views/moderations/index.html.erb b/app/views/moderations/index.html.erb index 56c562c72..e6774290c 100644 --- a/app/views/moderations/index.html.erb +++ b/app/views/moderations/index.html.erb @@ -77,7 +77,7 @@

<% else %> diff --git a/app/views/notifications/_badgeachievement.html.erb b/app/views/notifications/_badgeachievement.html.erb index 8f038fcbc..79e892cfa 100644 --- a/app/views/notifications/_badgeachievement.html.erb +++ b/app/views/notifications/_badgeachievement.html.erb @@ -25,6 +25,6 @@ if you have anything you'd like to promote. πŸŽ‰

- More information about listings + More information about listings

diff --git a/app/views/pages/about_listings.html.erb b/app/views/pages/about_listings.html.erb new file mode 100644 index 000000000..a442e1e63 --- /dev/null +++ b/app/views/pages/about_listings.html.erb @@ -0,0 +1 @@ +<%= render partial: "placeholder", locals: { title: "About #{community_name} Listings" } %> diff --git a/app/views/pages/community_moderation.html.erb b/app/views/pages/community_moderation.html.erb new file mode 100644 index 000000000..b44b9507d --- /dev/null +++ b/app/views/pages/community_moderation.html.erb @@ -0,0 +1 @@ +<%= render partial: "placeholder", locals: { title: "Community Moderation Guide" } %> diff --git a/app/views/pages/post_a_job.html.erb b/app/views/pages/post_a_job.html.erb new file mode 100644 index 000000000..cf8fb3447 --- /dev/null +++ b/app/views/pages/post_a_job.html.erb @@ -0,0 +1 @@ +<%= render partial: "placeholder", locals: { title: "Posting a Job on #{community_name} Listings" } %> diff --git a/app/views/pages/tag_moderation.html.erb b/app/views/pages/tag_moderation.html.erb new file mode 100644 index 000000000..c6aba09e2 --- /dev/null +++ b/app/views/pages/tag_moderation.html.erb @@ -0,0 +1 @@ +<%= render partial: "placeholder", locals: { title: "Tag Moderation Guide" } %> diff --git a/config/routes.rb b/config/routes.rb index b515c2496..2c0b3a5c4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 get "/shop", to: redirect("https://shop.dev.to") diff --git a/spec/mailers/digest_mailer_spec.rb b/spec/mailers/digest_mailer_spec.rb index d112dab2a..6910ee68e 100644 --- a/spec/mailers/digest_mailer_spec.rb +++ b/spec/mailers/digest_mailer_spec.rb @@ -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 diff --git a/spec/mailers/notify_mailer_spec.rb b/spec/mailers/notify_mailer_spec.rb index 5f72d0647..9b613057b 100644 --- a/spec/mailers/notify_mailer_spec.rb +++ b/spec/mailers/notify_mailer_spec.rb @@ -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 diff --git a/spec/requests/pages_spec.rb b/spec/requests/pages_spec.rb index 654657aa3..ba998b88b 100644 --- a/spec/requests/pages_spec.rb +++ b/spec/requests/pages_spec.rb @@ -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"