route pushstate
BegeMode opened this issue · comments
Now in Route.navigate:
.....
return history.pushState({}, document.title, this.path);
whether it is possible to change this:
return history.pushState(options, document.title, this.path);
ie send to options object?
yes, probably possible, been a while since I've worked on the router. If you could pass along a use case exampe or unit test that would probably get things moving along a litte quicker.
I had to rewrite the method Spine.Route.change:
Spine.Route.change = function (e) {
var path;
path = Spine.Route.getPath();
if (path === Spine.Route.path) {
return;
}
if (e && e.originalEvent && e.originalEvent.state) {
this.options = $.extend({}, this.options, e.originalEvent.state);
path = Spine.Controller.cutArea(path, this.options.area);
}
Spine.Route.path = path;
return Spine.Route.matchRoutes(Spine.Route.path, this.options);
};
The backend on ASP.NET MVC and URL might look like this:
/Controller/Action/id or /Area/Controller/Action/id
To work routing patterns in my main controller:
this.routes({
"/": this.proxy(this.homePage),
"/:controller": this.proxy(this.routing),
"/:controller/:action": this.proxy(this.routing),
"/:controller/:action/:id": this.proxy(this.routing),
});
I keep in the options object part of URL - area and some other data.
So I need to options object passed to the pushstate and then is processed in the Spine.Route.change.
...sorry for the poor English