Sha256: cc0e43e100ae24969dae242d65126a8d06363898a10cb5e8068edd0e6db3ed9f

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

_.component('Luca.containers.ColumnView').extends('Luca.core.Container').with
  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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
luca-0.8.599 src/containers/column_view.coffee
luca-0.8.59 src/containers/column_view.coffee