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 log.history = log.history || [];
67 log.history.push(arguments);
69 console.log( Array.prototype.slice.call(arguments) );
73 // Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
74 if (Function.prototype.bind && console && typeof console.log == "object") {
76 "log","info","warn","error","assert","dir","clear","profile","profileEnd"
77 ].forEach(function (method) {
78 console[method] = this.bind(console[method], console);
79 }, Function.prototype.call);
86 // If shebang has an operation nickname in it..
87 // e.g. /docs/#!/words/get_search
88 var fragments = $.param.fragment().split('/');
89 fragments.shift(); // get rid of the bang
91 switch (fragments.length) {
93 // Expand all operations for the resource and scroll to it
94 log('shebang resource:' + fragments[0]);
95 var dom_id = 'resource_' + fragments[0];
97 Docs.expandEndpointListForResource(fragments[0]);
98 $("#"+dom_id).slideto({highlight: false});
101 // Refer to the endpoint DOM element, e.g. #words_get_search
102 log('shebang endpoint: ' + fragments.join('_'));
105 Docs.expandEndpointListForResource(fragments[0]);
106 $("#"+dom_id).slideto({highlight: false});
109 var li_dom_id = fragments.join('_');
110 var li_content_dom_id = li_dom_id + "_content";
112 log("li_dom_id " + li_dom_id);
113 log("li_content_dom_id " + li_content_dom_id);
115 Docs.expandOperation($('#'+li_content_dom_id));
116 $('#'+li_dom_id).slideto({highlight: false});
122 toggleEndpointListForResource: function(resource) {
123 var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
124 if (elem.is(':visible')) {
125 Docs.collapseEndpointListForResource(resource);
127 Docs.expandEndpointListForResource(resource);
132 expandEndpointListForResource: function(resource) {
133 var resource = Docs.escapeResourceName(resource);
134 if (resource == '') {
135 $('.resource ul.endpoints').slideDown();
139 $('li#resource_' + resource).addClass('active');
141 var elem = $('li#resource_' + resource + ' ul.endpoints');
145 // Collapse resource and mark as explicitly closed
146 collapseEndpointListForResource: function(resource) {
147 var resource = Docs.escapeResourceName(resource);
148 $('li#resource_' + resource).removeClass('active');
150 var elem = $('li#resource_' + resource + ' ul.endpoints');
154 expandOperationsForResource: function(resource) {
155 // Make sure the resource container is open..
156 Docs.expandEndpointListForResource(resource);
158 if (resource == '') {
159 $('.resource ul.endpoints li.operation div.content').slideDown();
163 $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
164 Docs.expandOperation($(this));
168 collapseOperationsForResource: function(resource) {
169 // Make sure the resource container is open..
170 Docs.expandEndpointListForResource(resource);
172 $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
173 Docs.collapseOperation($(this));
177 escapeResourceName: function(resource) {
178 return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
181 expandOperation: function(elem) {
185 collapseOperation: function(elem) {
189 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
190 templates['content_type'] = template(function (Handlebars,depth0,helpers,partials,data) {
191 this.compilerInfo = [4,'>= 1.0.0'];
192 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
193 var buffer = "", stack1, functionType="function", self=this;
195 function program1(depth0,data) {
197 var buffer = "", stack1;
199 stack1 = helpers.each.call(depth0, depth0.produces, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
200 if(stack1 || stack1 === 0) { buffer += stack1; }
204 function program2(depth0,data) {
206 var buffer = "", stack1;
207 buffer += "\n <option value=\"";
208 stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
209 if(stack1 || stack1 === 0) { buffer += stack1; }
211 stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
212 if(stack1 || stack1 === 0) { buffer += stack1; }
213 buffer += "</option>\n ";
217 function program4(depth0,data) {
220 return "\n <option value=\"application/json\">application/json</option>\n";
223 buffer += "<label for=\"contentType\"></label>\n<select name=\"contentType\">\n";
224 stack1 = helpers['if'].call(depth0, depth0.produces, {hash:{},inverse:self.program(4, program4, data),fn:self.program(1, program1, data),data:data});
225 if(stack1 || stack1 === 0) { buffer += stack1; }
226 buffer += "\n</select>\n";
232 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
233 templates['main'] = template(function (Handlebars,depth0,helpers,partials,data) {
234 this.compilerInfo = [4,'>= 1.0.0'];
235 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
236 var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
238 function program1(depth0,data) {
240 var buffer = "", stack1, stack2;
241 buffer += "\n <div class=\"info_title\">"
242 + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.title)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
243 + "</div>\n <div class=\"info_description\">";
244 stack2 = ((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.description)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
245 if(stack2 || stack2 === 0) { buffer += stack2; }
246 buffer += "</div>\n ";
247 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});
248 if(stack2 || stack2 === 0) { buffer += stack2; }
250 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});
251 if(stack2 || stack2 === 0) { buffer += stack2; }
253 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});
254 if(stack2 || stack2 === 0) { buffer += stack2; }
258 function program2(depth0,data) {
260 var buffer = "", stack1;
261 buffer += "<div class=\"info_tos\"><a href=\""
262 + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.termsOfServiceUrl)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
263 + "\">Terms of service</a></div>";
267 function program4(depth0,data) {
269 var buffer = "", stack1;
270 buffer += "<div class='info_contact'><a href=\"mailto:"
271 + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.contact)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
272 + "\">Contact the developer</a></div>";
276 function program6(depth0,data) {
278 var buffer = "", stack1;
279 buffer += "<div class='info_license'><a href='"
280 + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.licenseUrl)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
282 + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.license)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
287 function program8(depth0,data) {
289 var buffer = "", stack1;
290 buffer += "\n , <span style=\"font-variant: small-caps\">api version</span>: ";
291 if (stack1 = helpers.apiVersion) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
292 else { stack1 = depth0.apiVersion; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
293 buffer += escapeExpression(stack1)
298 buffer += "<div class='info' id='api_info'>\n ";
299 stack1 = helpers['if'].call(depth0, depth0.info, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
300 if(stack1 || stack1 === 0) { buffer += stack1; }
301 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>: ";
302 if (stack1 = helpers.basePath) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
303 else { stack1 = depth0.basePath; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
304 buffer += escapeExpression(stack1)
306 stack1 = helpers['if'].call(depth0, depth0.apiVersion, {hash:{},inverse:self.noop,fn:self.program(8, program8, data),data:data});
307 if(stack1 || stack1 === 0) { buffer += stack1; }
308 buffer += "]</h4>\n </div>\n</div>\n";
314 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
315 templates['operation'] = template(function (Handlebars,depth0,helpers,partials,data) {
316 this.compilerInfo = [4,'>= 1.0.0'];
317 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
318 var buffer = "", stack1, options, functionType="function", escapeExpression=this.escapeExpression, self=this, blockHelperMissing=helpers.blockHelperMissing;
320 function program1(depth0,data) {
322 var buffer = "", stack1;
323 buffer += "\n <h4>Implementation Notes</h4>\n <p>";
324 if (stack1 = helpers.notes) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
325 else { stack1 = depth0.notes; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
326 if(stack1 || stack1 === 0) { buffer += stack1; }
331 function program3(depth0,data) {
334 return "\n <div class=\"auth\">\n <span class=\"api-ic ic-error\"></span>";
337 function program5(depth0,data) {
339 var buffer = "", stack1;
340 buffer += "\n <div id=\"api_information_panel\" style=\"top: 526px; left: 776px; display: none;\">\n ";
341 stack1 = helpers.each.call(depth0, depth0, {hash:{},inverse:self.noop,fn:self.program(6, program6, data),data:data});
342 if(stack1 || stack1 === 0) { buffer += stack1; }
343 buffer += "\n </div>\n ";
346 function program6(depth0,data) {
348 var buffer = "", stack1, stack2;
349 buffer += "\n <div title='";
350 stack2 = ((stack1 = depth0.description),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
351 if(stack2 || stack2 === 0) { buffer += stack2; }
353 + escapeExpression(((stack1 = depth0.scope),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
358 function program8(depth0,data) {
364 function program10(depth0,data) {
367 return "\n <div class='access'>\n <span class=\"api-ic ic-off\" title=\"click to authenticate\"></span>\n </div>\n ";
370 function program12(depth0,data) {
373 return "\n <h4>Response Class</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n ";
376 function program14(depth0,data) {
379 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 ";
382 function program16(depth0,data) {
385 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 ";
388 function program18(depth0,data) {
394 function program20(depth0,data) {
397 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 ";
400 buffer += "\n <ul class='operations' >\n <li class='";
401 if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
402 else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
403 buffer += escapeExpression(stack1)
404 + " operation' id='";
405 if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
406 else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
407 buffer += escapeExpression(stack1)
409 if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
410 else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
411 buffer += escapeExpression(stack1)
412 + "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/";
413 if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
414 else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
415 buffer += escapeExpression(stack1)
417 if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
418 else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
419 buffer += escapeExpression(stack1)
420 + "' class=\"toggleOperation\">";
421 if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
422 else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
423 buffer += escapeExpression(stack1)
424 + "</a>\n </span>\n <span class='path'>\n <a href='#!/";
425 if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
426 else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
427 buffer += escapeExpression(stack1)
429 if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
430 else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
431 buffer += escapeExpression(stack1)
432 + "' class=\"toggleOperation\">";
433 if (stack1 = helpers.path) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
434 else { stack1 = depth0.path; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
435 buffer += escapeExpression(stack1)
436 + "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/";
437 if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
438 else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
439 buffer += escapeExpression(stack1)
441 if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
442 else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
443 buffer += escapeExpression(stack1)
444 + "' class=\"toggleOperation\">";
445 if (stack1 = helpers.summary) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
446 else { stack1 = depth0.summary; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
447 if(stack1 || stack1 === 0) { buffer += stack1; }
448 buffer += "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='";
449 if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
450 else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
451 buffer += escapeExpression(stack1)
453 if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
454 else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
455 buffer += escapeExpression(stack1)
456 + "_content' style='display:none'>\n ";
457 stack1 = helpers['if'].call(depth0, depth0.notes, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
458 if(stack1 || stack1 === 0) { buffer += stack1; }
460 options = {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data};
461 if (stack1 = helpers.oauth) { stack1 = stack1.call(depth0, options); }
462 else { stack1 = depth0.oauth; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
463 if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
464 if(stack1 || stack1 === 0) { buffer += stack1; }
466 stack1 = helpers.each.call(depth0, depth0.oauth, {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
467 if(stack1 || stack1 === 0) { buffer += stack1; }
469 options = {hash:{},inverse:self.noop,fn:self.program(8, program8, data),data:data};
470 if (stack1 = helpers.oauth) { stack1 = stack1.call(depth0, options); }
471 else { stack1 = depth0.oauth; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
472 if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
473 if(stack1 || stack1 === 0) { buffer += stack1; }
475 options = {hash:{},inverse:self.noop,fn:self.program(10, program10, data),data:data};
476 if (stack1 = helpers.oauth) { stack1 = stack1.call(depth0, options); }
477 else { stack1 = depth0.oauth; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
478 if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
479 if(stack1 || stack1 === 0) { buffer += stack1; }
481 stack1 = helpers['if'].call(depth0, depth0.type, {hash:{},inverse:self.noop,fn:self.program(12, program12, data),data:data});
482 if(stack1 || stack1 === 0) { buffer += stack1; }
483 buffer += "\n <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n ";
484 stack1 = helpers['if'].call(depth0, depth0.parameters, {hash:{},inverse:self.noop,fn:self.program(14, program14, data),data:data});
485 if(stack1 || stack1 === 0) { buffer += stack1; }
487 stack1 = helpers['if'].call(depth0, depth0.responseMessages, {hash:{},inverse:self.noop,fn:self.program(16, program16, data),data:data});
488 if(stack1 || stack1 === 0) { buffer += stack1; }
490 stack1 = helpers['if'].call(depth0, depth0.isReadOnly, {hash:{},inverse:self.program(20, program20, data),fn:self.program(18, program18, data),data:data});
491 if(stack1 || stack1 === 0) { buffer += stack1; }
492 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";
498 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
499 templates['param'] = template(function (Handlebars,depth0,helpers,partials,data) {
500 this.compilerInfo = [4,'>= 1.0.0'];
501 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
502 var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
504 function program1(depth0,data) {
506 var buffer = "", stack1;
508 stack1 = helpers['if'].call(depth0, depth0.isFile, {hash:{},inverse:self.program(4, program4, data),fn:self.program(2, program2, data),data:data});
509 if(stack1 || stack1 === 0) { buffer += stack1; }
513 function program2(depth0,data) {
515 var buffer = "", stack1;
516 buffer += "\n <input type=\"file\" name='";
517 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
518 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
519 buffer += escapeExpression(stack1)
520 + "'/>\n <div class=\"parameter-content-type\" />\n ";
524 function program4(depth0,data) {
526 var buffer = "", stack1;
528 stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(7, program7, data),fn:self.program(5, program5, data),data:data});
529 if(stack1 || stack1 === 0) { buffer += stack1; }
533 function program5(depth0,data) {
535 var buffer = "", stack1;
536 buffer += "\n <textarea class='body-textarea' name='";
537 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
538 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
539 buffer += escapeExpression(stack1)
541 if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
542 else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
543 buffer += escapeExpression(stack1)
548 function program7(depth0,data) {
550 var buffer = "", stack1;
551 buffer += "\n <textarea class='body-textarea' name='";
552 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
553 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
554 buffer += escapeExpression(stack1)
555 + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n ";
559 function program9(depth0,data) {
561 var buffer = "", stack1;
563 stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(12, program12, data),fn:self.program(10, program10, data),data:data});
564 if(stack1 || stack1 === 0) { buffer += stack1; }
568 function program10(depth0,data) {
570 var buffer = "", stack1;
571 buffer += "\n <input class='parameter' minlength='0' name='";
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 + "' placeholder='' type='text' value='";
576 if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
577 else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
578 buffer += escapeExpression(stack1)
583 function program12(depth0,data) {
585 var buffer = "", stack1;
586 buffer += "\n <input class='parameter' minlength='0' name='";
587 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
588 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
589 buffer += escapeExpression(stack1)
590 + "' placeholder='' type='text' value=''/>\n ";
594 buffer += "<td class='code'>";
595 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
596 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
597 buffer += escapeExpression(stack1)
598 + "</td>\n<td>\n\n ";
599 stack1 = helpers['if'].call(depth0, depth0.isBody, {hash:{},inverse:self.program(9, program9, data),fn:self.program(1, program1, data),data:data});
600 if(stack1 || stack1 === 0) { buffer += stack1; }
601 buffer += "\n\n</td>\n<td>";
602 if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
603 else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
604 if(stack1 || stack1 === 0) { buffer += stack1; }
605 buffer += "</td>\n<td>";
606 if (stack1 = helpers.paramType) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
607 else { stack1 = depth0.paramType; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
608 if(stack1 || stack1 === 0) { buffer += stack1; }
609 buffer += "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n";
615 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
616 templates['param_list'] = template(function (Handlebars,depth0,helpers,partials,data) {
617 this.compilerInfo = [4,'>= 1.0.0'];
618 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
619 var buffer = "", stack1, stack2, options, self=this, helperMissing=helpers.helperMissing, functionType="function", escapeExpression=this.escapeExpression;
621 function program1(depth0,data) {
624 return " multiple='multiple'";
627 function program3(depth0,data) {
633 function program5(depth0,data) {
635 var buffer = "", stack1;
637 stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(8, program8, data),fn:self.program(6, program6, data),data:data});
638 if(stack1 || stack1 === 0) { buffer += stack1; }
642 function program6(depth0,data) {
648 function program8(depth0,data) {
650 var buffer = "", stack1, stack2, options;
652 options = {hash:{},inverse:self.program(11, program11, data),fn:self.program(9, program9, data),data:data};
653 stack2 = ((stack1 = helpers.isArray || depth0.isArray),stack1 ? stack1.call(depth0, depth0, options) : helperMissing.call(depth0, "isArray", depth0, options));
654 if(stack2 || stack2 === 0) { buffer += stack2; }
658 function program9(depth0,data) {
664 function program11(depth0,data) {
667 return "\n <option selected=\"\" value=''></option>\n ";
670 function program13(depth0,data) {
672 var buffer = "", stack1;
674 stack1 = helpers['if'].call(depth0, depth0.isDefault, {hash:{},inverse:self.program(16, program16, data),fn:self.program(14, program14, data),data:data});
675 if(stack1 || stack1 === 0) { buffer += stack1; }
679 function program14(depth0,data) {
681 var buffer = "", stack1;
682 buffer += "\n <option selected=\"\" value='";
683 if (stack1 = helpers.value) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
684 else { stack1 = depth0.value; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
685 buffer += escapeExpression(stack1)
687 if (stack1 = helpers.value) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
688 else { stack1 = depth0.value; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
689 buffer += escapeExpression(stack1)
690 + " (default)</option>\n ";
694 function program16(depth0,data) {
696 var buffer = "", stack1;
697 buffer += "\n <option value='";
698 if (stack1 = helpers.value) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
699 else { stack1 = depth0.value; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
700 buffer += escapeExpression(stack1)
702 if (stack1 = helpers.value) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
703 else { stack1 = depth0.value; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
704 buffer += escapeExpression(stack1)
709 buffer += "<td class='code'>";
710 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
711 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
712 buffer += escapeExpression(stack1)
713 + "</td>\n<td>\n <select ";
714 options = {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data};
715 stack2 = ((stack1 = helpers.isArray || depth0.isArray),stack1 ? stack1.call(depth0, depth0, options) : helperMissing.call(depth0, "isArray", depth0, options));
716 if(stack2 || stack2 === 0) { buffer += stack2; }
717 buffer += " class='parameter' name='";
718 if (stack2 = helpers.name) { stack2 = stack2.call(depth0, {hash:{},data:data}); }
719 else { stack2 = depth0.name; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
720 buffer += escapeExpression(stack2)
722 stack2 = helpers['if'].call(depth0, depth0.required, {hash:{},inverse:self.program(5, program5, data),fn:self.program(3, program3, data),data:data});
723 if(stack2 || stack2 === 0) { buffer += stack2; }
725 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});
726 if(stack2 || stack2 === 0) { buffer += stack2; }
727 buffer += "\n </select>\n</td>\n<td>";
728 if (stack2 = helpers.description) { stack2 = stack2.call(depth0, {hash:{},data:data}); }
729 else { stack2 = depth0.description; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
730 if(stack2 || stack2 === 0) { buffer += stack2; }
731 buffer += "</td>\n<td>";
732 if (stack2 = helpers.paramType) { stack2 = stack2.call(depth0, {hash:{},data:data}); }
733 else { stack2 = depth0.paramType; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
734 if(stack2 || stack2 === 0) { buffer += stack2; }
735 buffer += "</td>\n<td><span class=\"model-signature\"></span></td>";
741 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
742 templates['param_readonly'] = template(function (Handlebars,depth0,helpers,partials,data) {
743 this.compilerInfo = [4,'>= 1.0.0'];
744 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
745 var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
747 function program1(depth0,data) {
749 var buffer = "", stack1;
750 buffer += "\n <textarea class='body-textarea' readonly='readonly' name='";
751 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
752 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
753 buffer += escapeExpression(stack1)
755 if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
756 else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
757 buffer += escapeExpression(stack1)
762 function program3(depth0,data) {
764 var buffer = "", stack1;
766 stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(6, program6, data),fn:self.program(4, program4, data),data:data});
767 if(stack1 || stack1 === 0) { buffer += stack1; }
771 function program4(depth0,data) {
773 var buffer = "", stack1;
775 if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
776 else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
777 buffer += escapeExpression(stack1)
782 function program6(depth0,data) {
785 return "\n (empty)\n ";
788 buffer += "<td class='code'>";
789 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
790 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
791 buffer += escapeExpression(stack1)
793 stack1 = helpers['if'].call(depth0, depth0.isBody, {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data),data:data});
794 if(stack1 || stack1 === 0) { buffer += stack1; }
795 buffer += "\n</td>\n<td>";
796 if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
797 else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
798 if(stack1 || stack1 === 0) { buffer += stack1; }
799 buffer += "</td>\n<td>";
800 if (stack1 = helpers.paramType) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
801 else { stack1 = depth0.paramType; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
802 if(stack1 || stack1 === 0) { buffer += stack1; }
803 buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n";
809 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
810 templates['param_readonly_required'] = template(function (Handlebars,depth0,helpers,partials,data) {
811 this.compilerInfo = [4,'>= 1.0.0'];
812 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
813 var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
815 function program1(depth0,data) {
817 var buffer = "", stack1;
818 buffer += "\n <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='";
819 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
820 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
821 buffer += escapeExpression(stack1)
823 if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
824 else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
825 buffer += escapeExpression(stack1)
830 function program3(depth0,data) {
832 var buffer = "", stack1;
834 stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(6, program6, data),fn:self.program(4, program4, data),data:data});
835 if(stack1 || stack1 === 0) { buffer += stack1; }
839 function program4(depth0,data) {
841 var buffer = "", stack1;
843 if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
844 else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
845 buffer += escapeExpression(stack1)
850 function program6(depth0,data) {
853 return "\n (empty)\n ";
856 buffer += "<td class='code required'>";
857 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
858 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
859 buffer += escapeExpression(stack1)
861 stack1 = helpers['if'].call(depth0, depth0.isBody, {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data),data:data});
862 if(stack1 || stack1 === 0) { buffer += stack1; }
863 buffer += "\n</td>\n<td>";
864 if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
865 else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
866 if(stack1 || stack1 === 0) { buffer += stack1; }
867 buffer += "</td>\n<td>";
868 if (stack1 = helpers.paramType) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
869 else { stack1 = depth0.paramType; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
870 if(stack1 || stack1 === 0) { buffer += stack1; }
871 buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n";
877 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
878 templates['param_required'] = template(function (Handlebars,depth0,helpers,partials,data) {
879 this.compilerInfo = [4,'>= 1.0.0'];
880 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
881 var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
883 function program1(depth0,data) {
885 var buffer = "", stack1;
887 stack1 = helpers['if'].call(depth0, depth0.isFile, {hash:{},inverse:self.program(4, program4, data),fn:self.program(2, program2, data),data:data});
888 if(stack1 || stack1 === 0) { buffer += stack1; }
892 function program2(depth0,data) {
894 var buffer = "", stack1;
895 buffer += "\n <input type=\"file\" name='";
896 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
897 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
898 buffer += escapeExpression(stack1)
903 function program4(depth0,data) {
905 var buffer = "", stack1;
907 stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(7, program7, data),fn:self.program(5, program5, data),data:data});
908 if(stack1 || stack1 === 0) { buffer += stack1; }
912 function program5(depth0,data) {
914 var buffer = "", stack1;
915 buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='";
916 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
917 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
918 buffer += escapeExpression(stack1)
920 if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
921 else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
922 buffer += escapeExpression(stack1)
927 function program7(depth0,data) {
929 var buffer = "", stack1;
930 buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='";
931 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
932 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
933 buffer += escapeExpression(stack1)
934 + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n ";
938 function program9(depth0,data) {
940 var buffer = "", stack1;
942 stack1 = helpers['if'].call(depth0, depth0.isFile, {hash:{},inverse:self.program(12, program12, data),fn:self.program(10, program10, data),data:data});
943 if(stack1 || stack1 === 0) { buffer += stack1; }
947 function program10(depth0,data) {
949 var buffer = "", stack1;
950 buffer += "\n <input class='parameter' class='required' type='file' name='";
951 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
952 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
953 buffer += escapeExpression(stack1)
958 function program12(depth0,data) {
960 var buffer = "", stack1;
962 stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(15, program15, data),fn:self.program(13, program13, data),data:data});
963 if(stack1 || stack1 === 0) { buffer += stack1; }
967 function program13(depth0,data) {
969 var buffer = "", stack1;
970 buffer += "\n <input class='parameter required' minlength='1' name='";
971 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
972 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
973 buffer += escapeExpression(stack1)
974 + "' placeholder='(required)' type='text' value='";
975 if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
976 else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
977 buffer += escapeExpression(stack1)
982 function program15(depth0,data) {
984 var buffer = "", stack1;
985 buffer += "\n <input class='parameter required' minlength='1' name='";
986 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
987 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
988 buffer += escapeExpression(stack1)
989 + "' placeholder='(required)' type='text' value=''/>\n ";
993 buffer += "<td class='code required'>";
994 if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
995 else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
996 buffer += escapeExpression(stack1)
998 stack1 = helpers['if'].call(depth0, depth0.isBody, {hash:{},inverse:self.program(9, program9, data),fn:self.program(1, program1, data),data:data});
999 if(stack1 || stack1 === 0) { buffer += stack1; }
1000 buffer += "\n</td>\n<td>\n <strong>";
1001 if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1002 else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1003 if(stack1 || stack1 === 0) { buffer += stack1; }
1004 buffer += "</strong>\n</td>\n<td>";
1005 if (stack1 = helpers.paramType) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1006 else { stack1 = depth0.paramType; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1007 if(stack1 || stack1 === 0) { buffer += stack1; }
1008 buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1014 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1015 templates['parameter_content_type'] = template(function (Handlebars,depth0,helpers,partials,data) {
1016 this.compilerInfo = [4,'>= 1.0.0'];
1017 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1018 var buffer = "", stack1, functionType="function", self=this;
1020 function program1(depth0,data) {
1022 var buffer = "", stack1;
1024 stack1 = helpers.each.call(depth0, depth0.consumes, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
1025 if(stack1 || stack1 === 0) { buffer += stack1; }
1029 function program2(depth0,data) {
1031 var buffer = "", stack1;
1032 buffer += "\n <option value=\"";
1033 stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
1034 if(stack1 || stack1 === 0) { buffer += stack1; }
1036 stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
1037 if(stack1 || stack1 === 0) { buffer += stack1; }
1038 buffer += "</option>\n ";
1042 function program4(depth0,data) {
1045 return "\n <option value=\"application/json\">application/json</option>\n";
1048 buffer += "<label for=\"parameterContentType\"></label>\n<select name=\"parameterContentType\">\n";
1049 stack1 = helpers['if'].call(depth0, depth0.consumes, {hash:{},inverse:self.program(4, program4, data),fn:self.program(1, program1, data),data:data});
1050 if(stack1 || stack1 === 0) { buffer += stack1; }
1051 buffer += "\n</select>\n";
1057 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1058 templates['resource'] = template(function (Handlebars,depth0,helpers,partials,data) {
1059 this.compilerInfo = [4,'>= 1.0.0'];
1060 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1061 var buffer = "", stack1, options, functionType="function", escapeExpression=this.escapeExpression, self=this, blockHelperMissing=helpers.blockHelperMissing;
1063 function program1(depth0,data) {
1069 buffer += "<div class='heading'>\n <h2>\n <a href='#!/";
1070 if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1071 else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1072 buffer += escapeExpression(stack1)
1073 + "' onclick=\"Docs.toggleEndpointListForResource('";
1074 if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1075 else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1076 buffer += escapeExpression(stack1)
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)
1082 options = {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data};
1083 if (stack1 = helpers.description) { stack1 = stack1.call(depth0, options); }
1084 else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1085 if (!helpers.description) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
1086 if(stack1 || stack1 === 0) { buffer += stack1; }
1087 if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1088 else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1089 if(stack1 || stack1 === 0) { buffer += stack1; }
1090 buffer += "\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/";
1091 if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1092 else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1093 buffer += escapeExpression(stack1)
1094 + "' id='endpointListTogger_";
1095 if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1096 else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1097 buffer += escapeExpression(stack1)
1098 + "'\n onclick=\"Docs.toggleEndpointListForResource('";
1099 if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1100 else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1101 buffer += escapeExpression(stack1)
1102 + "');\">Show/Hide</a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.collapseOperationsForResource('";
1103 if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1104 else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1105 buffer += escapeExpression(stack1)
1106 + "'); return false;\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.expandOperationsForResource('";
1107 if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1108 else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1109 buffer += escapeExpression(stack1)
1110 + "'); return false;\">\n Expand Operations\n </a>\n </li>\n <li>\n <a href='";
1111 if (stack1 = helpers.url) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1112 else { stack1 = depth0.url; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1113 buffer += escapeExpression(stack1)
1114 + "'>Raw</a>\n </li>\n </ul>\n</div>\n<ul class='endpoints' id='";
1115 if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1116 else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1117 buffer += escapeExpression(stack1)
1118 + "_endpoint_list' style='display:none'>\n\n</ul>\n";
1124 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1125 templates['response_content_type'] = template(function (Handlebars,depth0,helpers,partials,data) {
1126 this.compilerInfo = [4,'>= 1.0.0'];
1127 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1128 var buffer = "", stack1, functionType="function", self=this;
1130 function program1(depth0,data) {
1132 var buffer = "", stack1;
1134 stack1 = helpers.each.call(depth0, depth0.produces, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
1135 if(stack1 || stack1 === 0) { buffer += stack1; }
1139 function program2(depth0,data) {
1141 var buffer = "", stack1;
1142 buffer += "\n <option value=\"";
1143 stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
1144 if(stack1 || stack1 === 0) { buffer += stack1; }
1146 stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
1147 if(stack1 || stack1 === 0) { buffer += stack1; }
1148 buffer += "</option>\n ";
1152 function program4(depth0,data) {
1155 return "\n <option value=\"application/json\">application/json</option>\n";
1158 buffer += "<label for=\"responseContentType\"></label>\n<select name=\"responseContentType\">\n";
1159 stack1 = helpers['if'].call(depth0, depth0.produces, {hash:{},inverse:self.program(4, program4, data),fn:self.program(1, program1, data),data:data});
1160 if(stack1 || stack1 === 0) { buffer += stack1; }
1161 buffer += "\n</select>\n";
1167 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1168 templates['signature'] = template(function (Handlebars,depth0,helpers,partials,data) {
1169 this.compilerInfo = [4,'>= 1.0.0'];
1170 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1171 var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
1174 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 ";
1175 if (stack1 = helpers.signature) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1176 else { stack1 = depth0.signature; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1177 if(stack1 || stack1 === 0) { buffer += stack1; }
1178 buffer += "\n </div>\n\n <div class=\"snippet\">\n <pre><code>";
1179 if (stack1 = helpers.sampleJSON) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1180 else { stack1 = depth0.sampleJSON; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1181 buffer += escapeExpression(stack1)
1182 + "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
1188 var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1189 templates['status_code'] = template(function (Handlebars,depth0,helpers,partials,data) {
1190 this.compilerInfo = [4,'>= 1.0.0'];
1191 helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1192 var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
1195 buffer += "<td width='15%' class='code'>";
1196 if (stack1 = helpers.code) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1197 else { stack1 = depth0.code; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1198 buffer += escapeExpression(stack1)
1200 if (stack1 = helpers.message) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1201 else { stack1 = depth0.message; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1202 if(stack1 || stack1 === 0) { buffer += stack1; }
1203 buffer += "</td>\n";
1210 // Generated by CoffeeScript 1.6.3
1212 var ContentTypeView, HeaderView, MainView, OperationView, ParameterContentTypeView, ParameterView, ResourceView, ResponseContentTypeView, SignatureView, StatusCodeView, SwaggerUi, _ref, _ref1, _ref10, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9,
1213 __hasProp = {}.hasOwnProperty,
1214 __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; };
1216 SwaggerUi = (function(_super) {
1217 __extends(SwaggerUi, _super);
1219 function SwaggerUi() {
1220 _ref = SwaggerUi.__super__.constructor.apply(this, arguments);
1224 SwaggerUi.prototype.dom_id = "swagger_ui";
1226 SwaggerUi.prototype.options = null;
1228 SwaggerUi.prototype.api = null;
1230 SwaggerUi.prototype.headerView = null;
1232 SwaggerUi.prototype.mainView = null;
1234 SwaggerUi.prototype.initialize = function(options) {
1236 if (options == null) {
1239 if (options.dom_id != null) {
1240 this.dom_id = options.dom_id;
1241 delete options.dom_id;
1243 if ($('#' + this.dom_id) == null) {
1244 $('body').append('<div id="' + this.dom_id + '"></div>');
1246 this.options = options;
1247 this.options.success = function() {
1248 return _this.render();
1250 this.options.progress = function(d) {
1251 return _this.showMessage(d);
1253 this.options.failure = function(d) {
1254 return _this.onLoadFailure(d);
1256 this.headerView = new HeaderView({
1259 return this.headerView.on('update-swagger-ui', function(data) {
1260 return _this.updateSwaggerUi(data);
1264 SwaggerUi.prototype.updateSwaggerUi = function(data) {
1265 this.options.url = data.url;
1269 SwaggerUi.prototype.load = function() {
1271 if ((_ref1 = this.mainView) != null) {
1274 url = this.options.url;
1275 if (url.indexOf("http") !== 0) {
1276 url = this.buildUrl(window.location.href.toString(), url);
1278 this.options.url = url;
1279 this.headerView.update(url);
1280 this.api = new SwaggerApi(this.options);
1285 SwaggerUi.prototype.render = function() {
1287 this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
1288 this.mainView = new MainView({
1290 el: $('#' + this.dom_id)
1293 switch (this.options.docExpansion) {
1295 Docs.expandOperationsForResource('');
1298 Docs.collapseOperationsForResource('');
1300 if (this.options.onComplete) {
1301 this.options.onComplete(this.api, this);
1303 return setTimeout(function() {
1304 return Docs.shebang();
1308 SwaggerUi.prototype.buildUrl = function(base, url) {
1309 var endOfPath, parts;
1310 log("base is " + base);
1311 if (url.indexOf("/") === 0) {
1312 parts = base.split("/");
1313 base = parts[0] + "//" + parts[2];
1316 endOfPath = base.length;
1317 if (base.indexOf("?") > -1) {
1318 endOfPath = Math.min(endOfPath, base.indexOf("?"));
1320 if (base.indexOf("#") > -1) {
1321 endOfPath = Math.min(endOfPath, base.indexOf("#"));
1323 base = base.substring(0, endOfPath);
1324 if (base.indexOf("/", base.length - 1) !== -1) {
1327 return base + "/" + url;
1331 SwaggerUi.prototype.showMessage = function(data) {
1335 $('#message-bar').removeClass('message-fail');
1336 $('#message-bar').addClass('message-success');
1337 return $('#message-bar').html(data);
1340 SwaggerUi.prototype.onLoadFailure = function(data) {
1345 $('#message-bar').removeClass('message-success');
1346 $('#message-bar').addClass('message-fail');
1347 val = $('#message-bar').html(data);
1348 if (this.options.onFailure != null) {
1349 this.options.onFailure(data);
1356 })(Backbone.Router);
1358 window.SwaggerUi = SwaggerUi;
1360 HeaderView = (function(_super) {
1361 __extends(HeaderView, _super);
1363 function HeaderView() {
1364 _ref1 = HeaderView.__super__.constructor.apply(this, arguments);
1368 HeaderView.prototype.events = {
1369 'click #show-pet-store-icon': 'showPetStore',
1370 'click #show-wordnik-dev-icon': 'showWordnikDev',
1371 'click #explore': 'showCustom',
1372 'keyup #input_baseUrl': 'showCustomOnKeyup',
1373 'keyup #input_apiKey': 'showCustomOnKeyup'
1376 HeaderView.prototype.initialize = function() {};
1378 HeaderView.prototype.showPetStore = function(e) {
1379 return this.trigger('update-swagger-ui', {
1380 url: "http://petstore.swagger.wordnik.com/api/api-docs"
1384 HeaderView.prototype.showWordnikDev = function(e) {
1385 return this.trigger('update-swagger-ui', {
1386 url: "http://api.wordnik.com/v4/resources.json"
1390 HeaderView.prototype.showCustomOnKeyup = function(e) {
1391 if (e.keyCode === 13) {
1392 return this.showCustom();
1396 HeaderView.prototype.showCustom = function(e) {
1400 return this.trigger('update-swagger-ui', {
1401 url: $('#input_baseUrl').val(),
1402 apiKey: $('#input_apiKey').val()
1406 HeaderView.prototype.update = function(url, apiKey, trigger) {
1407 if (trigger == null) {
1410 $('#input_baseUrl').val(url);
1412 return this.trigger('update-swagger-ui', {
1422 MainView = (function(_super) {
1423 __extends(MainView, _super);
1425 function MainView() {
1426 _ref2 = MainView.__super__.constructor.apply(this, arguments);
1430 MainView.prototype.initialize = function() {};
1432 MainView.prototype.render = function() {
1433 var counter, id, resource, resources, _i, _len, _ref3;
1434 $(this.el).html(Handlebars.templates.main(this.model));
1437 _ref3 = this.model.apisArray;
1438 for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
1439 resource = _ref3[_i];
1441 while (typeof resources[id] !== 'undefined') {
1442 id = id + "_" + counter;
1446 resources[id] = resource;
1447 this.addResource(resource);
1452 MainView.prototype.addResource = function(resource) {
1454 resourceView = new ResourceView({
1457 id: 'resource_' + resource.id,
1458 className: 'resource'
1460 return $('#resources').append(resourceView.render().el);
1463 MainView.prototype.clear = function() {
1464 return $(this.el).html('');
1471 ResourceView = (function(_super) {
1472 __extends(ResourceView, _super);
1474 function ResourceView() {
1475 _ref3 = ResourceView.__super__.constructor.apply(this, arguments);
1479 ResourceView.prototype.initialize = function() {};
1481 ResourceView.prototype.render = function() {
1482 var counter, id, methods, operation, _i, _len, _ref4;
1483 $(this.el).html(Handlebars.templates.resource(this.model));
1485 _ref4 = this.model.operationsArray;
1486 for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
1487 operation = _ref4[_i];
1489 id = operation.nickname;
1490 while (typeof methods[id] !== 'undefined') {
1491 id = id + "_" + counter;
1494 methods[id] = operation;
1495 operation.nickname = id;
1496 operation.parentId = this.model.id;
1497 this.addOperation(operation);
1502 ResourceView.prototype.addOperation = function(operation) {
1504 operation.number = this.number;
1505 operationView = new OperationView({
1508 className: 'endpoint'
1510 $('.endpoints', $(this.el)).append(operationView.render().el);
1511 return this.number++;
1514 return ResourceView;
1518 OperationView = (function(_super) {
1519 __extends(OperationView, _super);
1521 function OperationView() {
1522 _ref4 = OperationView.__super__.constructor.apply(this, arguments);
1526 OperationView.prototype.invocationUrl = null;
1528 OperationView.prototype.events = {
1529 'submit .sandbox': 'submitOperation',
1530 'click .submit': 'submitOperation',
1531 'click .response_hider': 'hideResponse',
1532 'click .toggleOperation': 'toggleOperationContent',
1533 'mouseenter .api-ic': 'mouseEnter',
1534 'mouseout .api-ic': 'mouseExit'
1537 OperationView.prototype.initialize = function() {};
1539 OperationView.prototype.mouseEnter = function(e) {
1540 var elem, hgh, pos, scMaxX, scMaxY, scX, scY, wd, x, y;
1541 elem = $(e.currentTarget.parentNode).find('#api_information_panel');
1544 scX = $(window).scrollLeft();
1545 scY = $(window).scrollTop();
1546 scMaxX = scX + $(window).width();
1547 scMaxY = scY + $(window).height();
1549 hgh = elem.height();
1550 if (x + wd > scMaxX) {
1556 if (y + hgh > scMaxY) {
1566 return $(e.currentTarget.parentNode).find('#api_information_panel').show();
1569 OperationView.prototype.mouseExit = function(e) {
1570 return $(e.currentTarget.parentNode).find('#api_information_panel').hide();
1573 OperationView.prototype.render = function() {
1574 var contentTypeModel, isMethodSubmissionSupported, k, o, param, responseContentTypeView, responseSignatureView, signatureModel, statusCode, type, v, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref5, _ref6, _ref7, _ref8;
1575 isMethodSubmissionSupported = true;
1576 if (!isMethodSubmissionSupported) {
1577 this.model.isReadOnly = true;
1579 this.model.oauth = null;
1580 if (this.model.authorizations) {
1581 _ref5 = this.model.authorizations;
1584 if (k === "oauth2") {
1585 if (this.model.oauth === null) {
1586 this.model.oauth = {};
1588 if (this.model.oauth.scopes === void 0) {
1589 this.model.oauth.scopes = [];
1591 for (_i = 0, _len = v.length; _i < _len; _i++) {
1593 this.model.oauth.scopes.push(o);
1598 $(this.el).html(Handlebars.templates.operation(this.model));
1599 if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
1601 sampleJSON: this.model.responseSampleJSON,
1603 signature: this.model.responseClassSignature
1605 responseSignatureView = new SignatureView({
1606 model: signatureModel,
1609 $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
1611 $('.model-signature', $(this.el)).html(this.model.type);
1613 contentTypeModel = {
1616 contentTypeModel.consumes = this.model.consumes;
1617 contentTypeModel.produces = this.model.produces;
1618 _ref6 = this.model.parameters;
1619 for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
1621 type = param.type || param.dataType;
1622 if (type.toLowerCase() === 'file') {
1623 if (!contentTypeModel.consumes) {
1624 log("set content type ");
1625 contentTypeModel.consumes = 'multipart/form-data';
1629 responseContentTypeView = new ResponseContentTypeView({
1630 model: contentTypeModel
1632 $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
1633 _ref7 = this.model.parameters;
1634 for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) {
1636 this.addParameter(param, contentTypeModel.consumes);
1638 _ref8 = this.model.responseMessages;
1639 for (_l = 0, _len3 = _ref8.length; _l < _len3; _l++) {
1640 statusCode = _ref8[_l];
1641 this.addStatusCode(statusCode);
1646 OperationView.prototype.addParameter = function(param, consumes) {
1648 param.consumes = consumes;
1649 paramView = new ParameterView({
1652 readOnly: this.model.isReadOnly
1654 return $('.operation-params', $(this.el)).append(paramView.render().el);
1657 OperationView.prototype.addStatusCode = function(statusCode) {
1659 statusCodeView = new StatusCodeView({
1663 return $('.operation-status', $(this.el)).append(statusCodeView.render().el);
1666 OperationView.prototype.submitOperation = function(e) {
1667 var error_free, form, isFileUpload, map, o, opts, val, _i, _j, _k, _len, _len1, _len2, _ref5, _ref6, _ref7;
1671 form = $('.sandbox', $(this.el));
1673 form.find("input.required").each(function() {
1675 $(this).removeClass("error");
1676 if (jQuery.trim($(this).val()) === "") {
1677 $(this).addClass("error");
1679 callback: function() {
1680 return $(_this).focus();
1683 return error_free = false;
1691 isFileUpload = false;
1692 _ref5 = form.find("input");
1693 for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
1695 if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1696 map[o.name] = o.value;
1698 if (o.type === "file") {
1699 isFileUpload = true;
1702 _ref6 = form.find("textarea");
1703 for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
1705 if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1706 map["body"] = o.value;
1709 _ref7 = form.find("select");
1710 for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) {
1712 val = this.getSelectedValue(o);
1713 if ((val != null) && jQuery.trim(val).length > 0) {
1717 opts.responseContentType = $("div select[name=responseContentType]", $(this.el)).val();
1718 opts.requestContentType = $("div select[name=parameterContentType]", $(this.el)).val();
1719 $(".response_throbber", $(this.el)).show();
1721 return this.handleFileUpload(map, form);
1723 return this.model["do"](map, opts, this.showCompleteStatus, this.showErrorStatus, this);
1728 OperationView.prototype.success = function(response, parent) {
1729 return parent.showCompleteStatus(response);
1732 OperationView.prototype.handleFileUpload = function(map, form) {
1733 var bodyParam, el, headerParams, o, obj, param, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref5, _ref6, _ref7, _ref8,
1735 log("it's a file upload");
1736 _ref5 = form.serializeArray();
1737 for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
1739 if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1740 map[o.name] = o.value;
1743 bodyParam = new FormData();
1744 _ref6 = this.model.parameters;
1745 for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
1747 if (param.paramType === 'form') {
1748 if (map[param.name] !== void 0) {
1749 bodyParam.append(param.name, map[param.name]);
1754 _ref7 = this.model.parameters;
1755 for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) {
1757 if (param.paramType === 'header') {
1758 headerParams[param.name] = map[param.name];
1762 _ref8 = form.find('input[type~="file"]');
1763 for (_l = 0, _len3 = _ref8.length; _l < _len3; _l++) {
1765 bodyParam.append($(el).attr('name'), el.files[0]);
1768 this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), this.model.urlify(map, false)) : this.model.urlify(map, true);
1769 $(".request_url", $(this.el)).html("<pre>" + this.invocationUrl + "</pre>");
1771 type: this.model.method,
1772 url: this.invocationUrl,
1773 headers: headerParams,
1778 error: function(data, textStatus, error) {
1779 return _this.showErrorStatus(_this.wrap(data), _this);
1781 success: function(data) {
1782 return _this.showResponse(data, _this);
1784 complete: function(data) {
1785 return _this.showCompleteStatus(_this.wrap(data), _this);
1788 if (window.authorizations) {
1789 window.authorizations.apply(obj);
1795 OperationView.prototype.wrap = function(data) {
1796 var h, headerArray, headers, i, o, _i, _len;
1798 headerArray = data.getAllResponseHeaders().split("\r");
1799 for (_i = 0, _len = headerArray.length; _i < _len; _i++) {
1800 i = headerArray[_i];
1802 if (h[0] !== void 0 && h[1] !== void 0) {
1803 headers[h[0].trim()] = h[1].trim();
1808 o.content.data = data.responseText;
1809 o.headers = headers;
1811 o.request.url = this.invocationUrl;
1812 o.status = data.status;
1816 OperationView.prototype.getSelectedValue = function(select) {
1817 var opt, options, _i, _len, _ref5;
1818 if (!select.multiple) {
1819 return select.value;
1822 _ref5 = select.options;
1823 for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
1826 options.push(opt.value);
1829 if (options.length > 0) {
1830 return options.join(",");
1837 OperationView.prototype.hideResponse = function(e) {
1841 $(".response", $(this.el)).slideUp();
1842 return $(".response_hider", $(this.el)).fadeOut();
1845 OperationView.prototype.showResponse = function(response) {
1847 prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>");
1848 return $(".response_body", $(this.el)).html(escape(prettyJson));
1851 OperationView.prototype.showErrorStatus = function(data, parent) {
1852 return parent.showStatus(data);
1855 OperationView.prototype.showCompleteStatus = function(data, parent) {
1856 return parent.showStatus(data);
1859 OperationView.prototype.formatXml = function(xml) {
1860 var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
1861 reg = /(>)(<)(\/*)/g;
1862 wsexp = /[ ]*(.*)[ ]+\n/g;
1863 contexp = /(<.+>)(.+\n)/g;
1864 xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
1867 lines = xml.split('\n');
1871 'single->single': 0,
1872 'single->closing': -1,
1873 'single->opening': 0,
1875 'closing->single': 0,
1876 'closing->closing': -1,
1877 'closing->opening': 0,
1878 'closing->other': 0,
1879 'opening->single': 1,
1880 'opening->closing': 0,
1881 'opening->opening': 1,
1882 'opening->other': 1,
1884 'other->closing': -1,
1885 'other->opening': 0,
1888 _fn = function(ln) {
1889 var fromTo, j, key, padding, type, types, value;
1891 single: Boolean(ln.match(/<.+\/>/)),
1892 closing: Boolean(ln.match(/<\/.+>/)),
1893 opening: Boolean(ln.match(/<[^!?].*>/))
1895 type = ((function() {
1898 for (key in types) {
1906 type = type === void 0 ? 'other' : type;
1907 fromTo = lastType + '->' + type;
1910 indent += transitions[fromTo];
1911 padding = ((function() {
1912 var _j, _ref5, _results;
1914 for (j = _j = 0, _ref5 = indent; 0 <= _ref5 ? _j < _ref5 : _j > _ref5; j = 0 <= _ref5 ? ++_j : --_j) {
1919 if (fromTo === 'opening->closing') {
1920 return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
1922 return formatted += padding + ln + '\n';
1925 for (_i = 0, _len = lines.length; _i < _len; _i++) {
1932 OperationView.prototype.showStatus = function(response) {
1933 var code, content, contentType, headers, pre, response_body, url;
1934 if (response.content === void 0) {
1935 content = response.data;
1938 content = response.content.data;
1939 url = response.request.url;
1941 headers = response.headers;
1942 contentType = headers && headers["Content-Type"] ? headers["Content-Type"].split(";")[0].trim() : null;
1944 code = $('<code />').text("no content");
1945 pre = $('<pre class="json" />').append(code);
1946 } else if (contentType === "application/json" || /\+json$/.test(contentType)) {
1947 code = $('<code />').text(JSON.stringify(JSON.parse(content), null, " "));
1948 pre = $('<pre class="json" />').append(code);
1949 } else if (contentType === "application/xml" || /\+xml$/.test(contentType)) {
1950 code = $('<code />').text(this.formatXml(content));
1951 pre = $('<pre class="xml" />').append(code);
1952 } else if (contentType === "text/html") {
1953 code = $('<code />').html(content);
1954 pre = $('<pre class="xml" />').append(code);
1955 } else if (/^image\//.test(contentType)) {
1956 pre = $('<img>').attr('src', url);
1958 code = $('<code />').text(content);
1959 pre = $('<pre class="json" />').append(code);
1961 response_body = pre;
1962 $(".request_url", $(this.el)).html("<pre>" + url + "</pre>");
1963 $(".response_code", $(this.el)).html("<pre>" + response.status + "</pre>");
1964 $(".response_body", $(this.el)).html(response_body);
1965 $(".response_headers", $(this.el)).html("<pre>" + JSON.stringify(response.headers, null, " ").replace(/\n/g, "<br>") + "</pre>");
1966 $(".response", $(this.el)).slideDown();
1967 $(".response_hider", $(this.el)).show();
1968 $(".response_throbber", $(this.el)).hide();
1969 return hljs.highlightBlock($('.response_body', $(this.el))[0]);
1972 OperationView.prototype.toggleOperationContent = function() {
1974 elem = $('#' + Docs.escapeResourceName(this.model.parentId) + "_" + this.model.nickname + "_content");
1975 if (elem.is(':visible')) {
1976 return Docs.collapseOperation(elem);
1978 return Docs.expandOperation(elem);
1982 return OperationView;
1986 StatusCodeView = (function(_super) {
1987 __extends(StatusCodeView, _super);
1989 function StatusCodeView() {
1990 _ref5 = StatusCodeView.__super__.constructor.apply(this, arguments);
1994 StatusCodeView.prototype.initialize = function() {};
1996 StatusCodeView.prototype.render = function() {
1998 template = this.template();
1999 $(this.el).html(template(this.model));
2003 StatusCodeView.prototype.template = function() {
2004 return Handlebars.templates.status_code;
2007 return StatusCodeView;
2011 ParameterView = (function(_super) {
2012 __extends(ParameterView, _super);
2014 function ParameterView() {
2015 _ref6 = ParameterView.__super__.constructor.apply(this, arguments);
2019 ParameterView.prototype.initialize = function() {
2020 return Handlebars.registerHelper('isArray', function(param, opts) {
2021 if (param.type.toLowerCase() === 'array' || param.allowMultiple) {
2022 return opts.fn(this);
2024 return opts.inverse(this);
2029 ParameterView.prototype.render = function() {
2030 var contentTypeModel, isParam, parameterContentTypeView, responseContentTypeView, signatureModel, signatureView, template, type;
2031 type = this.model.type || this.model.dataType;
2032 if (this.model.paramType === 'body') {
2033 this.model.isBody = true;
2035 if (type.toLowerCase() === 'file') {
2036 this.model.isFile = true;
2038 template = this.template();
2039 $(this.el).html(template(this.model));
2041 sampleJSON: this.model.sampleJSON,
2043 signature: this.model.signature
2045 if (this.model.sampleJSON) {
2046 signatureView = new SignatureView({
2047 model: signatureModel,
2050 $('.model-signature', $(this.el)).append(signatureView.render().el);
2052 $('.model-signature', $(this.el)).html(this.model.signature);
2055 if (this.model.isBody) {
2058 contentTypeModel = {
2061 contentTypeModel.consumes = this.model.consumes;
2063 parameterContentTypeView = new ParameterContentTypeView({
2064 model: contentTypeModel
2066 $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el);
2068 responseContentTypeView = new ResponseContentTypeView({
2069 model: contentTypeModel
2071 $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
2076 ParameterView.prototype.template = function() {
2077 if (this.model.isList) {
2078 return Handlebars.templates.param_list;
2080 if (this.options.readOnly) {
2081 if (this.model.required) {
2082 return Handlebars.templates.param_readonly_required;
2084 return Handlebars.templates.param_readonly;
2087 if (this.model.required) {
2088 return Handlebars.templates.param_required;
2090 return Handlebars.templates.param;
2096 return ParameterView;
2100 SignatureView = (function(_super) {
2101 __extends(SignatureView, _super);
2103 function SignatureView() {
2104 _ref7 = SignatureView.__super__.constructor.apply(this, arguments);
2108 SignatureView.prototype.events = {
2109 'click a.description-link': 'switchToDescription',
2110 'click a.snippet-link': 'switchToSnippet',
2111 'mousedown .snippet': 'snippetToTextArea'
2114 SignatureView.prototype.initialize = function() {};
2116 SignatureView.prototype.render = function() {
2118 template = this.template();
2119 $(this.el).html(template(this.model));
2120 this.switchToDescription();
2121 this.isParam = this.model.isParam;
2123 $('.notice', $(this.el)).text('Click to set as parameter value');
2128 SignatureView.prototype.template = function() {
2129 return Handlebars.templates.signature;
2132 SignatureView.prototype.switchToDescription = function(e) {
2136 $(".snippet", $(this.el)).hide();
2137 $(".description", $(this.el)).show();
2138 $('.description-link', $(this.el)).addClass('selected');
2139 return $('.snippet-link', $(this.el)).removeClass('selected');
2142 SignatureView.prototype.switchToSnippet = function(e) {
2146 $(".description", $(this.el)).hide();
2147 $(".snippet", $(this.el)).show();
2148 $('.snippet-link', $(this.el)).addClass('selected');
2149 return $('.description-link', $(this.el)).removeClass('selected');
2152 SignatureView.prototype.snippetToTextArea = function(e) {
2158 textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
2159 if ($.trim(textArea.val()) === '') {
2160 return textArea.val(this.model.sampleJSON);
2165 return SignatureView;
2169 ContentTypeView = (function(_super) {
2170 __extends(ContentTypeView, _super);
2172 function ContentTypeView() {
2173 _ref8 = ContentTypeView.__super__.constructor.apply(this, arguments);
2177 ContentTypeView.prototype.initialize = function() {};
2179 ContentTypeView.prototype.render = function() {
2181 template = this.template();
2182 $(this.el).html(template(this.model));
2183 $('label[for=contentType]', $(this.el)).text('Response Content Type');
2187 ContentTypeView.prototype.template = function() {
2188 return Handlebars.templates.content_type;
2191 return ContentTypeView;
2195 ResponseContentTypeView = (function(_super) {
2196 __extends(ResponseContentTypeView, _super);
2198 function ResponseContentTypeView() {
2199 _ref9 = ResponseContentTypeView.__super__.constructor.apply(this, arguments);
2203 ResponseContentTypeView.prototype.initialize = function() {};
2205 ResponseContentTypeView.prototype.render = function() {
2207 template = this.template();
2208 $(this.el).html(template(this.model));
2209 $('label[for=responseContentType]', $(this.el)).text('Response Content Type');
2213 ResponseContentTypeView.prototype.template = function() {
2214 return Handlebars.templates.response_content_type;
2217 return ResponseContentTypeView;
2221 ParameterContentTypeView = (function(_super) {
2222 __extends(ParameterContentTypeView, _super);
2224 function ParameterContentTypeView() {
2225 _ref10 = ParameterContentTypeView.__super__.constructor.apply(this, arguments);
2229 ParameterContentTypeView.prototype.initialize = function() {};
2231 ParameterContentTypeView.prototype.render = function() {
2233 template = this.template();
2234 $(this.el).html(template(this.model));
2235 $('label[for=parameterContentType]', $(this.el)).text('Parameter content type:');
2239 ParameterContentTypeView.prototype.template = function() {
2240 return Handlebars.templates.parameter_content_type;
2243 return ParameterContentTypeView;