Sha256: f1e73227b860d950d387840673512f85d0e7dc83225eff61c6d2893bcd54f072

Contents?: true

Size: 1.15 KB

Versions: 19

Compression:

Stored size: 1.15 KB

Contents

Luca.containers.ColumnView = Luca.core.Container.extend
  componentType: 'column_view'

  className: 'luca-ui-column-view'

  components: []

  initialize: (@options={})->
    Luca.core.Container::initialize.apply @, arguments
    @setColumnWidths()
  
  componentClass: 'luca-ui-column'

  containerTemplate: "containers/basic"

  appendContainers: true

  autoColumnWidths: ()-> 
    widths = []

    _( @components.length ).times ()=> 
      widths.push( parseInt( 100 / @components.length ) )

    widths

  setColumnWidths: ()->
    @columnWidths = if @layout? 
      _( @layout.split('/') ).map((v)-> parseInt(v) ) 
    else 
      @autoColumnWidths()

    @columnWidths = _( @columnWidths ).map (val)-> "#{ val }%"
  
  beforeComponents: ()->
    @debug "column_view before components"
    _( @components ).each (component)->
      component.ctype ||= "panel_view"
  
  beforeLayout: ()->
    @debug "column_view before layout"

    _(@columnWidths).each (width,index) =>
      @components[index].float = "left"
      @components[index].width = width

    Luca.core.Container::beforeLayout?.apply @, arguments

Luca.register 'column_view', "Luca.containers.ColumnView"

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
luca-0.8.3 src/containers/column_view.coffee
luca-0.8.2 src/containers/column_view.coffee
luca-0.8.06 src/containers/column_view.coffee
luca-0.8 src/containers/column_view.coffee
luca-0.7.92 src/containers/column_view.coffee
luca-0.7.91 src/containers/column_view.coffee
luca-0.7.9 src/containers/column_view.coffee
luca-0.7.8 src/containers/column_view.coffee
luca-0.7.7 src/containers/column_view.coffee
luca-0.7.6 src/containers/column_view.coffee
luca-0.7.5 src/containers/column_view.coffee
luca-0.7.4 src/containers/column_view.coffee
luca-0.7.3 src/containers/column_view.coffee
luca-0.7.2 src/containers/column_view.coffee
luca-0.7.0 src/containers/column_view.coffee
luca-0.6.9 src/containers/column_view.coffee
luca-0.6.8 src/containers/column_view.coffee
luca-0.6.7 src/containers/column_view.coffee
luca-0.6.6 src/containers/column_view.coffee