From 66ae15c580f367882fc85511dfcf0cf3964f9636 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Fri, 28 Jun 2024 04:36:24 +0000 Subject: [PATCH] Remove ability to switch themes --- app/controllers/application_controller.rb | 19 ------------------- app/controllers/themes_controller.rb | 14 -------------- app/views/_tailwind/profiles/_menu.html.erb | 3 --- app/views/_tailwind/profiles/design.html.erb | 10 ---------- app/views/profiles/design.html.haml | 13 ------------- app/views/profiles/show.html.haml | 2 -- config/initializers/flipper.rb | 1 - config/routes.rb | 7 ------- 8 files changed, 69 deletions(-) delete mode 100644 app/controllers/themes_controller.rb delete mode 100644 app/views/_tailwind/profiles/design.html.erb delete mode 100644 app/views/profiles/design.html.haml diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e430115c3..e5f2ba45b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -56,25 +56,6 @@ def show_tailwind_theme? true end - sig { params(tailwind: T::Boolean).void } - def update_tailwind_theme(tailwind) - update_tailwind_theme_cookie(tailwind) - update_tailwind_theme_user(tailwind) - end - - sig { params(tailwind: T::Boolean).void } - def update_tailwind_theme_cookie(tailwind) - cookies.signed[:planningalerts_theme] = ("tailwind" if tailwind) - end - - sig { params(tailwind: T::Boolean).void } - def update_tailwind_theme_user(tailwind) - u = current_user - return unless u - - u.update!(tailwind_theme: tailwind) - end - sig { void } def configure_permitted_parameters devise_parameter_sanitizer.permit(:sign_up) { |u| u.permit(:name, :email, :password) } diff --git a/app/controllers/themes_controller.rb b/app/controllers/themes_controller.rb deleted file mode 100644 index 972480e90..000000000 --- a/app/controllers/themes_controller.rb +++ /dev/null @@ -1,14 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -class ThemesController < ApplicationController - extend T::Sig - - sig { void } - def toggle - return unless Flipper.enabled?(:switch_themes, current_user) - - update_tailwind_theme(!show_tailwind_theme?) - redirect_to root_path - end -end diff --git a/app/views/_tailwind/profiles/_menu.html.erb b/app/views/_tailwind/profiles/_menu.html.erb index a78944e8d..b5eefb260 100644 --- a/app/views/_tailwind/profiles/_menu.html.erb +++ b/app/views/_tailwind/profiles/_menu.html.erb @@ -3,9 +3,6 @@
  • <%= pa_link_to_unless_current "Create new alert", new_profile_alert_path %>
  • <%= pa_link_to_unless_current "Your comments", comments_profile_path %>
  • <%= pa_link_to_unless_current "Edit account", edit_user_registration_path %>
  • - <% if Flipper.enabled?(:switch_themes, current_user) %> -
  • <%= pa_link_to_unless_current "Switch design", design_profile_path %>
  • - <% end %> <%# Setting "Sign out" to a block breaks on ios/safari %>
  • <%= button_to "Sign out", destroy_user_session_path, method: :delete, class: "#{pa_link_classes(quiet: false)} cursor-pointer" %>
  • diff --git a/app/views/_tailwind/profiles/design.html.erb b/app/views/_tailwind/profiles/design.html.erb deleted file mode 100644 index 1c972e6a3..000000000 --- a/app/views/_tailwind/profiles/design.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -<% content_for :page_title, "Switch design" %> - -<%= render Tailwind::Heading.new(tag: :h2).with_content(yield(:page_title)) %> -

    - Thanks for helping us by trying out the new design! -

    - -
    - <%= pa_button_to "Switch back to the original design", toggle_theme_path %> -
    diff --git a/app/views/profiles/design.html.haml b/app/views/profiles/design.html.haml deleted file mode 100644 index ecda7bf5f..000000000 --- a/app/views/profiles/design.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -- content_for :page_title, "Switch design" -%h1.page-title Switch design - -- if Flipper.enabled?(:switch_themes, current_user) - %p - Thanks for helping us by trying out the new design! - - = button_to "Switch to the new design", toggle_theme_path, class: "button button-action button-rounded" -- else - %p - It looks like you're not on the list to try out the new design just yet. Sorry! - %p - Contact us if you think this is a mistake. diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index bf97255c6..e453ce42d 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -15,7 +15,5 @@ %li= link_to "Your alerts", profile_alerts_path %li= link_to "Your comments", comments_profile_path %li= link_to "Edit account", edit_user_registration_path - - if Flipper.enabled?(:switch_themes, current_user) - %li= link_to "Switch design", design_profile_path = button_to "Sign out", destroy_user_session_path, method: :delete, class: "button button-action button-rounded" diff --git a/config/initializers/flipper.rb b/config/initializers/flipper.rb index b4999c27a..2cbf659e4 100644 --- a/config/initializers/flipper.rb +++ b/config/initializers/flipper.rb @@ -10,7 +10,6 @@ { "disable_streetview_in_emails" => "Disables Google streetview in email. Do this to save money", "disable_streetview_in_app" => "Disable Google streetview in the main application. Do this to save money", - "switch_themes" => "Can switch to new in progress design for the site", "extra_options_on_address_search" => "Add extra options to filter by time/space when searching address", "show_authority_map" => "Show boundary of authority on a map", # Very important to note that switching on maintance_mode ** is not enough **. diff --git a/config/routes.rb b/config/routes.rb index 5b4cd858f..986c1db39 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -92,8 +92,6 @@ def matches?(request) resources :alerts, except: :show, controller: :alerts_new get :comments - # The design route is temporary and only needed for early testers of the new tailwind based theme - get :design end resources :alerts, only: %i[new create], path_names: { new: "signup" }, param: :confirm_id do @@ -222,9 +220,4 @@ def matches?(request) get "/500", to: "documentation#error_500" post "/cuttlefish/event", to: "cuttlefish#event" - - # TODO: Only needed while we're testing the tailwind theme - resource :theme, only: [] do - post 'toggle' - end end