Skip to content

Instantly share code, notes, and snippets.

@justinrainbow
Created November 18, 2011 18:55
Show Gist options
  • Save justinrainbow/1377391 to your computer and use it in GitHub Desktop.
Save justinrainbow/1377391 to your computer and use it in GitHub Desktop.
Extension to add simple routing to a model
YUI.add('sk-gallery-model-router', function (Y) {
/* Any frequently used shortcuts, strings and constants */
var Lang = Y.Lang;
function ModelRouter(config) {
}
ModelRouter.prototype = {
getUrl: function (action) {
var route = this.routes[action],
name = route.name,
args = route.args ? this.getAttrs(route.args) : null;
return Routing.generate(name, args);
}
};
Y.namespace("Gallery").ModelRouter = ModelRouter;
}, '0.1.0');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment