about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-07-30 15:08:05 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:45:16 -0500
commitf8d23f70b9e5658b109a0180881fb272fccc28ca (patch)
treefd3477b383d9ceeed4c384f087ba88d4d9d33863 /app
parentb2129db547f89ec1e02bf0742cd08fe466867386 (diff)
[UI, Accessibility] Make underlining hyperlinks optional
Diffstat (limited to 'app')
-rw-r--r--app/controllers/settings/preferences_controller.rb1
-rw-r--r--app/javascript/flavours/glitch/styles/monsterfork/components/formatting.scss4
-rw-r--r--app/lib/user_settings_decorator.rb5
-rw-r--r--app/models/user.rb2
-rwxr-xr-xapp/views/layouts/application.html.haml18
-rw-r--r--app/views/settings/preferences/appearance/show.html.haml1
6 files changed, 28 insertions, 3 deletions
diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb
index cc3b38dad..b189b394f 100644
--- a/app/controllers/settings/preferences_controller.rb
+++ b/app/controllers/settings/preferences_controller.rb
@@ -63,6 +63,7 @@ class Settings::PreferencesController < Settings::BaseController
       :setting_crop_images,
       :setting_manual_publish,
       :setting_style_dashed_nest,
+      :setting_style_underline_a,
       notification_emails: %i(follow follow_request reblog favourite mention digest report pending_account trending_tag),
       interactions: %i(must_be_follower must_be_following must_be_following_dm)
     )
diff --git a/app/javascript/flavours/glitch/styles/monsterfork/components/formatting.scss b/app/javascript/flavours/glitch/styles/monsterfork/components/formatting.scss
index 2b822fdec..0d8a42211 100644
--- a/app/javascript/flavours/glitch/styles/monsterfork/components/formatting.scss
+++ b/app/javascript/flavours/glitch/styles/monsterfork/components/formatting.scss
@@ -79,10 +79,10 @@
 
   a {
     color: $secondary-text-color;
-    text-decoration: underline;
+    text-decoration: none;
 
     &:hover {
-      text-decoration: none;
+      text-decoration: underline;
 
       .fa {
         color: lighten($dark-text-color, 7%);
diff --git a/app/lib/user_settings_decorator.rb b/app/lib/user_settings_decorator.rb
index cd84d42e8..0d6d150fa 100644
--- a/app/lib/user_settings_decorator.rb
+++ b/app/lib/user_settings_decorator.rb
@@ -46,6 +46,7 @@ class UserSettingsDecorator
 
     user.settings['manual_publish']      = manual_publish_preference if change?('setting_manual_publish')
     user.settings['style_dashed_nest']   = style_dashed_nest_preference if change?('setting_style_dashed_nest')
+    user.settings['style_underline_a']   = style_underline_a_preference if change?('setting_style_underline_a')
   end
 
   def merged_notification_emails
@@ -168,6 +169,10 @@ class UserSettingsDecorator
     boolean_cast_setting 'setting_style_dashed_nest'
   end
 
+  def style_underline_a_preference
+    boolean_cast_setting 'setting_style_underline_a'
+  end
+
   def boolean_cast_setting(key)
     ActiveModel::Type::Boolean.new.cast(settings[key])
   end
diff --git a/app/models/user.rb b/app/models/user.rb
index 23c0f232b..129cb822d 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -114,7 +114,7 @@ class User < ApplicationRecord
            :expand_spoilers, :default_language, :aggregate_reblogs, :show_application,
            :advanced_layout, :use_blurhash, :use_pending_items, :trends, :crop_images,
            :default_content_type, :system_emoji_font,
-           :manual_publish, :style_dashed_nest,
+           :manual_publish, :style_dashed_nest, :style_underline_a,
            to: :settings, prefix: :setting, allow_nil: false
 
   attr_reader :invite_code, :sign_in_token_attempt
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 98ee041c1..aa3c560cb 100755
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -46,6 +46,24 @@
           border-style: dashed;
         }
 
+    - if current_account&.user&.setting_style_underline_a
+      :css
+        .status__content__text a,
+        .reply-indicator__content a,
+        .composer--reply > .content a,
+        .account__header__content a
+        {
+          text-decoration: underline;          
+        }
+
+        .status__content__text a:hover,
+        .reply-indicator__content a:hover,
+        .composer--reply > .content a:hover,
+        .account__header__content a:hover
+        {
+          text-decoration: none;          
+        }
+
   %body{ class: body_classes }
     = content_for?(:content) ? yield(:content) : yield
 
diff --git a/app/views/settings/preferences/appearance/show.html.haml b/app/views/settings/preferences/appearance/show.html.haml
index c2cff5ca4..8d4c182c3 100644
--- a/app/views/settings/preferences/appearance/show.html.haml
+++ b/app/views/settings/preferences/appearance/show.html.haml
@@ -32,6 +32,7 @@
 
   .fields-group
     = f.input :setting_style_dashed_nest, as: :boolean, wrapper: :with_label
+    = f.input :setting_style_underline_a, as: :boolean, wrapper: :with_label
 
   %h4= t 'appearance.toot_layout'