Sha256: ff00d049c9787fa3ff429634542ba405b6563397fc281bd0d26295409bd7764d

Contents?: true

Size: 1.14 KB

Versions: 14

Compression:

Stored size: 1.14 KB

Contents

require 'omf-web/widget/abstract_widget'

module OMF::Web::Widget::Layout

  # Implements a layout which displays contained widgets in two columns.
  #
  class TwoColumnsLayout < OMF::Web::Widget::AbstractWidget

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

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

    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
    
    def name
      @opts[:name] || @active_widget.name
    end
    
    def layout?
      return true
    end
    
    
    # Return html for an optional widget tools menu to be added
    # to the widget decoration by the theme.
    # 
    def tools_menu()
      raise "Why are we here"
    end    



  end # class

end

Version data entries

14 entries across 14 versions & 1 rubygems

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