glitch-soc/mastodon

View on GitHub
app/views/statuses_cleanup/show.html.haml

Summary

Maintainability
Test Coverage
- content_for :page_title do
  = t('settings.statuses_cleanup')

- content_for :heading_actions do
  = button_tag t('generic.save_changes'), class: 'button', form: 'edit_policy'

= simple_form_for @policy, url: statuses_cleanup_path, method: :put, html: { id: 'edit_policy' } do |f|
  .fields-row
    .fields-row__column.fields-row__column-6.fields-group
      = f.input :enabled,
                as: :boolean,
                hint: t('statuses_cleanup.enabled_hint'),
                label: t('statuses_cleanup.enabled'),
                wrapper: :with_label
    .fields-row__column.fields-row__column-6.fields-group
      = f.input :min_status_age,
                disabled: !@policy.enabled?,
                collection: AccountStatusesCleanupPolicy::ALLOWED_MIN_STATUS_AGE.map(&:to_i),
                hint: false,
                include_blank: false,
                label_method: ->(i) { t("statuses_cleanup.min_age.#{i}") },
                label: t('statuses_cleanup.min_age_label'),
                wrapper: :with_label

  .flash-message= t('statuses_cleanup.explanation')

  %h4= t('statuses_cleanup.exceptions')

  .fields-row
    .fields-row__column.fields-row__column-6.fields-group
      = f.input :keep_pinned,
                disabled: !@policy.enabled?,
                hint: t('statuses_cleanup.keep_pinned_hint'),
                label: t('statuses_cleanup.keep_pinned'),
                wrapper: :with_label
    .fields-row__column.fields-row__column-6.fields-group
      = f.input :keep_direct,
                disabled: !@policy.enabled?,
                hint: t('statuses_cleanup.keep_direct_hint'),
                label: t('statuses_cleanup.keep_direct'),
                wrapper: :with_label

  .fields-row
    .fields-row__column.fields-row__column-6.fields-group
      = f.input :keep_self_fav,
                disabled: !@policy.enabled?,
                hint: t('statuses_cleanup.keep_self_fav_hint'),
                label: t('statuses_cleanup.keep_self_fav'),
                wrapper: :with_label
    .fields-row__column.fields-row__column-6.fields-group
      = f.input :keep_self_bookmark,
                disabled: !@policy.enabled?,
                hint: t('statuses_cleanup.keep_self_bookmark_hint'),
                label: t('statuses_cleanup.keep_self_bookmark'),
                wrapper: :with_label

  .fields-row
    .fields-row__column.fields-row__column-6.fields-group
      = f.input :keep_polls,
                disabled: !@policy.enabled?,
                hint: t('statuses_cleanup.keep_polls_hint'),
                label: t('statuses_cleanup.keep_polls'),
                wrapper: :with_label
    .fields-row__column.fields-row__column-6.fields-group
      = f.input :keep_media,
                disabled: !@policy.enabled?,
                hint: t('statuses_cleanup.keep_media_hint'),
                label: t('statuses_cleanup.keep_media'),
                wrapper: :with_label

  %h4= t('statuses_cleanup.interaction_exceptions')

  .fields-row
    .fields-row__column.fields-row__column-6.fields-group
      = f.input :min_favs,
                disabled: !@policy.enabled?,
                hint: t('statuses_cleanup.min_favs_hint'),
                input_html: { min: 1, placeholder: t('statuses_cleanup.ignore_favs') },
                label: t('statuses_cleanup.min_favs'),
                wrapper: :with_label
    .fields-row__column.fields-row__column-6.fields-group
      = f.input :min_reblogs,
                disabled: !@policy.enabled?,
                hint: t('statuses_cleanup.min_reblogs_hint'),
                input_html: { min: 1, placeholder: t('statuses_cleanup.ignore_reblogs') },
                label: t('statuses_cleanup.min_reblogs'),
                wrapper: :with_label

  .flash-message= t('statuses_cleanup.interaction_exceptions_explanation')