From 35b576dbecfd9e980206189b61efe58fba9269b9 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 16 Oct 2018 14:07:54 +0200 Subject: Improve form for selecting media display preference (#8965) Regression from #8569 --- app/views/settings/preferences/show.html.haml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'app/views/settings/preferences') diff --git a/app/views/settings/preferences/show.html.haml b/app/views/settings/preferences/show.html.haml index 608a290e7..d889702fe 100644 --- a/app/views/settings/preferences/show.html.haml +++ b/app/views/settings/preferences/show.html.haml @@ -36,9 +36,11 @@ %hr#settings_web/ - - if Themes.instance.names.size > 1 - .fields-group - = f.input :setting_theme, collection: Themes.instance.names, label_method: lambda { |theme| I18n.t("themes.#{theme}", default: theme) }, wrapper: :with_block_label, include_blank: false + .fields-row + .fields-group.fields-row__column.fields-row__column-6 + = f.input :setting_theme, collection: Themes.instance.names, label_method: lambda { |theme| I18n.t("themes.#{theme}", default: theme) }, wrapper: :with_label, include_blank: false, hint: false + .fields-group.fields-row__column.fields-row__column-6 + = f.input :setting_display_media, collection: ['default', 'show_all', 'hide_all'], wrapper: :with_label, include_blank: false, label_method: lambda { |item| t("simple_form.hints.defaults.setting_display_media_#{item}") }, hint: false .fields-group = f.input :setting_unfollow_modal, as: :boolean, wrapper: :with_label @@ -47,7 +49,6 @@ .fields-group = f.input :setting_auto_play_gif, as: :boolean, wrapper: :with_label - = f.input :setting_display_media, collection: ['default', 'show_all', 'hide_all'], wrapper: :with_label, include_blank: false, label_method: lambda { |item| safe_join([t("simple_form.labels.defaults.setting_display_media_#{item}"), content_tag(:span, t("simple_form.hints.defaults.setting_display_media_#{item}"), class: 'hint')]) }, required: false, as: :radio_buttons, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li' = f.input :setting_expand_spoilers, as: :boolean, wrapper: :with_label = f.input :setting_reduce_motion, as: :boolean, wrapper: :with_label = f.input :setting_system_font_ui, as: :boolean, wrapper: :with_label -- cgit From 72d7d3003b1e21ef8a6f5112f1e8cb32c72e8992 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 17 Oct 2018 22:04:40 +0200 Subject: Do not show "limited" visibility in default visibility preference (#8999) * Do not show "limited" visibility in default visibility preference Fix regression from #8950 * Fix code style issue --- app/models/status.rb | 4 ++++ app/views/settings/preferences/show.html.haml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'app/views/settings/preferences') diff --git a/app/models/status.rb b/app/models/status.rb index b18cb56b2..bcb7dd373 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -238,6 +238,10 @@ class Status < ApplicationRecord left_outer_joins(:status_stat).select('statuses.id, greatest(statuses.updated_at, status_stats.updated_at) AS updated_at') end + def selectable_visibilities + visibilities.keys - %w(direct limited) + end + def in_chosen_languages(account) where(language: nil).or where(language: account.chosen_languages) end diff --git a/app/views/settings/preferences/show.html.haml b/app/views/settings/preferences/show.html.haml index d889702fe..ecb789f93 100644 --- a/app/views/settings/preferences/show.html.haml +++ b/app/views/settings/preferences/show.html.haml @@ -22,7 +22,7 @@ %hr#settings_publishing/ .fields-group - = f.input :setting_default_privacy, collection: Status.visibilities.keys - ['direct'], wrapper: :with_floating_label, include_blank: false, label_method: lambda { |visibility| safe_join([I18n.t("statuses.visibilities.#{visibility}"), content_tag(:span, I18n.t("statuses.visibilities.#{visibility}_long"), class: 'hint')]) }, required: false, as: :radio_buttons, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li' + = f.input :setting_default_privacy, collection: Status.selectable_visibilities, wrapper: :with_floating_label, include_blank: false, label_method: lambda { |visibility| safe_join([I18n.t("statuses.visibilities.#{visibility}"), content_tag(:span, I18n.t("statuses.visibilities.#{visibility}_long"), class: 'hint')]) }, required: false, as: :radio_buttons, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li' = f.input :setting_default_sensitive, as: :boolean, wrapper: :with_label -- cgit