app/public/restapi/javascripts/jst.js in restapi-0.0.2 vs app/public/restapi/javascripts/jst.js in restapi-0.0.3
- old
+ new
@@ -7,15 +7,17 @@
<h2><a href='<%= api.doc_url %>'><%= api.name %></a><br><small><%= api.short_description %></small></h2> \
<table class='table'> \
<thead><tr><th>Resource</th><th>Description</th></tr></thead> \
<tbody> \
<% _.each(api.methods, function(m) { %> \
- <tr> \
- <td><a href='<%= m.doc_url %>'><%= m.http_method %> <%= m.api_url %></a></td> \
- <td width='60%'><%= m['short_description'] %></td> \
- </tr> \
- <% }) %> \
+ <% _.each(m.apis, function(api) { %> \
+ <tr> \
+ <td><a href='<%= m.doc_url %>'><%= api.http_method %> <%= api.api_url %></a></td> \
+ <td width='60%'><%= api.short_description %></td> \
+ </tr> \
+ <% }) %>\
+ <% }) %> \
</tbody> \
</table> \
<% }) %>");
Restapi.Templates.Resource = _.template(
@@ -27,34 +29,42 @@
<small><%= resource.short_description %></small></h1></div> \
<% if(resource.full_description != '') { %> \
<div><%= resource.full_description %></div> \
<% } %> \
<div class='accordion' id='accordion'> \
- <% _.each(resource.methods, function(api) { %> \
+ <% _.each(resource.methods, function(m) { %> \
<hr><div class=''> \
- <div class='pull-right small'><a href='<%= api.doc_url %>'> >>> </a></div> \
+ <div class='pull-right small'><a href='<%= m.doc_url %>'> >>> </a></div> \
<div> \
- <a href='#description-<%= api.name %>' class='accordion-toggle' data-toggle='collapse' data-parent='#accordion'> \
- <h3><%= api.http_method %> <%= api.api_url %></a><br> \
- <small><%= api.short_description %></small></h3>\
+ <% _.each(m.apis, function(api) { %> \
+ <h3> \
+ <a href='#description-<%= m.name %>' \
+ class='accordion-toggle' \
+ data-toggle='collapse' \
+ data-parent='#accordion'> \
+ <%= api.http_method %> <%= api.api_url %> \
+ </a> <br> \
+ <small><%= api.short_description %></small> \
+ </h3> \
+ <% }) %> \
</div> \
- <div id='description-<%= api.name %>' class='collapse accordion-body'> \
- <%= api.full_description %> \
- <% if(api.errors != '') { %> \
+ <div id='description-<%= m.name %>' class='collapse accordion-body'> \
+ <%= m.full_description %> \
+ <% if(m.errors != '') { %> \
<h2>Errors</h2> \
- <% _.each(api.errors, function(err) { %> \
+ <% _.each(m.errors, function(err) { %> \
<%= err.code %> \
<%= err.description %> \
<br> \
<% }) %> \
<% } %> \
- <% if(api.params != ''){ %> \
+ <% if(m.params != ''){ %> \
<h2>Params</h2> \
<table class='table'> \
<thead><tr><th>Param name</th><th>Description</th></tr></thead> \
<tbody> \
- <% _.each(api.params, function(val) { %> \
+ <% _.each(m.params, function(val) { %> \
<tr><td><strong><%= val.name %></strong><br>\
<small><%= val.required ? 'required' : 'optional' %></small></td> \
<td><%= val.description %><br>\
<% if(val.validator != ''){ %> Value: <%= val.validator %><% } %> \
</td></tr> \
@@ -66,17 +76,26 @@
</div> \
<% }) %></div>");
Restapi.Templates.Method = _.template(
"<ul class='breadcrumb'> \
- <li><a href='<%= docs.doc_url %>'><%= docs.name %></a><span class='divider'>/</span></li> \
- <li><a href='<%= resource.doc_url %>'><%= resource.name %></a><span class='divider'>/</span></li> \
+ <li> \
+ <a href='<%= docs.doc_url %>'><%= docs.name %></a> \
+ <span class='divider'>/</span> \
+ </li> \
+ <li> \
+ <a href='<%= resource.doc_url %>'><%= resource.name %></a> \
+ <span class='divider'>/</span> \
+ </li> \
<li class='active'><%= method.name %></li> \
</ul> \
-<div class='page-header'><h1><%= method.http_method %> <%= method.api_url %><br> \
- <small><%= method.short_description %></small></h1> \
-</div> \
+<% _.each(method.apis, function(api) { %> \
+ <div class='page-header'> \
+ <h1><%= api.http_method %> <%= api.api_url %><br> \
+ <small><%= api.short_description %></small></h1> \
+ </div> \
+<% }) %> \
<div> \
<%= method.full_description %> \
<% if(method.errors != '') { %> \
<h2>Errors</h2> \
<% _.each(method.errors, function(err) { %> \
@@ -103,6 +122,6 @@
</tr> \
<% }) %> \
</tbody> \
</table> \
<% } %> \
-</div>");
\ No newline at end of file
+</div>");