Sha256: fff5746bfbea9a15f798fec591ad76ec21d339d56f7531678017d972ff505ef1

Contents?: true

Size: 1.13 KB

Versions: 13

Compression:

Stored size: 1.13 KB

Contents

format :html do
  view :filtered_list, tags: :unknown_ok do
    filtered_list_input
  end

  view :filter_items, tags: :unknown_ok, cache: :never do
    wrap { haml :filter_items }
  end

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

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

  # for override
  # @return [Card] search card on which filtering is based
  def filter_card
    filter_card_from_params || default_filter_card
  end

  def default_filter_card
    fcard = card.options_rule_card || Card[:all]
    return fcard if fcard.respond_to? :wql_hash
    fcard.fetch trait: :referred_to_by, new: {}
  end

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

  # currently actually used as a class
  # (because we don't have api to override slot's id)
  def filtered_list_slot_class
    @filtered_list_slot_class ||= "filtered-list-#{unique_id}"
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
card-1.96.8 mod/pointer/set/abstract/02_pointer/html_views/filter.rb
card-1.96.7 mod/pointer/set/abstract/02_pointer/html_views/filter.rb
card-1.96.6 mod/pointer/set/abstract/02_pointer/html_views/filter.rb
card-1.96.5 mod/pointer/set/abstract/02_pointer/html_views/filter.rb
card-1.96.4 mod/pointer/set/abstract/02_pointer/html_views/filter.rb
card-1.96.3 mod/pointer/set/abstract/02_pointer/html_views/filter.rb
card-1.96.2 mod/pointer/set/abstract/02_pointer/html_views/filter.rb
card-1.96.1 mod/pointer/set/abstract/02_pointer/html_views/filter.rb
card-1.96.0 mod/pointer/set/abstract/02_pointer/html_views/filter.rb
card-1.95.3 mod/pointer/set/abstract/02_pointer/html_views/filter.rb
card-1.95.2 mod/pointer/set/abstract/02_pointer/html_views/filter.rb
card-1.95.1 mod/pointer/set/abstract/02_pointer/html_views/filter.rb
card-1.95.0 mod/pointer/set/abstract/02_pointer/html_views/filter.rb