From a9ef82febb929be1e6ccd650cbad5d9850448fc4 Mon Sep 17 00:00:00 2001 From: Lynx Kotoura Date: Sat, 16 Jun 2018 19:56:45 +0900 Subject: Fix autosuggest-textarea backgrounds and some minor adjustments (#7817) --- app/javascript/styles/mastodon-light/diff.scss | 92 +++++++++++++++----------- 1 file changed, 55 insertions(+), 37 deletions(-) (limited to 'app/javascript/styles') diff --git a/app/javascript/styles/mastodon-light/diff.scss b/app/javascript/styles/mastodon-light/diff.scss index fad7feb98..84ccd326e 100644 --- a/app/javascript/styles/mastodon-light/diff.scss +++ b/app/javascript/styles/mastodon-light/diff.scss @@ -25,33 +25,51 @@ background: $ui-base-color url('data:image/svg+xml;utf8,') no-repeat bottom / 100% auto; } -.compose-form .compose-form__modifiers .compose-form__upload__actions .icon-button { - color: lighten($white, 7%); +// Change the colors used in compose-form +.compose-form { + .compose-form__modifiers { + .compose-form__upload__actions .icon-button { + color: lighten($white, 7%); + + &:active, + &:focus, + &:hover { + color: $white; + } + } - &:active, - &:focus, - &:hover { - color: $white; + .compose-form__upload-description input { + color: lighten($white, 7%); + + &::placeholder { + color: lighten($white, 7%); + } + } } -} -.compose-form .compose-form__modifiers .compose-form__upload-description input { - color: lighten($white, 7%); + .compose-form__buttons-wrapper { + background: darken($ui-base-color, 6%); + } - &::placeholder { - color: lighten($white, 7%); + .autosuggest-textarea__suggestions { + background: darken($ui-base-color, 6%); } -} -.compose-form .compose-form__buttons-wrapper { - background: darken($ui-base-color, 6%); + .autosuggest-textarea__suggestions__item { + &:hover, + &:focus, + &:active, + &.selected { + background: lighten($ui-base-color, 4%); + } + } } .emoji-mart-bar { - border-color: lighten($ui-base-color, 8%); + border-color: lighten($ui-base-color, 4%); &:first-child { - background: $ui-base-color; + background: darken($ui-base-color, 6%); } } @@ -60,6 +78,7 @@ border-color: $ui-base-color; } +// Change the background colors of statuses .focusable:focus { background: $ui-base-color; } @@ -77,7 +96,7 @@ background: darken($ui-base-color, 6%); } -// Change the background color of status__content__spoiler-link +// Change the background colors of status__content__spoiler-link .reply-indicator__content .status__content__spoiler-link, .status__content .status__content__spoiler-link { background: $ui-base-lighter-color; @@ -87,8 +106,7 @@ } } -// Change the background colors of media and video spoiler - +// Change the background colors of media and video spoilers .media-spoiler, .video-player__spoiler { background: $ui-base-color; @@ -101,30 +119,30 @@ // Change the colors used in the dropdown menu .dropdown-menu { background: $ui-base-color; -} -.dropdown-menu__arrow { - &.left { - border-left-color: $ui-base-color; - } + &__arrow { + &.left { + border-left-color: $ui-base-color; + } - &.top { - border-top-color: $ui-base-color; - } + &.top { + border-top-color: $ui-base-color; + } - &.bottom { - border-bottom-color: $ui-base-color; - } + &.bottom { + border-bottom-color: $ui-base-color; + } - &.right { - border-right-color: $ui-base-color; + &.right { + border-right-color: $ui-base-color; + } } -} -.dropdown-menu__item { - a { - background: $ui-base-color; - color: $darker-text-color; + &__item { + a { + background: $ui-base-color; + color: $darker-text-color; + } } } -- cgit From 9c08a368e7dbbe621690acc642e5300476b7a89f Mon Sep 17 00:00:00 2001 From: Lynx Kotoura Date: Sat, 16 Jun 2018 19:57:25 +0900 Subject: Adjust account__action-bar contents (#7818) --- app/javascript/mastodon/features/account/components/action_bar.js | 8 ++++---- app/javascript/styles/mastodon/components.scss | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'app/javascript/styles') diff --git a/app/javascript/mastodon/features/account/components/action_bar.js b/app/javascript/mastodon/features/account/components/action_bar.js index 2d0f72be2..69726a416 100644 --- a/app/javascript/mastodon/features/account/components/action_bar.js +++ b/app/javascript/mastodon/features/account/components/action_bar.js @@ -140,10 +140,6 @@ export default class ActionBar extends React.PureComponent { {extraInfo}
-
- -
-
@@ -160,6 +156,10 @@ export default class ActionBar extends React.PureComponent { {shortNumberFormat(account.get('followers_count'))}
+ +
+ +
); diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index 9ec25c572..4bcd1dec7 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -1211,6 +1211,10 @@ a .account__avatar { flex: 0 1 calc(50% - 140px); padding: 10px; + .icon-button { + vertical-align: middle; + } + .dropdown--active { .dropdown__content.dropdown__right { left: 6px; @@ -1230,13 +1234,14 @@ a .account__avatar { display: flex; flex: 1 1 auto; line-height: 18px; + text-align: center; } .account__action-bar__tab { text-decoration: none; overflow: hidden; flex: 0 1 80px; - border-left: 1px solid lighten($ui-base-color, 8%); + border-right: 1px solid lighten($ui-base-color, 8%); padding: 10px 5px; & > span { -- cgit From 31e5d7efd700547d27d0393264859fa02932a8dd Mon Sep 17 00:00:00 2001 From: Lynx Kotoura Date: Sun, 17 Jun 2018 20:47:56 +0900 Subject: Fix the action with X button on compose form (#7826) --- app/javascript/styles/mastodon/components.scss | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'app/javascript/styles') diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index 4bcd1dec7..28daac6a3 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -4941,8 +4941,8 @@ noscript { .navigation-bar { & > a:first-child { - will-change: margin-top, margin-left, width; - transition: margin-top $duration $delay, margin-left $duration ($duration + $delay); + will-change: margin-top, margin-left, margin-right, width; + transition: margin-top $duration $delay, margin-left $duration ($duration + $delay), margin-right $duration ($duration + $delay); } & > .navigation-bar__profile-edit { @@ -4975,8 +4975,7 @@ noscript { padding-bottom: 0; & > a:first-child { - margin-top: -50px; - margin-left: -40px; + margin: -100px 10px 0 -50px; } .navigation-bar__profile { @@ -4985,7 +4984,7 @@ noscript { .navigation-bar__profile-edit { position: absolute; - margin-top: -50px; + margin-top: -60px; } .navigation-bar__actions { @@ -4993,6 +4992,7 @@ noscript { pointer-events: auto; opacity: 1; transform: scale(1.0, 1.0) translate(0, 0); + bottom: 5px; } .compose__action-bar .icon-button { -- cgit From a58ec29631f74259364dc71b408a8d66df657149 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 17 Jun 2018 18:57:31 +0200 Subject: Allow selecting default posting language instead of auto-detect (#7828) * Allow selecting default posting language instead of auto-detect * Enable default language setting in credentials API * Fix form saving --- app/controllers/api/v1/accounts/credentials_controller.rb | 1 + app/controllers/settings/preferences_controller.rb | 1 + app/javascript/styles/mastodon/forms.scss | 2 ++ app/lib/user_settings_decorator.rb | 5 +++++ app/models/user.rb | 2 +- app/serializers/rest/credential_account_serializer.rb | 1 + app/services/post_status_service.rb | 2 +- app/views/settings/preferences/show.html.haml | 2 ++ config/locales/en.yml | 1 + config/locales/simple_form.en.yml | 5 ++++- 10 files changed, 19 insertions(+), 3 deletions(-) (limited to 'app/javascript/styles') diff --git a/app/controllers/api/v1/accounts/credentials_controller.rb b/app/controllers/api/v1/accounts/credentials_controller.rb index 259d07be8..2d0737ee4 100644 --- a/app/controllers/api/v1/accounts/credentials_controller.rb +++ b/app/controllers/api/v1/accounts/credentials_controller.rb @@ -32,6 +32,7 @@ class Api::V1::Accounts::CredentialsController < Api::BaseController { 'setting_default_privacy' => source_params.fetch(:privacy, @account.user.setting_default_privacy), 'setting_default_sensitive' => source_params.fetch(:sensitive, @account.user.setting_default_sensitive), + 'setting_default_language' => source_params.fetch(:language, @account.user.setting_default_language), } end end diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb index 851e62d1b..e2cb13167 100644 --- a/app/controllers/settings/preferences_controller.rb +++ b/app/controllers/settings/preferences_controller.rb @@ -35,6 +35,7 @@ class Settings::PreferencesController < ApplicationController params.require(:user).permit( :setting_default_privacy, :setting_default_sensitive, + :setting_default_language, :setting_unfollow_modal, :setting_boost_modal, :setting_delete_modal, diff --git a/app/javascript/styles/mastodon/forms.scss b/app/javascript/styles/mastodon/forms.scss index de16784a8..f1ed2c90b 100644 --- a/app/javascript/styles/mastodon/forms.scss +++ b/app/javascript/styles/mastodon/forms.scss @@ -140,6 +140,8 @@ code { } .input.with_block_label { + padding-top: 15px; + & > label { font-family: inherit; font-size: 16px; diff --git a/app/lib/user_settings_decorator.rb b/app/lib/user_settings_decorator.rb index a82f8974b..833959397 100644 --- a/app/lib/user_settings_decorator.rb +++ b/app/lib/user_settings_decorator.rb @@ -19,6 +19,7 @@ class UserSettingsDecorator user.settings['interactions'] = merged_interactions if change?('interactions') user.settings['default_privacy'] = default_privacy_preference if change?('setting_default_privacy') user.settings['default_sensitive'] = default_sensitive_preference if change?('setting_default_sensitive') + user.settings['default_language'] = default_language_preference if change?('setting_default_language') user.settings['unfollow_modal'] = unfollow_modal_preference if change?('setting_unfollow_modal') user.settings['boost_modal'] = boost_modal_preference if change?('setting_boost_modal') user.settings['delete_modal'] = delete_modal_preference if change?('setting_delete_modal') @@ -87,6 +88,10 @@ class UserSettingsDecorator settings['setting_theme'] end + def default_language_preference + settings['setting_default_language'] + 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 c95960dc6..c820c553a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -89,7 +89,7 @@ class User < ApplicationRecord delegate :auto_play_gif, :default_sensitive, :unfollow_modal, :boost_modal, :delete_modal, :reduce_motion, :system_font_ui, :noindex, :theme, :display_sensitive_media, :hide_network, - to: :settings, prefix: :setting, allow_nil: false + :default_language, to: :settings, prefix: :setting, allow_nil: false attr_accessor :invite_code diff --git a/app/serializers/rest/credential_account_serializer.rb b/app/serializers/rest/credential_account_serializer.rb index 56857cba8..fb195eb07 100644 --- a/app/serializers/rest/credential_account_serializer.rb +++ b/app/serializers/rest/credential_account_serializer.rb @@ -9,6 +9,7 @@ class REST::CredentialAccountSerializer < REST::AccountSerializer { privacy: user.setting_default_privacy, sensitive: user.setting_default_sensitive, + language: user.setting_default_language, note: object.note, fields: object.fields.map(&:to_h), } diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index a5a21c359..735985725 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -30,7 +30,7 @@ class PostStatusService < BaseService sensitive: (options[:sensitive].nil? ? account.user&.setting_default_sensitive : options[:sensitive]) || options[:spoiler_text].present?, spoiler_text: options[:spoiler_text] || '', visibility: options[:visibility] || account.user&.setting_default_privacy, - language: language_from_option(options[:language]) || LanguageDetector.instance.detect(text, account), + language: language_from_option(options[:language]) || account.user&.setting_default_language&.presence || LanguageDetector.instance.detect(text, account), application: options[:application]) end diff --git a/app/views/settings/preferences/show.html.haml b/app/views/settings/preferences/show.html.haml index 6ec03ab4b..43430069f 100644 --- a/app/views/settings/preferences/show.html.haml +++ b/app/views/settings/preferences/show.html.haml @@ -12,6 +12,8 @@ .fields-group = f.input :locale, collection: I18n.available_locales, wrapper: :with_label, include_blank: false, label_method: lambda { |locale| human_locale(locale) }, selected: I18n.locale + = f.input :setting_default_language, collection: [nil] + filterable_languages.sort, wrapper: :with_label, label_method: lambda { |locale| locale.nil? ? I18n.t('statuses.language_detection') : human_locale(locale) }, required: false, include_blank: false + = f.input :chosen_languages, collection: filterable_languages.sort, wrapper: :with_block_label, include_blank: false, label_method: lambda { |locale| human_locale(locale) }, required: false, as: :check_boxes, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li' %h4= t 'preferences.publishing' diff --git a/config/locales/en.yml b/config/locales/en.yml index 46875d2ec..01e5dd2f8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -675,6 +675,7 @@ en: disallowed_hashtags: one: 'contained a disallowed hashtag: %{tags}' other: 'contained the disallowed hashtags: %{tags}' + language_detection: Automatically detect language open_in_web: Open in web over_character_limit: character limit of %{max} exceeded pin_errors: diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index a75a0f567..6783f0045 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -12,10 +12,12 @@ en: other: %{count} characters left fields: You can have up to 4 items displayed as a table on your profile header: PNG, GIF or JPG. At most 2MB. Will be downscaled to 700x335px + locale: The language of the user interface, e-mails and push notifications locked: Requires you to manually approve followers note: one: 1 character left other: %{count} characters left + setting_default_language: The language of your toots can be detected automatically, but it's not always accurate setting_hide_network: Who you follow and who follows you will not be shown on your profile setting_noindex: Affects your public profile and status pages setting_theme: Affects how Mastodon looks when you're logged in from any device. @@ -24,7 +26,7 @@ en: sessions: otp: 'Enter the two-factor code generated by your phone app or use one of your recovery codes:' user: - chosen_languages: Only toots in selected languages will be displayed in public timelines. Select nothing to see toots in all languages + chosen_languages: When checked, only toots in selected languages will be displayed in public timelines labels: account: fields: @@ -53,6 +55,7 @@ en: password: Password setting_auto_play_gif: Auto-play animated GIFs setting_boost_modal: Show confirmation dialog before boosting + setting_default_language: Posting language setting_default_privacy: Post privacy setting_default_sensitive: Always mark media as sensitive setting_delete_modal: Show confirmation dialog before deleting a toot -- cgit