Skip to content

Commit

Permalink
Merge pull request #397 from tbranyen/update-to-latest
Browse files Browse the repository at this point in the history
Updated to the latest Backbone version 1.1.0.
  • Loading branch information
tbranyen committed Oct 25, 2013
2 parents ebed0c1 + 5c86166 commit 676b387
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
30 changes: 19 additions & 11 deletions backbone.layoutmanager.js
Expand Up @@ -28,9 +28,8 @@ var window = this;
// LayoutManager options at definition time.
var keys;

// Maintain references to the two `Backbone.View` functions that are
// overwritten so that they can be proxied.
var _configure = Backbone.View.prototype._configure;
// Maintain reference to the original constructor.
var ViewConstructor = Backbone.View;

// Cache these methods for performance.
var aPush = Array.prototype.push;
Expand Down Expand Up @@ -216,8 +215,11 @@ var LayoutManager = Backbone.View.extend({
// Grant this View superpowers.
this.manage = true;

// Give this View access to all passed options as instance properties.
_.extend(this, options);

// Have Backbone set up the rest of this View.
Backbone.View.call(this, options);
Backbone.View.apply(this, arguments);
},

// This method is used within specific methods to indicate that they should
Expand Down Expand Up @@ -855,21 +857,21 @@ Backbone.Layout = LayoutManager;

// Override _configure to provide extra functionality that is necessary in
// order for the render function reference to be bound during initialize.
Backbone.View.prototype._configure = function(options) {
var noel, retVal;
Backbone.View = function(options) {
var noel;

// Ensure options is always an object.
options = options || {};

// Remove the container element provided by Backbone.
if ("el" in options ? options.el === false : this.el === false) {
noel = true;
}

// Run the original _configure.
retVal = _configure.apply(this, arguments);

// If manage is set, do it!
if (options.manage || this.manage) {
// Set up this View.
LayoutManager.setupView(this);
LayoutManager.setupView(this, options);
}

// Assign the `noel` property once we're sure the View we're working with is
Expand All @@ -880,9 +882,15 @@ Backbone.View.prototype._configure = function(options) {
}

// Act like nothing happened.
return retVal;
ViewConstructor.apply(this, arguments);
};

// Copy over the extend method.
Backbone.View.extend = ViewConstructor.extend;

// Copy over the prototype as well.
Backbone.View.prototype = ViewConstructor.prototype;

// Default configuration options; designed to be overriden.
LayoutManager.prototype.options = {
// Prefix template/layout paths.
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Expand Up @@ -5,7 +5,7 @@
"dependencies": {
"jquery": ">=1.6",
"underscore": ">=1.5",
"backbone": "~1.0",
"backbone": "~1.1",
"requirejs": "~2.1.8"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -13,7 +13,7 @@
"node": ">=0.8"
},
"dependencies": {
"backbone": "~1.0",
"backbone": "~1.1",
"underscore.deferred": "~0.4",
"cheerio": "~0.12.2",
"underscore": ">=1.5"
Expand All @@ -36,7 +36,7 @@
"jam": {
"dependencies": {
"underscore": ">=1.5",
"backbone": "~1.0",
"backbone": "~1.1",
"jquery": ">=1.6"
},
"include": [
Expand Down

0 comments on commit 676b387

Please sign in to comment.