Skip to content

Commit

Permalink
Add: #271 フィルターの期限リストに2w、1m、3m
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode committed Dec 6, 2023
1 parent 831fa2d commit 0a7d46c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/custom_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def expires_in
return @expires_in if defined?(@expires_in)
return nil if expires_at.nil?

[30.minutes, 1.hour, 6.hours, 12.hours, 1.day, 1.week].find { |expires_in| expires_in.from_now >= expires_at }
[30.minutes, 1.hour, 6.hours, 12.hours, 1.day, 1.week, 2.weeks, 1.month, 3.months].find { |expires_in| expires_in.from_now >= expires_at }
end

def irreversible=(value)
Expand Down
4 changes: 2 additions & 2 deletions app/views/filters/_filter_fields.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
.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: ->(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, 2.weeks, 1.month, 3.months].map(&:to_i), label_method: ->(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: ->(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) { filter_action_label(action) }, hint: t('simple_form.hints.filters.action'), required: true
= f.input :filter_action, as: :radio_buttons, collection: %i(half_warn 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

.fields-group
= f.input :exclude_follows, wrapper: :with_label, kmyblue: true, label: t('simple_form.labels.filters.options.exclude_follows')
Expand Down
3 changes: 3 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1555,6 +1555,9 @@ en:
'3600': 1 hour
'43200': 12 hours
'604800': 1 week
'1209600': 2 weeks
'2629746': 1 month
'7889238': 3 months
'86400': 1 day
expires_in_prompt: Never
generate: Generate invite link
Expand Down
3 changes: 3 additions & 0 deletions config/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1543,6 +1543,9 @@ ja:
'3600': 1時間
'43200': 12時間
'604800': 1週間
'1209600': 2週間
'2629746': 1ヶ月
'7889238': 3ヶ月
'86400': 1日
expires_in_prompt: 無期限
generate: 招待リンクを作成
Expand Down

0 comments on commit 0a7d46c

Please sign in to comment.