Module: Card::Set::Abstract::List::HtmlViews::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb

Instance Method Summary collapse

Instance Method Details

#autocomplete_inputObject



67
68
69
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 67

def autocomplete_input
  autocomplete_field items_for_input.first, options_card_name
end

#bar_multiselect_inputObject



92
93
94
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 92

def bar_multiselect_input
  raw haml(:click_select_input, item_view: :bar, multiselect: true)
end

#bar_select_inputObject



84
85
86
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 84

def bar_select_input
  raw haml(:click_select_input, item_view: :bar, multiselect: false)
end

#box_multiselect_inputObject



96
97
98
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 96

def box_multiselect_input
  raw haml(:click_select_input, item_view: :box, multiselect: true)
end

#box_select_inputObject



88
89
90
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 88

def box_select_input
  raw haml(:click_select_input, item_view: :box, multiselect: false)
end

#checkbox_inputObject



71
72
73
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 71

def checkbox_input
  raw haml(:checkbox_input, submit_on_change: @submit_on_change)
end

#default_input_typeObject



47
48
49
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 47

def default_input_type
  :list
end

#hidden_inputObject



43
44
45
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 43

def hidden_input
  ""
end

#list_input(args = {}) ⇒ Object



55
56
57
58
59
60
61
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 55

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

#multiselect_inputObject



100
101
102
103
104
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 100

def multiselect_input
  select_tag "pointer_multiselect-#{unique_id}",
             options_for_select(card.options_hash, card.item_names),
             multiple: true, class: "pointer-multiselect form-control"
end

#one_line_contentObject



106
107
108
109
110
111
112
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 106

def one_line_content
  if count == 1
    card.first_name
  else
    short_content
  end
end

#radio_inputObject



75
76
77
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 75

def radio_input
  raw haml(:radio_input, submit_on_change: @submit_on_change)
end

#select_inputObject



79
80
81
82
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 79

def select_input
  select_tag "pointer_select-#{unique_id}", select_input_options,
             class: "pointer-select form-control"
end

#standard_pointer_coreObject



13
14
15
16
17
18
19
20
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 13

def standard_pointer_core
  with_paging do |paging_args|
    wrap_with :div,
              class: "card-list card-list-#{item_view_options[:view]} pointer-list" do
      standard_pointer_items(paging_args)
    end
  end
end

#standard_pointer_items(paging_args) ⇒ Object



22
23
24
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 22

def standard_pointer_items paging_args
  pointer_items(paging_args.extract!(:limit, :offset)).join(voo.separator || "\n")
end

#view: coreObject



9
10
11
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 9

view :core do
  standard_pointer_core
end

#view: inputObject



39
40
41
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 39

view :input do
  _render_hidden_content_field + super()
end

#view: listObject



51
52
53
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 51

view :list, cache: :never do
  list_input
end

#view: one_line_contentObject



26
27
28
29
30
31
32
33
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 26

view :one_line_content do
  item_view = implicit_item_view&.to_sym
  item_view = item_view == :name ? :name : :link
  wrap_with :div, class: "pointer-list one-line-pointer-list" do
    # limit to first 10 items to optimize
    pointer_items(view: item_view, limit: 10, offset: 0).join ", "
  end
end

#wrap_item(rendered, item_view) ⇒ Object



35
36
37
# File 'platypus/tmp/set/gem-defaults/mod005-list/abstract/01_list/html_views.rb', line 35

def wrap_item rendered, item_view
  %(<div class="pointer-item item-#{item_view}">#{rendered}</div>)
end