diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f323a6caa..9413c7220 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -369,4 +369,9 @@ def authenticate_user!(_fav = nil, **_opts) end end end + + # Whether this host is on the codidact network + def codidact? + helpers.codidact? + end end diff --git a/app/helpers/codidact_helper.rb b/app/helpers/codidact_helper.rb new file mode 100644 index 000000000..71e2567a7 --- /dev/null +++ b/app/helpers/codidact_helper.rb @@ -0,0 +1,11 @@ +# Provides helper methods to determine whether this site is part of the codidact network +module CodidactHelper + # Whether this server is part of the codidact network. + def codidact? + Rails.cache.fetch 'is_codidact' do + Rails.env.development? || + RequestContext.community.host.end_with?('.codidact.com') || + RequestContext.community.host.end_with?('.codidact.org') + end + end +end diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb index 84617ad42..be518f93f 100644 --- a/app/views/devise/mailer/confirmation_instructions.html.erb +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -1,4 +1,8 @@ -
Welcome to Codidact, <%= @resource.username %>! We're glad you're here.
+<% if codidact? %> +Welcome to Codidact, <%= @resource.username %>! We're glad you're here.
+<% else %> +Welcome, <%= @resource.username %>! We're glad you're here.
+<% end %>Please confirm your registration by clicking below (or copy and paste the URL into your browser).
diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index 8fc1a62a7..5830af0d9 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -7,10 +7,12 @@ <% end %> -This error has been logged. We even look at them sometimes.
-
- You can also report this
- on Meta
- to help us keep track of what's going wrong — quote error ID <%= @log.uuid %>
.
-
+ You can also report this
+ on Meta
+ to help us keep track of what's going wrong — quote error ID <%= @log.uuid %>
.
+
<%= link_to 'Go back', :back, class: 'button is-outlined' %> diff --git a/app/views/errors/unprocessable_entity.html.erb b/app/views/errors/unprocessable_entity.html.erb index ab5ed403e..8230ceae3 100644 --- a/app/views/errors/unprocessable_entity.html.erb +++ b/app/views/errors/unprocessable_entity.html.erb @@ -5,11 +5,16 @@
Your request couldn't be processed.
-- Our server's sulking today. Log out and back in, and if this keeps happening, let us know - on Meta. -
- +<% if codidact? %> ++ Our server's sulking today. Log out and back in, and if this keeps happening, let us know + on Meta. +
+<% else %> ++ Our server's sulking today. Log out and back in, and if this keeps happening, let us know. +
+<% end %><%= link_to 'Go back', :back, class: 'button is-outlined' %> diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb index b00c2c03f..77611978c 100644 --- a/app/views/layouts/_footer.html.erb +++ b/app/views/layouts/_footer.html.erb @@ -7,19 +7,23 @@
diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index c9bf20abd..a50b373c8 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -1,7 +1,10 @@ -<% desc = "#{SiteSetting['SiteName']} on Codidact - open, community-run Q&A knowledge sharing" %> +<% desc = codidact? ? + "#{SiteSetting['SiteName']} on Codidact - open, community-run Q&A knowledge sharing" : + "#{SiteSetting['SiteName']} - Q&A knowledge sharing" +%> <% page_title = (Rails.env.development? ? '[DEV] ' : '') + @@ -14,7 +17,7 @@ <% icon_path = SiteSetting['IconPath'] %> + title="<%= "#{codidact? ? 'Codidact ' : ''}#{RequestContext.community.name}" %> search" href="<%= osd_url(format: :xml) %>" /> diff --git a/app/views/layouts/_sidebar.html.erb b/app/views/layouts/_sidebar.html.erb index 33a713a42..78c6a724c 100644 --- a/app/views/layouts/_sidebar.html.erb +++ b/app/views/layouts/_sidebar.html.erb @@ -106,14 +106,20 @@