diff --git a/app/controllers/games/new/custom_controller.rb b/app/controllers/games/new/custom_controller.rb index dc39171f..bcb82698 100644 --- a/app/controllers/games/new/custom_controller.rb +++ b/app/controllers/games/new/custom_controller.rb @@ -12,7 +12,7 @@ def create if settings.valid? Game::Current.(settings:, user: current_user) { layout.store_http_cookie( - Games::New::Custom::Form::STORAGE_KEY, + Games::New::Custom::Form::COOKIE, value: settings.to_json) } diff --git a/app/controllers/ui_portal/patterns_controller.rb b/app/controllers/ui_portal/patterns_controller.rb index 55b577bf..fad628b7 100644 --- a/app/controllers/ui_portal/patterns_controller.rb +++ b/app/controllers/ui_portal/patterns_controller.rb @@ -89,7 +89,7 @@ def edit_pattern_params def store_pattern_settings(settings) layout.store_http_cookie( - UIPortal::Patterns::New::SettingsForm::STORAGE_KEY, + UIPortal::Patterns::New::SettingsForm::COOKIE, value: settings.to_json) end diff --git a/app/javascript/controllers/theme_controller.js b/app/javascript/controllers/theme_controller.js index adffbf73..8f2ab92a 100644 --- a/app/javascript/controllers/theme_controller.js +++ b/app/javascript/controllers/theme_controller.js @@ -1,7 +1,7 @@ import { Controller } from "@hotwired/stimulus" export default class ThemeController extends Controller { - static STORAGE_KEY = "theme" + static COOKIE = "theme" static LIGHT_THEME = "light" static LIGHT_THEME_COLOR = "#fff" @@ -216,14 +216,14 @@ export default class ThemeController extends Controller { } get #theme() { - return localStorage.getItem(ThemeController.STORAGE_KEY) + return localStorage.getItem(ThemeController.COOKIE) } set #theme(value) { if (value == ThemeController.SYSTEM_THEME) { - localStorage.removeItem(ThemeController.STORAGE_KEY) + localStorage.removeItem(ThemeController.COOKIE) } else { - localStorage.setItem(ThemeController.STORAGE_KEY, value) + localStorage.setItem(ThemeController.COOKIE, value) } } } diff --git a/app/views/games/current/rules/collapse_container.rb b/app/views/games/current/rules/collapse_container.rb index e68f9e58..fe1c3496 100644 --- a/app/views/games/current/rules/collapse_container.rb +++ b/app/views/games/current/rules/collapse_container.rb @@ -2,13 +2,13 @@ # Games::Current::Rules::CollapseContainer class Games::Current::Rules::CollapseContainer - COOKIE_NAME = "rules" + COOKIE = "rules" def initialize(context:) @context = Context.new(context) end - def cookie_name = COOKIE_NAME + def cookie_name = COOKIE def button_id = @button_id ||= "rules_button-#{Time.new.to_i}" def content_id = @content_id ||= "rules_content-#{Time.new.to_i}" diff --git a/app/views/games/new/custom/form.rb b/app/views/games/new/custom/form.rb index 59a79a2a..20d0b0b4 100644 --- a/app/views/games/new/custom/form.rb +++ b/app/views/games/new/custom/form.rb @@ -2,7 +2,7 @@ # Games::New::Custom::Form represents the "New Custom Game" form. class Games::New::Custom::Form - STORAGE_KEY = :board_settings + COOKIE = :board_settings def initialize(settings:, context:) @settings = settings @@ -39,7 +39,7 @@ def display_errors def previous_settings @previous_settings ||= - JSON.parse(cookies[STORAGE_KEY] || "{}").with_indifferent_access + JSON.parse(cookies[COOKIE] || "{}").with_indifferent_access end def cookies = context.cookies diff --git a/app/views/home/roster/slide_menu.rb b/app/views/home/roster/slide_menu.rb index 36566ae1..8d114e95 100644 --- a/app/views/home/roster/slide_menu.rb +++ b/app/views/home/roster/slide_menu.rb @@ -2,7 +2,7 @@ # Home::Roster::SlideMenu represents the War Room Roster slide menu. class Home::Roster::SlideMenu - COOKIE_NAME = "war_room-roster" + COOKIE = "war_room-roster" def self.css # rubocop:disable Layout/MultilineArrayLineBreaks @@ -32,7 +32,7 @@ def initialize(context:) @context = Context.new(context) end - def cookie_name = COOKIE_NAME + def cookie_name = COOKIE def title = "Roster" diff --git a/app/views/ui_portal/patterns/new.rb b/app/views/ui_portal/patterns/new.rb index db3406cc..e59a3f71 100644 --- a/app/views/ui_portal/patterns/new.rb +++ b/app/views/ui_portal/patterns/new.rb @@ -28,7 +28,7 @@ def display_errors # UIPortal::Patterns::New::SettingsForm class SettingsForm - STORAGE_KEY = :pattern_settings + COOKIE = :pattern_settings def initialize(pattern_settings, context:) @pattern_settings = pattern_settings @@ -55,7 +55,7 @@ def any_errors? = pattern_settings.errors.any? def previous_settings @previous_settings ||= - JSON.parse(cookies[STORAGE_KEY] || "{}").with_indifferent_access + JSON.parse(cookies[COOKIE] || "{}").with_indifferent_access end def cookies = context.cookies