Sha256: 77ca350077546c46434b5981c4638946c4d4d8e0938fc35962658891691c7d89

Contents?: true

Size: 1.58 KB

Versions: 13

Compression:

Stored size: 1.58 KB

Contents

(function() {
  var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
    extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
    hasProp = {}.hasOwnProperty;

  Backbone.Poised.StringControl = (function(superClass) {
    extend(StringControl, superClass);

    function StringControl() {
      this.render = bind(this.render, this);
      return StringControl.__super__.constructor.apply(this, arguments);
    }

    StringControl.prototype.initialize = function(options) {
      if (options == null) {
        options = {};
      }
      StringControl.__super__.initialize.apply(this, arguments);
      return this.options = _.chain(options).pick('model', 'attribute', 'rows', 'placeholder').defaults({
        type: 'text',
        placeholder: null,
        rows: 1
      }).value();
    };

    StringControl.prototype.render = function() {
      StringControl.__super__.render.apply(this, arguments);
      if (this.options.rows > 1) {
        this.subviews.textarea = new Backbone.Poised.Textarea(this.options);
        this.$el.append(this.subviews.textarea.render().el);
      } else {
        this.subviews.textfield = new Backbone.Poised.Textfield(this.options);
        this.$info.append(this.subviews.textfield.render().el);
      }
      return this;
    };

    return StringControl;

  })(Backbone.Poised.BaseControl);

}).call(this);

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ela-4.1.0 dist/app_js/vendor/backbone.poised/form/string_control.js
ela-4.0.0 dist/app_js/vendor/backbone.poised/form/string_control.js
ela-3.4.3 dist/app_js/vendor/backbone.poised/form/string_control.js
ela-3.4.2 dist/app_js/vendor/backbone.poised/form/string_control.js
ela-3.4.0 dist/app_js/vendor/backbone.poised/form/string_control.js
ela-3.3.1 dist/app_js/vendor/backbone.poised/form/string_control.js
ela-3.3.0 dist/app_js/vendor/backbone.poised/form/string_control.js
ela-3.2.0 dist/app_js/vendor/backbone.poised/form/string_control.js
ela-3.1.1 dist/app_js/vendor/backbone.poised/form/string_control.js
ela-3.1.0 dist/app_js/vendor/backbone.poised/form/string_control.js
ela-3.0.0 dist/app_js/vendor/backbone.poised/form/string_control.js
ela-2.0.0 dist/app_js/vendor/backbone.poised/form/string_control.js
ela-1.1.0 dist/app_js/vendor/backbone.poised/form/string_control.js