Class: OMF::Web::Widget::Layout::TwoColumnsLayout
- Inherits:
-
AbstractWidget
- Object
- Erector::Widget
- AbstractWidget
- OMF::Web::Widget::Layout::TwoColumnsLayout
- Defined in:
- lib/omf-web/widget/layout/two_columns_layout.rb
Overview
Implements a layout which displays contained widgets in two columns.
Instance Attribute Summary
Attributes inherited from AbstractWidget
#opts, #widget_id, #widget_type
Instance Method Summary collapse
- #collect_data_sources(ds_set) ⇒ Object
- #content ⇒ Object
-
#initialize(type, opts) ⇒ TwoColumnsLayout
constructor
A new instance of TwoColumnsLayout.
- #layout? ⇒ Boolean
- #name ⇒ Object
-
#tools_menu ⇒ Object
Return html for an optional widget tools menu to be added to the widget decoration by the theme.
Methods inherited from AbstractWidget
#mime_type, #title, #widget_info
Constructor Details
#initialize(type, opts) ⇒ TwoColumnsLayout
Returns a new instance of TwoColumnsLayout.
9 10 11 12 13 14 |
# File 'lib/omf-web/widget/layout/two_columns_layout.rb', line 9 def initialize(type, opts) super opts wt = opts[:widgets] || opts # support opts[:left] as well as opts[:widgets][:left] @left = (wt[:left] || []).map {|w| OMF::Web::Widget.(w)} @right = (wt[:right] || []).map {|w| OMF::Web::Widget.(w)} end |
Instance Method Details
#collect_data_sources(ds_set) ⇒ Object
21 22 23 24 25 |
# File 'lib/omf-web/widget/layout/two_columns_layout.rb', line 21 def collect_data_sources(ds_set) @left.each {|w| w.collect_data_sources(ds_set) } @right.each {|w| w.collect_data_sources(ds_set) } ds_set end |
#content ⇒ Object
16 17 18 19 |
# File 'lib/omf-web/widget/layout/two_columns_layout.rb', line 16 def content() OMF::Web::Theme.require 'two_columns_renderer' OMF::Web::Theme::TwoColumnsRenderer.new(@left, @right, @opts) end |
#layout? ⇒ Boolean
31 32 33 |
# File 'lib/omf-web/widget/layout/two_columns_layout.rb', line 31 def layout? return true end |
#name ⇒ Object
27 28 29 |
# File 'lib/omf-web/widget/layout/two_columns_layout.rb', line 27 def name @opts[:name] || @active_widget.name end |
#tools_menu ⇒ Object
Return html for an optional widget tools menu to be added to the widget decoration by the theme.
39 40 41 |
# File 'lib/omf-web/widget/layout/two_columns_layout.rb', line 39 def () raise "Why are we here" end |