Module: Card::Set::Abstract::Pointer::HtmlViews::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod030-card-mod-layout/abstract/pointer/html_views.rb,
card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb,
card/tmpsets/set/mod031-card-mod-layout/abstract/pointer/html_views.rb,
card/tmpsets/set/mod008-card-mod-list/abstract/01_pointer/html_views.rb

Instance Method Summary collapse

Instance Method Details



96
97
98
99
100
101
102
103
104
105
106
107
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb', line 96

def add_item_modal_link
  modal_link "Add Item",
             size: :large,
             class: "btn btn-sm btn-outline-secondary _add-item-link",
             path: { view: :filter_items_modal,
                     item: implicit_item_view,
                     filter_card: filter_card.name,
                     slot_selector: filtered_list_slot_class,
                     item_selector: "_filtered-list-item",
                     slot: { hide: [:modal_footer] },
                     filter: { not_ids: not_ids_value } }
end


113
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb', line 113

def add_item_overlay_link; end

#autocomplete_inputObject



70
71
72
73
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb', line 70

def autocomplete_input
  items = items_for_input
  haml :autocomplete_input, item: items.first, options_card: options_card_name
end

#checkbox_inputObject



75
76
77
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb', line 75

def checkbox_input
  haml :checkbox_input, submit_on_change: @submit_on_change
end

#default_input_typeObject



46
47
48
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb', line 46

def default_input_type
  :list
end

#list_input(args = {}) ⇒ Object

view :nav_item do nav_dropdown end



58
59
60
61
62
63
64
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb', line 58

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



90
91
92
93
94
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb', line 90

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

#not_ids_valueObject



109
110
111
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb', line 109

def not_ids_value
  card.item_ids.map(&:to_s).join(",")
end

#one_line_contentObject



115
116
117
118
119
120
121
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb', line 115

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

#radio_inputObject



79
80
81
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb', line 79

def radio_input
  haml :radio_input, submit_on_change: @submit_on_change
end

#select_inputObject



83
84
85
86
87
88
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb', line 83

def select_input
  options = { "-- Select --" => "" }.merge card.options_hash
  select_tag("pointer_select-#{unique_id}",
             options_for_select(options, card.item_name),
             class: "pointer-select form-control")
end

#standard_pointer_coreObject



19
20
21
22
23
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb', line 19

def standard_pointer_core
  with_paging do |paging_args|
    wrap_with :div, standard_pointer_items(paging_args), class: "pointer-list"
  end
end

#standard_pointer_items(paging_args) ⇒ Object



25
26
27
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb', line 25

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

#view: coreObject



9
10
11
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb', line 9

view :core, cache: :never do
  standard_pointer_core
end

#view: inputObject



42
43
44
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb', line 42

view :input do
  _render_hidden_content_field + super()
end

#view: item_coresObject



13
14
15
16
17
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb', line 13

view :item_cores, cache: :never do
  card.known_item_cards.map do |item|
    nest item, view: :core
  end.join "\n"
end

#view: listObject



50
51
52
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb', line 50

view :list, cache: :never do
  list_input
end


9
10
11
# File 'card/tmpsets/set/mod030-card-mod-layout/abstract/pointer/html_views.rb', line 9

view :nav_item do
  nav_dropdown
end

#view: one_line_contentObject



29
30
31
32
33
34
35
36
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb', line 29

view :one_line_content do
  item_view = implicit_item_view
  item_view = item_view == "name" ? "name" : "link"
  wrap_with :div, class: "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



38
39
40
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views.rb', line 38

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