diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-04-13 16:59:21 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-05-21 03:16:21 -0500 |
commit | 4c170d2a98e4a289ad40580785cbeb892bd68eab (patch) | |
tree | 25487ff89d96f7f04f14432228da1c8d114f5dee /app | |
parent | d033327136f99f52eb64171d0da75e19cfc46091 (diff) |
Add options to increase size and spacing of context menus and to gently the kobolds. Also allow showing multiple user roles.
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/settings/preferences_controller.rb | 4 | ||||
-rw-r--r-- | app/helpers/stream_entries_helper.rb | 19 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/styles/accounts.scss | 12 | ||||
-rw-r--r-- | app/lib/user_settings_decorator.rb | 16 | ||||
-rw-r--r-- | app/models/user.rb | 16 | ||||
-rwxr-xr-x | app/views/layouts/application.html.haml | 7 | ||||
-rw-r--r-- | app/views/settings/preferences/show.html.haml | 5 |
7 files changed, 72 insertions, 7 deletions
diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb index 0aa083a4a..ab1796f58 100644 --- a/app/controllers/settings/preferences_controller.rb +++ b/app/controllers/settings/preferences_controller.rb @@ -34,6 +34,10 @@ class Settings::PreferencesController < Settings::BaseController :setting_rawr_federated, :setting_hide_stats, :setting_hide_captions, + :setting_larger_menus, + :setting_gently_kobolds, + :setting_user_is_kobold, + :setting_default_privacy, :setting_default_sensitive, :setting_default_language, diff --git a/app/helpers/stream_entries_helper.rb b/app/helpers/stream_entries_helper.rb index 07901889d..f3848f3be 100644 --- a/app/helpers/stream_entries_helper.rb +++ b/app/helpers/stream_entries_helper.rb @@ -35,18 +35,23 @@ module StreamEntriesHelper end def account_badge(account, all: false) - if account.bot? - content_tag(:div, content_tag(:div, t('accounts.roles.bot'), class: 'account-role bot'), class: 'roles') - elsif (Setting.show_staff_badge && account.user_staff?) || all - content_tag(:div, class: 'roles') do + content_tag(:div, class: 'roles') do + roles = [] + roles << content_tag(:div, t('accounts.roles.bot'), class: 'account-role bot') if account.bot? + roles << content_tag(:div, t('accounts.roles.gentlies_kobolds'), class: 'account-role gentlies') if account&.user&.setting_gently_kobolds + roles << content_tag(:div, t('accounts.roles.kobold'), class: 'account-role kobold') if account&.user&.setting_user_is_kobold + + if (Setting.show_staff_badge && account.user_staff?) || all if all && !account.user_staff? - content_tag(:div, t('admin.accounts.roles.user'), class: 'account-role') + roles << content_tag(:div, t('admin.accounts.roles.user'), class: 'account-role') elsif account.user_admin? - content_tag(:div, t('accounts.roles.admin'), class: 'account-role admin') + roles << content_tag(:div, t('accounts.roles.admin'), class: 'account-role admin') elsif account.user_moderator? - content_tag(:div, t('accounts.roles.moderator'), class: 'account-role moderator') + roles << content_tag(:div, t('accounts.roles.moderator'), class: 'account-role moderator') end end + + roles.sum end end diff --git a/app/javascript/flavours/glitch/styles/accounts.scss b/app/javascript/flavours/glitch/styles/accounts.scss index a1ac5c626..6239becba 100644 --- a/app/javascript/flavours/glitch/styles/accounts.scss +++ b/app/javascript/flavours/glitch/styles/accounts.scss @@ -221,6 +221,18 @@ background-color: rgba(lighten($error-red, 12%), 0.1); border-color: rgba(lighten($error-red, 12%), 0.5); } + + &.gentlies { + color: lighten(cyan, 25%); + background-color: rgba(lighten(cyan, 25%), 0.1); + border-color: rgba(lighten(cyan, 25%), 0.1); + } + + &.kobold { + color: lighten(orange, 22%); + background-color: rgba(lighten(orange, 33%), 0.1); + border-color: rgba(lighten(orange, 33%), 0.1); + } } .account__header__fields { diff --git a/app/lib/user_settings_decorator.rb b/app/lib/user_settings_decorator.rb index 182fb640b..855a06fea 100644 --- a/app/lib/user_settings_decorator.rb +++ b/app/lib/user_settings_decorator.rb @@ -19,6 +19,10 @@ class UserSettingsDecorator user.settings['always_local'] = always_local_preference if change?('setting_always_local') user.settings['rawr_federated'] = rawr_federated_preference if change?('setting_rawr_federated') user.settings['hide_stats'] = hide_stats_preference if change?('setting_hide_stats') + user.settings['larger_menus'] = larger_menus_preference if change?('setting_larger_menus') + user.settings['gently_kobolds'] = gently_kobolds_preference if change?('setting_gently_kobolds') + user.settings['user_is_kobold'] = user_is_kobold_preference if change?('setting_user_is_kobold') + user.settings['hide_captions'] = hide_captions_preference if change?('setting_hide_captions') user.settings['notification_emails'] = merged_notification_emails if change?('notification_emails') user.settings['interactions'] = merged_interactions if change?('interactions') @@ -44,6 +48,18 @@ class UserSettingsDecorator user.settings['default_content_type']= default_content_type_preference if change?('setting_default_content_type') end + def larger_menus_preference + boolean_cast_setting 'setting_larger_menus' + end + + def gently_kobolds_preference + boolean_cast_setting 'setting_gently_kobolds' + end + + def user_is_kobold_preference + boolean_cast_setting 'setting_user_is_kobold' + end + def merged_notification_emails user.settings['notification_emails'].merge coerced_settings('notification_emails').to_h end diff --git a/app/models/user.rb b/app/models/user.rb index 9e611d33f..f6f164c0b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -108,6 +108,10 @@ class User < ApplicationRecord :hide_stats, :disable_color, :hide_captions, + :larger_menus, + :gently_kobolds, + :user_is_kobold, + :auto_play_gif, :default_sensitive, :unfollow_modal, @@ -209,6 +213,18 @@ class User < ApplicationRecord save! end + def setting_larger_menus + settings.larger_menus || false + end + + def setting_gently_kobolds + settings.gently_kobolds || false + end + + def setting_user_is_kobold + settings.user_is_kobold || false + end + def setting_default_privacy settings.default_privacy || 'public' end diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 158abc120..8533fba76 100755 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -52,5 +52,12 @@ span .caption { display: none } + - if current_account&.user&.setting_larger_menus + :css + .dropdown-menu__item a + { padding: 14px 14px !important; font-size: 14px !important } + .dropdown--active .dropdown__content > ul > li > a + { padding: 14px 0 !important; font-size: 14px !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 d6031d5b8..f3ae65c94 100644 --- a/app/views/settings/preferences/show.html.haml +++ b/app/views/settings/preferences/show.html.haml @@ -46,6 +46,10 @@ .fields-group = f.input :setting_hide_followers_count, as: :boolean, wrapper: :with_label + .fields-group + = f.input :setting_gently_kobolds, as: :boolean, wrapper: :with_label + = f.input :setting_user_is_kobold, as: :boolean, wrapper: :with_label + %hr#settings_web/ .fields-group @@ -54,6 +58,7 @@ = f.input :setting_disable_color, as: :boolean, wrapper: :with_label = f.input :setting_system_font_ui, as: :boolean, wrapper: :with_label = f.input :setting_hide_captions, as: :boolean, wrapper: :with_label + = f.input :setting_larger_menus, as: :boolean, wrapper: :with_label .fields-group = f.input :setting_unfollow_modal, as: :boolean, wrapper: :with_label |