1
0
Fork 0
forked from gitea/nas

Add kmyblue mark in config page

This commit is contained in:
KMY 2023-05-11 11:16:53 +09:00
parent 424dc584a9
commit d1c625df7c
9 changed files with 34 additions and 11 deletions

View file

@ -199,7 +199,8 @@
.account-role,
.simple_form .recommended,
.simple_form .not_recommended {
.simple_form .not_recommended,
.simple_form .kmyblue {
display: inline-block;
padding: 4px 6px;
cursor: default;
@ -230,6 +231,12 @@
border-color: rgba(lighten($error-red, 12%), 0.5);
}
.simple_form .kmyblue {
color: lighten($kmyblue, 12%);
background-color: rgba(lighten($kmyblue, 12%), 0.1);
border-color: rgba(lighten($kmyblue, 12%), 0.5);
}
.account__header__fields {
max-width: 100vw;
padding: 0;

View file

@ -5,6 +5,7 @@ $success-green: #79bd9a !default; // Padua
$error-red: #df405a !default; // Cerise
$warning-red: #ff5050 !default; // Sunset Orange
$gold-star: #ca8f04 !default; // Dark Goldenrod
$kmyblue: #29a5f7 !default;
$red-bookmark: $warning-red;

View file

@ -57,7 +57,7 @@
= ff.input :'web.display_media', collection: ['default', 'show_all', 'hide_all'],label_method: lambda { |item| t("simple_form.hints.defaults.setting_display_media_#{item}") }, hint: false, as: :radio_buttons, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', wrapper: :with_floating_label, label: I18n.t('simple_form.labels.defaults.setting_display_media')
.fields-group
= ff.input :'web.display_media_expand', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_display_media_expand'), hint: I18n.t('simple_form.hints.defaults.setting_display_media_expand')
= ff.input :'web.display_media_expand', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_display_media_expand'), hint: I18n.t('simple_form.hints.defaults.setting_display_media_expand')
.fields-group
= ff.input :'web.use_blurhash', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_use_blurhash'), hint: I18n.t('simple_form.hints.defaults.setting_use_blurhash')

View file

@ -36,4 +36,4 @@
.fields-group
= f.simple_fields_for :settings, current_user.settings do |ff|
= ff.input :stop_emoji_reaction_streaming, as: :boolean, wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_stop_emoji_reaction_streaming'), hint: I18n.t('simple_form.hints.defaults.setting_stop_emoji_reaction_streaming')
= ff.input :stop_emoji_reaction_streaming, as: :boolean, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_stop_emoji_reaction_streaming'), hint: I18n.t('simple_form.hints.defaults.setting_stop_emoji_reaction_streaming')

View file

@ -12,7 +12,7 @@
= ff.input :noindex, wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_noindex'), hint: I18n.t('simple_form.hints.defaults.setting_noindex')
.fields-group
= ff.input :noai, wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_noai'), hint: I18n.t('simple_form.hints.defaults.setting_noai')
= ff.input :noai, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_noai'), hint: I18n.t('simple_form.hints.defaults.setting_noai')
.fields-group
= ff.input :aggregate_reblogs, wrapper: :with_label, recommended: true, label: I18n.t('simple_form.labels.defaults.setting_aggregate_reblogs'), hint: I18n.t('simple_form.hints.defaults.setting_aggregate_reblogs')
@ -27,10 +27,10 @@
= ff.input :default_language, collection: [nil] + filterable_languages, wrapper: :with_label, label_method: lambda { |locale| locale.nil? ? I18n.t('statuses.default_language') : native_locale_name(locale) }, required: false, include_blank: false, hint: false, label: I18n.t('simple_form.labels.defaults.setting_default_language')
.fields-group
= ff.input :default_searchability, collection: Status.selectable_searchabilities, wrapper: :with_label, include_blank: false, label_method: lambda { |searchability| safe_join([I18n.t("statuses.searchabilities.#{searchability}"), I18n.t("statuses.searchabilities.#{searchability}_long")], ' - ') }, required: false, hint: false, label: I18n.t('simple_form.labels.defaults.setting_default_searchability')
= ff.input :default_searchability, collection: Status.selectable_searchabilities, wrapper: :with_label, kmyblue: true, include_blank: false, label_method: lambda { |searchability| safe_join([I18n.t("statuses.searchabilities.#{searchability}"), I18n.t("statuses.searchabilities.#{searchability}_long")], ' - ') }, required: false, hint: false, label: I18n.t('simple_form.labels.defaults.setting_default_searchability')
.fields-group
= ff.input :public_post_to_unlisted, wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_public_post_to_unlisted'), hint: I18n.t('simple_form.hints.defaults.setting_public_post_to_unlisted')
= ff.input :public_post_to_unlisted, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_public_post_to_unlisted'), hint: I18n.t('simple_form.hints.defaults.setting_public_post_to_unlisted')
.fields-group
= ff.input :default_sensitive, wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_default_sensitive'), hint: I18n.t('simple_form.hints.defaults.setting_default_sensitive')
@ -41,13 +41,13 @@
%h4= t 'preferences.stop_deliver'
.fields-group
= f.input :setting_send_without_domain_blocks, as: :boolean, wrapper: :with_label
= f.input :setting_send_without_domain_blocks, kmyblue: true, recommended: :not_recommended, as: :boolean, wrapper: :with_label
.fields-group
= f.input :setting_reject_public_unlisted_subscription, as: :boolean, wrapper: :with_label
= f.input :setting_reject_public_unlisted_subscription, kmyblue: true, as: :boolean, wrapper: :with_label
.fields-group
= f.input :setting_reject_unlisted_subscription, as: :boolean, wrapper: :with_label
= f.input :setting_reject_unlisted_subscription, kmyblue: true, as: :boolean, wrapper: :with_label
%h4= t 'preferences.public_timelines'

View file

@ -30,7 +30,7 @@
= f.input :my_actor_type, collection: ['person', 'bot', 'group'],label_method: lambda { |item| safe_join([t("simple_form.labels.defaults.#{item}"), content_tag(:span, I18n.t("simple_form.hints.defaults.#{item}"), class: 'hint')]) }, as: :radio_buttons, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', wrapper: :with_floating_label
.fields-group
= f.input :group_allow_private_message, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.group_allow_private_message')
= f.input :group_allow_private_message, as: :boolean, wrapper: :with_label, kmyblue: true, hint: t('simple_form.hints.defaults.group_allow_private_message')
.fields-group
= f.input :discoverable, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.discoverable'), recommended: true
@ -39,7 +39,7 @@
= f.input :hide_collections, as: :boolean, wrapper: :with_label, label: t('simple_form.labels.defaults.setting_hide_network'), hint: t('simple_form.hints.defaults.setting_hide_network')
.fields-group
= f.input :dissubscribable, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.dissubscribable')
= f.input :dissubscribable, as: :boolean, wrapper: :with_label, kmyblue: true, hint: t('simple_form.hints.defaults.dissubscribable')
%hr.spacer/

View file

@ -19,8 +19,20 @@ module RecommendedComponent
end
end
module KmyblueComponent
def kmyblue(_wrapper_options = nil)
return unless options[:kmyblue]
key = options[:kmyblue].is_a?(Symbol) ? options[:kmyblue] : :kmyblue
options[:label_text] = ->(raw_label_text, _required_label_text, _label_present) { safe_join([raw_label_text, ' ', content_tag(:span, I18n.t(key, scope: 'simple_form'), class: key)]) }
nil
end
end
SimpleForm.include_component(AppendComponent)
SimpleForm.include_component(RecommendedComponent)
SimpleForm.include_component(KmyblueComponent)
SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a
@ -78,6 +90,7 @@ SimpleForm.setup do |config|
b.wrapper tag: :div, class: :label_input do |ba|
ba.optional :recommended
ba.optional :kmyblue
ba.use :label
ba.wrapper tag: :div, class: :label_input__wrapper do |bb|

View file

@ -136,6 +136,7 @@ en:
webhook:
events: Select events to send
url: Where events will be sent to
kmyblue: kmyblue
labels:
account:
fields:

View file

@ -142,6 +142,7 @@ ja:
webhook:
events: 送信するイベントを選択
url: イベントの送信先
kmyblue: kmyblue
labels:
account:
fields: