Skip to content

Commit

Permalink
v0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinKolarik committed Jun 25, 2015
1 parent 0d38613 commit dd5a044
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ There are three ways to get ractive-route:

ractive-route will always expose itself as `Ractive.Router`. Additionally, you can load it using AMD or CommonJS module loader.

Version 0.2.x requires Ractive v0.6.x or v0.7.x.

## API

### new Router(options)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ractive-route",
"version": "0.2.0",
"version": "0.3.0",
"description": "Routing library for Ractive.js",
"homepage": "https://github.com/MartinKolarik/ractive-route/",
"github": "https://github.com/MartinKolarik/ractive-route/",
Expand Down
13 changes: 11 additions & 2 deletions ractive-route.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* ractive-route 0.2.0
* ractive-route 0.3.0
* https://github.com/MartinKolarik/ractive-route/
*
* Copyright (c) 2014 Martin Kolárik
Expand Down Expand Up @@ -218,6 +218,7 @@
* @public
*/
function Router(options) {
this.globals = options.globals || [];
this.basePath = options.basePath || '';
this.el = options.el;
this.data = options.data || function () { return {}; };
Expand Down Expand Up @@ -448,7 +449,15 @@
var href = el.getAttribute('href') || el.getAttribute('data-href');

if (href && !el.classList.contains('router-ignore') && pattern.test(href)) {
_this.dispatch(href);
var options = { state: {} };

if (_this.route && _this.route.view) {
_this.globals.forEach(function (global) {
options.state[global] = _this.route.view.get(global);
});
}

_this.dispatch(href, options);

e.preventDefault();
}
Expand Down
4 changes: 2 additions & 2 deletions ractive-route.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dd5a044

Please sign in to comment.