Module: DepictionsHelper

Defined in:
app/helpers/depictions_helper.rb

Instance Method Summary collapse

Instance Method Details

#depiction_svg_tag(depiction) ⇒ Object

!! NOT USED



23
24
25
26
27
28
29
30
# File 'app/helpers/depictions_helper.rb', line 23

def depiction_svg_tag(depiction)
  anchor = "clip_#{depiction.id}"
  (:svg, {foo: nil, "viewBox" => depiction.svg_view_box, xmlns: "http://www.w3.org/2000/svg", 'xmlns:xlink' => "http://www.w3.org/1999/xlink"}) do
    ( ('clip-path', depiction.svg_clip, id: anchor ).html_safe +
     (:image, href: depiction.image.image_file.url, 'clip-path' => "url(##{anchor})" ).html_safe
    ).html_safe
  end
end

#depiction_tag(depiction, size: :thumb) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/depictions_helper.rb', line 3

def depiction_tag(depiction, size: :thumb)
  return nil if depiction.nil?
  if depiction.from_sled?
    depictions_sled_tag(depiction, size: size)
    # depiction_svg_tag(depiction)
  else
    (:figure) do
      image_tag(depiction.image.image_file.url(size)) +
        (:figcaption, image_context_depiction_tag(depiction))
    end
  end
end

#depictions_sled_tag(depiction, size: :thumb) ⇒ Object



32
33
34
35
36
37
# File 'app/helpers/depictions_helper.rb', line 32

def depictions_sled_tag(depiction, size: :thumb)
  (:figure) do
    image_tag(depiction.sled_extraction_path(size)) +
      (:figcaption, image_context_depiction_tag(depiction))
  end
end

#image_context_depiction_tag(depiction) ⇒ Object



16
17
18
19
# File 'app/helpers/depictions_helper.rb', line 16

def image_context_depiction_tag(depiction)
  return nil if depiction.nil?
  object_tag(depiction.depiction_object.metamorphosize)
end