Sha256: 72cb7e7f288710512759189f8fab7f2527557fe87f42ad263be434c4691b6d40

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

_.def('Luca.containers.ColumnView').extends('Luca.core.Container').with
  componentType: 'column_view'

  className: 'luca-ui-column-view'

  components: []

  initialize: (@options={})->
    console.log "Column Views are deprecated in favor of just using grid css on a normal container"
    Luca.core.Container::initialize.apply @, arguments
    @setColumnWidths()

  componentClass: 'luca-ui-column'

  containerTemplate: "containers/basic"

  generateComponentElements: 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 }%"

  beforeLayout: ()->
    @debug "column_view before layout"

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
luca-0.9.76 src/containers/column_view.coffee
luca-0.9.7 src/containers/column_view.coffee
luca-0.9.65 src/containers/column_view.coffee
luca-0.9.6 src/containers/column_view.coffee
luca-0.9.42 src/containers/column_view.coffee
luca-0.9.4 src/containers/column_view.coffee