Sha256: d59c88c7f018b7de123d9c7e7d1e29d0b12348e150619b764a5ba4540aeb03da

Contents?: true

Size: 1.49 KB

Versions: 30

Compression:

Stored size: 1.49 KB

Contents

(function() {

  Luca.fields.ButtonField = Luca.core.Field.extend({
    form_field: true,
    readOnly: true,
    events: {
      "click input": "click_handler"
    },
    hooks: ["button:click"],
    className: 'luca-ui-field luca-ui-button-field',
    template: 'fields/button_field',
    click_handler: function(e) {
      var me, my;
      me = my = $(e.currentTarget);
      return this.trigger("button:click");
    },
    initialize: function(options) {
      var _ref;
      this.options = options != null ? options : {};
      _.extend(this.options);
      _.bindAll(this, "click_handler");
      Luca.core.Field.prototype.initialize.apply(this, arguments);
      if ((_ref = this.icon_class) != null ? _ref.length : void 0) {
        return this.template = "fields/button_field_link";
      }
    },
    afterInitialize: function() {
      this.input_id || (this.input_id = _.uniqueId('button'));
      this.input_name || (this.input_name = this.name || (this.name = this.input_id));
      this.input_value || (this.input_value = this.label || (this.label = this.text));
      this.input_type || (this.input_type = "button");
      this.input_class || (this.input_class = this["class"]);
      this.icon_class || (this.icon_class = "");
      if (this.icon_class.length && !this.icon_class.match(/^icon-/)) {
        return this.icon_class = "icon-" + this.icon_class;
      }
    },
    setValue: function() {
      return true;
    }
  });

  Luca.register("button_field", "Luca.fields.ButtonField");

}).call(this);

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
luca-0.9.76 vendor/assets/luca-ui/components/fields/button_field.js
luca-0.9.7 vendor/assets/luca-ui/components/fields/button_field.js
luca-0.9.65 vendor/assets/luca-ui/components/fields/button_field.js
luca-0.9.6 vendor/assets/luca-ui/components/fields/button_field.js
luca-0.9.42 vendor/assets/luca-ui/components/fields/button_field.js
luca-0.9.4 vendor/assets/luca-ui/components/fields/button_field.js
luca-0.9.2 vendor/assets/luca-ui/components/fields/button_field.js
luca-0.9.1 vendor/assets/luca-ui/components/fields/button_field.js
luca-0.9.0 vendor/assets/luca-ui/components/fields/button_field.js
luca-0.8.599 vendor/assets/luca-ui/components/fields/button_field.js
luca-0.8.59 vendor/assets/luca-ui/components/fields/button_field.js
luca-0.8.3 vendor/assets/luca-ui/components/fields/button_field.js
luca-0.8.2 vendor/assets/luca-ui/components/fields/button_field.js
luca-0.8.06 vendor/assets/luca-ui/components/fields/button_field.js
luca-0.8 vendor/assets/luca-ui/components/fields/button_field.js
luca-0.7.92 vendor/assets/luca-ui/components/fields/button_field.js
luca-0.7.91 vendor/assets/luca-ui/components/fields/button_field.js
luca-0.7.9 vendor/assets/luca-ui/components/fields/button_field.js
luca-0.7.8 vendor/assets/luca-ui/components/fields/button_field.js
luca-0.7.7 vendor/assets/luca-ui/components/fields/button_field.js