Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `.github/workflows/build-image.yml`: Fix erroneous deletion in a previous merge. - `Gemfile`: Conflict caused by glitch-soc-only hCaptcha dependency - `app/controllers/auth/sessions_controller.rb`: Minor conflict due to glitch-soc's theming system. - `app/controllers/filters_controller.rb`: Minor conflict due to glitch-soc's theming system. - `app/serializers/rest/status_serializer.rb`: Minor conflict due to glitch-soc having an extra `local_only` property
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
.fields-row
|
||||
.fields-row__column.fields-row__column-6.fields-group
|
||||
= f.input :phrase, 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')
|
||||
|
||||
.fields-group
|
||||
= f.input :context, wrapper: :with_block_label, collection: CustomFilter::VALID_CONTEXTS, as: :check_boxes, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', label_method: lambda { |context| I18n.t("filters.contexts.#{context}") }, include_blank: false
|
||||
|
||||
%hr.spacer/
|
||||
|
||||
.fields-group
|
||||
= f.input :irreversible, wrapper: :with_label
|
||||
|
||||
.fields-group
|
||||
= f.input :whole_word, wrapper: :with_label
|
||||
32
app/views/filters/_filter.html.haml
Normal file
32
app/views/filters/_filter.html.haml
Normal file
@@ -0,0 +1,32 @@
|
||||
.filters-list__item{ class: [filter.expired? && 'expired'] }
|
||||
= link_to edit_filter_path(filter), class: 'filters-list__item__title' do
|
||||
= filter.title
|
||||
|
||||
- if filter.expires?
|
||||
.expiration{ title: t('filters.index.expires_on', date: l(filter.expires_at)) }
|
||||
- if filter.expired?
|
||||
= t('invites.expired')
|
||||
- else
|
||||
= t('filters.index.expires_in', distance: distance_of_time_in_words_to_now(filter.expires_at))
|
||||
|
||||
.filters-list__item__permissions
|
||||
%ul.permissions-list
|
||||
- unless filter.keywords.empty?
|
||||
%li.permissions-list__item
|
||||
.permissions-list__item__icon
|
||||
= fa_icon('paragraph')
|
||||
.permissions-list__item__text
|
||||
.permissions-list__item__text__title
|
||||
= t('filters.index.keywords', count: filter.keywords.size)
|
||||
.permissions-list__item__text__type
|
||||
- keywords = filter.keywords.map(&:keyword)
|
||||
- keywords = keywords.take(5) + ['…'] if keywords.size > 5 # TODO
|
||||
= keywords.join(', ')
|
||||
|
||||
.announcements-list__item__action-bar
|
||||
.announcements-list__item__meta
|
||||
= t('filters.index.contexts', contexts: filter.context.map { |context| I18n.t("filters.contexts.#{context}") }.join(', '))
|
||||
|
||||
%div
|
||||
= table_link_to 'pencil', t('filters.edit.title'), edit_filter_path(filter)
|
||||
= table_link_to 'times', t('filters.index.delete'), filter_path(filter), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') }
|
||||
33
app/views/filters/_filter_fields.html.haml
Normal file
33
app/views/filters/_filter_fields.html.haml
Normal file
@@ -0,0 +1,33 @@
|
||||
.fields-row
|
||||
.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')
|
||||
|
||||
.fields-group
|
||||
= f.input :context, wrapper: :with_block_label, collection: CustomFilter::VALID_CONTEXTS, as: :check_boxes, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', label_method: lambda { |context| I18n.t("filters.contexts.#{context}") }, include_blank: false
|
||||
|
||||
%hr.spacer/
|
||||
|
||||
.fields-group
|
||||
= f.input :filter_action, as: :radio_buttons, collection: %i(warn hide), include_blank: false, wrapper: :with_block_label, label_method: ->(action) { safe_join([t("simple_form.labels.filters.actions.#{action}"), content_tag(:span, t("simple_form.hints.filters.actions.#{action}"), class: 'hint')]) }, hint: t('simple_form.hints.filters.action'), required: true
|
||||
|
||||
%hr.spacer/
|
||||
|
||||
%h4= t('filters.edit.keywords')
|
||||
|
||||
.table-wrapper
|
||||
%table.table.keywords-table
|
||||
%thead
|
||||
%tr
|
||||
%th= t('simple_form.labels.defaults.phrase')
|
||||
%th= t('simple_form.labels.defaults.whole_word')
|
||||
%th
|
||||
%tbody
|
||||
= f.simple_fields_for :keywords do |keyword|
|
||||
= render 'keyword_fields', f: keyword
|
||||
%tfoot
|
||||
%tr
|
||||
%td{ colspan: 3}
|
||||
= 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
|
||||
= safe_join([fa_icon('plus'), t('filters.edit.add_keyword')])
|
||||
8
app/views/filters/_keyword_fields.html.haml
Normal file
8
app/views/filters/_keyword_fields.html.haml
Normal file
@@ -0,0 +1,8 @@
|
||||
%tr.nested-fields
|
||||
%td= f.input :keyword, as: :string
|
||||
%td
|
||||
.label_input__wrapper= f.input_field :whole_word
|
||||
%td
|
||||
= f.hidden_field :id if f.object&.persisted? # Required so Rails doesn't put the field outside of the <tr/>
|
||||
= link_to_remove_association(f, class: 'table-action-link') do
|
||||
= safe_join([fa_icon('times'), t('filters.index.delete')])
|
||||
@@ -2,7 +2,7 @@
|
||||
= t('filters.edit.title')
|
||||
|
||||
= simple_form_for @filter, url: filter_path(@filter), method: :put do |f|
|
||||
= render 'fields', f: f
|
||||
= render 'filter_fields', f: f
|
||||
|
||||
.actions
|
||||
= f.button :button, t('generic.save_changes'), type: :submit
|
||||
|
||||
@@ -7,18 +7,5 @@
|
||||
- if @filters.empty?
|
||||
%div.muted-hint.center-text= t 'filters.index.empty'
|
||||
- else
|
||||
.table-wrapper
|
||||
%table.table
|
||||
%thead
|
||||
%tr
|
||||
%th= t('simple_form.labels.defaults.phrase')
|
||||
%th= t('simple_form.labels.defaults.context')
|
||||
%th
|
||||
%tbody
|
||||
- @filters.each do |filter|
|
||||
%tr
|
||||
%td= filter.phrase
|
||||
%td= filter.context.map { |context| I18n.t("filters.contexts.#{context}") }.join(', ')
|
||||
%td
|
||||
= table_link_to 'pencil', t('filters.edit.title'), edit_filter_path(filter)
|
||||
= table_link_to 'times', t('filters.index.delete'), filter_path(filter), method: :delete
|
||||
.applications-list
|
||||
= render partial: 'filter', collection: @filters
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
= t('filters.new.title')
|
||||
|
||||
= simple_form_for @filter, url: filters_path do |f|
|
||||
= render 'fields', f: f
|
||||
= render 'filter_fields', f: f
|
||||
|
||||
.actions
|
||||
= f.button :button, t('filters.new.title'), type: :submit
|
||||
= f.button :button, t('filters.new.save'), type: :submit
|
||||
|
||||
Reference in New Issue
Block a user