_filter_fields.html.haml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. .fields-row
  2. .fields-row__column.fields-row__column-6.fields-group
  3. = f.input :title, as: :string, wrapper: :with_label, hint: false
  4. .fields-row__column.fields-row__column-6.fields-group
  5. = 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')
  6. .fields-group
  7. = f.input :context, wrapper: :with_block_label, collection: CustomFilter::VALID_CONTEXTS, as: :check_boxes, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', label_method: ->(context) { I18n.t("filters.contexts.#{context}") }, include_blank: false
  8. %hr.spacer/
  9. .fields-group
  10. = f.input :filter_action, as: :radio_buttons, collection: %i(warn hide), include_blank: false, wrapper: :with_block_label, label_method: ->(action) { filter_action_label(action) }, hint: t('simple_form.hints.filters.action'), required: true
  11. %hr.spacer/
  12. - unless f.object.statuses.empty?
  13. %h4= t('filters.edit.statuses')
  14. %p.muted-hint= t('filters.edit.statuses_hint_html', path: filter_statuses_path(f.object))
  15. %hr.spacer/
  16. %h4= t('filters.edit.keywords')
  17. .table-wrapper
  18. %table.table.keywords-table
  19. %thead
  20. %tr
  21. %th= t('simple_form.labels.defaults.phrase')
  22. %th= t('simple_form.labels.defaults.whole_word')
  23. %th
  24. %tbody
  25. = f.simple_fields_for :keywords do |keyword|
  26. = render 'keyword_fields', f: keyword
  27. %tfoot
  28. %tr
  29. %td{ colspan: 3 }
  30. = link_to_add_association f, :keywords, class: 'table-action-link', partial: 'keyword_fields', 'data-association-insertion-node': '.keywords-table tbody', 'data-association-insertion-method': 'append' do
  31. = safe_join([fa_icon('plus'), t('filters.edit.add_keyword')])