Add `ip_blocks_expires_options` helper method for collection options

pull/32942/head
Matt Jankowski 2024-11-16 09:49:09 -05:00
parent 44d92fa4f6
commit 340219284a
2 changed files with 5 additions and 1 deletions

View File

@ -9,4 +9,8 @@ module Admin::IpBlocksHelper
]
)
end
def ip_blocks_expires_options
[1.day, 2.weeks, 1.month, 6.months, 1.year, 3.years]
end
end

View File

@ -12,7 +12,7 @@
.fields-group
= f.input :expires_in,
collection: [1.day, 2.weeks, 1.month, 6.months, 1.year, 3.years].map(&:to_i),
collection: ip_blocks_expires_options.map(&:to_i),
label_method: ->(i) { I18n.t("admin.ip_blocks.expires_in.#{i}") },
prompt: I18n.t('invites.expires_in_prompt'),
wrapper: :with_block_label