Skip to content

Commit

Permalink
closes #45
Browse files Browse the repository at this point in the history
  • Loading branch information
ayush committed Aug 28, 2012
1 parent 4570b99 commit 58d5a35
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/main/javascript/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ var Docs = {
},

toggleEndpointListForResource: function(resource) {
var elem = $('li#resource_' + resource + ' ul.endpoints');
var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
if (elem.is(':visible')) {
Docs.collapseEndpointListForResource(resource);
} else {
Expand All @@ -119,34 +119,38 @@ var Docs = {
expandEndpointListForResource: function(resource) {
$('#resource_' + resource).addClass('active');

var elem = $('li#resource_' + resource + ' ul.endpoints');
var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
elem.slideDown();
},

// Collapse resource and mark as explicitly closed
collapseEndpointListForResource: function(resource) {
$('#resource_' + resource).removeClass('active');

var elem = $('li#resource_' + resource + ' ul.endpoints');
var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
elem.slideUp();
},

expandOperationsForResource: function(resource) {
// Make sure the resource container is open..
Docs.expandEndpointListForResource(resource);
$('li#resource_' + resource + ' li.operation div.content').each(function() {
$('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
Docs.expandOperation($(this));
});
},

collapseOperationsForResource: function(resource) {
// Make sure the resource container is open..
Docs.expandEndpointListForResource(resource);
$('li#resource_' + resource + ' li.operation div.content').each(function() {
$('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
Docs.collapseOperation($(this));
});
},

escapeResourceName: function(resource) {
return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&")
},

expandOperation: function(elem) {
elem.slideDown();
},
Expand Down

0 comments on commit 58d5a35

Please sign in to comment.