Sha256: 966a0404241f8e0e460e5c7d014c57e6e6950be9a00be957d4ad7094ac8604ad

Contents?: true

Size: 904 Bytes

Versions: 1

Compression:

Stored size: 904 Bytes

Contents

include_set Abstract::Items

def raw_item_strings content
  reference_chunks(content).map(&:referee_name)
end

def item_titles default_to_name=true
  reference_chunks.map do |chunk|
    chunk.options[:title] || (default_to_name ? chunk.referee_name : nil)
  end
end

format do
  def chunk_list
    :references
  end
end

format :html do
  def input_type
    :link_list
  end

  view :link_list_input, cache: :never do
    link_list_input
  end

  def items_for_input items=nil
    items ||= card.item_names context: :raw
    items.empty? ? [["", ""]] : items.zip(card.item_titles(false))
  end

  def link_list_input args={}
    items = items_for_input args[:item_list]
    extra_class = "pointer-link-list-ul"
    ul_classes = classy "pointer-list-editor", extra_class
    haml :link_list_input, items: items, ul_classes: ul_classes,
                           options_card: options_card_name
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
card-mod-list-0.14.0 set/type/link_list.rb