app/public/restapi/javascripts/routers/documentation_router.js in restapi-0.0.2 vs app/public/restapi/javascripts/routers/documentation_router.js in restapi-0.0.3

- old
+ new

@@ -9,25 +9,29 @@ initialize: function() { // this.navigate(window.location.pathname); }, index: function() { - this.render('index'); + var url = window.location.pathname + '.json'; + this.render('index', url); }, resource: function(resource) { - this.render('resource'); + var url = [window.location.pathname, resource + '.json'].join('/'); + this.render('resource', url); }, method: function(resource, method) { - this.render('method'); + var url = [window.location.pathname, resource, method +'.json'].join('/'); + this.render('method', url); }, - render: function(type) { - this.data = $.getJSON(window.location.pathname + '.json', function(data) { - $('#api-title').html(data.docs.name).attr('href', data.docs.doc_url); - $('footer').html(data.docs.copyright); + render: function(type, url) { + this.data = $.getJSON(url, function(data) { + if(!Restapi.rendered) { + $('footer').html(data.docs.copyright); + } var html = ''; if (type == 'index') { html = Restapi.Templates.Index({ docs: data.docs }); } else if (type == 'resource') { @@ -38,10 +42,11 @@ resource: data.docs.resources[0], method: data.docs.resources[0].methods[0] }); } - $("#container").append(html); + $("#container").html(html); + Restapi.rendered = true; }); } }); \ No newline at end of file