Sha256: 285087a1aeb94c2670dfa5af6f14e6fc95a1b0ecfc0271e8076c0988ea5f8742

Contents?: true

Size: 850 Bytes

Versions: 12

Compression:

Stored size: 850 Bytes

Contents

include_set Abstract::Items
include_set Abstract::ReferenceList

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

def item_options
  nest_chunks.map(&:raw_options)
end

def items_content array
  standardized_items(array).join "\n"
end

format :html do
  def input_type
    :nest_list
  end

  view :nest_list_input, cache: :never do
    nest_list_input
  end

  view :input do
    _render_hidden_content_field + super()
  end

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

  def nest_list_input args={}
    items = items_for_input args[:item_list]
    extra_class = "_nest-list-ul"
    ul_classes = classy "pointer-list-editor", extra_class
    haml :nest_list_input, items: items, ul_classes: ul_classes
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
card-mod-list-0.18.1 set/type/nest_list.rb
card-mod-list-0.18.0 set/type/nest_list.rb
card-mod-list-0.17.0 set/type/nest_list.rb
card-mod-list-0.16.0 set/type/nest_list.rb
card-mod-list-0.15.6 set/type/nest_list.rb
card-mod-list-0.15.5 set/type/nest_list.rb
card-mod-list-0.15.4 set/type/nest_list.rb
card-mod-list-0.15.3 set/type/nest_list.rb
card-mod-list-0.15.2.pre1 set/type/nest_list.rb
card-mod-list-0.15.1.1 set/type/nest_list.rb
card-mod-list-0.15.1 set/type/nest_list.rb
card-mod-list-0.15.0 set/type/nest_list.rb