mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
backbonejs model conflict with connect-slashes
close #1648 - backbonejs model doesn't include tailing slash by default - connect-slashes returns 301 for GET without tailing slash - overwrote backbone model url method to include tailing slash
This commit is contained in:
parent
56de932492
commit
84bda76c18
1 changed files with 7 additions and 0 deletions
|
@ -41,6 +41,13 @@
|
|||
return Backbone.oldsync(method, model, options, error);
|
||||
};
|
||||
|
||||
Backbone.oldModelProtoUrl = Backbone.Model.prototype.url;
|
||||
//overwrite original url method to add slash to end of the url if needed.
|
||||
Backbone.Model.prototype.url = function () {
|
||||
var url = Backbone.oldModelProtoUrl.apply(this, arguments);
|
||||
return url + (url.charAt(url.length - 1) === '/' ? '' : '/');
|
||||
};
|
||||
|
||||
Ghost.init = function () {
|
||||
// remove the temporary message which appears
|
||||
$('.js-msg').remove();
|
||||
|
|
Loading…
Add table
Reference in a new issue