about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-12-10 03:04:05 -0600
committermultiple creatures <dev@multiple-creature.party>2019-12-10 03:04:05 -0600
commit13f49590347dd350c534663c2876ab4db5613aba (patch)
tree7cb9f714d199e6a3bb3de3d5c04f943ec04dc54b /app
parent41b0d10e88e02810006657c27b8ea3576646d45e (diff)
add accessibility option to make everything lowercase
Diffstat (limited to 'app')
-rw-r--r--app/controllers/settings/preferences_controller.rb1
-rw-r--r--app/lib/user_settings_decorator.rb5
-rw-r--r--app/models/account.rb1
-rw-r--r--app/models/user.rb5
-rwxr-xr-xapp/views/layouts/application.html.haml4
-rw-r--r--app/views/settings/preferences/show.html.haml1
6 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb
index 09380efd9..4aceaafda 100644
--- a/app/controllers/settings/preferences_controller.rb
+++ b/app/controllers/settings/preferences_controller.rb
@@ -37,6 +37,7 @@ class Settings::PreferencesController < Settings::BaseController
       :setting_always_local,
       :setting_rawr_federated,
       :setting_hide_stats,
+      :setting_force_lowercase,
       :setting_hide_captions,
       :setting_larger_menus,
       :setting_larger_buttons,
diff --git a/app/lib/user_settings_decorator.rb b/app/lib/user_settings_decorator.rb
index c2fe58b2d..17c55e3e8 100644
--- a/app/lib/user_settings_decorator.rb
+++ b/app/lib/user_settings_decorator.rb
@@ -30,6 +30,7 @@ class UserSettingsDecorator
     user.settings['hide_mntions_blocked']= hide_mntions_blocked_preference if change?('setting_hide_mntions_blocked')
     user.settings['hide_mntions_blocker']= hide_mntions_blocker_preference if change?('setting_hide_mntions_blocker')
     user.settings['hide_mntions_packm8'] = hide_mntions_packm8_preference if change?('setting_hide_mntions_packm8')
+    user.settings['force_lowercase']     = force_lowercase_preference if change?('setting_force_lowercase')
     user.settings['hide_captions']       = hide_captions_preference if change?('setting_hide_captions')
     user.settings['hide_mascot']         = hide_mascot_preference if change?('setting_hide_mascot')
     user.settings['hide_interactions']   = hide_interactions_preference if change?('setting_hide_interactions')
@@ -204,6 +205,10 @@ class UserSettingsDecorator
     boolean_cast_setting 'setting_hide_stats'
   end
 
+  def force_lowercase_preference
+    boolean_cast_setting 'setting_force_lowercase'
+  end
+
   def hide_captions_preference
     boolean_cast_setting 'setting_hide_captions'
   end
diff --git a/app/models/account.rb b/app/models/account.rb
index c52f28d33..66fe554d5 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -160,6 +160,7 @@ class Account < ApplicationRecord
            :hides_mascot?,
            :hides_captions?,
            :shows_cursor?,
+           :forces_lowercase?,
 
            to: :user,
            prefix: true,
diff --git a/app/models/user.rb b/app/models/user.rb
index 06af06911..e6a37b0bd 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -117,6 +117,7 @@ class User < ApplicationRecord
     :always_local,
     :rawr_federated,
     :hide_stats,
+    :force_lowercase,
     :hide_captions,
     :larger_menus,
     :larger_buttons,
@@ -368,6 +369,10 @@ class User < ApplicationRecord
     @hides_stats ||= (settings.hide_stats || false)
   end
 
+  def forces_lowercase?
+    @force_lowercase ||= (settings.force_lowercase || false)
+  end
+
   def hides_captions?
     @hides_captions ||= (settings.hide_captions || false)
   end
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 985e54683..a471d7b6f 100755
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -87,6 +87,10 @@
         :css
           span.cursor:hover { animation: t_blink 1s linear infinite }
 
+    - if current_account&.user_forces_lowercase?
+      :css
+        * { text-transform: lowercase; font-variant: inherit !important; }
+
   %body{ class: body_classes }
     = content_for?(:content) ? yield(:content) : yield
 
diff --git a/app/views/settings/preferences/show.html.haml b/app/views/settings/preferences/show.html.haml
index bde3dcf23..74a643c14 100644
--- a/app/views/settings/preferences/show.html.haml
+++ b/app/views/settings/preferences/show.html.haml
@@ -81,6 +81,7 @@
     = f.input :setting_larger_drawer, as: :boolean, wrapper: :with_label
     = f.input :setting_larger_emoji, as: :boolean, wrapper: :with_label
     = f.input :setting_show_cursor, as: :boolean, wrapper: :with_label
+    = f.input :setting_force_lowercase, as: :boolean, wrapper: :with_label
 
   .fields-group
     = f.input :setting_hide_mascot, as: :boolean, wrapper: :with_label