Module: Card::Set::Type::Image::Format

Extended by:
AbstractFormat
Includes:
File::Format
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

Methods included from File::Format

#view: core

Instance Method Details

#closed_sizeObject



51
52
53
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/image.rb', line 51

def closed_size
  :icon
end

#default_sizeObject



59
60
61
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/image.rb', line 59

def default_size
  :medium
end

#determine_image_sizeObject



63
64
65
66
67
68
69
70
71
72
73
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/image.rb', line 63

def determine_image_size
  voo.size =
    case
    when nest_mode == :closed then closed_size
    when voo.size.present?    then voo.size.to_sym
    when main?                then main_size
    else                           default_size
    end
  voo.size = :original if voo.size == :full
  voo.size
end

#handle_sourceObject



47
48
49
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/image.rb', line 47

def handle_source
  super
end

#main_sizeObject



55
56
57
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/image.rb', line 55

def main_size
  :large
end

#selected_versionObject



38
39
40
41
42
43
44
45
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/image.rb', line 38

def selected_version
  size = determine_image_size
  if size && size != :original
    card.image.versions[size]
  else
    card.image
  end
end

#short_contentObject



27
28
29
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/image.rb', line 27

def short_content
  render_core size: :icon
end

#view: inlineObject



75
76
77
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/image.rb', line 75

view :inline do
  _render_core
end

#view: one_line_contentObject



23
24
25
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/image.rb', line 23

view :one_line_content do
  _render_core size: :icon
end

#view: sourceObject



31
32
33
34
35
36
# File 'card/tmpsets/set/mod014-card-mod-carrierwave/type/image.rb', line 31

view :source do
  return card.content if card.web?
  image = selected_version
  return "" unless image.valid?
  contextualize_path image.url
end