Sha256: 2e7e277250eb9a2541aacd3ad4441c8421d3b52c40f475b5dd37f555264bd50c
Contents?: true
Size: 1.84 KB
Versions: 19
Compression:
Stored size: 1.84 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.Anchor = (function(superClass) { extend(Anchor, superClass); function Anchor() { this.render = bind(this.render, this); this.toggleCollapse = bind(this.toggleCollapse, this); this.initialize = bind(this.initialize, this); return Anchor.__super__.constructor.apply(this, arguments); } Anchor.prototype.tagName = 'div'; Anchor.prototype.className = 'poised anchor'; Anchor.prototype.initialize = function(options) { if (options == null) { options = {}; } if (options.anchor == null) { throw new Error('Missing `anchor` option'); } this.anchor = options.anchor; this.label = options.label; this.collapsible = options.collapsible === true; if (this.collapsible) { return this.collapsed = options.collapsed !== false; } }; Anchor.prototype.toggleCollapse = function() { return this.$el.toggleClass('collapsed'); }; Anchor.prototype.render = function() { this.$el.html(this.label || this.loadLocale("formAnchor." + this.anchor + ".label", { defaultValue: this.anchor.toLabel() })); if (this.collapsible) { this.$el.addClass('collapsible'); if (this.collapsed) { this.toggleCollapse(); } this.$el.on('tap', this.toggleCollapse); } return this; }; return Anchor; })(Backbone.Poised.View); }).call(this);
Version data entries
19 entries across 19 versions & 1 rubygems