diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-07-24 23:56:06 -0500 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-08-30 05:45:15 -0500 |
commit | 9bd0bb4e260d1dee975f4b4e50ca52c04e7c317f (patch) | |
tree | 405ba30326d276da5146c89d66852afc7415a2a7 | |
parent | 9c75c01decf1fbdb32350998c39a9d7fdeb00951 (diff) |
[UI, Accessibiity] Make dashed nest level indicators optional
-rw-r--r-- | app/controllers/settings/preferences_controller.rb | 1 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/styles/monsterfork/components/status.scss | 10 | ||||
-rw-r--r-- | app/lib/user_settings_decorator.rb | 5 | ||||
-rw-r--r-- | app/models/media_attachment.rb | 4 | ||||
-rw-r--r-- | app/models/user.rb | 2 | ||||
-rwxr-xr-x | app/views/layouts/application.html.haml | 6 | ||||
-rw-r--r-- | app/views/settings/preferences/appearance/show.html.haml | 3 | ||||
-rw-r--r-- | config/locales/simple_form.en-MP.yml | 1 |
8 files changed, 27 insertions, 5 deletions
diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb index 3d659af4c..cc3b38dad 100644 --- a/app/controllers/settings/preferences_controller.rb +++ b/app/controllers/settings/preferences_controller.rb @@ -62,6 +62,7 @@ class Settings::PreferencesController < Settings::BaseController :setting_trends, :setting_crop_images, :setting_manual_publish, + :setting_style_dashed_nest, 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/status.scss b/app/javascript/flavours/glitch/styles/monsterfork/components/status.scss index 2df7f1aac..64e454c83 100644 --- a/app/javascript/flavours/glitch/styles/monsterfork/components/status.scss +++ b/app/javascript/flavours/glitch/styles/monsterfork/components/status.scss @@ -26,14 +26,20 @@ } } +div[data-nest-level] { + border-style: solid; +} + @for $i from 0 through 15 { div[data-nest-level="#{$i}"] { - border-left: #{$i * 5}px dashed darken($ui-base-color, 8%); + border-left-width: #{$i * 5}px; + border-left-color: darken($ui-base-color, 8%); } } div[data-nest-deep="true"] { - border-left: 75px dashed darken($ui-base-color, 8%); + border-left-width: 75px; + border-left-color: darken($ui-base-color, 8%); } .status__content { diff --git a/app/lib/user_settings_decorator.rb b/app/lib/user_settings_decorator.rb index 8106b976c..cd84d42e8 100644 --- a/app/lib/user_settings_decorator.rb +++ b/app/lib/user_settings_decorator.rb @@ -45,6 +45,7 @@ class UserSettingsDecorator user.settings['crop_images'] = crop_images_preference if change?('setting_crop_images') 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') end def merged_notification_emails @@ -163,6 +164,10 @@ class UserSettingsDecorator boolean_cast_setting 'setting_manual_publish' end + def style_dashed_nest_preference + boolean_cast_setting 'setting_style_dashed_nest' + end + def boolean_cast_setting(key) ActiveModel::Type::Boolean.new.cast(settings[key]) end diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb index 324bd0305..4fed048a5 100644 --- a/app/models/media_attachment.rb +++ b/app/models/media_attachment.rb @@ -197,8 +197,8 @@ class MediaAttachment < ApplicationRecord scope :uninlined, -> { where(inline: false) } scope :inlined, -> { rewhere(inline: true) } scope :all_media, -> { unscope(where: :inline) } - scope :local, -> { where(remote_url: '') } - scope :remote, -> { where.not(remote_url: '') } + scope :local, -> { all_media.where(remote_url: '') } + scope :remote, -> { all_media.where.not(remote_url: '') } scope :cached, -> { remote.where.not(file_file_name: nil) } default_scope { uninlined.order(id: :asc) } diff --git a/app/models/user.rb b/app/models/user.rb index 8fe694ba1..23c0f232b 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, + :manual_publish, :style_dashed_nest, 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 3336cf391..98ee041c1 100755 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -40,6 +40,12 @@ - if Setting.custom_css.present? = stylesheet_link_tag custom_css_path, media: 'all' + - if current_account&.user&.setting_style_dashed_nest + :css + div[data-nest-level] { + border-style: dashed; + } + %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 5fc865814..c2cff5ca4 100644 --- a/app/views/settings/preferences/appearance/show.html.haml +++ b/app/views/settings/preferences/appearance/show.html.haml @@ -30,6 +30,9 @@ = f.input :setting_system_font_ui, as: :boolean, wrapper: :with_label = f.input :setting_system_emoji_font, as: :boolean, wrapper: :with_label + .fields-group + = f.input :setting_style_dashed_nest, as: :boolean, wrapper: :with_label + %h4= t 'appearance.toot_layout' .fields-group diff --git a/config/locales/simple_form.en-MP.yml b/config/locales/simple_form.en-MP.yml index 79a91dfb1..21a614794 100644 --- a/config/locales/simple_form.en-MP.yml +++ b/config/locales/simple_form.en-MP.yml @@ -49,6 +49,7 @@ en-MP: setting_favourite_modal: Show confirmation dialog before admiring (applies to Glitch flavour only) setting_manual_publish: Manually publish roars setting_show_application: Disclose application used to send roars + setting_style_dashed_nest: Use dashed nest level indicators setting_use_pending_items: Relax mode show_replies: Show replies on profile show_unlisted: Show unlisted roars to anonymous visitors |