X-Git-Url: https://git.draconx.ca/gitweb/homepage.git/blobdiff_plain/86d0dac7b5713b9d312dd8fea8da80132829d6e6..556a5888d1091c5fb1d202d911941941d0bba9c8:/lib/helpers.rb diff --git a/lib/helpers.rb b/lib/helpers.rb index cc0bf04..77916dd 100644 --- a/lib/helpers.rb +++ b/lib/helpers.rb @@ -82,10 +82,8 @@ def img_rep_fallback(item, rep) return :large end -def item_to_img(item, rep: :large, alt: nil, caption: nil) - unless item - return "[image not found]" - end +def gallery_img(item, rep: :large, alt: nil, caption: nil) + return "[image not found]" unless item alt ||= item[:title] caption ||= alt @@ -98,12 +96,10 @@ def item_to_img(item, rep: :large, alt: nil, caption: nil) b = Nokogiri::XML::Builder.new do |xml| xml.a(:href => item_uri(item, rep: :info)) { - xml.img(attrs) + xml.img(attrs, "generate-gallery" => "generate-gallery") unless caption.empty? xml << " ⁠" - xml.small { - xml << caption - } + xml.small { xml << caption } end } end