Class: OMF::Web::Theme::FlowRenderer
- Inherits:
-
LayoutRenderer
- Object
- Erector::Widget
- LayoutRenderer
- OMF::Web::Theme::FlowRenderer
- Defined in:
- lib/omf-web/theme/bright/flow_renderer.rb
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(layout_widget, widgets, opts) ⇒ FlowRenderer
constructor
A new instance of FlowRenderer.
- #render_widget(w) ⇒ Object
Methods inherited from LayoutRenderer
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(, , opts) super opts @layout_widget = @widgets = || [] @opts = opts end |
Instance Method Details
#content ⇒ Object
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 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 (w) r = w.content unless w.layout? r = WidgetChrome.new(w, r, @opts) end rawtext r.to_html end |