3 // Helper function for vertically aligning DOM elements
\r
4 // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
\r
5 $.fn.vAlign = function() {
\r
6 return this.each(function(i){
\r
7 var ah = $(this).height();
\r
8 var ph = $(this).parent().height();
\r
9 var mh = (ph - ah) / 2;
\r
10 $(this).css('margin-top', mh);
\r
14 $.fn.stretchFormtasticInputWidthToParent = function() {
\r
15 return this.each(function(i){
\r
16 var p_width = $(this).closest("form").innerWidth();
\r
17 var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10);
\r
18 var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
\r
19 $(this).css('width', p_width - p_padding - this_padding);
\r
23 $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
\r
25 // Vertically center these paragraphs
\r
26 // Parent may need a min-height for this to work..
\r
27 $('ul.downplayed li div.content p').vAlign();
\r
29 // When a sandbox form is submitted..
\r
30 $("form.sandbox").submit(function(){
\r
32 var error_free = true;
\r
34 // Cycle through the forms required inputs
\r
35 $(this).find("input.required").each(function() {
\r
37 // Remove any existing error styles from the input
\r
38 $(this).removeClass('error');
\r
40 // Tack the error style on if the input is empty..
\r
41 if ($(this).val() == '') {
\r
42 $(this).addClass('error');
\r
54 function clippyCopiedCallback(a) {
\r
55 $('#api_key_copied').fadeIn().delay(1000).fadeOut();
\r
57 // var b = $("#clippy_tooltip_" + a);
\r
58 // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
\r
59 // b.attr("title", "copy to clipboard")
\r
64 // Logging function that accounts for browsers that don't have window.console
\r
66 if (window.console) console.log.apply(console,arguments);
\r
68 // Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
\r
69 if (Function.prototype.bind && console && typeof console.log == "object") {
\r
71 "log","info","warn","error","assert","dir","clear","profile","profileEnd"
\r
72 ].forEach(function (method) {
\r
73 console[method] = this.bind(console[method], console);
\r
74 }, Function.prototype.call);
\r
79 shebang: function() {
\r
81 // If shebang has an operation nickname in it..
\r
82 // e.g. /docs/#!/words/get_search
\r
83 var fragments = $.param.fragment().split('/');
\r
84 fragments.shift(); // get rid of the bang
\r
86 switch (fragments.length) {
\r
88 // Expand all operations for the resource and scroll to it
\r
89 // log('shebang resource:' + fragments[0]);
\r
90 var dom_id = 'resource_' + fragments[0];
\r
92 Docs.expandEndpointListForResource(fragments[0]);
\r
93 $("#"+dom_id).slideto({highlight: false});
\r
96 // Refer to the endpoint DOM element, e.g. #words_get_search
\r
97 // log('shebang endpoint: ' + fragments.join('_'));
\r
100 Docs.expandEndpointListForResource(fragments[0]);
\r
101 $("#"+dom_id).slideto({highlight: false});
\r
103 // Expand operation
\r
104 var li_dom_id = fragments.join('_');
\r
105 var li_content_dom_id = li_dom_id + "_content";
\r
107 // log("li_dom_id " + li_dom_id);
\r
108 // log("li_content_dom_id " + li_content_dom_id);
\r
110 Docs.expandOperation($('#'+li_content_dom_id));
\r
111 $('#'+li_dom_id).slideto({highlight: false});
\r
117 toggleEndpointListForResource: function(resource) {
\r
118 var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
\r
119 if (elem.is(':visible')) {
\r
120 Docs.collapseEndpointListForResource(resource);
\r
122 Docs.expandEndpointListForResource(resource);
\r
127 expandEndpointListForResource: function(resource) {
\r
128 var resource = Docs.escapeResourceName(resource);
\r
129 if (resource == '') {
\r
130 $('.resource ul.endpoints').slideDown();
\r
134 $('li#resource_' + resource).addClass('active');
\r
136 var elem = $('li#resource_' + resource + ' ul.endpoints');
\r
140 // Collapse resource and mark as explicitly closed
\r
141 collapseEndpointListForResource: function(resource) {
\r
142 var resource = Docs.escapeResourceName(resource);
\r
143 $('li#resource_' + resource).removeClass('active');
\r
145 var elem = $('li#resource_' + resource + ' ul.endpoints');
\r
149 expandOperationsForResource: function(resource) {
\r
150 // Make sure the resource container is open..
\r
151 Docs.expandEndpointListForResource(resource);
\r
153 if (resource == '') {
\r
154 $('.resource ul.endpoints li.operation div.content').slideDown();
\r
158 $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
\r
159 Docs.expandOperation($(this));
\r
163 collapseOperationsForResource: function(resource) {
\r
164 // Make sure the resource container is open..
\r
165 Docs.expandEndpointListForResource(resource);
\r
167 $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
\r
168 Docs.collapseOperation($(this));
\r
172 escapeResourceName: function(resource) {
\r
173 return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
\r
176 expandOperation: function(elem) {
\r
180 collapseOperation: function(elem) {
\r
186 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
187 templates['content_type'] = template(function (Handlebars,depth0,helpers,partials,data) {
188 this.compilerInfo = [4,'>= 1.0.0'];
189 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
190 var buffer = "", stack1, functionType="function", self=this;
192 function program1(depth0,data) {
194 var buffer = "", stack1;
196 stack1 = helpers.each.call(depth0, depth0.produces, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
197 if(stack1 || stack1 === 0) { buffer += stack1; }
201 function program2(depth0,data) {
203 var buffer = "", stack1;
204 buffer += "\n <option value=\"";
205 stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
206 if(stack1 || stack1 === 0) { buffer += stack1; }
208 stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
209 if(stack1 || stack1 === 0) { buffer += stack1; }
210 buffer += "</option>\n ";
214 function program4(depth0,data) {
217 return "\n <option value=\"application/json\">application/json</option>\n";
220 buffer += "<label for=\"contentType\"></label>\n<select name=\"contentType\">\n";
221 stack1 = helpers['if'].call(depth0, depth0.produces, {hash:{},inverse:self.program(4, program4, data),fn:self.program(1, program1, data),data:data});
222 if(stack1 || stack1 === 0) { buffer += stack1; }
223 buffer += "\n</select>\n";
229 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
230 templates['main'] = template(function (Handlebars,depth0,helpers,partials,data) {
231 this.compilerInfo = [4,'>= 1.0.0'];
232 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
233 var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
235 function program1(depth0,data) {
237 var buffer = "", stack1, stack2;
238 buffer += "\n <div class=\"info_title\">"
239 + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.title)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
240 + "</div>\n <div class=\"info_description\">";
241 stack2 = ((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.description)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
242 if(stack2 || stack2 === 0) { buffer += stack2; }
243 buffer += "</div>\n ";
244 stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.termsOfServiceUrl), {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
245 if(stack2 || stack2 === 0) { buffer += stack2; }
247 stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.contact), {hash:{},inverse:self.noop,fn:self.program(4, program4, data),data:data});
248 if(stack2 || stack2 === 0) { buffer += stack2; }
250 stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.license), {hash:{},inverse:self.noop,fn:self.program(6, program6, data),data:data});
251 if(stack2 || stack2 === 0) { buffer += stack2; }
255 function program2(depth0,data) {
257 var buffer = "", stack1;
258 buffer += "<div class=\"info_tos\"><a href=\""
259 + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.termsOfServiceUrl)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
260 + "\">Terms of service</a></div>";
264 function program4(depth0,data) {
266 var buffer = "", stack1;
267 buffer += "<div class='info_contact'><a href=\"mailto:"
268 + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.contact)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
269 + "\">Contact the developer</a></div>";
273 function program6(depth0,data) {
275 var buffer = "", stack1;
276 buffer += "<div class='info_license'><a href='"
277 + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.licenseUrl)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
279 + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.license)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
284 function program8(depth0,data) {
286 var buffer = "", stack1;
287 buffer += "\n , <span style=\"font-variant: small-caps\">api version</span>: ";
288 if (stack1 = helpers.apiVersion) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
289 else { stack1 = depth0.apiVersion; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
290 buffer += escapeExpression(stack1)
295 buffer += "<div class='info' id='api_info'>\n ";
296 stack1 = helpers['if'].call(depth0, depth0.info, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
297 if(stack1 || stack1 === 0) { buffer += stack1; }
298 buffer += "\n</div>\n<div class='container' id='resources_container'>\n <ul id='resources'>\n </ul>\n\n <div class=\"footer\">\n <br>\n <br>\n <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: ";
299 if (stack1 = helpers.basePath) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
300 else { stack1 = depth0.basePath; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
301 buffer += escapeExpression(stack1)
303 stack1 = helpers['if'].call(depth0, depth0.apiVersion, {hash:{},inverse:self.noop,fn:self.program(8, program8, data),data:data});
304 if(stack1 || stack1 === 0) { buffer += stack1; }
305 buffer += "]</h4>\n </div>\n</div>\n";
311 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
312 templates['operation'] = template(function (Handlebars,depth0,helpers,partials,data) {
313 this.compilerInfo = [4,'>= 1.0.0'];
314 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
315 var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
317 function program1(depth0,data) {
319 var buffer = "", stack1;
320 buffer += "\n <h4>Implementation Notes</h4>\n <p>";
321 if (stack1 = helpers.notes) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
322 else { stack1 = depth0.notes; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
323 if(stack1 || stack1 === 0) { buffer += stack1; }
328 function program3(depth0,data) {
331 return "\n <h4>Response Class</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n ";
334 function program5(depth0,data) {
337 return "\n <h4>Parameters</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th style=\"width: 100px; max-width: 100px\">Parameter</th>\n <th style=\"width: 310px; max-width: 310px\">Value</th>\n <th style=\"width: 200px; max-width: 200px\">Description</th>\n <th style=\"width: 100px; max-width: 100px\">Parameter Type</th>\n <th style=\"width: 220px; max-width: 230px\">Data Type</th>\n </tr>\n </thead>\n <tbody class=\"operation-params\">\n\n </tbody>\n </table>\n ";
340 function program7(depth0,data) {
343 return "\n <div style='margin:0;padding:0;display:inline'></div>\n <h4>Error Status Codes</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n ";
346 function program9(depth0,data) {
352 function program11(depth0,data) {
355 return "\n <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n <img alt='Throbber' class='response_throbber' src='images/throbber.gif' style='display:none' />\n </div>\n ";
358 buffer += "\n <ul class='operations' >\n <li class='";
359 if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
360 else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
361 buffer += escapeExpression(stack1)
362 + " operation' id='";
363 if (stack1 = helpers.resourceName) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
364 else { stack1 = depth0.resourceName; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
365 buffer += escapeExpression(stack1)
367 if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
368 else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
369 buffer += escapeExpression(stack1)
371 if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
372 else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
373 buffer += escapeExpression(stack1)
375 if (stack1 = helpers.number) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
376 else { stack1 = depth0.number; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
377 buffer += escapeExpression(stack1)
378 + "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/";
379 if (stack1 = helpers.resourceName) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
380 else { stack1 = depth0.resourceName; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
381 buffer += escapeExpression(stack1)
383 if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
384 else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
385 buffer += escapeExpression(stack1)
387 if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
388 else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
389 buffer += escapeExpression(stack1)
391 if (stack1 = helpers.number) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
392 else { stack1 = depth0.number; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
393 buffer += escapeExpression(stack1)
394 + "' class=\"toggleOperation\">";
395 if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
396 else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
397 buffer += escapeExpression(stack1)
398 + "</a>\n </span>\n <span class='path'>\n <a href='#!/";
399 if (stack1 = helpers.resourceName) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
400 else { stack1 = depth0.resourceName; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
401 buffer += escapeExpression(stack1)
403 if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
404 else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
405 buffer += escapeExpression(stack1)
407 if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
408 else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
409 buffer += escapeExpression(stack1)
411 if (stack1 = helpers.number) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
412 else { stack1 = depth0.number; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
413 buffer += escapeExpression(stack1)
414 + "' class=\"toggleOperation\">";
415 if (stack1 = helpers.path) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
416 else { stack1 = depth0.path; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
417 buffer += escapeExpression(stack1)
418 + "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/";
419 if (stack1 = helpers.resourceName) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
420 else { stack1 = depth0.resourceName; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
421 buffer += escapeExpression(stack1)
423 if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
424 else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
425 buffer += escapeExpression(stack1)
427 if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
428 else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
429 buffer += escapeExpression(stack1)
431 if (stack1 = helpers.number) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
432 else { stack1 = depth0.number; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
433 buffer += escapeExpression(stack1)
434 + "' class=\"toggleOperation\">";
435 if (stack1 = helpers.summary) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
436 else { stack1 = depth0.summary; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
437 if(stack1 || stack1 === 0) { buffer += stack1; }
438 buffer += "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='";
439 if (stack1 = helpers.resourceName) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
440 else { stack1 = depth0.resourceName; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
441 buffer += escapeExpression(stack1)
443 if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
444 else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
445 buffer += escapeExpression(stack1)
447 if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
448 else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
449 buffer += escapeExpression(stack1)
451 if (stack1 = helpers.number) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
452 else { stack1 = depth0.number; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
453 buffer += escapeExpression(stack1)
454 + "_content' style='display:none'>\n ";
455 stack1 = helpers['if'].call(depth0, depth0.notes, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
456 if(stack1 || stack1 === 0) { buffer += stack1; }
458 stack1 = helpers['if'].call(depth0, depth0.type, {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
459 if(stack1 || stack1 === 0) { buffer += stack1; }
460 buffer += "\n <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n ";
461 stack1 = helpers['if'].call(depth0, depth0.parameters, {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
462 if(stack1 || stack1 === 0) { buffer += stack1; }
464 stack1 = helpers['if'].call(depth0, depth0.responseMessages, {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data});
465 if(stack1 || stack1 === 0) { buffer += stack1; }
467 stack1 = helpers['if'].call(depth0, depth0.isReadOnly, {hash:{},inverse:self.program(11, program11, data),fn:self.program(9, program9, data),data:data});
468 if(stack1 || stack1 === 0) { buffer += stack1; }
469 buffer += "\n </form>\n <div class='response' style='display:none'>\n <h4>Request URL</h4>\n <div class='block request_url'></div>\n <h4>Response Body</h4>\n <div class='block response_body'></div>\n <h4>Response Code</h4>\n <div class='block response_code'></div>\n <h4>Response Headers</h4>\n <div class='block response_headers'></div>\n </div>\n </div>\n </li>\n </ul>\n";
475 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
476 templates['param'] = template(function (Handlebars,depth0,helpers,partials,data) {
477 this.compilerInfo = [4,'>= 1.0.0'];
478 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
479 var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
481 function program1(depth0,data) {
483 var buffer = "", stack1;
485 stack1 = helpers['if'].call(depth0, depth0.isFile, {hash:{},inverse:self.program(4, program4, data),fn:self.program(2, program2, data),data:data});
486 if(stack1 || stack1 === 0) { buffer += stack1; }
490 function program2(depth0,data) {
492 var buffer = "", stack1;
493 buffer += "\n <input type=\"file\" name='";
494 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
495 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
496 buffer += escapeExpression(stack1)
497 + "'/>\n <div class=\"parameter-content-type\" />\n ";
501 function program4(depth0,data) {
503 var buffer = "", stack1;
505 stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(7, program7, data),fn:self.program(5, program5, data),data:data});
506 if(stack1 || stack1 === 0) { buffer += stack1; }
510 function program5(depth0,data) {
512 var buffer = "", stack1;
513 buffer += "\n <textarea class='body-textarea' name='";
514 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
515 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
516 buffer += escapeExpression(stack1)
518 if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
519 else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
520 buffer += escapeExpression(stack1)
525 function program7(depth0,data) {
527 var buffer = "", stack1;
528 buffer += "\n <textarea class='body-textarea' name='";
529 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
530 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
531 buffer += escapeExpression(stack1)
532 + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n ";
536 function program9(depth0,data) {
538 var buffer = "", stack1;
540 stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(12, program12, data),fn:self.program(10, program10, data),data:data});
541 if(stack1 || stack1 === 0) { buffer += stack1; }
545 function program10(depth0,data) {
547 var buffer = "", stack1;
548 buffer += "\n <input class='parameter' minlength='0' name='";
549 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
550 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
551 buffer += escapeExpression(stack1)
552 + "' placeholder='' type='text' value='";
553 if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
554 else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
555 buffer += escapeExpression(stack1)
560 function program12(depth0,data) {
562 var buffer = "", stack1;
563 buffer += "\n <input class='parameter' minlength='0' name='";
564 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
565 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
566 buffer += escapeExpression(stack1)
567 + "' placeholder='' type='text' value=''/>\n ";
571 buffer += "<td class='code'>";
572 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
573 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
574 buffer += escapeExpression(stack1)
575 + "</td>\n<td>\n\n ";
576 stack1 = helpers['if'].call(depth0, depth0.isBody, {hash:{},inverse:self.program(9, program9, data),fn:self.program(1, program1, data),data:data});
577 if(stack1 || stack1 === 0) { buffer += stack1; }
578 buffer += "\n\n</td>\n<td>";
579 if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
580 else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
581 if(stack1 || stack1 === 0) { buffer += stack1; }
582 buffer += "</td>\n<td>";
583 if (stack1 = helpers.paramType) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
584 else { stack1 = depth0.paramType; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
585 if(stack1 || stack1 === 0) { buffer += stack1; }
586 buffer += "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n";
592 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
593 templates['param_list'] = template(function (Handlebars,depth0,helpers,partials,data) {
594 this.compilerInfo = [4,'>= 1.0.0'];
595 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
596 var buffer = "", stack1, stack2, self=this, functionType="function", escapeExpression=this.escapeExpression;
598 function program1(depth0,data) {
601 return " multiple='multiple'";
604 function program3(depth0,data) {
610 function program5(depth0,data) {
612 var buffer = "", stack1;
614 stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(8, program8, data),fn:self.program(6, program6, data),data:data});
615 if(stack1 || stack1 === 0) { buffer += stack1; }
619 function program6(depth0,data) {
625 function program8(depth0,data) {
627 var buffer = "", stack1;
629 stack1 = helpers['if'].call(depth0, depth0.allowMultiple, {hash:{},inverse:self.program(11, program11, data),fn:self.program(9, program9, data),data:data});
630 if(stack1 || stack1 === 0) { buffer += stack1; }
634 function program9(depth0,data) {
640 function program11(depth0,data) {
643 return "\n <option selected=\"\" value=''></option>\n ";
646 function program13(depth0,data) {
648 var buffer = "", stack1;
650 stack1 = helpers['if'].call(depth0, depth0.isDefault, {hash:{},inverse:self.program(16, program16, data),fn:self.program(14, program14, data),data:data});
651 if(stack1 || stack1 === 0) { buffer += stack1; }
655 function program14(depth0,data) {
657 var buffer = "", stack1;
658 buffer += "\n <option selected=\"\" value='";
659 if (stack1 = helpers.value) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
660 else { stack1 = depth0.value; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
661 buffer += escapeExpression(stack1)
663 if (stack1 = helpers.value) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
664 else { stack1 = depth0.value; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
665 buffer += escapeExpression(stack1)
666 + " (default)</option>\n ";
670 function program16(depth0,data) {
672 var buffer = "", stack1;
673 buffer += "\n <option value='";
674 if (stack1 = helpers.value) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
675 else { stack1 = depth0.value; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
676 buffer += escapeExpression(stack1)
678 if (stack1 = helpers.value) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
679 else { stack1 = depth0.value; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
680 buffer += escapeExpression(stack1)
685 buffer += "<td class='code'>";
686 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
687 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
688 buffer += escapeExpression(stack1)
689 + "</td>\n<td>\n <select ";
690 stack1 = helpers['if'].call(depth0, depth0.allowMultiple, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
691 if(stack1 || stack1 === 0) { buffer += stack1; }
692 buffer += " class='parameter' name='";
693 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
694 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
695 buffer += escapeExpression(stack1)
697 stack1 = helpers['if'].call(depth0, depth0.required, {hash:{},inverse:self.program(5, program5, data),fn:self.program(3, program3, data),data:data});
698 if(stack1 || stack1 === 0) { buffer += stack1; }
700 stack2 = helpers.each.call(depth0, ((stack1 = depth0.allowableValues),stack1 == null || stack1 === false ? stack1 : stack1.descriptiveValues), {hash:{},inverse:self.noop,fn:self.program(13, program13, data),data:data});
701 if(stack2 || stack2 === 0) { buffer += stack2; }
702 buffer += "\n </select>\n</td>\n<td>";
703 if (stack2 = helpers.description) { stack2 = stack2.call(depth0, {hash:{},data:data}); }
704 else { stack2 = depth0.description; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
705 if(stack2 || stack2 === 0) { buffer += stack2; }
706 buffer += "</td>\n<td>";
707 if (stack2 = helpers.paramType) { stack2 = stack2.call(depth0, {hash:{},data:data}); }
708 else { stack2 = depth0.paramType; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
709 if(stack2 || stack2 === 0) { buffer += stack2; }
710 buffer += "</td>\n<td><span class=\"model-signature\"></span></td>";
716 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
717 templates['param_readonly'] = template(function (Handlebars,depth0,helpers,partials,data) {
718 this.compilerInfo = [4,'>= 1.0.0'];
719 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
720 var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
722 function program1(depth0,data) {
724 var buffer = "", stack1;
725 buffer += "\n <textarea class='body-textarea' readonly='readonly' name='";
726 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
727 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
728 buffer += escapeExpression(stack1)
730 if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
731 else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
732 buffer += escapeExpression(stack1)
737 function program3(depth0,data) {
739 var buffer = "", stack1;
741 stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(6, program6, data),fn:self.program(4, program4, data),data:data});
742 if(stack1 || stack1 === 0) { buffer += stack1; }
746 function program4(depth0,data) {
748 var buffer = "", stack1;
750 if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
751 else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
752 buffer += escapeExpression(stack1)
757 function program6(depth0,data) {
760 return "\n (empty)\n ";
763 buffer += "<td class='code'>";
764 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
765 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
766 buffer += escapeExpression(stack1)
768 stack1 = helpers['if'].call(depth0, depth0.isBody, {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data),data:data});
769 if(stack1 || stack1 === 0) { buffer += stack1; }
770 buffer += "\n</td>\n<td>";
771 if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
772 else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
773 if(stack1 || stack1 === 0) { buffer += stack1; }
774 buffer += "</td>\n<td>";
775 if (stack1 = helpers.paramType) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
776 else { stack1 = depth0.paramType; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
777 if(stack1 || stack1 === 0) { buffer += stack1; }
778 buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n";
784 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
785 templates['param_readonly_required'] = template(function (Handlebars,depth0,helpers,partials,data) {
786 this.compilerInfo = [4,'>= 1.0.0'];
787 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
788 var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
790 function program1(depth0,data) {
792 var buffer = "", stack1;
793 buffer += "\n <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='";
794 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
795 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
796 buffer += escapeExpression(stack1)
798 if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
799 else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
800 buffer += escapeExpression(stack1)
805 function program3(depth0,data) {
807 var buffer = "", stack1;
809 stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(6, program6, data),fn:self.program(4, program4, data),data:data});
810 if(stack1 || stack1 === 0) { buffer += stack1; }
814 function program4(depth0,data) {
816 var buffer = "", stack1;
818 if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
819 else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
820 buffer += escapeExpression(stack1)
825 function program6(depth0,data) {
828 return "\n (empty)\n ";
831 buffer += "<td class='code required'>";
832 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
833 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
834 buffer += escapeExpression(stack1)
836 stack1 = helpers['if'].call(depth0, depth0.isBody, {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data),data:data});
837 if(stack1 || stack1 === 0) { buffer += stack1; }
838 buffer += "\n</td>\n<td>";
839 if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
840 else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
841 if(stack1 || stack1 === 0) { buffer += stack1; }
842 buffer += "</td>\n<td>";
843 if (stack1 = helpers.paramType) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
844 else { stack1 = depth0.paramType; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
845 if(stack1 || stack1 === 0) { buffer += stack1; }
846 buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n";
852 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
853 templates['param_required'] = template(function (Handlebars,depth0,helpers,partials,data) {
854 this.compilerInfo = [4,'>= 1.0.0'];
855 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
856 var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
858 function program1(depth0,data) {
860 var buffer = "", stack1;
862 stack1 = helpers['if'].call(depth0, depth0.isFile, {hash:{},inverse:self.program(4, program4, data),fn:self.program(2, program2, data),data:data});
863 if(stack1 || stack1 === 0) { buffer += stack1; }
867 function program2(depth0,data) {
869 var buffer = "", stack1;
870 buffer += "\n <input type=\"file\" name='";
871 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
872 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
873 buffer += escapeExpression(stack1)
878 function program4(depth0,data) {
880 var buffer = "", stack1;
882 stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(7, program7, data),fn:self.program(5, program5, data),data:data});
883 if(stack1 || stack1 === 0) { buffer += stack1; }
887 function program5(depth0,data) {
889 var buffer = "", stack1;
890 buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='";
891 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
892 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
893 buffer += escapeExpression(stack1)
895 if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
896 else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
897 buffer += escapeExpression(stack1)
902 function program7(depth0,data) {
904 var buffer = "", stack1;
905 buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='";
906 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
907 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
908 buffer += escapeExpression(stack1)
909 + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n ";
913 function program9(depth0,data) {
915 var buffer = "", stack1;
917 stack1 = helpers['if'].call(depth0, depth0.isFile, {hash:{},inverse:self.program(12, program12, data),fn:self.program(10, program10, data),data:data});
918 if(stack1 || stack1 === 0) { buffer += stack1; }
922 function program10(depth0,data) {
924 var buffer = "", stack1;
925 buffer += "\n <input class='parameter' class='required' type='file' name='";
926 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
927 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
928 buffer += escapeExpression(stack1)
933 function program12(depth0,data) {
935 var buffer = "", stack1;
937 stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(15, program15, data),fn:self.program(13, program13, data),data:data});
938 if(stack1 || stack1 === 0) { buffer += stack1; }
942 function program13(depth0,data) {
944 var buffer = "", stack1;
945 buffer += "\n <input class='parameter required' minlength='1' name='";
946 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
947 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
948 buffer += escapeExpression(stack1)
949 + "' placeholder='(required)' type='text' value='";
950 if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
951 else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
952 buffer += escapeExpression(stack1)
957 function program15(depth0,data) {
959 var buffer = "", stack1;
960 buffer += "\n <input class='parameter required' minlength='1' name='";
961 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
962 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
963 buffer += escapeExpression(stack1)
964 + "' placeholder='(required)' type='text' value=''/>\n ";
968 buffer += "<td class='code required'>";
969 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
970 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
971 buffer += escapeExpression(stack1)
973 stack1 = helpers['if'].call(depth0, depth0.isBody, {hash:{},inverse:self.program(9, program9, data),fn:self.program(1, program1, data),data:data});
974 if(stack1 || stack1 === 0) { buffer += stack1; }
975 buffer += "\n</td>\n<td>\n <strong>";
976 if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
977 else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
978 if(stack1 || stack1 === 0) { buffer += stack1; }
979 buffer += "</strong>\n</td>\n<td>";
980 if (stack1 = helpers.paramType) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
981 else { stack1 = depth0.paramType; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
982 if(stack1 || stack1 === 0) { buffer += stack1; }
983 buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n";
989 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
990 templates['parameter_content_type'] = template(function (Handlebars,depth0,helpers,partials,data) {
991 this.compilerInfo = [4,'>= 1.0.0'];
992 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
993 var buffer = "", stack1, functionType="function", self=this;
995 function program1(depth0,data) {
997 var buffer = "", stack1;
999 stack1 = helpers.each.call(depth0, depth0.consumes, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
1000 if(stack1 || stack1 === 0) { buffer += stack1; }
1004 function program2(depth0,data) {
1006 var buffer = "", stack1;
1007 buffer += "\n <option value=\"";
1008 stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
1009 if(stack1 || stack1 === 0) { buffer += stack1; }
1011 stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
1012 if(stack1 || stack1 === 0) { buffer += stack1; }
1013 buffer += "</option>\n ";
1017 function program4(depth0,data) {
1020 return "\n <option value=\"application/json\">application/json</option>\n";
1023 buffer += "<label for=\"parameterContentType\"></label>\n<select name=\"parameterContentType\">\n";
1024 stack1 = helpers['if'].call(depth0, depth0.consumes, {hash:{},inverse:self.program(4, program4, data),fn:self.program(1, program1, data),data:data});
1025 if(stack1 || stack1 === 0) { buffer += stack1; }
1026 buffer += "\n</select>\n";
1032 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1033 templates['resource'] = template(function (Handlebars,depth0,helpers,partials,data) {
1034 this.compilerInfo = [4,'>= 1.0.0'];
1035 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1036 var buffer = "", stack1, options, functionType="function", escapeExpression=this.escapeExpression, self=this, blockHelperMissing=helpers.blockHelperMissing;
1038 function program1(depth0,data) {
1044 buffer += "<div class='heading'>\n <h2>\n <a href='#!/";
1045 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1046 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1047 buffer += escapeExpression(stack1)
1048 + "' onclick=\"Docs.toggleEndpointListForResource('";
1049 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1050 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1051 buffer += escapeExpression(stack1)
1053 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1054 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1055 buffer += escapeExpression(stack1)
1057 options = {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data};
1058 if (stack1 = helpers.description) { stack1 = stack1.call(depth0, options); }
1059 else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1060 if (!helpers.description) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
1061 if(stack1 || stack1 === 0) { buffer += stack1; }
1062 if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1063 else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1064 if(stack1 || stack1 === 0) { buffer += stack1; }
1065 buffer += "\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/";
1066 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1067 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1068 buffer += escapeExpression(stack1)
1069 + "' id='endpointListTogger_";
1070 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1071 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1072 buffer += escapeExpression(stack1)
1073 + "'\n onclick=\"Docs.toggleEndpointListForResource('";
1074 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1075 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1076 buffer += escapeExpression(stack1)
1077 + "');\">Show/Hide</a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.collapseOperationsForResource('";
1078 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1079 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1080 buffer += escapeExpression(stack1)
1081 + "'); return false;\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.expandOperationsForResource('";
1082 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1083 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1084 buffer += escapeExpression(stack1)
1085 + "'); return false;\">\n Expand Operations\n </a>\n </li>\n <li>\n <a href='";
1086 if (stack1 = helpers.url) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1087 else { stack1 = depth0.url; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1088 buffer += escapeExpression(stack1)
1089 + "'>Raw</a>\n </li>\n </ul>\n</div>\n<ul class='endpoints' id='";
1090 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1091 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1092 buffer += escapeExpression(stack1)
1093 + "_endpoint_list' style='display:none'>\n\n</ul>\n";
1099 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1100 templates['response_content_type'] = template(function (Handlebars,depth0,helpers,partials,data) {
1101 this.compilerInfo = [4,'>= 1.0.0'];
1102 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1103 var buffer = "", stack1, functionType="function", self=this;
1105 function program1(depth0,data) {
1107 var buffer = "", stack1;
1109 stack1 = helpers.each.call(depth0, depth0.produces, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
1110 if(stack1 || stack1 === 0) { buffer += stack1; }
1114 function program2(depth0,data) {
1116 var buffer = "", stack1;
1117 buffer += "\n <option value=\"";
1118 stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
1119 if(stack1 || stack1 === 0) { buffer += stack1; }
1121 stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
1122 if(stack1 || stack1 === 0) { buffer += stack1; }
1123 buffer += "</option>\n ";
1127 function program4(depth0,data) {
1130 return "\n <option value=\"application/json\">application/json</option>\n";
1133 buffer += "<label for=\"responseContentType\"></label>\n<select name=\"responseContentType\">\n";
1134 stack1 = helpers['if'].call(depth0, depth0.produces, {hash:{},inverse:self.program(4, program4, data),fn:self.program(1, program1, data),data:data});
1135 if(stack1 || stack1 === 0) { buffer += stack1; }
1136 buffer += "\n</select>\n";
1142 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1143 templates['signature'] = template(function (Handlebars,depth0,helpers,partials,data) {
1144 this.compilerInfo = [4,'>= 1.0.0'];
1145 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1146 var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
1149 buffer += "<div>\n<ul class=\"signature-nav\">\n <li><a class=\"description-link\" href=\"#\">Model</a></li>\n <li><a class=\"snippet-link\" href=\"#\">Model Schema</a></li>\n</ul>\n<div>\n\n<div class=\"signature-container\">\n <div class=\"description\">\n ";
1150 if (stack1 = helpers.signature) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1151 else { stack1 = depth0.signature; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1152 if(stack1 || stack1 === 0) { buffer += stack1; }
1153 buffer += "\n </div>\n\n <div class=\"snippet\">\n <pre><code>";
1154 if (stack1 = helpers.sampleJSON) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1155 else { stack1 = depth0.sampleJSON; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1156 buffer += escapeExpression(stack1)
1157 + "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
1163 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1164 templates['status_code'] = template(function (Handlebars,depth0,helpers,partials,data) {
1165 this.compilerInfo = [4,'>= 1.0.0'];
1166 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1167 var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
1170 buffer += "<td width='15%' class='code'>";
1171 if (stack1 = helpers.code) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1172 else { stack1 = depth0.code; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1173 buffer += escapeExpression(stack1)
1175 if (stack1 = helpers.message) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1176 else { stack1 = depth0.message; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1177 if(stack1 || stack1 === 0) { buffer += stack1; }
1178 buffer += "</td>\n";
1185 // Generated by CoffeeScript 1.6.3
1187 var ContentTypeView, HeaderView, MainView, OperationView, ParameterContentTypeView, ParameterView, ResourceView, ResponseContentTypeView, SignatureView, StatusCodeView, SwaggerUi, _ref, _ref1, _ref10, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9,
1188 __hasProp = {}.hasOwnProperty,
1189 __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
1191 SwaggerUi = (function(_super) {
1192 __extends(SwaggerUi, _super);
1194 function SwaggerUi() {
1195 _ref = SwaggerUi.__super__.constructor.apply(this, arguments);
1199 SwaggerUi.prototype.dom_id = "swagger_ui";
1201 SwaggerUi.prototype.options = null;
1203 SwaggerUi.prototype.api = null;
1205 SwaggerUi.prototype.headerView = null;
1207 SwaggerUi.prototype.mainView = null;
1209 SwaggerUi.prototype.initialize = function(options) {
1211 if (options == null) {
1214 if (options.dom_id != null) {
1215 this.dom_id = options.dom_id;
1216 delete options.dom_id;
1218 if ($('#' + this.dom_id) == null) {
1219 $('body').append('<div id="' + this.dom_id + '"></div>');
1221 this.options = options;
1222 this.options.success = function() {
1223 return _this.render();
1225 this.options.progress = function(d) {
1226 return _this.showMessage(d);
1228 this.options.failure = function(d) {
1229 return _this.onLoadFailure(d);
1231 this.headerView = new HeaderView({
1234 return this.headerView.on('update-swagger-ui', function(data) {
1235 return _this.updateSwaggerUi(data);
1239 SwaggerUi.prototype.updateSwaggerUi = function(data) {
1240 this.options.url = data.url;
1244 SwaggerUi.prototype.load = function() {
1246 if ((_ref1 = this.mainView) != null) {
1249 url = this.options.url;
1250 if (url.indexOf("http") !== 0) {
1251 url = this.buildUrl(window.location.href.toString(), url);
1253 this.options.url = url;
1254 this.headerView.update(url);
1255 this.api = new SwaggerApi(this.options);
1260 SwaggerUi.prototype.render = function() {
1262 this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
1263 this.mainView = new MainView({
1265 el: $('#' + this.dom_id)
1268 switch (this.options.docExpansion) {
1270 Docs.expandOperationsForResource('');
1273 Docs.collapseOperationsForResource('');
1275 if (this.options.onComplete) {
1276 this.options.onComplete(this.api, this);
1278 return setTimeout(function() {
1279 return Docs.shebang();
1283 SwaggerUi.prototype.buildUrl = function(base, url) {
1285 console.log("base is " + base);
1286 parts = base.split("/");
1287 base = parts[0] + "//" + parts[2];
1288 if (url.indexOf("/") === 0) {
1291 return base + "/" + url;
1295 SwaggerUi.prototype.showMessage = function(data) {
1299 $('#message-bar').removeClass('message-fail');
1300 $('#message-bar').addClass('message-success');
1301 return $('#message-bar').html(data);
1304 SwaggerUi.prototype.onLoadFailure = function(data) {
1309 $('#message-bar').removeClass('message-success');
1310 $('#message-bar').addClass('message-fail');
1311 val = $('#message-bar').html(data);
1312 if (this.options.onFailure != null) {
1313 this.options.onFailure(data);
1320 })(Backbone.Router);
1322 window.SwaggerUi = SwaggerUi;
1324 HeaderView = (function(_super) {
1325 __extends(HeaderView, _super);
1327 function HeaderView() {
1328 _ref1 = HeaderView.__super__.constructor.apply(this, arguments);
1332 HeaderView.prototype.events = {
1333 'click #show-pet-store-icon': 'showPetStore',
1334 'click #show-wordnik-dev-icon': 'showWordnikDev',
1335 'click #explore': 'showCustom',
1336 'keyup #input_baseUrl': 'showCustomOnKeyup',
1337 'keyup #input_apiKey': 'showCustomOnKeyup'
1340 HeaderView.prototype.initialize = function() {};
1342 HeaderView.prototype.showPetStore = function(e) {
1343 return this.trigger('update-swagger-ui', {
1344 url: "http://petstore.swagger.wordnik.com/api/api-docs"
1348 HeaderView.prototype.showWordnikDev = function(e) {
1349 return this.trigger('update-swagger-ui', {
1350 url: "http://api.wordnik.com/v4/resources.json"
1354 HeaderView.prototype.showCustomOnKeyup = function(e) {
1355 if (e.keyCode === 13) {
1356 return this.showCustom();
1360 HeaderView.prototype.showCustom = function(e) {
1364 return this.trigger('update-swagger-ui', {
1365 url: $('#input_baseUrl').val(),
1366 apiKey: $('#input_apiKey').val()
1370 HeaderView.prototype.update = function(url, apiKey, trigger) {
1371 if (trigger == null) {
1374 $('#input_baseUrl').val(url);
1376 return this.trigger('update-swagger-ui', {
1386 MainView = (function(_super) {
1387 __extends(MainView, _super);
1389 function MainView() {
1390 _ref2 = MainView.__super__.constructor.apply(this, arguments);
1394 MainView.prototype.initialize = function() {};
1396 MainView.prototype.render = function() {
1397 var resource, _i, _len, _ref3;
1398 $(this.el).html(Handlebars.templates.main(this.model));
1399 _ref3 = this.model.apisArray;
1400 for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
1401 resource = _ref3[_i];
1402 this.addResource(resource);
1407 MainView.prototype.addResource = function(resource) {
1409 resourceView = new ResourceView({
1412 id: 'resource_' + resource.name,
1413 className: 'resource'
1415 return $('#resources').append(resourceView.render().el);
1418 MainView.prototype.clear = function() {
1419 return $(this.el).html('');
1426 ResourceView = (function(_super) {
1427 __extends(ResourceView, _super);
1429 function ResourceView() {
1430 _ref3 = ResourceView.__super__.constructor.apply(this, arguments);
1434 ResourceView.prototype.initialize = function() {};
1436 ResourceView.prototype.render = function() {
1437 var operation, _i, _len, _ref4;
1438 console.log(this.model.description);
1439 $(this.el).html(Handlebars.templates.resource(this.model));
1441 _ref4 = this.model.operationsArray;
1442 for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
1443 operation = _ref4[_i];
1444 this.addOperation(operation);
1449 ResourceView.prototype.addOperation = function(operation) {
1451 operation.number = this.number;
1452 operationView = new OperationView({
1455 className: 'endpoint'
1457 $('.endpoints', $(this.el)).append(operationView.render().el);
1458 return this.number++;
1461 return ResourceView;
1465 OperationView = (function(_super) {
1466 __extends(OperationView, _super);
1468 function OperationView() {
1469 _ref4 = OperationView.__super__.constructor.apply(this, arguments);
1473 OperationView.prototype.invocationUrl = null;
1475 OperationView.prototype.events = {
1476 'submit .sandbox': 'submitOperation',
1477 'click .submit': 'submitOperation',
1478 'click .response_hider': 'hideResponse',
1479 'click .toggleOperation': 'toggleOperationContent'
1482 OperationView.prototype.initialize = function() {};
1484 OperationView.prototype.render = function() {
1485 var contentTypeModel, isMethodSubmissionSupported, param, responseContentTypeView, responseSignatureView, signatureModel, statusCode, type, _i, _j, _k, _len, _len1, _len2, _ref5, _ref6, _ref7;
1486 isMethodSubmissionSupported = true;
1487 if (!isMethodSubmissionSupported) {
1488 this.model.isReadOnly = true;
1490 $(this.el).html(Handlebars.templates.operation(this.model));
1491 if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
1493 sampleJSON: this.model.responseSampleJSON,
1495 signature: this.model.responseClassSignature
1497 responseSignatureView = new SignatureView({
1498 model: signatureModel,
1501 $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
1503 $('.model-signature', $(this.el)).html(this.model.type);
1505 contentTypeModel = {
1508 contentTypeModel.consumes = this.model.consumes;
1509 contentTypeModel.produces = this.model.produces;
1510 _ref5 = this.model.parameters;
1511 for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
1513 type = param.type || param.dataType;
1514 if (type.toLowerCase() === 'file') {
1515 if (!contentTypeModel.consumes) {
1516 console.log("set content type ");
1517 contentTypeModel.consumes = 'multipart/form-data';
1521 responseContentTypeView = new ResponseContentTypeView({
1522 model: contentTypeModel
1524 $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
1525 _ref6 = this.model.parameters;
1526 for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
1528 this.addParameter(param, contentTypeModel.consumes);
1530 _ref7 = this.model.responseMessages;
1531 for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) {
1532 statusCode = _ref7[_k];
1533 this.addStatusCode(statusCode);
1538 OperationView.prototype.addParameter = function(param, consumes) {
1540 param.consumes = consumes;
1541 paramView = new ParameterView({
1544 readOnly: this.model.isReadOnly
1546 return $('.operation-params', $(this.el)).append(paramView.render().el);
1549 OperationView.prototype.addStatusCode = function(statusCode) {
1551 statusCodeView = new StatusCodeView({
1555 return $('.operation-status', $(this.el)).append(statusCodeView.render().el);
1558 OperationView.prototype.submitOperation = function(e) {
1559 var error_free, form, isFileUpload, map, o, opts, val, _i, _j, _k, _len, _len1, _len2, _ref5, _ref6, _ref7;
1563 form = $('.sandbox', $(this.el));
1565 form.find("input.required").each(function() {
1567 $(this).removeClass("error");
1568 if (jQuery.trim($(this).val()) === "") {
1569 $(this).addClass("error");
1571 callback: function() {
1572 return $(_this).focus();
1575 return error_free = false;
1583 isFileUpload = false;
1584 _ref5 = form.find("input");
1585 for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
1587 if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1588 map[o.name] = o.value;
1590 if (o.type === "file") {
1591 isFileUpload = true;
1594 _ref6 = form.find("textarea");
1595 for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
1597 if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1598 map["body"] = o.value;
1601 _ref7 = form.find("select");
1602 for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) {
1604 val = this.getSelectedValue(o);
1605 if ((val != null) && jQuery.trim(val).length > 0) {
1609 opts.responseContentType = $("div select[name=responseContentType]", $(this.el)).val();
1610 opts.requestContentType = $("div select[name=parameterContentType]", $(this.el)).val();
1611 $(".response_throbber", $(this.el)).show();
1613 return this.handleFileUpload(map, form);
1615 return this.model["do"](map, opts, this.showCompleteStatus, this.showErrorStatus, this);
1620 OperationView.prototype.success = function(response, parent) {
1621 return parent.showCompleteStatus(response);
1624 OperationView.prototype.handleFileUpload = function(map, form) {
1625 var bodyParam, headerParams, o, obj, param, _i, _j, _k, _len, _len1, _len2, _ref5, _ref6, _ref7,
1627 console.log("it's a file upload");
1628 _ref5 = form.serializeArray();
1629 for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
1631 if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1632 map[o.name] = o.value;
1635 bodyParam = new FormData();
1636 _ref6 = this.model.parameters;
1637 for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
1639 if (param.paramType === 'form') {
1640 bodyParam.append(param.name, map[param.name]);
1644 _ref7 = this.model.parameters;
1645 for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) {
1647 if (param.paramType === 'header') {
1648 headerParams[param.name] = map[param.name];
1651 console.log(headerParams);
1652 $.each($('input[type~="file"]'), function(i, el) {
1653 return bodyParam.append($(el).attr('name'), el.files[0]);
1655 console.log(bodyParam);
1656 this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), this.model.urlify(map, false)) : this.model.urlify(map, true);
1657 $(".request_url", $(this.el)).html("<pre>" + this.invocationUrl + "</pre>");
1659 type: this.model.method,
1660 url: this.invocationUrl,
1661 headers: headerParams,
1666 error: function(data, textStatus, error) {
1667 return _this.showErrorStatus(_this.wrap(data), _this);
1669 success: function(data) {
1670 return _this.showResponse(data, _this);
1672 complete: function(data) {
1673 return _this.showCompleteStatus(_this.wrap(data), _this);
1676 if (window.authorizations) {
1677 window.authorizations.apply(obj);
1683 OperationView.prototype.wrap = function(data) {
1688 o.content.data = data.responseText;
1689 o.getHeaders = function() {
1691 "Content-Type": data.getResponseHeader("Content-Type")
1695 o.request.url = this.invocationUrl;
1696 o.status = data.status;
1700 OperationView.prototype.getSelectedValue = function(select) {
1701 var opt, options, _i, _len, _ref5;
1702 if (!select.multiple) {
1703 return select.value;
1706 _ref5 = select.options;
1707 for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
1710 options.push(opt.value);
1713 if (options.length > 0) {
1714 return options.join(",");
1721 OperationView.prototype.hideResponse = function(e) {
1725 $(".response", $(this.el)).slideUp();
1726 return $(".response_hider", $(this.el)).fadeOut();
1729 OperationView.prototype.showResponse = function(response) {
1731 prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>");
1732 return $(".response_body", $(this.el)).html(escape(prettyJson));
1735 OperationView.prototype.showErrorStatus = function(data, parent) {
1736 return parent.showStatus(data);
1739 OperationView.prototype.showCompleteStatus = function(data, parent) {
1740 return parent.showStatus(data);
1743 OperationView.prototype.formatXml = function(xml) {
1744 var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
1745 reg = /(>)(<)(\/*)/g;
1746 wsexp = /[ ]*(.*)[ ]+\n/g;
1747 contexp = /(<.+>)(.+\n)/g;
1748 xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
1751 lines = xml.split('\n');
1755 'single->single': 0,
1756 'single->closing': -1,
1757 'single->opening': 0,
1759 'closing->single': 0,
1760 'closing->closing': -1,
1761 'closing->opening': 0,
1762 'closing->other': 0,
1763 'opening->single': 1,
1764 'opening->closing': 0,
1765 'opening->opening': 1,
1766 'opening->other': 1,
1768 'other->closing': -1,
1769 'other->opening': 0,
1772 _fn = function(ln) {
1773 var fromTo, j, key, padding, type, types, value;
1775 single: Boolean(ln.match(/<.+\/>/)),
1776 closing: Boolean(ln.match(/<\/.+>/)),
1777 opening: Boolean(ln.match(/<[^!?].*>/))
1779 type = ((function() {
1782 for (key in types) {
1790 type = type === void 0 ? 'other' : type;
1791 fromTo = lastType + '->' + type;
1794 indent += transitions[fromTo];
1795 padding = ((function() {
1796 var _j, _ref5, _results;
1798 for (j = _j = 0, _ref5 = indent; 0 <= _ref5 ? _j < _ref5 : _j > _ref5; j = 0 <= _ref5 ? ++_j : --_j) {
1803 if (fromTo === 'opening->closing') {
1804 return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
1806 return formatted += padding + ln + '\n';
1809 for (_i = 0, _len = lines.length; _i < _len; _i++) {
1816 OperationView.prototype.showStatus = function(data) {
1817 var code, content, contentType, headers, pre, response_body;
1818 content = data.content.data;
1819 headers = data.getHeaders();
1820 contentType = headers["Content-Type"];
1821 if (content === void 0) {
1822 code = $('<code />').text("no content");
1823 pre = $('<pre class="json" />').append(code);
1824 } else if (contentType.indexOf("application/json") === 0 || contentType.indexOf("application/hal+json") === 0) {
1825 code = $('<code />').text(JSON.stringify(JSON.parse(content), null, 2));
1826 pre = $('<pre class="json" />').append(code);
1827 } else if (contentType.indexOf("application/xml") === 0) {
1828 code = $('<code />').text(this.formatXml(content));
1829 pre = $('<pre class="xml" />').append(code);
1830 } else if (contentType.indexOf("text/html") === 0) {
1831 code = $('<code />').html(content);
1832 pre = $('<pre class="xml" />').append(code);
1833 } else if (contentType.indexOf("image/") === 0) {
1834 pre = $('<img>').attr('src', data.request.url);
1836 code = $('<code />').text(content);
1837 pre = $('<pre class="json" />').append(code);
1839 response_body = pre;
1840 $(".request_url", $(this.el)).html("<pre>" + data.request.url + "</pre>");
1841 $(".response_code", $(this.el)).html("<pre>" + data.status + "</pre>");
1842 $(".response_body", $(this.el)).html(response_body);
1843 $(".response_headers", $(this.el)).html("<pre>" + JSON.stringify(data.getHeaders(), null, " ").replace(/\n/g, "<br>") + "</pre>");
1844 $(".response", $(this.el)).slideDown();
1845 $(".response_hider", $(this.el)).show();
1846 $(".response_throbber", $(this.el)).hide();
1847 return hljs.highlightBlock($('.response_body', $(this.el))[0]);
1850 OperationView.prototype.toggleOperationContent = function() {
1852 elem = $('#' + Docs.escapeResourceName(this.model.resourceName) + "_" + this.model.nickname + "_" + this.model.method + "_" + this.model.number + "_content");
1853 if (elem.is(':visible')) {
1854 return Docs.collapseOperation(elem);
1856 return Docs.expandOperation(elem);
1860 return OperationView;
1864 StatusCodeView = (function(_super) {
1865 __extends(StatusCodeView, _super);
1867 function StatusCodeView() {
1868 _ref5 = StatusCodeView.__super__.constructor.apply(this, arguments);
1872 StatusCodeView.prototype.initialize = function() {};
1874 StatusCodeView.prototype.render = function() {
1876 template = this.template();
1877 $(this.el).html(template(this.model));
1881 StatusCodeView.prototype.template = function() {
1882 return Handlebars.templates.status_code;
1885 return StatusCodeView;
1889 ParameterView = (function(_super) {
1890 __extends(ParameterView, _super);
1892 function ParameterView() {
1893 _ref6 = ParameterView.__super__.constructor.apply(this, arguments);
1897 ParameterView.prototype.initialize = function() {};
1899 ParameterView.prototype.render = function() {
1900 var contentTypeModel, isParam, parameterContentTypeView, responseContentTypeView, signatureModel, signatureView, template, type;
1901 type = this.model.type || this.model.dataType;
1902 if (this.model.paramType === 'body') {
1903 this.model.isBody = true;
1905 if (type.toLowerCase() === 'file') {
1906 this.model.isFile = true;
1908 template = this.template();
1909 $(this.el).html(template(this.model));
1911 sampleJSON: this.model.sampleJSON,
1913 signature: this.model.signature
1915 if (this.model.sampleJSON) {
1916 signatureView = new SignatureView({
1917 model: signatureModel,
1920 $('.model-signature', $(this.el)).append(signatureView.render().el);
1922 $('.model-signature', $(this.el)).html(this.model.signature);
1925 if (this.model.isBody) {
1928 contentTypeModel = {
1931 contentTypeModel.consumes = this.model.consumes;
1933 parameterContentTypeView = new ParameterContentTypeView({
1934 model: contentTypeModel
1936 $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el);
1938 responseContentTypeView = new ResponseContentTypeView({
1939 model: contentTypeModel
1941 $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
1946 ParameterView.prototype.template = function() {
1947 if (this.model.isList) {
1948 return Handlebars.templates.param_list;
1950 if (this.options.readOnly) {
1951 if (this.model.required) {
1952 return Handlebars.templates.param_readonly_required;
1954 return Handlebars.templates.param_readonly;
1957 if (this.model.required) {
1958 return Handlebars.templates.param_required;
1960 return Handlebars.templates.param;
1966 return ParameterView;
1970 SignatureView = (function(_super) {
1971 __extends(SignatureView, _super);
1973 function SignatureView() {
1974 _ref7 = SignatureView.__super__.constructor.apply(this, arguments);
1978 SignatureView.prototype.events = {
1979 'click a.description-link': 'switchToDescription',
1980 'click a.snippet-link': 'switchToSnippet',
1981 'mousedown .snippet': 'snippetToTextArea'
1984 SignatureView.prototype.initialize = function() {};
1986 SignatureView.prototype.render = function() {
1988 template = this.template();
1989 $(this.el).html(template(this.model));
1990 this.switchToDescription();
1991 this.isParam = this.model.isParam;
1993 $('.notice', $(this.el)).text('Click to set as parameter value');
1998 SignatureView.prototype.template = function() {
1999 return Handlebars.templates.signature;
2002 SignatureView.prototype.switchToDescription = function(e) {
2006 $(".snippet", $(this.el)).hide();
2007 $(".description", $(this.el)).show();
2008 $('.description-link', $(this.el)).addClass('selected');
2009 return $('.snippet-link', $(this.el)).removeClass('selected');
2012 SignatureView.prototype.switchToSnippet = function(e) {
2016 $(".description", $(this.el)).hide();
2017 $(".snippet", $(this.el)).show();
2018 $('.snippet-link', $(this.el)).addClass('selected');
2019 return $('.description-link', $(this.el)).removeClass('selected');
2022 SignatureView.prototype.snippetToTextArea = function(e) {
2028 textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
2029 if ($.trim(textArea.val()) === '') {
2030 return textArea.val(this.model.sampleJSON);
2035 return SignatureView;
2039 ContentTypeView = (function(_super) {
2040 __extends(ContentTypeView, _super);
2042 function ContentTypeView() {
2043 _ref8 = ContentTypeView.__super__.constructor.apply(this, arguments);
2047 ContentTypeView.prototype.initialize = function() {};
2049 ContentTypeView.prototype.render = function() {
2051 template = this.template();
2052 $(this.el).html(template(this.model));
2053 $('label[for=contentType]', $(this.el)).text('Response Content Type');
2057 ContentTypeView.prototype.template = function() {
2058 return Handlebars.templates.content_type;
2061 return ContentTypeView;
2065 ResponseContentTypeView = (function(_super) {
2066 __extends(ResponseContentTypeView, _super);
2068 function ResponseContentTypeView() {
2069 _ref9 = ResponseContentTypeView.__super__.constructor.apply(this, arguments);
2073 ResponseContentTypeView.prototype.initialize = function() {};
2075 ResponseContentTypeView.prototype.render = function() {
2077 template = this.template();
2078 $(this.el).html(template(this.model));
2079 $('label[for=responseContentType]', $(this.el)).text('Response Content Type');
2083 ResponseContentTypeView.prototype.template = function() {
2084 return Handlebars.templates.response_content_type;
2087 return ResponseContentTypeView;
2091 ParameterContentTypeView = (function(_super) {
2092 __extends(ParameterContentTypeView, _super);
2094 function ParameterContentTypeView() {
2095 _ref10 = ParameterContentTypeView.__super__.constructor.apply(this, arguments);
2099 ParameterContentTypeView.prototype.initialize = function() {};
2101 ParameterContentTypeView.prototype.render = function() {
2103 template = this.template();
2104 $(this.el).html(template(this.model));
2105 $('label[for=parameterContentType]', $(this.el)).text('Parameter content type:');
2109 ParameterContentTypeView.prototype.template = function() {
2110 return Handlebars.templates.parameter_content_type;
2113 return ParameterContentTypeView;