Class: OMF::Web::Widget::Layout::TwoColumnsLayout

Inherits:
AbstractWidget
  • Object
show all
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

Methods inherited from AbstractWidget

#mime_type, #title, #widget_info

Methods included from Common::Loggable

#_logger, #debug, #error, #fatal, #info, init_log, logger, set_environment, #warn

Constructor Details

#initialize(type, opts) ⇒ TwoColumnsLayout

Returns a new instance of TwoColumnsLayout.



9
10
11
12
13
# File 'lib/omf-web/widget/layout/two_columns_layout.rb', line 9

def initialize(type, opts)
  super opts
  @left = (opts[:left] || []).map {|w| OMF::Web::Widget.create_widget(w)}
  @right = (opts[:right] || []).map {|w| OMF::Web::Widget.create_widget(w)}      
end

Instance Method Details

#collect_data_sources(ds_set) ⇒ Object



20
21
22
23
24
# File 'lib/omf-web/widget/layout/two_columns_layout.rb', line 20

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

#contentObject



15
16
17
18
# File 'lib/omf-web/widget/layout/two_columns_layout.rb', line 15

def content()
  OMF::Web::Theme.require 'two_columns_renderer'
  OMF::Web::Theme::TwoColumnsRenderer.new(@left, @right, @opts)      
end

#layout?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/omf-web/widget/layout/two_columns_layout.rb', line 30

def layout?
  return true
end

#nameObject



26
27
28
# File 'lib/omf-web/widget/layout/two_columns_layout.rb', line 26

def name
  @opts[:name] || @active_widget.name
end

#tools_menuObject

Return html for an optional widget tools menu to be added to the widget decoration by the theme.



38
39
40
# File 'lib/omf-web/widget/layout/two_columns_layout.rb', line 38

def tools_menu()
  raise "Why are we here"
end