Sha256: 269064c2413929894db67a3e5bed94976c5135b09b752af70644ca4d2fc146a1

Contents?: true

Size: 1.72 KB

Versions: 30

Compression:

Stored size: 1.72 KB

Contents

(function() {

  Luca.containers.ColumnView = Luca.core.Container.extend({
    componentType: 'column_view',
    className: 'luca-ui-column-view',
    components: [],
    initialize: function(options) {
      this.options = options != null ? options : {};
      Luca.core.Container.prototype.initialize.apply(this, arguments);
      return this.setColumnWidths();
    },
    componentClass: 'luca-ui-column',
    containerTemplate: "containers/basic",
    appendContainers: true,
    autoColumnWidths: function() {
      var widths,
        _this = this;
      widths = [];
      _(this.components.length).times(function() {
        return widths.push(parseInt(100 / _this.components.length));
      });
      return widths;
    },
    setColumnWidths: function() {
      this.columnWidths = this.layout != null ? _(this.layout.split('/')).map(function(v) {
        return parseInt(v);
      }) : this.autoColumnWidths();
      return this.columnWidths = _(this.columnWidths).map(function(val) {
        return "" + val + "%";
      });
    },
    beforeComponents: function() {
      this.debug("column_view before components");
      return _(this.components).each(function(component) {
        return component.ctype || (component.ctype = "panel_view");
      });
    },
    beforeLayout: function() {
      var _ref,
        _this = this;
      this.debug("column_view before layout");
      _(this.columnWidths).each(function(width, index) {
        _this.components[index].float = "left";
        return _this.components[index].width = width;
      });
      return (_ref = Luca.core.Container.prototype.beforeLayout) != null ? _ref.apply(this, arguments) : void 0;
    }
  });

  Luca.register('column_view', "Luca.containers.ColumnView");

}).call(this);

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
luca-0.7.6 vendor/assets/luca-ui/containers/column_view.js
luca-0.7.5 vendor/assets/luca-ui/containers/column_view.js
luca-0.7.4 vendor/assets/luca-ui/containers/column_view.js
luca-0.7.3 vendor/assets/luca-ui/containers/column_view.js
luca-0.7.2 vendor/assets/luca-ui/containers/column_view.js
luca-0.7.0 vendor/assets/luca-ui/containers/column_view.js
luca-0.6.9 vendor/assets/luca-ui/containers/column_view.js
luca-0.6.8 vendor/assets/luca-ui/containers/column_view.js
luca-0.6.7 vendor/assets/luca-ui/containers/column_view.js
luca-0.6.6 vendor/assets/luca-ui/containers/column_view.js