Sha256: 20105594f69f270c7331e29bbd5b5dc45fd7437d3b7f59bbf6d9e13192d58edb

Contents?: true

Size: 1.36 KB

Versions: 58

Compression:

Stored size: 1.36 KB

Contents

/**
 * A table cell using the row model's value of the column attribute as
 * text. If attribute value is empty, use most specific default
 * available.
 *
 * @param {function|string} [options.column.default]
 *   A function returning a default value for display if attribute
 *   value is empty.
 *
 * @param {string} [options.column.contentBinding]
 *   If this is provided, the function `options.column.default`
 *   receives the values of `options.column.contentBinding` and of
 *   this.getModel() via its options hash. No-op if
 *   `options.column.default` is not a function.
 *
 * @since 12.0
 */
pageflow.TextTableCellView = pageflow.TableCellView.extend({
  className: 'text_table_cell',

  update: function() {
    this.$el.text(this._updateText());
  },

  _updateText: function() {
    if (!!this.attributeValue()) {
      return this.attributeValue();
    }
    else if (typeof this.options.column.default === 'function') {
      var options = {};
      if (!!this.options.column.contentBinding) {
        options = {
          contentBinding: this.options.column.contentBinding,
          model: this.getModel()
        };
      }
      return this.options.column.default(options);
    }
    else if ('default' in this.options.column) {
      return this.options.column.default;
    }
    else {
      return I18n.t('pageflow.ui.text_table_cell_view.empty');
    }
  }
});

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
pageflow-14.5.2 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js
pageflow-15.0.2 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js
pageflow-15.0.1 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js
pageflow-15.0.0 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js
pageflow-14.5.1 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js
pageflow-14.5.0 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js
pageflow-15.0.0.rc2 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js
pageflow-15.0.0.rc1 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js
pageflow-15.0.0.beta4 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js
pageflow-15.0.0.beta3 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js
pageflow-14.4.0 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js
pageflow-15.0.0.beta2 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js
pageflow-15.0.0.beta1 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js
pageflow-14.3.0 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js
pageflow-14.2.1 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js
pageflow-14.2.0 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js
pageflow-14.1.1 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js
pageflow-14.1.0 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js
pageflow-14.0.0 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js
pageflow-14.0.0.rc2 app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js