Module: Card::Set::Abstract::Search::Views::Format

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod035-card-mod-search/abstract/05_search/views.rb,
card/tmpsets/set/mod036-card-mod-search/abstract/05_search/views.rb

Instance Method Summary collapse

Instance Method Details

#view: card_listObject



19
20
21
22
23
24
25
26
27
# File 'card/tmpsets/set/mod035-card-mod-search/abstract/05_search/views.rb', line 19

view :card_list, cache: :never do
  if search_with_params.empty?
    "no results"
  else
    search_with_params.map do |item_card|
      nest_item item_card
    end.join "\n"
  end
end

#view: no_search_resultsObject



29
30
31
# File 'card/tmpsets/set/mod035-card-mod-search/abstract/05_search/views.rb', line 29

view :no_search_results do
  "no results"
end

#view: search_countObject



10
11
12
# File 'card/tmpsets/set/mod035-card-mod-search/abstract/05_search/views.rb', line 10

view :search_count, cache: :never do
  search_with_params.to_s
end

#view: search_errorObject



14
15
16
17
# File 'card/tmpsets/set/mod035-card-mod-search/abstract/05_search/views.rb', line 14

view :search_error, cache: :never do
  sr_class = search_with_params.class.to_s
  %(#{sr_class} :: #{search_with_params.message} :: #{card.content})
end

#with_resultsObject



33
34
35
# File 'card/tmpsets/set/mod035-card-mod-search/abstract/05_search/views.rb', line 33

def with_results
  search_with_params.empty? ? render_no_search_results : yield
end