Module: Card::Set::Abstract::Media::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
tmpsets/set/mod001-utility/abstract/media.rb

Instance Method Summary collapse

Instance Method Details

#image_altObject



18
19
20
# File 'tmpsets/set/mod001-utility/abstract/media.rb', line 18

def image_alt
  image_card&.name
end

#image_cardObject



9
10
11
# File 'tmpsets/set/mod001-utility/abstract/media.rb', line 9

def image_card
  @image_card ||= card.fetch(trait: :image)
end

#image_src(opts) ⇒ Object



13
14
15
16
# File 'tmpsets/set/mod001-utility/abstract/media.rb', line 13

def image_src opts
  return "" unless image_card
  nest(image_card, view: :source, size: opts[:size])
end

#text_with_image(opts = {}) ⇒ Object



22
23
24
25
26
# File 'tmpsets/set/mod001-utility/abstract/media.rb', line 22

def text_with_image opts={}
  class_up "media-left", "m-2"
  @image_card = Card.cardish(opts[:image]) if opts[:image]
  haml :media_snippet, normalized_text_with_image_opts(opts)
end