Created
March 13, 2013 18:00
-
-
Save tommycutter/5154572 to your computer and use it in GitHub Desktop.
Template for dynamic routes with PathJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Path.map("#/activities(/:param1)(/:param2)").to(function(){ | |
// View all activities | |
if(!this.params["param1"]) { | |
activitiesPage(); | |
} | |
// Create a new activity | |
if(this.params["param1"] == 'create') { | |
activitiesCreatePage(); | |
} | |
// View the activity | |
if($.isNumeric(this.params["param1"]) && !this.params["param2"]) { | |
activitiesDetailPage(this.params["param1"]); | |
} | |
// Edit the activity | |
if($.isNumeric(this.params["param1"]) && this.params["param2"] == 'edit') { | |
activitiesEditPage(this.params["param1"]); | |
} | |
// Delete the activity | |
if($.isNumeric(this.params["param1"]) && this.params["param2"] == 'delete') { | |
activitiesDeletePage(this.params["param1"]); | |
} | |
}); | |
function activitiesPage() { | |
// activities landing page loaded | |
} | |
function activitiesDetailPage(id) { | |
// activities detail page loaded | |
} | |
function activitiesCreatePage() { | |
// create new activity page loaded | |
} | |
function activitiesEditPage(id) { | |
// edit activity page loaded | |
} | |
function activitiesDeletePage(id) { | |
// delete activity page loaded | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment