You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
module ApplicationHelper
|
|
|
|
|
|
def svg(name)
|
|
|
file_path = "#{Rails.root}/app/assets/images/#{name}.svg"
|
|
|
if File.exist?(file_path)
|
|
|
Rails.cache.fetch(['svg', name]) do
|
|
|
File.read(file_path).html_safe
|
|
|
end
|
|
|
else
|
|
|
'(not found)'
|
|
|
end
|
|
|
end
|
|
|
|
|
|
|
|
|
def quiz_image_urls
|
|
|
|
|
|
urls = []
|
|
|
|
|
|
assets = Node.viewable.map {|node| node.assets.includes(file_attachment: :blob).select{ |asset| asset.file.image? } }.flatten
|
|
|
assets.each do |asset|
|
|
|
urls << rails_storage_proxy_path(asset.file.variant(resize_to_limit: [((image_orientation(asset.file) == :landscape) ? 2400 : 1600), nil]))
|
|
|
end
|
|
|
|
|
|
urls.compact.uniq
|
|
|
end
|
|
|
end
|