small_img() helper added

This commit is contained in:
Christoph Haas 2020-11-01 23:24:07 +01:00
parent c4f5741b0c
commit f1cff3883d
4 changed files with 45 additions and 29 deletions

View file

@ -32,6 +32,24 @@ module PackagesHelper
str.join(' ∙ ')
end
def small_img(screenshot, cls: 'thumbnail')
if screenshot && screenshot.simage(:small)
image = screenshot.simage(:small)
image_tag(
image.url,
width: image.width,
height: image.height,
alt: screenshot.caption,
class: cls
)
else
image_tag(
'/images/dummy/no-screenshots-available.svg',
width: 220,
height: 220 * 3 / 4
)
end
end
# Show filled/empty star icons from FontAwesome
# depending on the rating (1-5)