Class: Troo::Presenters::List
- Inherits:
-
Object
- Object
- Troo::Presenters::List
- Includes:
- DecoratorHelpers
- Defined in:
- lib/troo/presenters/list.rb
Instance Method Summary collapse
- #initialize(list, options = {}) ⇒ Troo::Presenters::List constructor
- #render_cards ⇒ String
- #render_list ⇒ String
- #show ⇒ String
Methods included from DecoratorHelpers
Constructor Details
#initialize(list, options = {}) ⇒ Troo::Presenters::List
8 9 10 |
# File 'lib/troo/presenters/list.rb', line 8 def initialize(list, = {}) @list, = list, end |
Instance Method Details
#render_cards ⇒ String
39 40 41 42 43 44 45 |
# File 'lib/troo/presenters/list.rb', line 39 def render_cards output.spacer do list.cards.map do |card| output.render Presenters::Resource.list_view(card) end end end |
#render_list ⇒ String
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/troo/presenters/list.rb', line 24 def render_list output.render Presenters::Resource.list_view(list) output.indent do if list.cards.empty? output.spacer do output.render error('No cards were found.') end else render_cards end end end |
#show ⇒ String
13 14 15 16 17 18 19 20 21 |
# File 'lib/troo/presenters/list.rb', line 13 def show output.render Presenters::Resource.list_view(list.board) output.spacer output.indent do render_list end end |