Module: Card::Set::All::HistoryBridge::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
tmpsets/set/mod005-history/all/history_bridge.rb

Instance Method Summary collapse

Instance Method Details



47
48
49
50
51
52
# File 'tmpsets/set/mod005-history/all/history_bridge.rb', line 47

def act_link_list acts, context
  items = acts_for_accordion(acts, context) do |act, seq|
    act_link_list_item act, seq, context
  end
  bridge_pills items
end


54
55
56
57
58
# File 'tmpsets/set/mod005-history/all/history_bridge.rb', line 54

def act_link_list_item act, seq=nil, _context=nil
  opts = act_listing_opts_from_params(seq)
  opts[:slot_class] = "revision-#{act.id} history-slot nav-item"
  act_renderer(:bridge).new(self, act, opts).bridge_link
end

#act_list_group(acts, context, &block) ⇒ Object



60
61
62
# File 'tmpsets/set/mod005-history/all/history_bridge.rb', line 60

def act_list_group acts, context, &block
  list_group acts_for_accordion(acts, context, &block), class: "clear-both"
end

#acts_bridge_layout(acts, context = :bridge) ⇒ Object



38
39
40
41
42
43
44
45
# File 'tmpsets/set/mod005-history/all/history_bridge.rb', line 38

def acts_bridge_layout acts, context=:bridge
  output [
    _render_creator_credit,
    _render_updated_by,
    act_link_list(acts, context),
    act_paging(acts, context)
  ]
end

#humanized_search_result(item_cards, item_view: :link, max_count: 3, others_target: card) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'tmpsets/set/mod005-history/all/history_bridge.rb', line 24

def humanized_search_result item_cards, item_view: :link, max_count: 3,
                            others_target: card
  return "" unless item_cards.present?

  total = item_cards.size
  fetch_count = total > max_count ? max_count - 1 : max_count

  reduced = item_cards.first(fetch_count).map { |c| nest c, view: item_view }
  if total > max_count
    reduced << link_to_card(others_target,  "#{total - fetch_count} others")
  end
  reduced.to_sentence
end