1
0
Fork 0
forked from gitea/nas

Add: #271 フィルターの期限リストに2w、1m、3m (#335)

This commit is contained in:
KMY(雪あすか) 2023-12-06 13:36:07 +09:00 committed by GitHub
parent 9829d9b28a
commit 534d66f904
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 2 deletions

View file

@ -54,7 +54,7 @@ class CustomFilter < ApplicationRecord
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)

View file

@ -2,7 +2,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: ->(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

View file

@ -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

View file

@ -1543,6 +1543,9 @@ ja:
'3600': 1時間
'43200': 12時間
'604800': 1週間
'1209600': 2週間
'2629746': 1ヶ月
'7889238': 3ヶ月
'86400': 1日
expires_in_prompt: 無期限
generate: 招待リンクを作成