Just like we did for budgets, we're doing the same thing in all the places where we render background images attached by either regular users or administrators. This way we correctly render background images with characters like brackets or quotes.
22 lines
543 B
Ruby
22 lines
543 B
Ruby
module ImagesHelper
|
|
def image_absolute_url(image, version)
|
|
return "" unless image
|
|
|
|
polymorphic_url(image.variant(version))
|
|
end
|
|
|
|
def image_class(image)
|
|
image.persisted? ? "persisted-image" : "cached-image"
|
|
end
|
|
|
|
def render_image(image, version, show_caption = true)
|
|
render "images/image", image: image,
|
|
version: (version if image.persisted?),
|
|
show_caption: show_caption
|
|
end
|
|
|
|
def attached_background_css(path)
|
|
"background-image: url('#{j path}');"
|
|
end
|
|
end
|