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

Extended by:
AbstractFormat
Includes:
File::Format
Defined in:
platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image.rb

Instance Method Summary collapse

Methods included from File::Format

#handle_source, #view: core

Instance Method Details

#closed_sizeObject



56
57
58
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image.rb', line 56

def closed_size
  :icon
end

#default_sizeObject



64
65
66
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image.rb', line 64

def default_size
  :medium
end

#determine_image_sizeObject



68
69
70
71
72
73
74
75
76
77
78
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image.rb', line 68

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

#main_sizeObject



60
61
62
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image.rb', line 60

def main_size
  :large
end

#selected_versionObject



45
46
47
48
49
50
51
52
53
54
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image.rb', line 45

def selected_version
  size = determine_image_size
  image = card.image

  if size && size != :original && !svg?
    image.versions[size]
  else
    image
  end
end

#short_contentObject



28
29
30
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image.rb', line 28

def short_content
  render_core size: :icon
end

#sourceObject



36
37
38
39
40
41
42
43
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image.rb', line 36

def source
  return card.content if card.web?

  image = selected_version
  return "" unless image.valid?

  contextualize_path image.url
end

#view: inlineObject



80
81
82
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image.rb', line 80

view :inline do
  _render_core
end

#view: one_line_contentObject



24
25
26
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image.rb', line 24

view :one_line_content do
  _render_core size: :icon
end

#view: sourceObject



32
33
34
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image.rb', line 32

view :source, unknown: :blank do
  source
end