14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/helpers/blazer/base_helper.rb', line 14
def blazer_format_value(key, value)
if value.is_a?(Numeric) && !key.to_s.end_with?("id") && !key.to_s.start_with?("id")
number_with_delimiter(value, delimiter: ',', separator: '.')
elsif value =~ BLAZER_URL_REGEX
if Blazer.images && (key.include?("image") || BLAZER_IMAGE_EXT.include?(value.split(".").last.split("?").first.try(:downcase)))
link_to value, target: "_blank" do
image_tag value, referrerpolicy: "no-referrer"
end
else
link_to value, value, target: "_blank"
end
elsif key.end_with?("_date")
value.in_time_zone(Blazer.time_zone).strftime('%Y/%m/%d') rescue value
elsif key.end_with?("_time")
value.in_time_zone(Blazer.time_zone).strftime('%H:%M') rescue value
else
value
end
end
|