Class: OMF::Web::Theme::FlowRenderer

Inherits:
LayoutRenderer show all
Defined in:
lib/omf-web/theme/bright/flow_renderer.rb

Instance Method Summary collapse

Methods inherited from LayoutRenderer

#render?

Constructor Details

#initialize(layout_widget, widgets, opts) ⇒ FlowRenderer

Returns a new instance of FlowRenderer.



8
9
10
11
12
13
# File 'lib/omf-web/theme/bright/flow_renderer.rb', line 8

def initialize(layout_widget, widgets, opts)
  super opts
  @layout_widget = layout_widget
  @widgets = widgets || []
  @opts = opts
end

Instance Method Details

#contentObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/omf-web/theme/bright/flow_renderer.rb', line 15

def content
  # This is a very simple way of determining the width settings.
  width = (100 / @widgets.size).to_i
  div :class => 'flow_layout' do
    @widgets.each do |w|
      div :class => 'flow_layout_single', :style => "width:#{width}%; float:left" do
        render_widget w
      end
    end
  end     
end

#render_widget(w) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/omf-web/theme/bright/flow_renderer.rb', line 27

def render_widget(w)
  r = w.content
  unless w.layout?
    r = WidgetChrome.new(w, r, @opts)
  end
  rawtext r.to_html      
end