Class: OMF::Web::Theme::TwoColumnsRenderer
- Inherits:
-
Erector::Widget
- Object
- Erector::Widget
- OMF::Web::Theme::TwoColumnsRenderer
- Defined in:
- lib/omf-web/theme/bright/two_columns_renderer.rb
Constant Summary collapse
- DEFAULT_LAYOUT =
'66_33'
- @@layout2class =
{ '50_50' => "yui-g", '66_33' => "yui-gc", '33_66' => "yui-gd", '75_25' => "yui-ge", '25_75' => "yui-gf" }
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(lwidgets, rwidgets, opts) ⇒ TwoColumnsRenderer
constructor
A new instance of TwoColumnsRenderer.
- #render_left ⇒ Object
- #render_right ⇒ Object
- #render_widget(w) ⇒ Object
Constructor Details
#initialize(lwidgets, rwidgets, opts) ⇒ TwoColumnsRenderer
Returns a new instance of TwoColumnsRenderer.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/omf-web/theme/bright/two_columns_renderer.rb', line 18 def initialize(, , opts) super opts # looking for something like: 'layout/two_columns/50_50' layout = (opts[:type].split('/')[2] || DEFAULT_LAYOUT).to_s unless @layout_class = @@layout2class[layout] warn "Unknown layout '#{layout}'" @layout_class = @@layout2class[DEFAULT_LAYOUT] end = || [] = || [] @opts = opts end |
Instance Method Details
#content ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/omf-web/theme/bright/two_columns_renderer.rb', line 32 def content div :class => @layout_class do div :class => "yui-u first column column-left" do render_left end div :class => "yui-u column column-right" do render_right end end end |
#render_left ⇒ Object
44 45 46 47 48 |
# File 'lib/omf-web/theme/bright/two_columns_renderer.rb', line 44 def render_left .each do |w| w end end |
#render_right ⇒ Object
50 51 52 53 54 |
# File 'lib/omf-web/theme/bright/two_columns_renderer.rb', line 50 def render_right .each do |w| w end end |
#render_widget(w) ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/omf-web/theme/bright/two_columns_renderer.rb', line 56 def (w) r = w.content unless w.layout? r = WidgetChrome.new(w, r, @opts) end rawtext r.to_html end |