Sha256: ac6be7ae30cf072dce70ed236bbbcd1205549da3014262805ac03a891a486f39

Contents?: true

Size: 1.38 KB

Versions: 30

Compression:

Stored size: 1.38 KB

Contents

(function() {

  Luca.fields.TextField = Luca.core.Field.extend({
    form_field: true,
    events: {
      "keydown input": "keydown_handler",
      "blur input": "blur_handler",
      "focus input": "focus_handler",
      "change input": "change_handler"
    },
    template: 'fields/text_field',
    initialize: function(options) {
      this.options = options != null ? options : {};
      _.bindAll(this, "keydown_handler", "blur_handler", "focus_handler");
      Luca.core.Field.prototype.initialize.apply(this, arguments);
      this.input_id || (this.input_id = _.uniqueId('field'));
      this.input_name || (this.input_name = this.name);
      this.label || (this.label = this.name);
      if (this.prepend) {
        this.$el.addClass('input-prepend');
        this.addOn = this.prepend;
      }
      if (this.append) {
        this.$el.addClass('input-append');
        return this.addOn = this.append;
      }
    },
    keydown_handler: _.throttle((function(e) {
      return this.change_handler.apply(this, arguments);
    }), 300),
    blur_handler: function(e) {
      var me, my;
      return me = my = $(e.currentTarget);
    },
    focus_handler: function(e) {
      var me, my;
      return me = my = $(e.currentTarget);
    },
    change_handler: function(e) {
      return this.trigger("on:change", this, e);
    }
  });

  Luca.register("text_field", "Luca.fields.TextField");

}).call(this);

Version data entries

30 entries across 30 versions & 1 rubygems

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