Sha256: a95f2f140cb4bf2d6818d694743ce58ddfbee96660a7a85cc4b9e6da8454b1eb

Contents?: true

Size: 828 Bytes

Versions: 14

Compression:

Stored size: 828 Bytes

Contents

require 'omf-web/theme/bright/layout_renderer'

module OMF::Web::Theme
  
  class FlowRenderer < LayoutRenderer
    
    def initialize(layout_widget, widgets, opts)
      super opts
      @layout_widget = layout_widget
      @widgets = widgets || []
      @opts = opts
    end
    
    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

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
omf_web-1.2.9 lib/omf-web/theme/bright/flow_renderer.rb
omf_web-1.2.8 lib/omf-web/theme/bright/flow_renderer.rb
omf_web-1.2.7 lib/omf-web/theme/bright/flow_renderer.rb
omf_web-1.2.6 lib/omf-web/theme/bright/flow_renderer.rb
omf_web-1.2.5 lib/omf-web/theme/bright/flow_renderer.rb
omf_web-1.2.4 lib/omf-web/theme/bright/flow_renderer.rb
omf_web-1.2.3 lib/omf-web/theme/bright/flow_renderer.rb
omf_web-1.2.2 lib/omf-web/theme/bright/flow_renderer.rb
omf_web-1.2.1 lib/omf-web/theme/bright/flow_renderer.rb
omf_web-1.2.0 lib/omf-web/theme/bright/flow_renderer.rb
omf_web-1.0.0 lib/omf-web/theme/bright/flow_renderer.rb
omf_web-0.9.9 lib/omf-web/theme/bright/flow_renderer.rb
omf_web-0.9.8 lib/omf-web/theme/bright/flow_renderer.rb
omf_web-0.9.7 lib/omf-web/theme/bright/flow_renderer.rb