Module: Card::Set::Type::Image::EmailHtmlFormat

Extended by:
AbstractFormat
Defined in:
card/tmpsets/set/mod014-card-mod-carrierwave/type/image.rb,
card/tmpsets/set/mod013-card-mod-carrierwave/type/image.rb

Instance Method Summary collapse

Instance Method Details

#attach_image(mail, path) ⇒ Object



90
91
92
93
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/image.rb', line 90

def attach_image mail, path
  mail.attachments.inline[path] = ::File.read path
  mail.attachments[path].url
end

#view: inlineObject



81
82
83
84
85
86
87
88
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/image.rb', line 81

view :inline, cache: :never do
  handle_source do |source|
    return source unless (mail = inherit :active_mail) &&
                         ::File.exist?(path = selected_version.path)
    url = attach_image mail, path
    image_tag url
  end
end