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

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

Instance Method Summary collapse

Instance Method Details

#default_filter_cardObject



52
53
54
55
56
57
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views/filter.rb', line 52

def default_filter_card
  fcard = card.options_rule_card || Card[:all]
  return fcard if fcard.respond_to? :cql_hash

  fcard.fetch :referred_to_by, new: {}
end

#filter_cardCard

for override

Returns:

  • (Card)

    search card on which filtering is based



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

def filter_card
  filter_card_from_params || default_filter_card
end

#filter_card_from_paramsObject



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

def filter_card_from_params
  return unless params[:filter_card]
  Card.fetch params[:filter_card], new: {}
end

#filtered_list_inputObject



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

def filtered_list_input
  with_nest_mode :normal do
    class_up "card-slot", filtered_list_slot_class
    with_class_up "card-slot", filtered_list_slot_class do
      wrap do
        haml :filtered_list_input
      end
    end
  end
end

#filtered_list_item(item_card) ⇒ Object



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

def filtered_list_item item_card
  nest_item item_card do |rendered, item_view|
    wrap_item rendered, item_view
  end
end

#filtered_list_slot_classObject

currently actually used as a class (because we don’t have api to override slot’s id)



66
67
68
# File 'card/tmpsets/set/mod009-card-mod-list/abstract/01_pointer/html_views/filter.rb', line 66

def filtered_list_slot_class
  @filtered_list_slot_class ||= "filtered-list-#{unique_id}"
end

NOCACHE because params alter view



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

view :add_selected_link, cache: :never, unknown: true do
  link_to "Add Selected",
          path: { filter_card: params[:filter_card] },
          class: "_add-selected slotter _close-modal btn btn-primary disabled",
          data: { "slot-selector": ".#{params[:slot_selector]}",
                  "item-selector": ".#{params[:item_selector]}",
                  remote: true }
end

#view: filter_itemsObject



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

view :filter_items, unknown: true, wrap: :slot, template: :haml

#view: filter_items_modalObject



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

view :filter_items_modal, unknown: true, wrap: :modal do
  render_filter_items
end

#view: filtered_listObject



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

view :filtered_list, unknown: true do
  filtered_list_input
end