2 * swagger-ui - Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API
4 * @link http://swagger.io
9 // Helper function for vertically aligning DOM elements
10 // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
11 $.fn.vAlign = function() {
12 return this.each(function(i){
13 var ah = $(this).height();
14 var ph = $(this).parent().height();
15 var mh = (ph - ah) / 2;
16 $(this).css('margin-top', mh);
20 $.fn.stretchFormtasticInputWidthToParent = function() {
21 return this.each(function(i){
22 var p_width = $(this).closest("form").innerWidth();
23 var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10);
24 var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
25 $(this).css('width', p_width - p_padding - this_padding);
29 $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
31 // Vertically center these paragraphs
32 // Parent may need a min-height for this to work..
33 $('ul.downplayed li div.content p').vAlign();
35 // When a sandbox form is submitted..
36 $("form.sandbox").submit(function(){
38 var error_free = true;
40 // Cycle through the forms required inputs
41 $(this).find("input.required").each(function() {
43 // Remove any existing error styles from the input
44 $(this).removeClass('error');
46 // Tack the error style on if the input is empty..
47 if ($(this).val() == '') {
48 $(this).addClass('error');
60 function clippyCopiedCallback(a) {
61 $('#api_key_copied').fadeIn().delay(1000).fadeOut();
63 // var b = $("#clippy_tooltip_" + a);
64 // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
65 // b.attr("title", "copy to clipboard")
70 // Logging function that accounts for browsers that don't have window.console
72 log.history = log.history || [];
73 log.history.push(arguments);
75 console.log( Array.prototype.slice.call(arguments)[0] );
79 // Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
80 if (Function.prototype.bind && console && typeof console.log == "object") {
82 "log","info","warn","error","assert","dir","clear","profile","profileEnd"
83 ].forEach(function (method) {
84 console[method] = this.bind(console[method], console);
85 }, Function.prototype.call);
92 // If shebang has an operation nickname in it..
93 // e.g. /docs/#!/words/get_search
94 var fragments = $.param.fragment().split('/');
95 fragments.shift(); // get rid of the bang
97 switch (fragments.length) {
99 // Expand all operations for the resource and scroll to it
100 var dom_id = 'resource_' + fragments[0];
102 Docs.expandEndpointListForResource(fragments[0]);
103 $("#"+dom_id).slideto({highlight: false});
106 // Refer to the endpoint DOM element, e.g. #words_get_search
109 Docs.expandEndpointListForResource(fragments[0]);
110 $("#"+dom_id).slideto({highlight: false});
113 var li_dom_id = fragments.join('_');
114 var li_content_dom_id = li_dom_id + "_content";
117 Docs.expandOperation($('#'+li_content_dom_id));
118 $('#'+li_dom_id).slideto({highlight: false});
124 toggleEndpointListForResource: function(resource) {
125 var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
126 if (elem.is(':visible')) {
127 Docs.collapseEndpointListForResource(resource);
129 Docs.expandEndpointListForResource(resource);
134 expandEndpointListForResource: function(resource) {
135 var resource = Docs.escapeResourceName(resource);
136 if (resource == '') {
137 $('.resource ul.endpoints').slideDown();
141 $('li#resource_' + resource).addClass('active');
143 var elem = $('li#resource_' + resource + ' ul.endpoints');
147 // Collapse resource and mark as explicitly closed
148 collapseEndpointListForResource: function(resource) {
149 var resource = Docs.escapeResourceName(resource);
150 if (resource == '') {
151 $('.resource ul.endpoints').slideUp();
155 $('li#resource_' + resource).removeClass('active');
157 var elem = $('li#resource_' + resource + ' ul.endpoints');
161 expandOperationsForResource: function(resource) {
162 // Make sure the resource container is open..
163 Docs.expandEndpointListForResource(resource);
165 if (resource == '') {
166 $('.resource ul.endpoints li.operation div.content').slideDown();
170 $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
171 Docs.expandOperation($(this));
175 collapseOperationsForResource: function(resource) {
176 // Make sure the resource container is open..
177 Docs.expandEndpointListForResource(resource);
179 if (resource == '') {
180 $('.resource ul.endpoints li.operation div.content').slideUp();
184 $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
185 Docs.collapseOperation($(this));
189 escapeResourceName: function(resource) {
190 return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
193 expandOperation: function(elem) {
197 collapseOperation: function(elem) {
202 this["Handlebars"] = this["Handlebars"] || {};
203 this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
204 this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
205 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
206 return "<!--div class='auth_button' id='apikey_button'><img class='auth_icon' alt='apply api key' src='images/apikey.jpeg'></div-->\n<div class='auth_container' id='apikey_container'>\n <div class='key_input_container'>\n <div class='auth_label'>"
207 + escapeExpression(((helper = (helper = helpers.keyName || (depth0 != null ? depth0.keyName : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"keyName","hash":{},"data":data}) : helper)))
208 + "</div>\n <input placeholder=\"api_key\" class=\"auth_input\" id=\"input_apiKey_entry\" name=\"apiKey\" type=\"text\"/>\n <div class='auth_submit'><a class='auth_submit_button' id=\"apply_api_key\" href=\"#\">apply</a></div>\n </div>\n</div>\n\n";
211 __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; },
212 __hasProp = {}.hasOwnProperty;
214 SwaggerUi = (function(_super) {
215 __extends(SwaggerUi, _super);
217 function SwaggerUi() {
218 return SwaggerUi.__super__.constructor.apply(this, arguments);
221 SwaggerUi.prototype.dom_id = "swagger_ui";
223 SwaggerUi.prototype.options = null;
225 SwaggerUi.prototype.api = null;
227 SwaggerUi.prototype.headerView = null;
229 SwaggerUi.prototype.mainView = null;
231 SwaggerUi.prototype.initialize = function(options) {
232 if (options == null) {
235 if (options.dom_id != null) {
236 this.dom_id = options.dom_id;
237 delete options.dom_id;
239 if (options.supportedSubmitMethods == null) {
240 options.supportedSubmitMethods = ['get', 'put', 'post', 'delete', 'head', 'options', 'patch'];
242 if ($('#' + this.dom_id) == null) {
243 $('body').append('<div id="' + this.dom_id + '"></div>');
245 this.options = options;
246 this.options.success = (function(_this) {
248 return _this.render();
251 this.options.progress = (function(_this) {
253 return _this.showMessage(d);
256 this.options.failure = (function(_this) {
258 return _this.onLoadFailure(d);
261 this.headerView = new HeaderView({
264 return this.headerView.on('update-swagger-ui', (function(_this) {
265 return function(data) {
266 return _this.updateSwaggerUi(data);
271 SwaggerUi.prototype.setOption = function(option, value) {
272 return this.options[option] = value;
275 SwaggerUi.prototype.getOption = function(option) {
276 return this.options[option];
279 SwaggerUi.prototype.updateSwaggerUi = function(data) {
280 this.options.url = data.url;
284 SwaggerUi.prototype.load = function() {
286 if ((_ref = this.mainView) != null) {
289 url = this.options.url;
290 if (url && url.indexOf("http") !== 0) {
291 url = this.buildUrl(window.location.href.toString(), url);
293 this.options.url = url;
294 this.headerView.update(url);
295 return this.api = new SwaggerClient(this.options);
298 SwaggerUi.prototype.collapseAll = function() {
299 return Docs.collapseEndpointListForResource('');
302 SwaggerUi.prototype.listAll = function() {
303 return Docs.collapseOperationsForResource('');
306 SwaggerUi.prototype.expandAll = function() {
307 return Docs.expandOperationsForResource('');
310 SwaggerUi.prototype.render = function() {
311 this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
312 this.mainView = new MainView({
314 el: $('#' + this.dom_id),
315 swaggerOptions: this.options
318 switch (this.options.docExpansion) {
326 if (this.options.onComplete) {
327 this.options.onComplete(this.api, this);
329 return setTimeout((function(_this) {
331 return Docs.shebang();
336 SwaggerUi.prototype.buildUrl = function(base, url) {
337 var endOfPath, parts;
338 if (url.indexOf("/") === 0) {
339 parts = base.split("/");
340 base = parts[0] + "//" + parts[2];
343 endOfPath = base.length;
344 if (base.indexOf("?") > -1) {
345 endOfPath = Math.min(endOfPath, base.indexOf("?"));
347 if (base.indexOf("#") > -1) {
348 endOfPath = Math.min(endOfPath, base.indexOf("#"));
350 base = base.substring(0, endOfPath);
351 if (base.indexOf("/", base.length - 1) !== -1) {
354 return base + "/" + url;
358 SwaggerUi.prototype.showMessage = function(data) {
362 $('#message-bar').removeClass('message-fail');
363 $('#message-bar').addClass('message-success');
364 return $('#message-bar').html(data);
367 SwaggerUi.prototype.onLoadFailure = function(data) {
372 $('#message-bar').removeClass('message-success');
373 $('#message-bar').addClass('message-fail');
374 val = $('#message-bar').html(data);
375 if (this.options.onFailure != null) {
376 this.options.onFailure(data);
381 SwaggerUi.prototype.renderGFM = function(data) {
385 return $('.markdown').each(function(index) {
386 return $(this).html(marked($(this).html()));
394 window.SwaggerUi = SwaggerUi;
396 this["Handlebars"]["templates"]["basic_auth_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
397 return "<div class='auth_button' id='basic_auth_button'><img class='auth_icon' src='images/password.jpeg'></div>\n<div class='auth_container' id='basic_auth_container'>\n <div class='key_input_container'>\n <div class=\"auth_label\">Username</div>\n <input placeholder=\"username\" class=\"auth_input\" id=\"input_username\" name=\"username\" type=\"text\"/>\n <div class=\"auth_label\">Password</div>\n <input placeholder=\"password\" class=\"auth_input\" id=\"input_password\" name=\"password\" type=\"password\"/>\n <div class='auth_submit'><a class='auth_submit_button' id=\"apply_basic_auth\" href=\"#\">apply</a></div>\n </div>\n</div>\n\n";
399 Handlebars.registerHelper('sanitize', function(html) {
400 html = html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
401 return new Handlebars.SafeString(html);
404 this["Handlebars"]["templates"]["content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
405 var stack1, buffer = "";
406 stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
407 if (stack1 != null) { buffer += stack1; }
409 },"2":function(depth0,helpers,partials,data) {
410 var stack1, lambda=this.lambda, buffer = " <option value=\"";
411 stack1 = lambda(depth0, depth0);
412 if (stack1 != null) { buffer += stack1; }
414 stack1 = lambda(depth0, depth0);
415 if (stack1 != null) { buffer += stack1; }
416 return buffer + "</option>\n";
417 },"4":function(depth0,helpers,partials,data) {
418 return " <option value=\"application/json\">application/json</option>\n";
419 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
420 var stack1, buffer = "<label for=\"contentType\"></label>\n<select name=\"contentType\">\n";
421 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
422 if (stack1 != null) { buffer += stack1; }
423 return buffer + "</select>\n";
426 __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; },
427 __hasProp = {}.hasOwnProperty;
429 ApiKeyButton = (function(_super) {
430 __extends(ApiKeyButton, _super);
432 function ApiKeyButton() {
433 return ApiKeyButton.__super__.constructor.apply(this, arguments);
436 ApiKeyButton.prototype.initialize = function() {};
438 ApiKeyButton.prototype.render = function() {
440 template = this.template();
441 $(this.el).html(template(this.model));
445 ApiKeyButton.prototype.events = {
446 "click #apikey_button": "toggleApiKeyContainer",
447 "click #apply_api_key": "applyApiKey"
450 ApiKeyButton.prototype.applyApiKey = function() {
452 window.authorizations.add(this.model.name, new ApiKeyAuthorization(this.model.name, $("#input_apiKey_entry").val(), this.model["in"]));
453 window.swaggerUi.load();
454 return elem = $('#apikey_container').show();
457 ApiKeyButton.prototype.toggleApiKeyContainer = function() {
459 if ($('#apikey_container').length > 0) {
460 elem = $('#apikey_container').first();
461 if (elem.is(':visible')) {
464 $('.auth_container').hide();
470 ApiKeyButton.prototype.template = function() {
471 return Handlebars.templates.apikey_button_view;
478 this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
479 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <div class=\"info_title\">"
480 + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
481 + "</div>\n <div class=\"info_description markdown\">";
482 stack1 = lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.description : stack1), depth0);
483 if (stack1 != null) { buffer += stack1; }
484 buffer += "</div>\n ";
485 stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
486 if (stack1 != null) { buffer += stack1; }
488 stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.noop,"data":data});
489 if (stack1 != null) { buffer += stack1; }
491 stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), {"name":"if","hash":{},"fn":this.program(6, data),"inverse":this.noop,"data":data});
492 if (stack1 != null) { buffer += stack1; }
494 stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), {"name":"if","hash":{},"fn":this.program(8, data),"inverse":this.noop,"data":data});
495 if (stack1 != null) { buffer += stack1; }
497 stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
498 if (stack1 != null) { buffer += stack1; }
499 return buffer + "\n";
500 },"2":function(depth0,helpers,partials,data) {
501 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
502 return "<div class=\"info_tos\"><a href=\""
503 + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), depth0))
504 + "\">Terms of service</a></div>";
505 },"4":function(depth0,helpers,partials,data) {
506 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
507 return "<div class='info_name'>Created by "
508 + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), depth0))
510 },"6":function(depth0,helpers,partials,data) {
511 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
512 return "<div class='info_url'>See more at <a href=\""
513 + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
515 + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
517 },"8":function(depth0,helpers,partials,data) {
518 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
519 return "<div class='info_email'><a href=\"mailto:"
520 + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), depth0))
522 + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
523 + "\">Contact the developer</a></div>";
524 },"10":function(depth0,helpers,partials,data) {
525 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
526 return "<div class='info_license'><a href='"
527 + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.url : stack1), depth0))
529 + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.name : stack1), depth0))
531 },"12":function(depth0,helpers,partials,data) {
532 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
533 return " , <span style=\"font-variant: small-caps\">api version</span>: "
534 + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), depth0))
536 },"14":function(depth0,helpers,partials,data) {
537 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
538 return " <span style=\"float:right;display:none\"><a href=\""
539 + escapeExpression(((helper = (helper = helpers.validatorUrl || (depth0 != null ? depth0.validatorUrl : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"validatorUrl","hash":{},"data":data}) : helper)))
541 + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
542 + "\"><img id=\"validator\" src=\""
543 + escapeExpression(((helper = (helper = helpers.validatorUrl || (depth0 != null ? depth0.validatorUrl : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"validatorUrl","hash":{},"data":data}) : helper)))
545 + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
546 + "\"></a>\n </span>\n";
547 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
548 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div class='info' id='api_info'>\n";
549 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.info : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
550 if (stack1 != null) { buffer += stack1; }
551 buffer += "</div>\n<div class='container' id='resources_container'>\n <ul id='resources'></ul>\n\n <div class=\"footer\">\n <br>\n <br>\n <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: "
552 + escapeExpression(((helper = (helper = helpers.basePath || (depth0 != null ? depth0.basePath : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"basePath","hash":{},"data":data}) : helper)))
554 stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), {"name":"if","hash":{},"fn":this.program(12, data),"inverse":this.noop,"data":data});
555 if (stack1 != null) { buffer += stack1; }
557 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.validatorUrl : depth0), {"name":"if","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data});
558 if (stack1 != null) { buffer += stack1; }
559 return buffer + " </h4>\n </div>\n</div>\n";
562 __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; },
563 __hasProp = {}.hasOwnProperty;
565 BasicAuthButton = (function(_super) {
566 __extends(BasicAuthButton, _super);
568 function BasicAuthButton() {
569 return BasicAuthButton.__super__.constructor.apply(this, arguments);
572 BasicAuthButton.prototype.initialize = function() {};
574 BasicAuthButton.prototype.render = function() {
576 template = this.template();
577 $(this.el).html(template(this.model));
581 BasicAuthButton.prototype.events = {
582 "click #basic_auth_button": "togglePasswordContainer",
583 "click #apply_basic_auth": "applyPassword"
586 BasicAuthButton.prototype.applyPassword = function() {
587 var elem, password, username;
588 username = $(".input_username").val();
589 password = $(".input_password").val();
590 window.authorizations.add(this.model.type, new PasswordAuthorization("basic", username, password));
591 window.swaggerUi.load();
592 return elem = $('#basic_auth_container').hide();
595 BasicAuthButton.prototype.togglePasswordContainer = function() {
597 if ($('#basic_auth_container').length > 0) {
598 elem = $('#basic_auth_container').show();
599 if (elem.is(':visible')) {
600 return elem.slideUp();
602 $('.auth_container').hide();
608 BasicAuthButton.prototype.template = function() {
609 return Handlebars.templates.basic_auth_button_view;
612 return BasicAuthButton;
616 this["Handlebars"]["templates"]["operation"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
618 },"3":function(depth0,helpers,partials,data) {
619 return " <h4>Warning: Deprecated</h4>\n";
620 },"5":function(depth0,helpers,partials,data) {
621 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, buffer = " <h4>Implementation Notes</h4>\n <p class=\"markdown\">";
622 stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
623 if (stack1 != null) { buffer += stack1; }
624 return buffer + "</p>\n";
625 },"7":function(depth0,helpers,partials,data) {
626 return " <div class=\"auth\">\n <span class=\"api-ic ic-error\"></span>";
627 },"9":function(depth0,helpers,partials,data) {
628 var stack1, buffer = " <div id=\"api_information_panel\" style=\"top: 526px; left: 776px; display: none;\">\n";
629 stack1 = helpers.each.call(depth0, depth0, {"name":"each","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
630 if (stack1 != null) { buffer += stack1; }
631 return buffer + " </div>\n";
632 },"10":function(depth0,helpers,partials,data) {
633 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <div title='";
634 stack1 = lambda((depth0 != null ? depth0.description : depth0), depth0);
635 if (stack1 != null) { buffer += stack1; }
637 + escapeExpression(lambda((depth0 != null ? depth0.scope : depth0), depth0))
639 },"12":function(depth0,helpers,partials,data) {
641 },"14":function(depth0,helpers,partials,data) {
642 return " <div class='access'>\n <span class=\"api-ic ic-off\" title=\"click to authenticate\"></span>\n </div>\n";
643 },"16":function(depth0,helpers,partials,data) {
644 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
645 return " <h4>Response Class (Status "
646 + escapeExpression(((helper = (helper = helpers.successCode || (depth0 != null ? depth0.successCode : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"successCode","hash":{},"data":data}) : helper)))
647 + ")</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n";
648 },"18":function(depth0,helpers,partials,data) {
649 return " <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";
650 },"20":function(depth0,helpers,partials,data) {
651 return " <div style='margin:0;padding:0;display:inline'></div>\n <h4>Response Messages</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n <th>Response Model</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n";
652 },"22":function(depth0,helpers,partials,data) {
654 },"24":function(depth0,helpers,partials,data) {
655 return " <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 <span class='response_throbber' style='display:none'></span>\n </div>\n";
656 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
657 var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "\n <ul class='operations' >\n <li class='"
658 + escapeExpression(((helper = (helper = helpers.method || (depth0 != null ? depth0.method : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"method","hash":{},"data":data}) : helper)))
660 + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
662 + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
663 + "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/"
664 + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
666 + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
667 + "' class=\"toggleOperation\">"
668 + escapeExpression(((helper = (helper = helpers.method || (depth0 != null ? depth0.method : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"method","hash":{},"data":data}) : helper)))
669 + "</a>\n </span>\n <span class='path'>\n <a href='#!/"
670 + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
672 + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
673 + "' class=\"toggleOperation ";
674 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
675 if (stack1 != null) { buffer += stack1; }
677 + escapeExpression(((helper = (helper = helpers.path || (depth0 != null ? depth0.path : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"path","hash":{},"data":data}) : helper)))
678 + "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/"
679 + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
681 + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
682 + "' class=\"toggleOperation\">";
683 stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"summary","hash":{},"data":data}) : helper));
684 if (stack1 != null) { buffer += stack1; }
685 buffer += "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='"
686 + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
688 + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
689 + "_content' style='display:none'>\n";
690 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data});
691 if (stack1 != null) { buffer += stack1; }
692 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.description : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.noop,"data":data});
693 if (stack1 != null) { buffer += stack1; }
694 stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(7, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
695 if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
696 if (stack1 != null) { buffer += stack1; }
698 stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.oauth : depth0), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
699 if (stack1 != null) { buffer += stack1; }
701 stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(12, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
702 if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
703 if (stack1 != null) { buffer += stack1; }
705 stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
706 if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
707 if (stack1 != null) { buffer += stack1; }
708 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.type : depth0), {"name":"if","hash":{},"fn":this.program(16, data),"inverse":this.noop,"data":data});
709 if (stack1 != null) { buffer += stack1; }
710 buffer += " <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n";
711 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.parameters : depth0), {"name":"if","hash":{},"fn":this.program(18, data),"inverse":this.noop,"data":data});
712 if (stack1 != null) { buffer += stack1; }
713 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.responseMessages : depth0), {"name":"if","hash":{},"fn":this.program(20, data),"inverse":this.noop,"data":data});
714 if (stack1 != null) { buffer += stack1; }
715 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isReadOnly : depth0), {"name":"if","hash":{},"fn":this.program(22, data),"inverse":this.program(24, data),"data":data});
716 if (stack1 != null) { buffer += stack1; }
717 return buffer + " </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";
720 __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; },
721 __hasProp = {}.hasOwnProperty;
723 ContentTypeView = (function(_super) {
724 __extends(ContentTypeView, _super);
726 function ContentTypeView() {
727 return ContentTypeView.__super__.constructor.apply(this, arguments);
730 ContentTypeView.prototype.initialize = function() {};
732 ContentTypeView.prototype.render = function() {
734 template = this.template();
735 $(this.el).html(template(this.model));
736 $('label[for=contentType]', $(this.el)).text('Response Content Type');
740 ContentTypeView.prototype.template = function() {
741 return Handlebars.templates.content_type;
744 return ContentTypeView;
748 this["Handlebars"]["templates"]["param"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
749 var stack1, buffer = "";
750 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
751 if (stack1 != null) { buffer += stack1; }
753 },"2":function(depth0,helpers,partials,data) {
754 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
755 return " <input type=\"file\" name='"
756 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
757 + "'/>\n <div class=\"parameter-content-type\" />\n";
758 },"4":function(depth0,helpers,partials,data) {
759 var stack1, buffer = "";
760 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
761 if (stack1 != null) { buffer += stack1; }
763 },"5":function(depth0,helpers,partials,data) {
764 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
765 return " <textarea class='body-textarea' name='"
766 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
768 + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
769 + "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
770 },"7":function(depth0,helpers,partials,data) {
771 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
772 return " <textarea class='body-textarea' name='"
773 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
774 + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
775 },"9":function(depth0,helpers,partials,data) {
776 var stack1, buffer = "";
777 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(10, data),"data":data});
778 if (stack1 != null) { buffer += stack1; }
780 },"10":function(depth0,helpers,partials,data) {
781 var stack1, buffer = "";
782 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(11, data),"inverse":this.program(13, data),"data":data});
783 if (stack1 != null) { buffer += stack1; }
785 },"11":function(depth0,helpers,partials,data) {
786 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
787 return " <input class='parameter' minlength='0' name='"
788 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
789 + "' placeholder='' type='text' value='"
790 + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
792 },"13":function(depth0,helpers,partials,data) {
793 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
794 return " <input class='parameter' minlength='0' name='"
795 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
796 + "' placeholder='' type='text' value=''/>\n";
797 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
798 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
799 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
801 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
802 if (stack1 != null) { buffer += stack1; }
803 buffer += "\n</td>\n<td class=\"markdown\">";
804 stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
805 if (stack1 != null) { buffer += stack1; }
806 buffer += "</td>\n<td>";
807 stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
808 if (stack1 != null) { buffer += stack1; }
809 return buffer + "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n";
812 __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; },
813 __hasProp = {}.hasOwnProperty;
815 HeaderView = (function(_super) {
816 __extends(HeaderView, _super);
818 function HeaderView() {
819 return HeaderView.__super__.constructor.apply(this, arguments);
822 HeaderView.prototype.events = {
823 'click #show-pet-store-icon': 'showPetStore',
824 'click #show-wordnik-dev-icon': 'showWordnikDev',
825 'click #explore': 'showCustom',
826 'keyup #input_baseUrl': 'showCustomOnKeyup',
827 'keyup #input_apiKey': 'showCustomOnKeyup'
830 HeaderView.prototype.initialize = function() {};
832 HeaderView.prototype.showPetStore = function(e) {
833 return this.trigger('update-swagger-ui', {
834 url: "http://petstore.swagger.wordnik.com/api/api-docs"
838 HeaderView.prototype.showWordnikDev = function(e) {
839 return this.trigger('update-swagger-ui', {
840 url: "http://api.wordnik.com/v4/resources.json"
844 HeaderView.prototype.showCustomOnKeyup = function(e) {
845 if (e.keyCode === 13) {
846 return this.showCustom();
850 HeaderView.prototype.showCustom = function(e) {
854 return this.trigger('update-swagger-ui', {
855 url: $('#input_baseUrl').val(),
856 apiKey: $('#input_apiKey').val()
860 HeaderView.prototype.update = function(url, apiKey, trigger) {
861 if (trigger == null) {
864 $('#input_baseUrl').val(url);
866 return this.trigger('update-swagger-ui', {
876 this["Handlebars"]["templates"]["param_list"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
877 return " multiple='multiple'";
878 },"3":function(depth0,helpers,partials,data) {
880 },"5":function(depth0,helpers,partials,data) {
881 var stack1, buffer = "";
882 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(6, data),"data":data});
883 if (stack1 != null) { buffer += stack1; }
885 },"6":function(depth0,helpers,partials,data) {
886 var stack1, helperMissing=helpers.helperMissing, buffer = "";
887 stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(3, data),"inverse":this.program(7, data),"data":data}));
888 if (stack1 != null) { buffer += stack1; }
890 },"7":function(depth0,helpers,partials,data) {
891 return " <option selected=\"\" value=''></option>\n";
892 },"9":function(depth0,helpers,partials,data) {
893 var stack1, buffer = "";
894 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isDefault : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
895 if (stack1 != null) { buffer += stack1; }
897 },"10":function(depth0,helpers,partials,data) {
898 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
899 return " <option selected=\"\" value='"
900 + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
902 + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
903 + " (default)</option>\n";
904 },"12":function(depth0,helpers,partials,data) {
905 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
906 return " <option value='"
907 + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
909 + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
911 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
912 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
913 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
914 + "</td>\n<td>\n <select ";
915 stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}));
916 if (stack1 != null) { buffer += stack1; }
917 buffer += " class='parameter' name='"
918 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
920 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(5, data),"data":data});
921 if (stack1 != null) { buffer += stack1; }
922 stack1 = helpers.each.call(depth0, ((stack1 = (depth0 != null ? depth0.allowableValues : depth0)) != null ? stack1.descriptiveValues : stack1), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
923 if (stack1 != null) { buffer += stack1; }
924 buffer += " </select>\n</td>\n<td class=\"markdown\">";
925 stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
926 if (stack1 != null) { buffer += stack1; }
927 buffer += "</td>\n<td>";
928 stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
929 if (stack1 != null) { buffer += stack1; }
930 return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>";
933 __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; },
934 __hasProp = {}.hasOwnProperty;
936 MainView = (function(_super) {
939 __extends(MainView, _super);
941 function MainView() {
942 return MainView.__super__.constructor.apply(this, arguments);
946 'alpha': function(a, b) {
947 return a.path.localeCompare(b.path);
949 'method': function(a, b) {
950 return a.method.localeCompare(b.method);
954 MainView.prototype.initialize = function(opts) {
955 var auth, key, value, _ref;
959 this.model.auths = [];
960 _ref = this.model.securityDefinitions;
968 this.model.auths.push(auth);
970 if (this.model.swaggerVersion === "2.0") {
971 if ("validatorUrl" in opts.swaggerOptions) {
972 return this.model.validatorUrl = opts.swaggerOptions.validatorUrl;
973 } else if (this.model.url.indexOf("localhost") > 0) {
974 return this.model.validatorUrl = null;
976 return this.model.validatorUrl = "http://online.swagger.io/validator";
981 MainView.prototype.render = function() {
982 var auth, button, counter, id, name, resource, resources, _i, _len, _ref;
983 if (this.model.securityDefinitions) {
984 for (name in this.model.securityDefinitions) {
985 auth = this.model.securityDefinitions[name];
986 if (auth.type === "apiKey" && $("#apikey_button").length === 0) {
987 button = new ApiKeyButton({
990 $('.auth_main_container').append(button);
992 if (auth.type === "basicAuth" && $("#basic_auth_button").length === 0) {
993 button = new BasicAuthButton({
996 $('.auth_main_container').append(button);
1000 $(this.el).html(Handlebars.templates.main(this.model));
1003 _ref = this.model.apisArray;
1004 for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1005 resource = _ref[_i];
1007 while (typeof resources[id] !== 'undefined') {
1008 id = id + "_" + counter;
1012 resources[id] = resource;
1013 this.addResource(resource, this.model.auths);
1015 $('.propWrap').hover(function() {
1016 return $('.optionsWrapper', $(this)).show();
1018 return $('.optionsWrapper', $(this)).hide();
1023 MainView.prototype.addResource = function(resource, auths) {
1025 resource.id = resource.id.replace(/\s/g, '_');
1026 resourceView = new ResourceView({
1029 id: 'resource_' + resource.id,
1030 className: 'resource',
1032 swaggerOptions: this.options.swaggerOptions
1034 return $('#resources').append(resourceView.render().el);
1037 MainView.prototype.clear = function() {
1038 return $(this.el).html('');
1045 this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1046 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1047 return " <textarea class='body-textarea' readonly='readonly' name='"
1048 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1050 + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1052 },"3":function(depth0,helpers,partials,data) {
1053 var stack1, buffer = "";
1054 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
1055 if (stack1 != null) { buffer += stack1; }
1057 },"4":function(depth0,helpers,partials,data) {
1058 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1060 + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1062 },"6":function(depth0,helpers,partials,data) {
1063 return " (empty)\n";
1064 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1065 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
1066 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1068 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
1069 if (stack1 != null) { buffer += stack1; }
1070 buffer += "</td>\n<td class=\"markdown\">";
1071 stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
1072 if (stack1 != null) { buffer += stack1; }
1073 buffer += "</td>\n<td>";
1074 stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
1075 if (stack1 != null) { buffer += stack1; }
1076 return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1078 this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1079 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1080 return " <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"
1081 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1083 + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1085 },"3":function(depth0,helpers,partials,data) {
1086 var stack1, buffer = "";
1087 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
1088 if (stack1 != null) { buffer += stack1; }
1090 },"4":function(depth0,helpers,partials,data) {
1091 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1093 + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1095 },"6":function(depth0,helpers,partials,data) {
1096 return " (empty)\n";
1097 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1098 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
1099 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1101 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
1102 if (stack1 != null) { buffer += stack1; }
1103 buffer += "</td>\n<td class=\"markdown\">";
1104 stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
1105 if (stack1 != null) { buffer += stack1; }
1106 buffer += "</td>\n<td>";
1107 stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
1108 if (stack1 != null) { buffer += stack1; }
1109 return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1112 __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; },
1113 __hasProp = {}.hasOwnProperty;
1115 OperationView = (function(_super) {
1116 __extends(OperationView, _super);
1118 function OperationView() {
1119 return OperationView.__super__.constructor.apply(this, arguments);
1122 OperationView.prototype.invocationUrl = null;
1124 OperationView.prototype.events = {
1125 'submit .sandbox': 'submitOperation',
1126 'click .submit': 'submitOperation',
1127 'click .response_hider': 'hideResponse',
1128 'click .toggleOperation': 'toggleOperationContent',
1129 'mouseenter .api-ic': 'mouseEnter',
1130 'mouseout .api-ic': 'mouseExit'
1133 OperationView.prototype.initialize = function(opts) {
1137 this.auths = opts.auths;
1138 this.parentId = this.model.parentId;
1139 this.nickname = this.model.nickname;
1143 OperationView.prototype.mouseEnter = function(e) {
1144 var elem, hgh, pos, scMaxX, scMaxY, scX, scY, wd, x, y;
1145 elem = $(this.el).find('.content');
1148 scX = $(window).scrollLeft();
1149 scY = $(window).scrollTop();
1150 scMaxX = scX + $(window).width();
1151 scMaxY = scY + $(window).height();
1153 hgh = elem.height();
1154 if (x + wd > scMaxX) {
1160 if (y + hgh > scMaxY) {
1170 return $(e.currentTarget.parentNode).find('#api_information_panel').show();
1173 OperationView.prototype.mouseExit = function(e) {
1174 return $(e.currentTarget.parentNode).find('#api_information_panel').hide();
1177 OperationView.prototype.render = function() {
1178 var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, modelAuths, o, param, ref, responseContentTypeView, responseSignatureView, schema, schemaObj, scopeIndex, signatureModel, statusCode, successResponse, type, v, value, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3, _ref4;
1179 isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
1180 if (!isMethodSubmissionSupported) {
1181 this.model.isReadOnly = true;
1183 this.model.description = this.model.description || this.model.notes;
1184 if (this.model.description) {
1185 this.model.description = this.model.description.replace(/(?:\r\n|\r|\n)/g, '<br />');
1187 this.model.oauth = null;
1188 modelAuths = this.model.authorizations || this.model.security;
1190 if (Array.isArray(modelAuths)) {
1191 for (_i = 0, _len = modelAuths.length; _i < _len; _i++) {
1192 auths = modelAuths[_i];
1193 for (key in auths) {
1195 for (a in this.auths) {
1196 auth = this.auths[a];
1197 if (auth.type === 'oauth2') {
1198 this.model.oauth = {};
1199 this.model.oauth.scopes = [];
1200 _ref = auth.value.scopes;
1203 scopeIndex = auths[key].indexOf(k);
1204 if (scopeIndex >= 0) {
1209 this.model.oauth.scopes.push(o);
1217 for (k in modelAuths) {
1219 if (k === "oauth2") {
1220 if (this.model.oauth === null) {
1221 this.model.oauth = {};
1223 if (this.model.oauth.scopes === void 0) {
1224 this.model.oauth.scopes = [];
1226 for (_j = 0, _len1 = v.length; _j < _len1; _j++) {
1228 this.model.oauth.scopes.push(o);
1234 if (typeof this.model.responses !== 'undefined') {
1235 this.model.responseMessages = [];
1236 _ref1 = this.model.responses;
1237 for (code in _ref1) {
1238 value = _ref1[code];
1240 schemaObj = this.model.responses[code].schema;
1241 if (schemaObj && schemaObj['$ref']) {
1242 schema = schemaObj['$ref'];
1243 if (schema.indexOf('#/definitions/') === 0) {
1244 schema = schema.substring('#/definitions/'.length);
1247 this.model.responseMessages.push({
1249 message: value.description,
1250 responseModel: schema
1254 if (typeof this.model.responseMessages === 'undefined') {
1255 this.model.responseMessages = [];
1257 signatureModel = null;
1258 if (this.model.successResponse) {
1259 successResponse = this.model.successResponse;
1260 for (key in successResponse) {
1261 value = successResponse[key];
1262 this.model.successCode = key;
1263 if (typeof value === 'object' && typeof value.createJSONSample === 'function') {
1265 sampleJSON: JSON.stringify(value.createJSONSample(), void 0, 2),
1267 signature: value.getMockSignature()
1271 } else if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
1273 sampleJSON: this.model.responseSampleJSON,
1275 signature: this.model.responseClassSignature
1278 $(this.el).html(Handlebars.templates.operation(this.model));
1279 if (signatureModel) {
1280 responseSignatureView = new SignatureView({
1281 model: signatureModel,
1284 $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
1286 this.model.responseClassSignature = 'string';
1287 $('.model-signature', $(this.el)).html(this.model.type);
1289 contentTypeModel = {
1292 contentTypeModel.consumes = this.model.consumes;
1293 contentTypeModel.produces = this.model.produces;
1294 _ref2 = this.model.parameters;
1295 for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1297 type = param.type || param.dataType || '';
1298 if (typeof type === 'undefined') {
1299 schema = param.schema;
1300 if (schema && schema['$ref']) {
1301 ref = schema['$ref'];
1302 if (ref.indexOf('#/definitions/') === 0) {
1303 type = ref.substring('#/definitions/'.length);
1309 if (type && type.toLowerCase() === 'file') {
1310 if (!contentTypeModel.consumes) {
1311 contentTypeModel.consumes = 'multipart/form-data';
1316 responseContentTypeView = new ResponseContentTypeView({
1317 model: contentTypeModel
1319 $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
1320 _ref3 = this.model.parameters;
1321 for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
1323 this.addParameter(param, contentTypeModel.consumes);
1325 _ref4 = this.model.responseMessages;
1326 for (_m = 0, _len4 = _ref4.length; _m < _len4; _m++) {
1327 statusCode = _ref4[_m];
1328 this.addStatusCode(statusCode);
1333 OperationView.prototype.addParameter = function(param, consumes) {
1335 param.consumes = consumes;
1336 paramView = new ParameterView({
1339 readOnly: this.model.isReadOnly
1341 return $('.operation-params', $(this.el)).append(paramView.render().el);
1344 OperationView.prototype.addStatusCode = function(statusCode) {
1346 statusCodeView = new StatusCodeView({
1350 return $('.operation-status', $(this.el)).append(statusCodeView.render().el);
1353 OperationView.prototype.submitOperation = function(e) {
1354 var error_free, form, isFileUpload, map, o, opts, val, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;
1358 form = $('.sandbox', $(this.el));
1360 form.find("input.required").each(function() {
1361 $(this).removeClass("error");
1362 if (jQuery.trim($(this).val()) === "") {
1363 $(this).addClass("error");
1365 callback: (function(_this) {
1367 return $(_this).focus();
1371 return error_free = false;
1374 form.find("textarea.required").each(function() {
1375 $(this).removeClass("error");
1376 if (jQuery.trim($(this).val()) === "") {
1377 $(this).addClass("error");
1379 callback: (function(_this) {
1381 return $(_this).focus();
1385 return error_free = false;
1393 isFileUpload = false;
1394 _ref = form.find("input");
1395 for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1397 if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1398 map[o.name] = o.value;
1400 if (o.type === "file") {
1401 map[o.name] = o.files[0];
1402 isFileUpload = true;
1405 _ref1 = form.find("textarea");
1406 for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
1408 if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1409 map[o.name] = o.value;
1412 _ref2 = form.find("select");
1413 for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1415 val = this.getSelectedValue(o);
1416 if ((val != null) && jQuery.trim(val).length > 0) {
1420 opts.responseContentType = $("div select[name=responseContentType]", $(this.el)).val();
1421 opts.requestContentType = $("div select[name=parameterContentType]", $(this.el)).val();
1422 $(".response_throbber", $(this.el)).show();
1424 return this.handleFileUpload(map, form);
1426 return this.model["do"](map, opts, this.showCompleteStatus, this.showErrorStatus, this);
1431 OperationView.prototype.success = function(response, parent) {
1432 return parent.showCompleteStatus(response);
1435 OperationView.prototype.handleFileUpload = function(map, form) {
1436 var bodyParam, el, headerParams, o, obj, param, params, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3;
1437 _ref = form.serializeArray();
1438 for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1440 if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1441 map[o.name] = o.value;
1444 bodyParam = new FormData();
1446 _ref1 = this.model.parameters;
1447 for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
1449 if (param.paramType === 'form' || param["in"] === 'formData') {
1450 if (param.type.toLowerCase() !== 'file' && map[param.name] !== void 0) {
1451 bodyParam.append(param.name, map[param.name]);
1456 _ref2 = this.model.parameters;
1457 for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1459 if (param.paramType === 'header') {
1460 headerParams[param.name] = map[param.name];
1463 _ref3 = form.find('input[type~="file"]');
1464 for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
1466 if (typeof el.files[0] !== 'undefined') {
1467 bodyParam.append($(el).attr('name'), el.files[0]);
1471 this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), delete headerParams['Content-Type'], this.model.urlify(map, false)) : this.model.urlify(map, true);
1472 $(".request_url", $(this.el)).html("<pre></pre>");
1473 $(".request_url pre", $(this.el)).text(this.invocationUrl);
1475 type: this.model.method,
1476 url: this.invocationUrl,
1477 headers: headerParams,
1482 error: (function(_this) {
1483 return function(data, textStatus, error) {
1484 return _this.showErrorStatus(_this.wrap(data), _this);
1487 success: (function(_this) {
1488 return function(data) {
1489 return _this.showResponse(data, _this);
1492 complete: (function(_this) {
1493 return function(data) {
1494 return _this.showCompleteStatus(_this.wrap(data), _this);
1498 if (window.authorizations) {
1499 window.authorizations.apply(obj);
1502 obj.data.append("fake", "true");
1508 OperationView.prototype.wrap = function(data) {
1509 var h, headerArray, headers, i, o, _i, _len;
1511 headerArray = data.getAllResponseHeaders().split("\r");
1512 for (_i = 0, _len = headerArray.length; _i < _len; _i++) {
1513 i = headerArray[_i];
1514 h = i.match(/^([^:]*?):(.*)$/);
1519 if (h[0] !== void 0 && h[1] !== void 0) {
1520 headers[h[0].trim()] = h[1].trim();
1525 o.content.data = data.responseText;
1526 o.headers = headers;
1528 o.request.url = this.invocationUrl;
1529 o.status = data.status;
1533 OperationView.prototype.getSelectedValue = function(select) {
1534 var opt, options, _i, _len, _ref;
1535 if (!select.multiple) {
1536 return select.value;
1539 _ref = select.options;
1540 for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1543 options.push(opt.value);
1546 if (options.length > 0) {
1554 OperationView.prototype.hideResponse = function(e) {
1558 $(".response", $(this.el)).slideUp();
1559 return $(".response_hider", $(this.el)).fadeOut();
1562 OperationView.prototype.showResponse = function(response) {
1564 prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>");
1565 return $(".response_body", $(this.el)).html(escape(prettyJson));
1568 OperationView.prototype.showErrorStatus = function(data, parent) {
1569 return parent.showStatus(data);
1572 OperationView.prototype.showCompleteStatus = function(data, parent) {
1573 return parent.showStatus(data);
1576 OperationView.prototype.formatXml = function(xml) {
1577 var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
1578 reg = /(>)(<)(\/*)/g;
1579 wsexp = /[ ]*(.*)[ ]+\n/g;
1580 contexp = /(<.+>)(.+\n)/g;
1581 xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
1584 lines = xml.split('\n');
1588 'single->single': 0,
1589 'single->closing': -1,
1590 'single->opening': 0,
1592 'closing->single': 0,
1593 'closing->closing': -1,
1594 'closing->opening': 0,
1595 'closing->other': 0,
1596 'opening->single': 1,
1597 'opening->closing': 0,
1598 'opening->opening': 1,
1599 'opening->other': 1,
1601 'other->closing': -1,
1602 'other->opening': 0,
1605 _fn = function(ln) {
1606 var fromTo, j, key, padding, type, types, value;
1608 single: Boolean(ln.match(/<.+\/>/)),
1609 closing: Boolean(ln.match(/<\/.+>/)),
1610 opening: Boolean(ln.match(/<[^!?].*>/))
1612 type = ((function() {
1615 for (key in types) {
1623 type = type === void 0 ? 'other' : type;
1624 fromTo = lastType + '->' + type;
1627 indent += transitions[fromTo];
1628 padding = ((function() {
1629 var _j, _ref, _results;
1631 for (j = _j = 0, _ref = indent; 0 <= _ref ? _j < _ref : _j > _ref; j = 0 <= _ref ? ++_j : --_j) {
1636 if (fromTo === 'opening->closing') {
1637 return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
1639 return formatted += padding + ln + '\n';
1642 for (_i = 0, _len = lines.length; _i < _len; _i++) {
1649 OperationView.prototype.showStatus = function(response) {
1650 var code, content, contentType, e, headers, json, opts, pre, response_body, response_body_el, url;
1651 if (response.content === void 0) {
1652 content = response.data;
1655 content = response.content.data;
1656 url = response.request.url;
1658 headers = response.headers;
1661 contentType = headers["Content-Type"] || headers["content-type"];
1663 contentType = contentType.split(";")[0].trim();
1666 $(".response_body", $(this.el)).removeClass('json');
1667 $(".response_body", $(this.el)).removeClass('xml');
1669 code = $('<code />').text("no content");
1670 pre = $('<pre class="json" />').append(code);
1671 } else if (contentType === "application/json" || /\+json$/.test(contentType)) {
1674 json = JSON.stringify(JSON.parse(content), null, " ");
1677 json = "can't parse JSON. Raw result:\n\n" + content;
1679 code = $('<code />').text(json);
1680 pre = $('<pre class="json" />').append(code);
1681 } else if (contentType === "application/xml" || /\+xml$/.test(contentType)) {
1682 code = $('<code />').text(this.formatXml(content));
1683 pre = $('<pre class="xml" />').append(code);
1684 } else if (contentType === "text/html") {
1685 code = $('<code />').html(_.escape(content));
1686 pre = $('<pre class="xml" />').append(code);
1687 } else if (/^image\//.test(contentType)) {
1688 pre = $('<img>').attr('src', url);
1690 code = $('<code />').text(content);
1691 pre = $('<pre class="json" />').append(code);
1693 response_body = pre;
1694 $(".request_url", $(this.el)).html("<pre></pre>");
1695 $(".request_url pre", $(this.el)).text(url);
1696 $(".response_code", $(this.el)).html("<pre>" + response.status + "</pre>");
1697 $(".response_body", $(this.el)).html(response_body);
1698 $(".response_headers", $(this.el)).html("<pre>" + _.escape(JSON.stringify(response.headers, null, " ")).replace(/\n/g, "<br>") + "</pre>");
1699 $(".response", $(this.el)).slideDown();
1700 $(".response_hider", $(this.el)).show();
1701 $(".response_throbber", $(this.el)).hide();
1702 response_body_el = $('.response_body', $(this.el))[0];
1703 opts = this.options.swaggerOptions;
1704 if (opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold) {
1705 return response_body_el;
1707 return hljs.highlightBlock(response_body_el);
1711 OperationView.prototype.toggleOperationContent = function() {
1713 elem = $('#' + Docs.escapeResourceName(this.parentId + "_" + this.nickname + "_content"));
1714 if (elem.is(':visible')) {
1715 return Docs.collapseOperation(elem);
1717 return Docs.expandOperation(elem);
1721 return OperationView;
1725 var ParameterContentTypeView,
1726 __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; },
1727 __hasProp = {}.hasOwnProperty;
1729 ParameterContentTypeView = (function(_super) {
1730 __extends(ParameterContentTypeView, _super);
1732 function ParameterContentTypeView() {
1733 return ParameterContentTypeView.__super__.constructor.apply(this, arguments);
1736 ParameterContentTypeView.prototype.initialize = function() {};
1738 ParameterContentTypeView.prototype.render = function() {
1740 template = this.template();
1741 $(this.el).html(template(this.model));
1742 $('label[for=parameterContentType]', $(this.el)).text('Parameter content type:');
1746 ParameterContentTypeView.prototype.template = function() {
1747 return Handlebars.templates.parameter_content_type;
1750 return ParameterContentTypeView;
1754 this["Handlebars"]["templates"]["param_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1755 var stack1, buffer = "";
1756 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
1757 if (stack1 != null) { buffer += stack1; }
1759 },"2":function(depth0,helpers,partials,data) {
1760 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1761 return " <input type=\"file\" name='"
1762 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1764 },"4":function(depth0,helpers,partials,data) {
1765 var stack1, buffer = "";
1766 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
1767 if (stack1 != null) { buffer += stack1; }
1769 },"5":function(depth0,helpers,partials,data) {
1770 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1771 return " <textarea class='body-textarea required' placeholder='(required)' name='"
1772 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1774 + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1775 + "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
1776 },"7":function(depth0,helpers,partials,data) {
1777 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1778 return " <textarea class='body-textarea required' placeholder='(required)' name='"
1779 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1780 + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
1781 },"9":function(depth0,helpers,partials,data) {
1782 var stack1, buffer = "";
1783 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
1784 if (stack1 != null) { buffer += stack1; }
1786 },"10":function(depth0,helpers,partials,data) {
1787 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1788 return " <input class='parameter' class='required' type='file' name='"
1789 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1791 },"12":function(depth0,helpers,partials,data) {
1792 var stack1, buffer = "";
1793 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(13, data),"inverse":this.program(15, data),"data":data});
1794 if (stack1 != null) { buffer += stack1; }
1796 },"13":function(depth0,helpers,partials,data) {
1797 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1798 return " <input class='parameter required' minlength='1' name='"
1799 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1800 + "' placeholder='(required)' type='text' value='"
1801 + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1803 },"15":function(depth0,helpers,partials,data) {
1804 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1805 return " <input class='parameter required' minlength='1' name='"
1806 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1807 + "' placeholder='(required)' type='text' value=''/>\n";
1808 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1809 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
1810 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1812 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
1813 if (stack1 != null) { buffer += stack1; }
1814 buffer += "</td>\n<td>\n <strong><span class=\"markdown\">";
1815 stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
1816 if (stack1 != null) { buffer += stack1; }
1817 buffer += "</span></strong>\n</td>\n<td>";
1818 stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
1819 if (stack1 != null) { buffer += stack1; }
1820 return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1822 this["Handlebars"]["templates"]["parameter_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1823 var stack1, buffer = "";
1824 stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
1825 if (stack1 != null) { buffer += stack1; }
1827 },"2":function(depth0,helpers,partials,data) {
1828 var stack1, lambda=this.lambda, buffer = " <option value=\"";
1829 stack1 = lambda(depth0, depth0);
1830 if (stack1 != null) { buffer += stack1; }
1832 stack1 = lambda(depth0, depth0);
1833 if (stack1 != null) { buffer += stack1; }
1834 return buffer + "</option>\n";
1835 },"4":function(depth0,helpers,partials,data) {
1836 return " <option value=\"application/json\">application/json</option>\n";
1837 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1838 var stack1, buffer = "<label for=\"parameterContentType\"></label>\n<select name=\"parameterContentType\">\n";
1839 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
1840 if (stack1 != null) { buffer += stack1; }
1841 return buffer + "</select>\n";
1844 __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; },
1845 __hasProp = {}.hasOwnProperty;
1847 ParameterView = (function(_super) {
1848 __extends(ParameterView, _super);
1850 function ParameterView() {
1851 return ParameterView.__super__.constructor.apply(this, arguments);
1854 ParameterView.prototype.initialize = function() {
1855 return Handlebars.registerHelper('isArray', function(param, opts) {
1856 if (param.type.toLowerCase() === 'array' || param.allowMultiple) {
1857 return opts.fn(this);
1859 return opts.inverse(this);
1864 ParameterView.prototype.render = function() {
1865 var contentTypeModel, isParam, parameterContentTypeView, ref, responseContentTypeView, schema, signatureModel, signatureView, template, type;
1866 type = this.model.type || this.model.dataType;
1867 if (typeof type === 'undefined') {
1868 schema = this.model.schema;
1869 if (schema && schema['$ref']) {
1870 ref = schema['$ref'];
1871 if (ref.indexOf('#/definitions/') === 0) {
1872 type = ref.substring('#/definitions/'.length);
1878 this.model.type = type;
1879 this.model.paramType = this.model["in"] || this.model.paramType;
1880 if (this.model.paramType === 'body' || this.model["in"] === 'body') {
1881 this.model.isBody = true;
1883 if (type && type.toLowerCase() === 'file') {
1884 this.model.isFile = true;
1886 this.model["default"] = this.model["default"] || this.model.defaultValue;
1887 if (this.model.allowableValues) {
1888 this.model.isList = true;
1890 template = this.template();
1891 $(this.el).html(template(this.model));
1893 sampleJSON: this.model.sampleJSON,
1895 signature: this.model.signature
1897 if (this.model.sampleJSON) {
1898 signatureView = new SignatureView({
1899 model: signatureModel,
1902 $('.model-signature', $(this.el)).append(signatureView.render().el);
1904 $('.model-signature', $(this.el)).html(this.model.signature);
1907 if (this.model.isBody) {
1910 contentTypeModel = {
1913 contentTypeModel.consumes = this.model.consumes;
1915 parameterContentTypeView = new ParameterContentTypeView({
1916 model: contentTypeModel
1918 $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el);
1920 responseContentTypeView = new ResponseContentTypeView({
1921 model: contentTypeModel
1923 $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
1928 ParameterView.prototype.template = function() {
1929 if (this.model.isList) {
1930 return Handlebars.templates.param_list;
1932 if (this.options.readOnly) {
1933 if (this.model.required) {
1934 return Handlebars.templates.param_readonly_required;
1936 return Handlebars.templates.param_readonly;
1939 if (this.model.required) {
1940 return Handlebars.templates.param_required;
1942 return Handlebars.templates.param;
1948 return ParameterView;
1953 __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; },
1954 __hasProp = {}.hasOwnProperty;
1956 ResourceView = (function(_super) {
1957 __extends(ResourceView, _super);
1959 function ResourceView() {
1960 return ResourceView.__super__.constructor.apply(this, arguments);
1963 ResourceView.prototype.initialize = function(opts) {
1967 this.auths = opts.auths;
1968 if ("" === this.model.description) {
1969 this.model.description = null;
1971 if (this.model.description != null) {
1972 return this.model.summary = this.model.description;
1976 ResourceView.prototype.render = function() {
1977 var counter, id, methods, operation, _i, _len, _ref;
1979 $(this.el).html(Handlebars.templates.resource(this.model));
1980 _ref = this.model.operationsArray;
1981 for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1982 operation = _ref[_i];
1984 id = operation.nickname;
1985 while (typeof methods[id] !== 'undefined') {
1986 id = id + "_" + counter;
1989 methods[id] = operation;
1990 operation.nickname = id;
1991 operation.parentId = this.model.id;
1992 this.addOperation(operation);
1994 $('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'));
1995 $('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource'));
1996 $('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource'));
2000 ResourceView.prototype.addOperation = function(operation) {
2002 operation.number = this.number;
2003 operationView = new OperationView({
2006 className: 'endpoint',
2007 swaggerOptions: this.options.swaggerOptions,
2010 $('.endpoints', $(this.el)).append(operationView.render().el);
2011 return this.number++;
2014 ResourceView.prototype.callDocs = function(fnName, e) {
2016 return Docs[fnName](e.currentTarget.getAttribute('data-id'));
2019 return ResourceView;
2023 this["Handlebars"]["templates"]["resource"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
2025 },"3":function(depth0,helpers,partials,data) {
2026 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
2027 return "<li>\n <a href='"
2028 + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
2029 + "'>Raw</a>\n </li>";
2030 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2031 var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "<div class='heading'>\n <h2>\n <a href='#!/"
2032 + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2033 + "' class=\"toggleEndpointList\" data-id=\""
2034 + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2036 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
2038 stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(options={"name":"summary","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
2039 if (!helpers.summary) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
2040 if (stack1 != null) { buffer += stack1; }
2041 stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"summary","hash":{},"data":data}) : helper));
2042 if (stack1 != null) { buffer += stack1; }
2043 buffer += "\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/"
2044 + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2045 + "' id='endpointListTogger_"
2046 + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2047 + "' class=\"toggleEndpointList\" data-id=\""
2048 + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2049 + "\">Show/Hide</a>\n </li>\n <li>\n <a href='#' class=\"collapseResource\" data-id=\""
2050 + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2051 + "\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' class=\"expandResource\" data-id=\""
2052 + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2053 + "\">\n Expand Operations\n </a>\n </li>\n ";
2054 stack1 = ((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(options={"name":"url","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
2055 if (!helpers.url) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
2056 if (stack1 != null) { buffer += stack1; }
2057 return buffer + "\n </ul>\n</div>\n<ul class='endpoints' id='"
2058 + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2059 + "_endpoint_list' style='display:none'>\n\n</ul>\n";
2061 var ResponseContentTypeView,
2062 __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; },
2063 __hasProp = {}.hasOwnProperty;
2065 ResponseContentTypeView = (function(_super) {
2066 __extends(ResponseContentTypeView, _super);
2068 function ResponseContentTypeView() {
2069 return ResponseContentTypeView.__super__.constructor.apply(this, arguments);
2072 ResponseContentTypeView.prototype.initialize = function() {};
2074 ResponseContentTypeView.prototype.render = function() {
2076 template = this.template();
2077 $(this.el).html(template(this.model));
2078 $('label[for=responseContentType]', $(this.el)).text('Response Content Type');
2082 ResponseContentTypeView.prototype.template = function() {
2083 return Handlebars.templates.response_content_type;
2086 return ResponseContentTypeView;
2090 this["Handlebars"]["templates"]["response_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
2091 var stack1, buffer = "";
2092 stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
2093 if (stack1 != null) { buffer += stack1; }
2095 },"2":function(depth0,helpers,partials,data) {
2096 var stack1, lambda=this.lambda, buffer = " <option value=\"";
2097 stack1 = lambda(depth0, depth0);
2098 if (stack1 != null) { buffer += stack1; }
2100 stack1 = lambda(depth0, depth0);
2101 if (stack1 != null) { buffer += stack1; }
2102 return buffer + "</option>\n";
2103 },"4":function(depth0,helpers,partials,data) {
2104 return " <option value=\"application/json\">application/json</option>\n";
2105 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2106 var stack1, buffer = "<label for=\"responseContentType\"></label>\n<select name=\"responseContentType\">\n";
2107 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
2108 if (stack1 != null) { buffer += stack1; }
2109 return buffer + "</select>\n";
2112 __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; },
2113 __hasProp = {}.hasOwnProperty;
2115 SignatureView = (function(_super) {
2116 __extends(SignatureView, _super);
2118 function SignatureView() {
2119 return SignatureView.__super__.constructor.apply(this, arguments);
2122 SignatureView.prototype.events = {
2123 'click a.description-link': 'switchToDescription',
2124 'click a.snippet-link': 'switchToSnippet',
2125 'mousedown .snippet': 'snippetToTextArea'
2128 SignatureView.prototype.initialize = function() {};
2130 SignatureView.prototype.render = function() {
2132 template = this.template();
2133 $(this.el).html(template(this.model));
2134 this.switchToSnippet();
2135 this.isParam = this.model.isParam;
2137 $('.notice', $(this.el)).text('Click to set as parameter value');
2142 SignatureView.prototype.template = function() {
2143 return Handlebars.templates.signature;
2146 SignatureView.prototype.switchToDescription = function(e) {
2150 $(".snippet", $(this.el)).hide();
2151 $(".description", $(this.el)).show();
2152 $('.description-link', $(this.el)).addClass('selected');
2153 return $('.snippet-link', $(this.el)).removeClass('selected');
2156 SignatureView.prototype.switchToSnippet = function(e) {
2160 $(".description", $(this.el)).hide();
2161 $(".snippet", $(this.el)).show();
2162 $('.snippet-link', $(this.el)).addClass('selected');
2163 return $('.description-link', $(this.el)).removeClass('selected');
2166 SignatureView.prototype.snippetToTextArea = function(e) {
2172 textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
2173 if ($.trim(textArea.val()) === '') {
2174 return textArea.val(this.model.sampleJSON);
2179 return SignatureView;
2183 this["Handlebars"]["templates"]["signature"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2184 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, 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 ";
2185 stack1 = ((helper = (helper = helpers.signature || (depth0 != null ? depth0.signature : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signature","hash":{},"data":data}) : helper));
2186 if (stack1 != null) { buffer += stack1; }
2187 return buffer + "\n </div>\n\n <div class=\"snippet\">\n <pre><code>"
2188 + escapeExpression(((helper = (helper = helpers.sampleJSON || (depth0 != null ? depth0.sampleJSON : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"sampleJSON","hash":{},"data":data}) : helper)))
2189 + "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
2192 __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; },
2193 __hasProp = {}.hasOwnProperty;
2195 StatusCodeView = (function(_super) {
2196 __extends(StatusCodeView, _super);
2198 function StatusCodeView() {
2199 return StatusCodeView.__super__.constructor.apply(this, arguments);
2202 StatusCodeView.prototype.initialize = function() {};
2204 StatusCodeView.prototype.render = function() {
2205 var responseModel, responseModelView, template;
2206 template = this.template();
2207 $(this.el).html(template(this.model));
2208 if (swaggerUi.api.models.hasOwnProperty(this.model.responseModel)) {
2210 sampleJSON: JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(), null, 2),
2212 signature: swaggerUi.api.models[this.model.responseModel].getMockSignature()
2214 responseModelView = new SignatureView({
2215 model: responseModel,
2218 $('.model-signature', this.$el).append(responseModelView.render().el);
2220 $('.model-signature', this.$el).html('');
2225 StatusCodeView.prototype.template = function() {
2226 return Handlebars.templates.status_code;
2229 return StatusCodeView;
2233 this["Handlebars"]["templates"]["status_code"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2234 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td width='15%' class='code'>"
2235 + escapeExpression(((helper = (helper = helpers.code || (depth0 != null ? depth0.code : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"code","hash":{},"data":data}) : helper)))
2237 stack1 = ((helper = (helper = helpers.message || (depth0 != null ? depth0.message : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"message","hash":{},"data":data}) : helper));
2238 if (stack1 != null) { buffer += stack1; }
2239 return buffer + "</td>\n<td width='50%'><span class=\"model-signature\" /></td>";