3 // Helper function for vertically aligning DOM elements
4 // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
5 $.fn.vAlign = function() {
6 return this.each(function(i){
7 var ah = $(this).height();
8 var ph = $(this).parent().height();
9 var mh = (ph - ah) / 2;
10 $(this).css('margin-top', mh);
14 $.fn.stretchFormtasticInputWidthToParent = function() {
15 return this.each(function(i){
16 var p_width = $(this).closest("form").innerWidth();
17 var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10);
18 var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
19 $(this).css('width', p_width - p_padding - this_padding);
23 $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
25 // Vertically center these paragraphs
26 // Parent may need a min-height for this to work..
27 $('ul.downplayed li div.content p').vAlign();
29 // When a sandbox form is submitted..
30 $("form.sandbox").submit(function(){
32 var error_free = true;
34 // Cycle through the forms required inputs
35 $(this).find("input.required").each(function() {
37 // Remove any existing error styles from the input
38 $(this).removeClass('error');
40 // Tack the error style on if the input is empty..
41 if ($(this).val() == '') {
42 $(this).addClass('error');
54 function clippyCopiedCallback(a) {
55 $('#api_key_copied').fadeIn().delay(1000).fadeOut();
57 // var b = $("#clippy_tooltip_" + a);
58 // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
59 // b.attr("title", "copy to clipboard")
64 // Logging function that accounts for browsers that don't have window.console
66 if (window.console) console.log.apply(console,arguments);
68 // Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
69 if (Function.prototype.bind && console && typeof console.log == "object") {
71 "log","info","warn","error","assert","dir","clear","profile","profileEnd"
72 ].forEach(function (method) {
73 console[method] = this.bind(console[method], console);
74 }, Function.prototype.call);
81 // If shebang has an operation nickname in it..
82 // e.g. /docs/#!/words/get_search
83 var fragments = $.param.fragment().split('/');
84 fragments.shift(); // get rid of the bang
86 switch (fragments.length) {
88 // Expand all operations for the resource and scroll to it
89 // log('shebang resource:' + fragments[0]);
90 var dom_id = 'resource_' + fragments[0];
92 Docs.expandEndpointListForResource(fragments[0]);
93 $("#"+dom_id).slideto({highlight: false});
96 // Refer to the endpoint DOM element, e.g. #words_get_search
97 // log('shebang endpoint: ' + fragments.join('_'));
100 Docs.expandEndpointListForResource(fragments[0]);
101 $("#"+dom_id).slideto({highlight: false});
104 var li_dom_id = fragments.join('_');
105 var li_content_dom_id = li_dom_id + "_content";
107 // log("li_dom_id " + li_dom_id);
108 // log("li_content_dom_id " + li_content_dom_id);
110 Docs.expandOperation($('#'+li_content_dom_id));
111 $('#'+li_dom_id).slideto({highlight: false});
117 toggleEndpointListForResource: function(resource) {
118 var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
119 if (elem.is(':visible')) {
120 Docs.collapseEndpointListForResource(resource);
122 Docs.expandEndpointListForResource(resource);
127 expandEndpointListForResource: function(resource) {
128 var resource = Docs.escapeResourceName(resource);
129 if (resource == '') {
130 $('.resource ul.endpoints').slideDown();
134 $('li#resource_' + resource).addClass('active');
136 var elem = $('li#resource_' + resource + ' ul.endpoints');
140 // Collapse resource and mark as explicitly closed
141 collapseEndpointListForResource: function(resource) {
142 var resource = Docs.escapeResourceName(resource);
143 $('li#resource_' + resource).removeClass('active');
145 var elem = $('li#resource_' + resource + ' ul.endpoints');
149 expandOperationsForResource: function(resource) {
150 // Make sure the resource container is open..
151 Docs.expandEndpointListForResource(resource);
153 if (resource == '') {
154 $('.resource ul.endpoints li.operation div.content').slideDown();
158 $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
159 Docs.expandOperation($(this));
163 collapseOperationsForResource: function(resource) {
164 // Make sure the resource container is open..
165 Docs.expandEndpointListForResource(resource);
167 $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
168 Docs.collapseOperation($(this));
172 escapeResourceName: function(resource) {
173 return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
176 expandOperation: function(elem) {
180 collapseOperation: function(elem) {
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 <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 stack1 = helpers['if'].call(depth0, depth0.consumes, {hash:{},inverse:self.program(4, program4, data),fn:self.program(1, program1, data),data:data});
1024 if(stack1 || stack1 === 0) { buffer += stack1; }
1025 buffer += "\n</select>\n";
1031 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1032 templates['resource'] = template(function (Handlebars,depth0,helpers,partials,data) {
1033 this.compilerInfo = [4,'>= 1.0.0'];
1034 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1035 var buffer = "", stack1, options, functionType="function", escapeExpression=this.escapeExpression, self=this, blockHelperMissing=helpers.blockHelperMissing;
1037 function program1(depth0,data) {
1043 buffer += "<div class='heading'>\n <h2>\n <a href='#!/";
1044 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1045 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1046 buffer += escapeExpression(stack1)
1047 + "' onclick=\"Docs.toggleEndpointListForResource('";
1048 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1049 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1050 buffer += escapeExpression(stack1)
1052 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1053 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1054 buffer += escapeExpression(stack1)
1056 options = {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data};
1057 if (stack1 = helpers.description) { stack1 = stack1.call(depth0, options); }
1058 else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1059 if (!helpers.description) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
1060 if(stack1 || stack1 === 0) { buffer += stack1; }
1061 if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1062 else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1063 if(stack1 || stack1 === 0) { buffer += stack1; }
1064 buffer += "\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/";
1065 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1066 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1067 buffer += escapeExpression(stack1)
1068 + "' id='endpointListTogger_";
1069 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1070 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1071 buffer += escapeExpression(stack1)
1072 + "'\n onclick=\"Docs.toggleEndpointListForResource('";
1073 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1074 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1075 buffer += escapeExpression(stack1)
1076 + "');\">Show/Hide</a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.collapseOperationsForResource('";
1077 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1078 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1079 buffer += escapeExpression(stack1)
1080 + "'); return false;\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.expandOperationsForResource('";
1081 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1082 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1083 buffer += escapeExpression(stack1)
1084 + "'); return false;\">\n Expand Operations\n </a>\n </li>\n <li>\n <a href='";
1085 stack1 = "resources/" + depth0.path + ".json";
1086 buffer += escapeExpression(stack1)
1087 + "'>Raw</a>\n </li>\n </ul>\n</div>\n<ul class='endpoints' id='";
1088 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1089 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1090 buffer += escapeExpression(stack1)
1091 + "_endpoint_list' style='display:none'>\n\n</ul>\n";
1097 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1098 templates['response_content_type'] = template(function (Handlebars,depth0,helpers,partials,data) {
1099 this.compilerInfo = [4,'>= 1.0.0'];
1100 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1101 var buffer = "", stack1, functionType="function", self=this;
1103 function program1(depth0,data) {
1105 var buffer = "", stack1;
1107 stack1 = helpers.each.call(depth0, depth0.produces, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
1108 if(stack1 || stack1 === 0) { buffer += stack1; }
1112 function program2(depth0,data) {
1114 var buffer = "", stack1;
1115 buffer += "\n <option value=\"";
1116 stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
1117 if(stack1 || stack1 === 0) { buffer += stack1; }
1119 stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
1120 if(stack1 || stack1 === 0) { buffer += stack1; }
1121 buffer += "</option>\n ";
1125 function program4(depth0,data) {
1128 return "\n <option value=\"application/json\">application/json</option>\n";
1131 stack1 = helpers['if'].call(depth0, depth0.produces, {hash:{},inverse:self.program(4, program4, data),fn:self.program(1, program1, data),data:data});
1132 if(stack1 || stack1 === 0) { buffer += stack1; }
1133 buffer += "\n</select>\n";
1139 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1140 templates['signature'] = template(function (Handlebars,depth0,helpers,partials,data) {
1141 this.compilerInfo = [4,'>= 1.0.0'];
1142 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1143 var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
1146 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 ";
1147 if (stack1 = helpers.signature) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1148 else { stack1 = depth0.signature; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1149 if(stack1 || stack1 === 0) { buffer += stack1; }
1150 buffer += "\n </div>\n\n <div class=\"snippet\">\n <pre><code>";
1151 if (stack1 = helpers.sampleJSON) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1152 else { stack1 = depth0.sampleJSON; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1153 buffer += escapeExpression(stack1)
1154 + "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
1160 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1161 templates['status_code'] = template(function (Handlebars,depth0,helpers,partials,data) {
1162 this.compilerInfo = [4,'>= 1.0.0'];
1163 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1164 var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
1167 buffer += "<td width='15%' class='code'>";
1168 if (stack1 = helpers.code) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1169 else { stack1 = depth0.code; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1170 buffer += escapeExpression(stack1)
1172 if (stack1 = helpers.message) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1173 else { stack1 = depth0.message; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1174 if(stack1 || stack1 === 0) { buffer += stack1; }
1175 buffer += "</td>\n";
1182 // Generated by CoffeeScript 1.6.3
1184 var ContentTypeView, HeaderView, MainView, OperationView, ParameterContentTypeView, ParameterView, ResourceView, ResponseContentTypeView, SignatureView, StatusCodeView, SwaggerUi, _ref, _ref1, _ref10, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9,
1185 __hasProp = {}.hasOwnProperty,
1186 __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; };
1188 SwaggerUi = (function(_super) {
1189 __extends(SwaggerUi, _super);
1191 function SwaggerUi() {
1192 _ref = SwaggerUi.__super__.constructor.apply(this, arguments);
1196 SwaggerUi.prototype.dom_id = "swagger_ui";
1198 SwaggerUi.prototype.options = null;
1200 SwaggerUi.prototype.api = null;
1202 SwaggerUi.prototype.headerView = null;
1204 SwaggerUi.prototype.mainView = null;
1206 SwaggerUi.prototype.initialize = function(options) {
1208 if (options == null) {
1211 if (options.dom_id != null) {
1212 this.dom_id = options.dom_id;
1213 delete options.dom_id;
1215 if ($('#' + this.dom_id) == null) {
1216 $('body').append('<div id="' + this.dom_id + '"></div>');
1218 this.options = options;
1219 this.options.success = function() {
1220 return _this.render();
1222 this.options.progress = function(d) {
1223 return _this.showMessage(d);
1225 this.options.failure = function(d) {
1226 return _this.onLoadFailure(d);
1228 this.headerView = new HeaderView({
1231 return this.headerView.on('update-swagger-ui', function(data) {
1232 return _this.updateSwaggerUi(data);
1236 SwaggerUi.prototype.updateSwaggerUi = function(data) {
1237 this.options.url = data.url;
1241 SwaggerUi.prototype.load = function() {
1243 if ((_ref1 = this.mainView) != null) {
1246 url = this.options.url;
1247 if (url.indexOf("http") !== 0) {
1248 url = this.buildUrl(window.location.href.toString(), url);
1250 this.options.url = url;
1251 this.headerView.update(url);
1252 this.api = new SwaggerApi(this.options);
1257 SwaggerUi.prototype.render = function() {
1259 this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
1260 this.mainView = new MainView({
1262 el: $('#' + this.dom_id)
1265 switch (this.options.docExpansion) {
1267 Docs.expandOperationsForResource('');
1270 Docs.collapseOperationsForResource('');
1272 if (this.options.onComplete) {
1273 this.options.onComplete(this.api, this);
1275 return setTimeout(function() {
1276 return Docs.shebang();
1280 SwaggerUi.prototype.buildUrl = function(base, url) {
1282 console.log("base is " + base);
1283 parts = base.split("/");
1284 base = parts[0] + "//" + parts[2];
1285 if (url.indexOf("/") === 0) {
1288 return base + "/" + url;
1292 SwaggerUi.prototype.showMessage = function(data) {
1296 $('#message-bar').removeClass('message-fail');
1297 $('#message-bar').addClass('message-success');
1298 return $('#message-bar').html(data);
1301 SwaggerUi.prototype.onLoadFailure = function(data) {
1306 $('#message-bar').removeClass('message-success');
1307 $('#message-bar').addClass('message-fail');
1308 val = $('#message-bar').html(data);
1309 if (this.options.onFailure != null) {
1310 this.options.onFailure(data);
1317 })(Backbone.Router);
1319 window.SwaggerUi = SwaggerUi;
1321 HeaderView = (function(_super) {
1322 __extends(HeaderView, _super);
1324 function HeaderView() {
1325 _ref1 = HeaderView.__super__.constructor.apply(this, arguments);
1329 HeaderView.prototype.events = {
1330 'click #show-pet-store-icon': 'showPetStore',
1331 'click #show-wordnik-dev-icon': 'showWordnikDev',
1332 'click #explore': 'showCustom',
1333 'keyup #input_baseUrl': 'showCustomOnKeyup',
1334 'keyup #input_apiKey': 'showCustomOnKeyup'
1337 HeaderView.prototype.initialize = function() {};
1339 HeaderView.prototype.showPetStore = function(e) {
1340 return this.trigger('update-swagger-ui', {
1341 url: "http://petstore.swagger.wordnik.com/api/api-docs"
1345 HeaderView.prototype.showWordnikDev = function(e) {
1346 return this.trigger('update-swagger-ui', {
1347 url: "http://api.wordnik.com/v4/resources.json"
1351 HeaderView.prototype.showCustomOnKeyup = function(e) {
1352 if (e.keyCode === 13) {
1353 return this.showCustom();
1357 HeaderView.prototype.showCustom = function(e) {
1361 return this.trigger('update-swagger-ui', {
1362 url: $('#input_baseUrl').val(),
1363 apiKey: $('#input_apiKey').val()
1367 HeaderView.prototype.update = function(url, apiKey, trigger) {
1368 if (trigger == null) {
1371 $('#input_baseUrl').val(url);
1373 return this.trigger('update-swagger-ui', {
1383 MainView = (function(_super) {
1384 __extends(MainView, _super);
1386 function MainView() {
1387 _ref2 = MainView.__super__.constructor.apply(this, arguments);
1391 MainView.prototype.initialize = function() {};
1393 MainView.prototype.render = function() {
1394 var resource, _i, _len, _ref3;
1395 $(this.el).html(Handlebars.templates.main(this.model));
1396 _ref3 = this.model.apisArray;
1397 for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
1398 resource = _ref3[_i];
1399 this.addResource(resource);
1404 MainView.prototype.addResource = function(resource) {
1406 resourceView = new ResourceView({
1409 id: 'resource_' + resource.name,
1410 className: 'resource'
1412 return $('#resources').append(resourceView.render().el);
1415 MainView.prototype.clear = function() {
1416 return $(this.el).html('');
1423 ResourceView = (function(_super) {
1424 __extends(ResourceView, _super);
1426 function ResourceView() {
1427 _ref3 = ResourceView.__super__.constructor.apply(this, arguments);
1431 ResourceView.prototype.initialize = function() {};
1433 ResourceView.prototype.render = function() {
1434 var operation, _i, _len, _ref4;
1435 console.log(this.model.description);
1436 $(this.el).html(Handlebars.templates.resource(this.model));
1438 _ref4 = this.model.operationsArray;
1439 for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
1440 operation = _ref4[_i];
1441 this.addOperation(operation);
1446 ResourceView.prototype.addOperation = function(operation) {
1448 operation.number = this.number;
1449 operationView = new OperationView({
1452 className: 'endpoint'
1454 $('.endpoints', $(this.el)).append(operationView.render().el);
1455 return this.number++;
1458 return ResourceView;
1462 OperationView = (function(_super) {
1463 __extends(OperationView, _super);
1465 function OperationView() {
1466 _ref4 = OperationView.__super__.constructor.apply(this, arguments);
1470 OperationView.prototype.invocationUrl = null;
1472 OperationView.prototype.events = {
1473 'submit .sandbox': 'submitOperation',
1474 'click .submit': 'submitOperation',
1475 'click .response_hider': 'hideResponse',
1476 'click .toggleOperation': 'toggleOperationContent'
1479 OperationView.prototype.initialize = function() {};
1481 OperationView.prototype.render = function() {
1482 var contentTypeModel, isMethodSubmissionSupported, param, responseContentTypeView, responseSignatureView, signatureModel, statusCode, type, _i, _j, _k, _len, _len1, _len2, _ref5, _ref6, _ref7;
1483 isMethodSubmissionSupported = true;
1484 if (!isMethodSubmissionSupported) {
1485 this.model.isReadOnly = true;
1487 $(this.el).html(Handlebars.templates.operation(this.model));
1488 if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
1490 sampleJSON: this.model.responseSampleJSON,
1492 signature: this.model.responseClassSignature
1494 responseSignatureView = new SignatureView({
1495 model: signatureModel,
1498 $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
1500 $('.model-signature', $(this.el)).html(this.model.type);
1502 contentTypeModel = {
1505 contentTypeModel.consumes = this.model.consumes;
1506 contentTypeModel.produces = this.model.produces;
1507 _ref5 = this.model.parameters;
1508 for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
1510 type = param.type || param.dataType;
1511 if (type.toLowerCase() === 'file') {
1512 if (!contentTypeModel.consumes) {
1513 console.log("set content type ");
1514 contentTypeModel.consumes = 'multipart/form-data';
1518 responseContentTypeView = new ResponseContentTypeView({
1519 model: contentTypeModel
1521 $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
1522 _ref6 = this.model.parameters;
1523 for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
1525 this.addParameter(param, contentTypeModel.consumes);
1527 _ref7 = this.model.responseMessages;
1528 for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) {
1529 statusCode = _ref7[_k];
1530 this.addStatusCode(statusCode);
1535 OperationView.prototype.addParameter = function(param, consumes) {
1537 param.consumes = consumes;
1538 paramView = new ParameterView({
1541 readOnly: this.model.isReadOnly
1543 return $('.operation-params', $(this.el)).append(paramView.render().el);
1546 OperationView.prototype.addStatusCode = function(statusCode) {
1548 statusCodeView = new StatusCodeView({
1552 return $('.operation-status', $(this.el)).append(statusCodeView.render().el);
1555 OperationView.prototype.submitOperation = function(e) {
1556 var error_free, form, isFileUpload, map, o, opts, val, _i, _j, _k, _len, _len1, _len2, _ref5, _ref6, _ref7;
1560 form = $('.sandbox', $(this.el));
1562 form.find("input.required").each(function() {
1564 $(this).removeClass("error");
1565 if (jQuery.trim($(this).val()) === "") {
1566 $(this).addClass("error");
1568 callback: function() {
1569 return $(_this).focus();
1572 return error_free = false;
1580 isFileUpload = false;
1581 _ref5 = form.find("input");
1582 for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
1584 if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1585 map[o.name] = o.value;
1587 if (o.type === "file") {
1588 isFileUpload = true;
1591 _ref6 = form.find("textarea");
1592 for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
1594 if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1595 map["body"] = o.value;
1598 _ref7 = form.find("select");
1599 for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) {
1601 val = this.getSelectedValue(o);
1602 if ((val != null) && jQuery.trim(val).length > 0) {
1606 opts.responseContentType = $("div select[name=responseContentType]", $(this.el)).val();
1607 opts.requestContentType = $("div select[name=parameterContentType]", $(this.el)).val();
1608 $(".response_throbber", $(this.el)).show();
1610 return this.handleFileUpload(map, form);
1612 return this.model["do"](map, opts, this.showCompleteStatus, this.showErrorStatus, this);
1617 OperationView.prototype.success = function(response, parent) {
1618 return parent.showCompleteStatus(response);
1621 OperationView.prototype.handleFileUpload = function(map, form) {
1622 var bodyParam, headerParams, o, obj, param, _i, _j, _k, _len, _len1, _len2, _ref5, _ref6, _ref7,
1624 console.log("it's a file upload");
1625 _ref5 = form.serializeArray();
1626 for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
1628 if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1629 map[o.name] = o.value;
1632 bodyParam = new FormData();
1633 _ref6 = this.model.parameters;
1634 for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
1636 if (param.paramType === 'form') {
1637 bodyParam.append(param.name, map[param.name]);
1641 _ref7 = this.model.parameters;
1642 for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) {
1644 if (param.paramType === 'header') {
1645 headerParams[param.name] = map[param.name];
1648 console.log(headerParams);
1649 $.each($('input[type~="file"]'), function(i, el) {
1650 return bodyParam.append($(el).attr('name'), el.files[0]);
1652 console.log(bodyParam);
1653 this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), this.model.urlify(map, false)) : this.model.urlify(map, true);
1654 $(".request_url", $(this.el)).html("<pre>" + this.invocationUrl + "</pre>");
1656 type: this.model.method,
1657 url: this.invocationUrl,
1658 headers: headerParams,
1663 error: function(data, textStatus, error) {
1664 return _this.showErrorStatus(_this.wrap(data), _this);
1666 success: function(data) {
1667 return _this.showResponse(data, _this);
1669 complete: function(data) {
1670 return _this.showCompleteStatus(_this.wrap(data), _this);
1673 if (window.authorizations) {
1674 window.authorizations.apply(obj);
1680 OperationView.prototype.wrap = function(data) {
1685 o.content.data = data.responseText;
1686 o.getHeaders = function() {
1688 "Content-Type": data.getResponseHeader("Content-Type")
1692 o.request.url = this.invocationUrl;
1693 o.status = data.status;
1697 OperationView.prototype.getSelectedValue = function(select) {
1698 var opt, options, _i, _len, _ref5;
1699 if (!select.multiple) {
1700 return select.value;
1703 _ref5 = select.options;
1704 for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
1707 options.push(opt.value);
1710 if (options.length > 0) {
1711 return options.join(",");
1718 OperationView.prototype.hideResponse = function(e) {
1722 $(".response", $(this.el)).slideUp();
1723 return $(".response_hider", $(this.el)).fadeOut();
1726 OperationView.prototype.showResponse = function(response) {
1728 prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>");
1729 return $(".response_body", $(this.el)).html(escape(prettyJson));
1732 OperationView.prototype.showErrorStatus = function(data, parent) {
1733 return parent.showStatus(data);
1736 OperationView.prototype.showCompleteStatus = function(data, parent) {
1737 return parent.showStatus(data);
1740 OperationView.prototype.formatXml = function(xml) {
1741 var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
1742 reg = /(>)(<)(\/*)/g;
1743 wsexp = /[ ]*(.*)[ ]+\n/g;
1744 contexp = /(<.+>)(.+\n)/g;
1745 xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
1748 lines = xml.split('\n');
1752 'single->single': 0,
1753 'single->closing': -1,
1754 'single->opening': 0,
1756 'closing->single': 0,
1757 'closing->closing': -1,
1758 'closing->opening': 0,
1759 'closing->other': 0,
1760 'opening->single': 1,
1761 'opening->closing': 0,
1762 'opening->opening': 1,
1763 'opening->other': 1,
1765 'other->closing': -1,
1766 'other->opening': 0,
1769 _fn = function(ln) {
1770 var fromTo, j, key, padding, type, types, value;
1772 single: Boolean(ln.match(/<.+\/>/)),
1773 closing: Boolean(ln.match(/<\/.+>/)),
1774 opening: Boolean(ln.match(/<[^!?].*>/))
1776 type = ((function() {
1779 for (key in types) {
1787 type = type === void 0 ? 'other' : type;
1788 fromTo = lastType + '->' + type;
1791 indent += transitions[fromTo];
1792 padding = ((function() {
1793 var _j, _ref5, _results;
1795 for (j = _j = 0, _ref5 = indent; 0 <= _ref5 ? _j < _ref5 : _j > _ref5; j = 0 <= _ref5 ? ++_j : --_j) {
1800 if (fromTo === 'opening->closing') {
1801 return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
1803 return formatted += padding + ln + '\n';
1806 for (_i = 0, _len = lines.length; _i < _len; _i++) {
1813 OperationView.prototype.showStatus = function(data) {
1814 var code, content, contentType, headers, pre, response_body;
1815 content = data.content.data;
1816 headers = data.getHeaders();
1817 contentType = headers["Content-Type"];
1818 if (content === void 0) {
1819 code = $('<code />').text("no content");
1820 pre = $('<pre class="json" />').append(code);
1821 } else if (contentType.indexOf("application/json") === 0 || contentType.indexOf("application/hal+json") === 0) {
1822 code = $('<code />').text(JSON.stringify(JSON.parse(content), null, 2));
1823 pre = $('<pre class="json" />').append(code);
1824 } else if (contentType.indexOf("application/xml") === 0) {
1825 code = $('<code />').text(this.formatXml(content));
1826 pre = $('<pre class="xml" />').append(code);
1827 } else if (contentType.indexOf("text/html") === 0) {
1828 code = $('<code />').html(content);
1829 pre = $('<pre class="xml" />').append(code);
1830 } else if (contentType.indexOf("image/") === 0) {
1831 pre = $('<img>').attr('src', data.request.url);
1833 code = $('<code />').text(content);
1834 pre = $('<pre class="json" />').append(code);
1836 response_body = pre;
1837 $(".request_url", $(this.el)).html("<pre>" + data.request.url + "</pre>");
1838 $(".response_code", $(this.el)).html("<pre>" + data.status + "</pre>");
1839 $(".response_body", $(this.el)).html(response_body);
1840 $(".response_headers", $(this.el)).html("<pre>" + JSON.stringify(data.getHeaders(), null, " ").replace(/\n/g, "<br>") + "</pre>");
1841 $(".response", $(this.el)).slideDown();
1842 $(".response_hider", $(this.el)).show();
1843 $(".response_throbber", $(this.el)).hide();
1844 return hljs.highlightBlock($('.response_body', $(this.el))[0]);
1847 OperationView.prototype.toggleOperationContent = function() {
1849 elem = $('#' + Docs.escapeResourceName(this.model.resourceName) + "_" + this.model.nickname + "_" + this.model.method + "_" + this.model.number + "_content");
1850 if (elem.is(':visible')) {
1851 return Docs.collapseOperation(elem);
1853 return Docs.expandOperation(elem);
1857 return OperationView;
1861 StatusCodeView = (function(_super) {
1862 __extends(StatusCodeView, _super);
1864 function StatusCodeView() {
1865 _ref5 = StatusCodeView.__super__.constructor.apply(this, arguments);
1869 StatusCodeView.prototype.initialize = function() {};
1871 StatusCodeView.prototype.render = function() {
1873 template = this.template();
1874 $(this.el).html(template(this.model));
1878 StatusCodeView.prototype.template = function() {
1879 return Handlebars.templates.status_code;
1882 return StatusCodeView;
1886 ParameterView = (function(_super) {
1887 __extends(ParameterView, _super);
1889 function ParameterView() {
1890 _ref6 = ParameterView.__super__.constructor.apply(this, arguments);
1894 ParameterView.prototype.initialize = function() {};
1896 ParameterView.prototype.render = function() {
1897 var contentTypeModel, isParam, parameterContentTypeView, responseContentTypeView, signatureModel, signatureView, template, type;
1898 type = this.model.type || this.model.dataType;
1899 if (this.model.paramType === 'body') {
1900 this.model.isBody = true;
1902 if (type.toLowerCase() === 'file') {
1903 this.model.isFile = true;
1905 template = this.template();
1906 $(this.el).html(template(this.model));
1908 sampleJSON: this.model.sampleJSON,
1910 signature: this.model.signature
1912 if (this.model.sampleJSON) {
1913 signatureView = new SignatureView({
1914 model: signatureModel,
1917 $('.model-signature', $(this.el)).append(signatureView.render().el);
1919 $('.model-signature', $(this.el)).html(this.model.signature);
1922 if (this.model.isBody) {
1925 contentTypeModel = {
1928 contentTypeModel.consumes = this.model.consumes;
1930 parameterContentTypeView = new ParameterContentTypeView({
1931 model: contentTypeModel
1933 $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el);
1935 responseContentTypeView = new ResponseContentTypeView({
1936 model: contentTypeModel
1938 $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
1943 ParameterView.prototype.template = function() {
1944 if (this.model.isList) {
1945 return Handlebars.templates.param_list;
1947 if (this.options.readOnly) {
1948 if (this.model.required) {
1949 return Handlebars.templates.param_readonly_required;
1951 return Handlebars.templates.param_readonly;
1954 if (this.model.required) {
1955 return Handlebars.templates.param_required;
1957 return Handlebars.templates.param;
1963 return ParameterView;
1967 SignatureView = (function(_super) {
1968 __extends(SignatureView, _super);
1970 function SignatureView() {
1971 _ref7 = SignatureView.__super__.constructor.apply(this, arguments);
1975 SignatureView.prototype.events = {
1976 'click a.description-link': 'switchToDescription',
1977 'click a.snippet-link': 'switchToSnippet',
1978 'mousedown .snippet': 'snippetToTextArea'
1981 SignatureView.prototype.initialize = function() {};
1983 SignatureView.prototype.render = function() {
1985 template = this.template();
1986 $(this.el).html(template(this.model));
1987 this.switchToDescription();
1988 this.isParam = this.model.isParam;
1990 $('.notice', $(this.el)).text('Click to set as parameter value');
1995 SignatureView.prototype.template = function() {
1996 return Handlebars.templates.signature;
1999 SignatureView.prototype.switchToDescription = function(e) {
2003 $(".snippet", $(this.el)).hide();
2004 $(".description", $(this.el)).show();
2005 $('.description-link', $(this.el)).addClass('selected');
2006 return $('.snippet-link', $(this.el)).removeClass('selected');
2009 SignatureView.prototype.switchToSnippet = function(e) {
2013 $(".description", $(this.el)).hide();
2014 $(".snippet", $(this.el)).show();
2015 $('.snippet-link', $(this.el)).addClass('selected');
2016 return $('.description-link', $(this.el)).removeClass('selected');
2019 SignatureView.prototype.snippetToTextArea = function(e) {
2025 textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
2026 if ($.trim(textArea.val()) === '') {
2027 return textArea.val(this.model.sampleJSON);
2032 return SignatureView;
2036 ContentTypeView = (function(_super) {
2037 __extends(ContentTypeView, _super);
2039 function ContentTypeView() {
2040 _ref8 = ContentTypeView.__super__.constructor.apply(this, arguments);
2044 ContentTypeView.prototype.initialize = function() {};
2046 ContentTypeView.prototype.render = function() {
2048 template = this.template();
2049 $(this.el).html(template(this.model));
2050 $('label[for=contentType]', $(this.el)).text('Response Content Type');
2054 ContentTypeView.prototype.template = function() {
2055 return Handlebars.templates.content_type;
2058 return ContentTypeView;
2062 ResponseContentTypeView = (function(_super) {
2063 __extends(ResponseContentTypeView, _super);
2065 function ResponseContentTypeView() {
2066 _ref9 = ResponseContentTypeView.__super__.constructor.apply(this, arguments);
2070 ResponseContentTypeView.prototype.initialize = function() {};
2072 ResponseContentTypeView.prototype.render = function() {
2074 template = this.template();
2075 $(this.el).html(template(this.model));
2076 $('label[for=responseContentType]', $(this.el)).text('Response Content Type');
2080 ResponseContentTypeView.prototype.template = function() {
2081 return Handlebars.templates.response_content_type;
2084 return ResponseContentTypeView;
2088 ParameterContentTypeView = (function(_super) {
2089 __extends(ParameterContentTypeView, _super);
2091 function ParameterContentTypeView() {
2092 _ref10 = ParameterContentTypeView.__super__.constructor.apply(this, arguments);
2096 ParameterContentTypeView.prototype.initialize = function() {};
2098 ParameterContentTypeView.prototype.render = function() {
2100 template = this.template();
2101 $(this.el).html(template(this.model));
2102 $('label[for=parameterContentType]', $(this.el)).text('Parameter content type:');
2106 ParameterContentTypeView.prototype.template = function() {
2107 return Handlebars.templates.parameter_content_type;
2110 return ParameterContentTypeView;