diff --git a/.haml-lint_todo.yml b/.haml-lint_todo.yml index 67f97c01c8..f2f70e1300 100644 --- a/.haml-lint_todo.yml +++ b/.haml-lint_todo.yml @@ -18,8 +18,13 @@ linters: - 'app/views/admin/accounts/_local_account.html.haml' - 'app/views/admin/accounts/index.html.haml' - 'app/views/admin/roles/_form.html.haml' + - 'app/views/home/index.html.haml' - 'app/views/layouts/application.html.haml' ViewLength: exclude: - 'app/views/admin/instances/show.html.haml' + + InstanceVariables: + exclude: + - 'app/views/application/_sidebar.html.haml' diff --git a/app/views/admin/custom_emojis/edit.html.haml b/app/views/admin/custom_emojis/edit.html.haml index a984f18d62..212684f048 100644 --- a/app/views/admin/custom_emojis/edit.html.haml +++ b/app/views/admin/custom_emojis/edit.html.haml @@ -14,7 +14,7 @@ .fields-group %samp= @custom_emoji.shortcode - - if !@custom_emoji.local? + - unless @custom_emoji.local? %h4= t('admin.custom_emojis.domain') .fields-group diff --git a/app/views/admin/friend_servers/_friend_domain.html.haml b/app/views/admin/friend_servers/_friend_domain.html.haml index 7da4db1b89..9a2e857aba 100644 --- a/app/views/admin/friend_servers/_friend_domain.html.haml +++ b/app/views/admin/friend_servers/_friend_domain.html.haml @@ -3,29 +3,29 @@ - unless friend.available %span.negative-hint = fa_icon('times') - = ' ' +   = t 'admin.friend_servers.disabled' %samp= friend.domain %td - if friend.accepted? %span.positive-hint = fa_icon('check') - = ' ' +   = t 'admin.friend_servers.enabled' - elsif friend.i_am_pending? = fa_icon('hourglass') - = ' ' +   = t 'admin.friend_servers.pending' - elsif friend.they_are_pending? %span.warning-hint = fa_icon('hourglass') - = ' ' +   = t 'admin.friend_servers.pending_you' - else %span.negative-hint = fa_icon('times') - = ' ' +   = t 'admin.friend_servers.disabled' %td - = table_link_to 'pencil', t('admin.friend_servers.edit_friend'), edit_admin_friend_server_path(friend) + = table_link_to 'pencil', t('admin.friend_servers.edit_friend'), edit_admin_friend_server_path(friend) = table_link_to 'times', t('admin.friend_servers.delete'), admin_friend_server_path(friend), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } diff --git a/app/views/admin/friend_servers/edit.html.haml b/app/views/admin/friend_servers/edit.html.haml index 06cff11bfb..9a2acb21a5 100644 --- a/app/views/admin/friend_servers/edit.html.haml +++ b/app/views/admin/friend_servers/edit.html.haml @@ -11,16 +11,16 @@ - if @friend.accepted? %span.positive-hint = fa_icon('check') - = ' ' +   = t 'admin.friend_servers.enabled' - elsif @friend.pending? = fa_icon('hourglass') - = ' ' +   = t 'admin.friend_servers.pending' - else %span.negative-hint = fa_icon('times') - = ' ' +   = t 'admin.friend_servers.disabled' .action-buttons %div diff --git a/app/views/admin/statuses/show.html.haml b/app/views/admin/statuses/show.html.haml index 317ccde078..69776b94f7 100644 --- a/app/views/admin/statuses/show.html.haml +++ b/app/views/admin/statuses/show.html.haml @@ -44,16 +44,16 @@ .action-buttons %div - - if @account.local? - = link_to t('admin.statuses.remove_history'), remove_history_admin_account_status_path(@account.id), data: { confirm: t('admin.statuses.are_you_sure') }, method: :post, class: 'button' if can?(:warn, @account) - - if @account.local? && @status.with_media? - = link_to t('admin.statuses.remove_media'), remove_media_admin_account_status_path(@account.id), data: { confirm: t('admin.statuses.are_you_sure') }, method: :post, class: 'button' if can?(:warn, @account) - - if @account.local? && !@status.sensitive && @status.with_media? - = link_to t('admin.statuses.force_nsfw'), force_sensitive_admin_account_status_path(@account.id), data: { confirm: t('admin.statuses.are_you_sure') }, method: :post, class: 'button' if can?(:warn, @account) - - if @account.local? && !@status.spoiler_text.present? - = link_to t('admin.statuses.force_cw'), force_cw_admin_account_status_path(@account.id), data: { confirm: t('admin.statuses.are_you_sure') }, method: :post, class: 'button' if can?(:warn, @account) - - if @account.local? - = link_to t('admin.statuses.remove'), remove_status_admin_account_status_path(@account.id), data: { confirm: t('admin.statuses.are_you_sure') }, method: :post, class: 'button' if can?(:warn, @account) + - if @account.local? && can?(:warn, @account) + = link_to t('admin.statuses.remove_history'), remove_history_admin_account_status_path(@account.id), data: { confirm: t('admin.statuses.are_you_sure') }, method: :post, class: 'button' + - if @account.local? && @status.with_media? && can?(:warn, @account) + = link_to t('admin.statuses.remove_media'), remove_media_admin_account_status_path(@account.id), data: { confirm: t('admin.statuses.are_you_sure') }, method: :post, class: 'button' + - if @account.local? && !@status.sensitive && @status.with_media? && can?(:warn, @account) + = link_to t('admin.statuses.force_nsfw'), force_sensitive_admin_account_status_path(@account.id), data: { confirm: t('admin.statuses.are_you_sure') }, method: :post, class: 'button' + - if @account.local? && @status.spoiler_text.blank? && can?(:warn, @account) + = link_to t('admin.statuses.force_cw'), force_cw_admin_account_status_path(@account.id), data: { confirm: t('admin.statuses.are_you_sure') }, method: :post, class: 'button' + - if @account.local? && can?(:warn, @account) + = link_to t('admin.statuses.remove'), remove_status_admin_account_status_path(@account.id), data: { confirm: t('admin.statuses.are_you_sure') }, method: :post, class: 'button' %hr.spacer/ diff --git a/app/views/antennas/_antenna.html.haml b/app/views/antennas/_antenna.html.haml index a79e3557bf..ed3b8c3bde 100644 --- a/app/views/antennas/_antenna.html.haml +++ b/app/views/antennas/_antenna.html.haml @@ -26,7 +26,7 @@ .permissions-list__item__text__title = t('antennas.index.domains', count: antenna.antenna_domains.size) .permissions-list__item__text__type - - domains = antenna.antenna_domains.map { |domain| domain.name } + - domains = antenna.antenna_domains.map(&:name) - domains = domains.take(5) + ['…'] if domains.size > 5 # TODO = domains.join(', ') - unless antenna.antenna_accounts.empty? @@ -40,7 +40,7 @@ - accounts = antenna.antenna_accounts.map { |account| account.account.domain ? "@#{account.account.username}@#{account.account.domain}" : "@#{account.account.username}" } - accounts = accounts.take(5) + ['…'] if accounts.size > 5 # TODO = accounts.join(', ') - - unless antenna.keywords.nil? || antenna.keywords.empty? + - if antenna.keywords.present? %li.permissions-list__item .permissions-list__item__icon = fa_icon('paragraph') diff --git a/app/views/antennas/_antenna_fields.html.haml b/app/views/antennas/_antenna_fields.html.haml index 998aa5fdeb..49ec951669 100644 --- a/app/views/antennas/_antenna_fields.html.haml +++ b/app/views/antennas/_antenna_fields.html.haml @@ -5,7 +5,7 @@ .fields-row__column.fields-row__column-6.fields-group = f.input :title, as: :string, wrapper: :with_label, hint: false .fields-row__column.fields-row__column-6.fields-group - = f.input :expires_in, wrapper: :with_label, collection: [30.minutes, 1.hour, 6.hours, 12.hours, 1.day, 1.week].map(&:to_i), label_method: lambda { |i| I18n.t("invites.expires_in.#{i}") }, include_blank: I18n.t('invites.expires_in_prompt') + = f.input :expires_in, wrapper: :with_label, collection: [30.minutes, 1.hour, 6.hours, 12.hours, 1.day, 1.week].map(&:to_i), label_method: ->(i) { I18n.t("invites.expires_in.#{i}") }, include_blank: I18n.t('invites.expires_in_prompt') .fields-row = f.input :available, wrapper: :with_label, label: t('antennas.edit.available'), hint: false diff --git a/app/views/settings/preferences/other/show.html.haml b/app/views/settings/preferences/other/show.html.haml index 353715df01..e0ca7e4332 100644 --- a/app/views/settings/preferences/other/show.html.haml +++ b/app/views/settings/preferences/other/show.html.haml @@ -26,7 +26,7 @@ - if Setting.enable_emoji_reaction .fields-row .fields-group.fields-row__column.fields-row__column-12 - = ff.input :emoji_reaction_policy, kmyblue: true, collection: ['allow', 'outside_only', 'followers_only', 'following_only', 'mutuals_only', 'block'], label_method: lambda { |item| safe_join([t("simple_form.labels.defaults.setting_emoji_reaction_policy_items.#{item}")]) }, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', include_blank: false, wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_emoji_reaction_policy'), hint: false, warning_hint: I18n.t('simple_form.hints.defaults.setting_emoji_reaction_policy') + = ff.input :emoji_reaction_policy, kmyblue: true, collection: %w(allow outside_only followers_only following_only mutuals_only block), label_method: ->(item) { safe_join([t("simple_form.labels.defaults.setting_emoji_reaction_policy_items.#{item}")]) }, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', include_blank: false, wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_emoji_reaction_policy'), hint: false, warning_hint: I18n.t('simple_form.hints.defaults.setting_emoji_reaction_policy') - if @dtl_enabled @@ -38,7 +38,7 @@ = ff.input :'web.enable_dtl_menu', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_dtl_menu') .fields-group - = ff.input :dtl_force_with_tag, kmyblue: true, collection: ['full', 'searchability', 'none'], label_method: lambda { |item| safe_join([t("simple_form.labels.dtl_force_with_tag.#{item}")]) }, as: :radio_buttons, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', wrapper: :with_floating_label, label: I18n.t('simple_form.labels.defaults.setting_dtl_force_with_tag'), hint: I18n.t('simple_form.hints.defaults.setting_dtl_force_with_tag', tag: @dtl_tag) + = ff.input :dtl_force_with_tag, kmyblue: true, collection: %w(full searchability none), label_method: ->(item) { safe_join([t("simple_form.labels.dtl_force_with_tag.#{item}")]) }, as: :radio_buttons, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', wrapper: :with_floating_label, label: I18n.t('simple_form.labels.defaults.setting_dtl_force_with_tag'), hint: I18n.t('simple_form.hints.defaults.setting_dtl_force_with_tag', tag: @dtl_tag) .fields-group = ff.input :dtl_force_subscribable, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_dtl_force_subscribable'), hint: I18n.t('simple_form.hints.defaults.setting_dtl_force_subscribable') diff --git a/app/views/settings/preferences/reaching/show.html.haml b/app/views/settings/preferences/reaching/show.html.haml index 3e330ad590..8f0b68556e 100644 --- a/app/views/settings/preferences/reaching/show.html.haml +++ b/app/views/settings/preferences/reaching/show.html.haml @@ -8,7 +8,6 @@ = render 'shared/error_messages', object: current_user = f.simple_fields_for :settings, current_user.settings do |ff| - %h4= t 'preferences.visibility' .fields-row @@ -16,7 +15,7 @@ = ff.input :default_privacy, collection: Status.selectable_visibilities, wrapper: :with_label, include_blank: false, label_method: ->(visibility) { safe_join([I18n.t("statuses.visibilities.#{visibility}"), I18n.t("statuses.visibilities.#{visibility}_long")], ' - ') }, required: false, hint: false, label: I18n.t('simple_form.labels.defaults.setting_default_privacy') .fields-group.fields-row__column.fields-row__column-6 - = ff.input :default_reblog_privacy, collection: Status.selectable_reblog_visibilities, wrapper: :with_label, kmyblue: true, include_blank: false, label_method: lambda { |visibility| safe_join([I18n.t("statuses.visibilities.#{visibility}"), I18n.t("statuses.visibilities.#{visibility}_long")], ' - ') }, required: false, hint: false, label: I18n.t('simple_form.labels.defaults.setting_default_reblog_privacy') + = ff.input :default_reblog_privacy, collection: Status.selectable_reblog_visibilities, wrapper: :with_label, kmyblue: true, include_blank: false, label_method: ->(visibility) { safe_join([I18n.t("statuses.visibilities.#{visibility}"), I18n.t("statuses.visibilities.#{visibility}_long")], ' - ') }, required: false, hint: false, label: I18n.t('simple_form.labels.defaults.setting_default_reblog_privacy') .fields-group = ff.input :stay_privacy, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_stay_privacy') @@ -32,7 +31,7 @@ .fields-row .fields-group.fields-row__column.fields-row__column-12 - = 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'), hint: I18n.t('simple_form.hints.defaults.setting_default_searchability') + = ff.input :default_searchability, collection: Status.selectable_searchabilities, wrapper: :with_label, kmyblue: true, include_blank: false, label_method: ->(searchability) { safe_join([I18n.t("statuses.searchabilities.#{searchability}"), I18n.t("statuses.searchabilities.#{searchability}_long")], ' - ') }, required: false, label: I18n.t('simple_form.labels.defaults.setting_default_searchability'), hint: I18n.t('simple_form.hints.defaults.setting_default_searchability') .fields-group = ff.input :disallow_unlisted_public_searchability, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_disallow_unlisted_public_searchability'), hint: I18n.t('simple_form.hints.defaults.setting_disallow_unlisted_public_searchability') @@ -41,7 +40,7 @@ .fields-row .fields-group.fields-row__column.fields-row__column-12 - = ff.input :default_searchability_of_search, collection: Status.selectable_searchabilities_for_search, wrapper: :with_label, kmyblue: true, include_blank: false, label_method: lambda { |searchability| safe_join([I18n.t("statuses.searchabilities.#{searchability}"), I18n.t("statuses.searchabilities.#{searchability}_search_long")], ' - ') }, required: false, hint: false, label: I18n.t('simple_form.labels.defaults.setting_default_searchability_of_search') + = ff.input :default_searchability_of_search, collection: Status.selectable_searchabilities_for_search, wrapper: :with_label, kmyblue: true, include_blank: false, label_method: ->(searchability) { safe_join([I18n.t("statuses.searchabilities.#{searchability}"), I18n.t("statuses.searchabilities.#{searchability}_search_long")], ' - ') }, required: false, hint: false, label: I18n.t('simple_form.labels.defaults.setting_default_searchability_of_search') .fields-group = ff.input :use_public_index, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_use_public_index') diff --git a/app/views/settings/profiles/show.html.haml b/app/views/settings/profiles/show.html.haml index 77e7c5be27..ba6169132c 100644 --- a/app/views/settings/profiles/show.html.haml +++ b/app/views/settings/profiles/show.html.haml @@ -62,7 +62,7 @@ %h4= t('edit_profile.other') .fields-group - = f.input :my_actor_type, collection: ['person', 'bot'],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 + = f.input :my_actor_type, collection: %w(person bot), label_method: ->(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 .actions = f.button :button, t('generic.save_changes'), type: :submit