Class: CWM::PagerTreeItem
- Defined in:
- library/cwm/src/lib/cwm/tree_pager.rb
Overview
A TreeItem that knows a Page, useful for a TreePager.
The UI label and id
are taken from its Page: CWM::Page#label,
AbstractWidget#widget_id
Instance Attribute Summary collapse
- #page ⇒ Page readonly
Attributes inherited from TreeItem
#children, #icon, #id, #label, #open
Instance Method Summary collapse
-
#initialize(page, icon: nil, open: true, children: []) ⇒ PagerTreeItem
constructor
A new instance of PagerTreeItem.
-
#pages ⇒ Array<Page>
My page and all pages of descendant items (needed to initialize a Pager).
Methods inherited from TreeItem
Constructor Details
#initialize(page, icon: nil, open: true, children: []) ⇒ PagerTreeItem
Returns a new instance of PagerTreeItem.
15 16 17 18 19 |
# File 'library/cwm/src/lib/cwm/tree_pager.rb', line 15 def initialize(page, icon: nil, open: true, children: []) @page = page super(page., page.label, icon: icon, open: open, children: children) end |
Instance Attribute Details
#page ⇒ Page (readonly)
11 12 13 |
# File 'library/cwm/src/lib/cwm/tree_pager.rb', line 11 def page @page end |
Instance Method Details
#pages ⇒ Array<Page>
Returns My page and all pages of descendant items (needed to initialize a CWM::Pager).
23 24 25 |
# File 'library/cwm/src/lib/cwm/tree_pager.rb', line 23 def pages children.values.flat_map(&:pages).unshift(@page) end |