Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

oldRedirects unravelled in right order

  • Loading branch information...
commit 55226b24415c86def490da4ce632cc856d1430bc 1 parent 5ff6107
@smathy smathy authored
View
9 lib/batman.js
@@ -7492,6 +7492,7 @@
this.redirect = __bind(this.redirect, this);
Controller.__super__.constructor.apply(this, arguments);
this._resetActionFrames();
+ this._oldRedirect = [];
}
Controller.prototype.renderCache = new Batman.RenderCache;
@@ -7522,7 +7523,7 @@
};
Controller.prototype.executeAction = function(action, params) {
- var frame, oldRedirect, parentFrame, result, _ref, _ref1,
+ var frame, parentFrame, result, _ref, _ref1,
_this = this;
if (params == null) {
params = this.get('params');
@@ -7536,13 +7537,13 @@
var _ref;
_this._runFilters(action, params, 'afterFilters');
_this._resetActionFrames();
- return (_ref = Batman.navigator) != null ? _ref.redirect = oldRedirect : void 0;
+ return (_ref = Batman.navigator) != null ? _ref.redirect = _this._oldRedirect.pop() : void 0;
});
this._actionFrames.push(frame);
frame.startOperation({
internal: true
});
- oldRedirect = (_ref = Batman.navigator) != null ? _ref.redirect : void 0;
+ this._oldRedirect.push((_ref = Batman.navigator) != null ? _ref.redirect : void 0);
if ((_ref1 = Batman.navigator) != null) {
_ref1.redirect = this.redirect;
}
@@ -11154,7 +11155,7 @@
count = void 0;
}
}
- if (count) {
+ if (count != null) {
return Batman.helpers.pluralize(count, string, void 0, includeCount);
} else {
return Batman.helpers.pluralize(string);
View
9 lib/dist/batman.node.js
@@ -7492,6 +7492,7 @@
this.redirect = __bind(this.redirect, this);
Controller.__super__.constructor.apply(this, arguments);
this._resetActionFrames();
+ this._oldRedirect = [];
}
Controller.prototype.renderCache = new Batman.RenderCache;
@@ -7522,7 +7523,7 @@
};
Controller.prototype.executeAction = function(action, params) {
- var frame, oldRedirect, parentFrame, result, _ref, _ref1,
+ var frame, parentFrame, result, _ref, _ref1,
_this = this;
if (params == null) {
params = this.get('params');
@@ -7536,13 +7537,13 @@
var _ref;
_this._runFilters(action, params, 'afterFilters');
_this._resetActionFrames();
- return (_ref = Batman.navigator) != null ? _ref.redirect = oldRedirect : void 0;
+ return (_ref = Batman.navigator) != null ? _ref.redirect = _this._oldRedirect.pop() : void 0;
});
this._actionFrames.push(frame);
frame.startOperation({
internal: true
});
- oldRedirect = (_ref = Batman.navigator) != null ? _ref.redirect : void 0;
+ this._oldRedirect.push((_ref = Batman.navigator) != null ? _ref.redirect : void 0);
if ((_ref1 = Batman.navigator) != null) {
_ref1.redirect = this.redirect;
}
@@ -11154,7 +11155,7 @@
count = void 0;
}
}
- if (count) {
+ if (count != null) {
return Batman.helpers.pluralize(count, string, void 0, includeCount);
} else {
return Batman.helpers.pluralize(string);
View
5 src/controller/controller.coffee
@@ -45,6 +45,7 @@ class Batman.Controller extends Batman.Object
constructor: ->
super
@_resetActionFrames()
+ @_oldRedirect = []
renderCache: new Batman.RenderCache
defaultRenderYield: 'main'
@@ -79,12 +80,12 @@ class Batman.Controller extends Batman.Object
frame = new Batman.ControllerActionFrame {parentFrame, action}, =>
@_runFilters action, params, 'afterFilters'
@_resetActionFrames()
- Batman.navigator?.redirect = oldRedirect
+ Batman.navigator?.redirect = @_oldRedirect.pop()
@_actionFrames.push frame
frame.startOperation({internal: true})
- oldRedirect = Batman.navigator?.redirect
+ @_oldRedirect.push Batman.navigator?.redirect
Batman.navigator?.redirect = @redirect
@_runFilters action, params, 'beforeFilters'
Please sign in to comment.
Something went wrong with that request. Please try again.