Skip to content

Instantly share code, notes, and snippets.

@brendanmckenzie
Created April 22, 2012 03:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brendanmckenzie/2cce7c5d884d7b379b74 to your computer and use it in GitHub Desktop.
Save brendanmckenzie/2cce7c5d884d7b379b74 to your computer and use it in GitHub Desktop.
steal(
'jquery/controller',
function ($) {
/**
* @class Ecm.Router
*/
$.Controller('Ecm.Router',
/** @Static */
{
defaults: {}
},
/** @Prototype */
{
init: function () {
$.route("do/:action", { action: '', id: '' })
$.route("do/:action/:id", { action: '', id: '' })
},
"do/:action/:id route": function (obj) {
switch (obj.action) {
case 'open-campaign':
$('.content').ecm_campaign_show({ id: obj.id });
break;
}
},
"do/:action route": function (obj) {
switch (obj.action) {
case 'create-campaign':
$('.content').ecm_campaign_create();
break;
}
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment