Sha256: 448af9cea2fb2faea52e8d78ebc3af37ade5557e1d280c369b3a9d2c0cb178b4

Contents?: true

Size: 824 Bytes

Versions: 11

Compression:

Stored size: 824 Bytes

Contents

IMAGE_BOX_SIZE_MAP = {
  icon: :icon, small: :small, medium: :small, large: :medium, xlarge: :medium
}.freeze

format :html do
  view :boxed, unknown: true do
    image_box { |size| render_core size: size }
  end

  view :boxed_link, unknown: true do
    image_box { |size| link_to_card image_box_link_target, render_core(size: size) }
  end

  def image_box
    voo.size ||= :medium
    wrap_with :div, title: image_box_title, class: "image-box #{voo.size}" do
      yield image_box_size
    end
  end

  ## METHODS FOR OVERRIDE

  def image_box_size
    IMAGE_BOX_SIZE_MAP[voo.size.to_sym] || :medium
  end

  def image_box_card_name
    card.name.junction? ? card.name.left : card.name
  end

  def image_box_link_target
    image_box_card_name
  end

  def image_box_title
    voo.title || image_box_card_name
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
card-mod-bar_and_box-0.11.4 set/type/image.rb
card-mod-bar_and_box-0.11.3 set/type/image.rb
card-mod-bar_and_box-0.11.2 set/type/image.rb
card-mod-bar_and_box-0.11.1 set/type/image.rb
card-mod-bar_and_box-0.11.0 set/type/image.rb
card-1.100.0 mod/media/set/type/image.rb
card-1.99.6 mod/media/set/type/image.rb
card-1.99.5 mod/media/set/type/image.rb
card-1.99.4 mod/media/set/type/image.rb
card-1.99.3 mod/media/set/type/image.rb
card-1.99.2 mod/media/set/type/image.rb