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\"><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";
977 return this.model.validatorUrl = null;
982 MainView.prototype.render = function() {
983 var auth, button, counter, id, name, resource, resources, _i, _len, _ref;
984 if (this.model.securityDefinitions) {
985 for (name in this.model.securityDefinitions) {
986 auth = this.model.securityDefinitions[name];
987 if (auth.type === "apiKey" && $("#apikey_button").length === 0) {
988 button = new ApiKeyButton({
991 $('.auth_main_container').append(button);
993 if (auth.type === "basicAuth" && $("#basic_auth_button").length === 0) {
994 button = new BasicAuthButton({
997 $('.auth_main_container').append(button);
1001 $(this.el).html(Handlebars.templates.main(this.model));
1004 _ref = this.model.apisArray;
1005 for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1006 resource = _ref[_i];
1008 while (typeof resources[id] !== 'undefined') {
1009 id = id + "_" + counter;
1013 resources[id] = resource;
1014 this.addResource(resource, this.model.auths);
1016 $('.propWrap').hover(function() {
1017 return $('.optionsWrapper', $(this)).show();
1019 return $('.optionsWrapper', $(this)).hide();
1024 MainView.prototype.addResource = function(resource, auths) {
1026 resource.id = resource.id.replace(/\s/g, '_');
1027 resourceView = new ResourceView({
1030 id: 'resource_' + resource.id,
1031 className: 'resource',
1033 swaggerOptions: this.options.swaggerOptions
1035 return $('#resources').append(resourceView.render().el);
1038 MainView.prototype.clear = function() {
1039 return $(this.el).html('');
1046 this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1047 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1048 return " <textarea class='body-textarea' readonly='readonly' name='"
1049 + 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)))
1051 + 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)))
1053 },"3":function(depth0,helpers,partials,data) {
1054 var stack1, buffer = "";
1055 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});
1056 if (stack1 != null) { buffer += stack1; }
1058 },"4":function(depth0,helpers,partials,data) {
1059 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1061 + 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)))
1063 },"6":function(depth0,helpers,partials,data) {
1064 return " (empty)\n";
1065 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1066 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
1067 + 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)))
1069 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});
1070 if (stack1 != null) { buffer += stack1; }
1071 buffer += "</td>\n<td class=\"markdown\">";
1072 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));
1073 if (stack1 != null) { buffer += stack1; }
1074 buffer += "</td>\n<td>";
1075 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));
1076 if (stack1 != null) { buffer += stack1; }
1077 return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1079 this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1080 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1081 return " <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"
1082 + 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)))
1084 + 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)))
1086 },"3":function(depth0,helpers,partials,data) {
1087 var stack1, buffer = "";
1088 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});
1089 if (stack1 != null) { buffer += stack1; }
1091 },"4":function(depth0,helpers,partials,data) {
1092 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1094 + 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)))
1096 },"6":function(depth0,helpers,partials,data) {
1097 return " (empty)\n";
1098 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1099 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
1100 + 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)))
1102 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});
1103 if (stack1 != null) { buffer += stack1; }
1104 buffer += "</td>\n<td class=\"markdown\">";
1105 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));
1106 if (stack1 != null) { buffer += stack1; }
1107 buffer += "</td>\n<td>";
1108 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));
1109 if (stack1 != null) { buffer += stack1; }
1110 return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1113 __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; },
1114 __hasProp = {}.hasOwnProperty;
1116 OperationView = (function(_super) {
1117 __extends(OperationView, _super);
1119 function OperationView() {
1120 return OperationView.__super__.constructor.apply(this, arguments);
1123 OperationView.prototype.invocationUrl = null;
1125 OperationView.prototype.events = {
1126 'submit .sandbox': 'submitOperation',
1127 'click .submit': 'submitOperation',
1128 'click .response_hider': 'hideResponse',
1129 'click .toggleOperation': 'toggleOperationContent',
1130 'mouseenter .api-ic': 'mouseEnter',
1131 'mouseout .api-ic': 'mouseExit'
1134 OperationView.prototype.initialize = function(opts) {
1138 this.auths = opts.auths;
1139 this.parentId = this.model.parentId;
1140 this.nickname = this.model.nickname;
1144 OperationView.prototype.mouseEnter = function(e) {
1145 var elem, hgh, pos, scMaxX, scMaxY, scX, scY, wd, x, y;
1146 elem = $(this.el).find('.content');
1149 scX = $(window).scrollLeft();
1150 scY = $(window).scrollTop();
1151 scMaxX = scX + $(window).width();
1152 scMaxY = scY + $(window).height();
1154 hgh = elem.height();
1155 if (x + wd > scMaxX) {
1161 if (y + hgh > scMaxY) {
1171 return $(e.currentTarget.parentNode).find('#api_information_panel').show();
1174 OperationView.prototype.mouseExit = function(e) {
1175 return $(e.currentTarget.parentNode).find('#api_information_panel').hide();
1178 OperationView.prototype.render = function() {
1179 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;
1180 isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
1181 if (!isMethodSubmissionSupported) {
1182 this.model.isReadOnly = true;
1184 this.model.description = this.model.description || this.model.notes;
1185 if (this.model.description) {
1186 this.model.description = this.model.description.replace(/(?:\r\n|\r|\n)/g, '<br />');
1188 this.model.oauth = null;
1189 modelAuths = this.model.authorizations || this.model.security;
1191 if (Array.isArray(modelAuths)) {
1192 for (_i = 0, _len = modelAuths.length; _i < _len; _i++) {
1193 auths = modelAuths[_i];
1194 for (key in auths) {
1196 for (a in this.auths) {
1197 auth = this.auths[a];
1198 if (auth.type === 'oauth2') {
1199 this.model.oauth = {};
1200 this.model.oauth.scopes = [];
1201 _ref = auth.value.scopes;
1204 scopeIndex = auths[key].indexOf(k);
1205 if (scopeIndex >= 0) {
1210 this.model.oauth.scopes.push(o);
1218 for (k in modelAuths) {
1220 if (k === "oauth2") {
1221 if (this.model.oauth === null) {
1222 this.model.oauth = {};
1224 if (this.model.oauth.scopes === void 0) {
1225 this.model.oauth.scopes = [];
1227 for (_j = 0, _len1 = v.length; _j < _len1; _j++) {
1229 this.model.oauth.scopes.push(o);
1235 if (typeof this.model.responses !== 'undefined') {
1236 this.model.responseMessages = [];
1237 _ref1 = this.model.responses;
1238 for (code in _ref1) {
1239 value = _ref1[code];
1241 schemaObj = this.model.responses[code].schema;
1242 if (schemaObj && schemaObj['$ref']) {
1243 schema = schemaObj['$ref'];
1244 if (schema.indexOf('#/definitions/') === 0) {
1245 schema = schema.substring('#/definitions/'.length);
1248 this.model.responseMessages.push({
1250 message: value.description,
1251 responseModel: schema
1255 if (typeof this.model.responseMessages === 'undefined') {
1256 this.model.responseMessages = [];
1258 signatureModel = null;
1259 if (this.model.successResponse) {
1260 successResponse = this.model.successResponse;
1261 for (key in successResponse) {
1262 value = successResponse[key];
1263 this.model.successCode = key;
1264 if (typeof value === 'object' && typeof value.createJSONSample === 'function') {
1266 sampleJSON: JSON.stringify(value.createJSONSample(), void 0, 2),
1268 signature: value.getMockSignature()
1272 } else if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
1274 sampleJSON: this.model.responseSampleJSON,
1276 signature: this.model.responseClassSignature
1279 $(this.el).html(Handlebars.templates.operation(this.model));
1280 if (signatureModel) {
1281 responseSignatureView = new SignatureView({
1282 model: signatureModel,
1285 $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
1287 this.model.responseClassSignature = 'string';
1288 $('.model-signature', $(this.el)).html(this.model.type);
1290 contentTypeModel = {
1293 contentTypeModel.consumes = this.model.consumes;
1294 contentTypeModel.produces = this.model.produces;
1295 _ref2 = this.model.parameters;
1296 for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1298 type = param.type || param.dataType || '';
1299 if (typeof type === 'undefined') {
1300 schema = param.schema;
1301 if (schema && schema['$ref']) {
1302 ref = schema['$ref'];
1303 if (ref.indexOf('#/definitions/') === 0) {
1304 type = ref.substring('#/definitions/'.length);
1310 if (type && type.toLowerCase() === 'file') {
1311 if (!contentTypeModel.consumes) {
1312 contentTypeModel.consumes = 'multipart/form-data';
1317 responseContentTypeView = new ResponseContentTypeView({
1318 model: contentTypeModel
1320 $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
1321 _ref3 = this.model.parameters;
1322 for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
1324 this.addParameter(param, contentTypeModel.consumes);
1326 _ref4 = this.model.responseMessages;
1327 for (_m = 0, _len4 = _ref4.length; _m < _len4; _m++) {
1328 statusCode = _ref4[_m];
1329 this.addStatusCode(statusCode);
1334 OperationView.prototype.addParameter = function(param, consumes) {
1336 param.consumes = consumes;
1337 paramView = new ParameterView({
1340 readOnly: this.model.isReadOnly
1342 return $('.operation-params', $(this.el)).append(paramView.render().el);
1345 OperationView.prototype.addStatusCode = function(statusCode) {
1347 statusCodeView = new StatusCodeView({
1351 return $('.operation-status', $(this.el)).append(statusCodeView.render().el);
1354 OperationView.prototype.submitOperation = function(e) {
1355 var error_free, form, isFileUpload, map, o, opts, val, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;
1359 form = $('.sandbox', $(this.el));
1361 form.find("input.required").each(function() {
1362 $(this).removeClass("error");
1363 if (jQuery.trim($(this).val()) === "") {
1364 $(this).addClass("error");
1366 callback: (function(_this) {
1368 return $(_this).focus();
1372 return error_free = false;
1375 form.find("textarea.required").each(function() {
1376 $(this).removeClass("error");
1377 if (jQuery.trim($(this).val()) === "") {
1378 $(this).addClass("error");
1380 callback: (function(_this) {
1382 return $(_this).focus();
1386 return error_free = false;
1394 isFileUpload = false;
1395 _ref = form.find("input");
1396 for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1398 if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1399 map[o.name] = o.value;
1401 if (o.type === "file") {
1402 map[o.name] = o.files[0];
1403 isFileUpload = true;
1406 _ref1 = form.find("textarea");
1407 for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
1409 if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1410 map[o.name] = o.value;
1413 _ref2 = form.find("select");
1414 for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1416 val = this.getSelectedValue(o);
1417 if ((val != null) && jQuery.trim(val).length > 0) {
1421 opts.responseContentType = $("div select[name=responseContentType]", $(this.el)).val();
1422 opts.requestContentType = $("div select[name=parameterContentType]", $(this.el)).val();
1423 $(".response_throbber", $(this.el)).show();
1425 return this.handleFileUpload(map, form);
1427 return this.model["do"](map, opts, this.showCompleteStatus, this.showErrorStatus, this);
1432 OperationView.prototype.success = function(response, parent) {
1433 return parent.showCompleteStatus(response);
1436 OperationView.prototype.handleFileUpload = function(map, form) {
1437 var bodyParam, el, headerParams, o, obj, param, params, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3;
1438 _ref = form.serializeArray();
1439 for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1441 if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1442 map[o.name] = o.value;
1445 bodyParam = new FormData();
1447 _ref1 = this.model.parameters;
1448 for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
1450 if (param.paramType === 'form' || param["in"] === 'formData') {
1451 if (param.type.toLowerCase() !== 'file' && map[param.name] !== void 0) {
1452 bodyParam.append(param.name, map[param.name]);
1457 _ref2 = this.model.parameters;
1458 for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1460 if (param.paramType === 'header') {
1461 headerParams[param.name] = map[param.name];
1464 _ref3 = form.find('input[type~="file"]');
1465 for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
1467 if (typeof el.files[0] !== 'undefined') {
1468 bodyParam.append($(el).attr('name'), el.files[0]);
1472 this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), delete headerParams['Content-Type'], this.model.urlify(map, false)) : this.model.urlify(map, true);
1473 $(".request_url", $(this.el)).html("<pre></pre>");
1474 $(".request_url pre", $(this.el)).text(this.invocationUrl);
1476 type: this.model.method,
1477 url: this.invocationUrl,
1478 headers: headerParams,
1483 error: (function(_this) {
1484 return function(data, textStatus, error) {
1485 return _this.showErrorStatus(_this.wrap(data), _this);
1488 success: (function(_this) {
1489 return function(data) {
1490 return _this.showResponse(data, _this);
1493 complete: (function(_this) {
1494 return function(data) {
1495 return _this.showCompleteStatus(_this.wrap(data), _this);
1499 if (window.authorizations) {
1500 window.authorizations.apply(obj);
1503 obj.data.append("fake", "true");
1509 OperationView.prototype.wrap = function(data) {
1510 var h, headerArray, headers, i, o, _i, _len;
1512 headerArray = data.getAllResponseHeaders().split("\r");
1513 for (_i = 0, _len = headerArray.length; _i < _len; _i++) {
1514 i = headerArray[_i];
1515 h = i.match(/^([^:]*?):(.*)$/);
1520 if (h[0] !== void 0 && h[1] !== void 0) {
1521 headers[h[0].trim()] = h[1].trim();
1526 o.content.data = data.responseText;
1527 o.headers = headers;
1529 o.request.url = this.invocationUrl;
1530 o.status = data.status;
1534 OperationView.prototype.getSelectedValue = function(select) {
1535 var opt, options, _i, _len, _ref;
1536 if (!select.multiple) {
1537 return select.value;
1540 _ref = select.options;
1541 for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1544 options.push(opt.value);
1547 if (options.length > 0) {
1555 OperationView.prototype.hideResponse = function(e) {
1559 $(".response", $(this.el)).slideUp();
1560 return $(".response_hider", $(this.el)).fadeOut();
1563 OperationView.prototype.showResponse = function(response) {
1565 prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>");
1566 return $(".response_body", $(this.el)).html(escape(prettyJson));
1569 OperationView.prototype.showErrorStatus = function(data, parent) {
1570 return parent.showStatus(data);
1573 OperationView.prototype.showCompleteStatus = function(data, parent) {
1574 return parent.showStatus(data);
1577 OperationView.prototype.formatXml = function(xml) {
1578 var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
1579 reg = /(>)(<)(\/*)/g;
1580 wsexp = /[ ]*(.*)[ ]+\n/g;
1581 contexp = /(<.+>)(.+\n)/g;
1582 xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
1585 lines = xml.split('\n');
1589 'single->single': 0,
1590 'single->closing': -1,
1591 'single->opening': 0,
1593 'closing->single': 0,
1594 'closing->closing': -1,
1595 'closing->opening': 0,
1596 'closing->other': 0,
1597 'opening->single': 1,
1598 'opening->closing': 0,
1599 'opening->opening': 1,
1600 'opening->other': 1,
1602 'other->closing': -1,
1603 'other->opening': 0,
1606 _fn = function(ln) {
1607 var fromTo, j, key, padding, type, types, value;
1609 single: Boolean(ln.match(/<.+\/>/)),
1610 closing: Boolean(ln.match(/<\/.+>/)),
1611 opening: Boolean(ln.match(/<[^!?].*>/))
1613 type = ((function() {
1616 for (key in types) {
1624 type = type === void 0 ? 'other' : type;
1625 fromTo = lastType + '->' + type;
1628 indent += transitions[fromTo];
1629 padding = ((function() {
1630 var _j, _ref, _results;
1632 for (j = _j = 0, _ref = indent; 0 <= _ref ? _j < _ref : _j > _ref; j = 0 <= _ref ? ++_j : --_j) {
1637 if (fromTo === 'opening->closing') {
1638 return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
1640 return formatted += padding + ln + '\n';
1643 for (_i = 0, _len = lines.length; _i < _len; _i++) {
1650 OperationView.prototype.showStatus = function(response) {
1651 var code, content, contentType, e, headers, json, opts, pre, response_body, response_body_el, url;
1652 if (response.content === void 0) {
1653 content = response.data;
1656 content = response.content.data;
1657 url = response.request.url;
1659 headers = response.headers;
1662 contentType = headers["Content-Type"] || headers["content-type"];
1664 contentType = contentType.split(";")[0].trim();
1667 $(".response_body", $(this.el)).removeClass('json');
1668 $(".response_body", $(this.el)).removeClass('xml');
1670 code = $('<code />').text("no content");
1671 pre = $('<pre class="json" />').append(code);
1672 } else if (contentType === "application/json" || /\+json$/.test(contentType)) {
1675 json = JSON.stringify(JSON.parse(content), null, " ");
1678 json = "can't parse JSON. Raw result:\n\n" + content;
1680 code = $('<code />').text(json);
1681 pre = $('<pre class="json" />').append(code);
1682 } else if (contentType === "application/xml" || /\+xml$/.test(contentType)) {
1683 code = $('<code />').text(this.formatXml(content));
1684 pre = $('<pre class="xml" />').append(code);
1685 } else if (contentType === "text/html") {
1686 code = $('<code />').html(_.escape(content));
1687 pre = $('<pre class="xml" />').append(code);
1688 } else if (/^image\//.test(contentType)) {
1689 pre = $('<img>').attr('src', url);
1691 code = $('<code />').text(content);
1692 pre = $('<pre class="json" />').append(code);
1694 response_body = pre;
1695 $(".request_url", $(this.el)).html("<pre></pre>");
1696 $(".request_url pre", $(this.el)).text(url);
1697 $(".response_code", $(this.el)).html("<pre>" + response.status + "</pre>");
1698 $(".response_body", $(this.el)).html(response_body);
1699 $(".response_headers", $(this.el)).html("<pre>" + _.escape(JSON.stringify(response.headers, null, " ")).replace(/\n/g, "<br>") + "</pre>");
1700 $(".response", $(this.el)).slideDown();
1701 $(".response_hider", $(this.el)).show();
1702 $(".response_throbber", $(this.el)).hide();
1703 response_body_el = $('.response_body', $(this.el))[0];
1704 opts = this.options.swaggerOptions;
1705 if (opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold) {
1706 return response_body_el;
1708 return hljs.highlightBlock(response_body_el);
1712 OperationView.prototype.toggleOperationContent = function() {
1714 elem = $('#' + Docs.escapeResourceName(this.parentId + "_" + this.nickname + "_content"));
1715 if (elem.is(':visible')) {
1716 return Docs.collapseOperation(elem);
1718 return Docs.expandOperation(elem);
1722 return OperationView;
1726 var ParameterContentTypeView,
1727 __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; },
1728 __hasProp = {}.hasOwnProperty;
1730 ParameterContentTypeView = (function(_super) {
1731 __extends(ParameterContentTypeView, _super);
1733 function ParameterContentTypeView() {
1734 return ParameterContentTypeView.__super__.constructor.apply(this, arguments);
1737 ParameterContentTypeView.prototype.initialize = function() {};
1739 ParameterContentTypeView.prototype.render = function() {
1741 template = this.template();
1742 $(this.el).html(template(this.model));
1743 $('label[for=parameterContentType]', $(this.el)).text('Parameter content type:');
1747 ParameterContentTypeView.prototype.template = function() {
1748 return Handlebars.templates.parameter_content_type;
1751 return ParameterContentTypeView;
1755 this["Handlebars"]["templates"]["param_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1756 var stack1, buffer = "";
1757 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});
1758 if (stack1 != null) { buffer += stack1; }
1760 },"2":function(depth0,helpers,partials,data) {
1761 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1762 return " <input type=\"file\" name='"
1763 + 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)))
1765 },"4":function(depth0,helpers,partials,data) {
1766 var stack1, buffer = "";
1767 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});
1768 if (stack1 != null) { buffer += stack1; }
1770 },"5":function(depth0,helpers,partials,data) {
1771 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1772 return " <textarea class='body-textarea required' placeholder='(required)' name='"
1773 + 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)))
1775 + 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)))
1776 + "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
1777 },"7":function(depth0,helpers,partials,data) {
1778 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1779 return " <textarea class='body-textarea required' placeholder='(required)' name='"
1780 + 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)))
1781 + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
1782 },"9":function(depth0,helpers,partials,data) {
1783 var stack1, buffer = "";
1784 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});
1785 if (stack1 != null) { buffer += stack1; }
1787 },"10":function(depth0,helpers,partials,data) {
1788 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1789 return " <input class='parameter' class='required' type='file' name='"
1790 + 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)))
1792 },"12":function(depth0,helpers,partials,data) {
1793 var stack1, buffer = "";
1794 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});
1795 if (stack1 != null) { buffer += stack1; }
1797 },"13":function(depth0,helpers,partials,data) {
1798 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1799 return " <input class='parameter required' minlength='1' name='"
1800 + 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)))
1801 + "' placeholder='(required)' type='text' value='"
1802 + 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)))
1804 },"15":function(depth0,helpers,partials,data) {
1805 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1806 return " <input class='parameter required' minlength='1' name='"
1807 + 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)))
1808 + "' placeholder='(required)' type='text' value=''/>\n";
1809 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1810 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
1811 + 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)))
1813 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});
1814 if (stack1 != null) { buffer += stack1; }
1815 buffer += "</td>\n<td>\n <strong><span class=\"markdown\">";
1816 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));
1817 if (stack1 != null) { buffer += stack1; }
1818 buffer += "</span></strong>\n</td>\n<td>";
1819 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));
1820 if (stack1 != null) { buffer += stack1; }
1821 return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1823 this["Handlebars"]["templates"]["parameter_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1824 var stack1, buffer = "";
1825 stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
1826 if (stack1 != null) { buffer += stack1; }
1828 },"2":function(depth0,helpers,partials,data) {
1829 var stack1, lambda=this.lambda, buffer = " <option value=\"";
1830 stack1 = lambda(depth0, depth0);
1831 if (stack1 != null) { buffer += stack1; }
1833 stack1 = lambda(depth0, depth0);
1834 if (stack1 != null) { buffer += stack1; }
1835 return buffer + "</option>\n";
1836 },"4":function(depth0,helpers,partials,data) {
1837 return " <option value=\"application/json\">application/json</option>\n";
1838 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1839 var stack1, buffer = "<label for=\"parameterContentType\"></label>\n<select name=\"parameterContentType\">\n";
1840 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});
1841 if (stack1 != null) { buffer += stack1; }
1842 return buffer + "</select>\n";
1845 __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; },
1846 __hasProp = {}.hasOwnProperty;
1848 ParameterView = (function(_super) {
1849 __extends(ParameterView, _super);
1851 function ParameterView() {
1852 return ParameterView.__super__.constructor.apply(this, arguments);
1855 ParameterView.prototype.initialize = function() {
1856 return Handlebars.registerHelper('isArray', function(param, opts) {
1857 if (param.type.toLowerCase() === 'array' || param.allowMultiple) {
1858 return opts.fn(this);
1860 return opts.inverse(this);
1865 ParameterView.prototype.render = function() {
1866 var contentTypeModel, isParam, parameterContentTypeView, ref, responseContentTypeView, schema, signatureModel, signatureView, template, type;
1867 type = this.model.type || this.model.dataType;
1868 if (typeof type === 'undefined') {
1869 schema = this.model.schema;
1870 if (schema && schema['$ref']) {
1871 ref = schema['$ref'];
1872 if (ref.indexOf('#/definitions/') === 0) {
1873 type = ref.substring('#/definitions/'.length);
1879 this.model.type = type;
1880 this.model.paramType = this.model["in"] || this.model.paramType;
1881 if (this.model.paramType === 'body' || this.model["in"] === 'body') {
1882 this.model.isBody = true;
1884 if (type && type.toLowerCase() === 'file') {
1885 this.model.isFile = true;
1887 this.model["default"] = this.model["default"] || this.model.defaultValue;
1888 if (this.model.allowableValues) {
1889 this.model.isList = true;
1891 template = this.template();
1892 $(this.el).html(template(this.model));
1894 sampleJSON: this.model.sampleJSON,
1896 signature: this.model.signature
1898 if (this.model.sampleJSON) {
1899 signatureView = new SignatureView({
1900 model: signatureModel,
1903 $('.model-signature', $(this.el)).append(signatureView.render().el);
1905 $('.model-signature', $(this.el)).html(this.model.signature);
1908 if (this.model.isBody) {
1911 contentTypeModel = {
1914 contentTypeModel.consumes = this.model.consumes;
1916 parameterContentTypeView = new ParameterContentTypeView({
1917 model: contentTypeModel
1919 $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el);
1921 responseContentTypeView = new ResponseContentTypeView({
1922 model: contentTypeModel
1924 $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
1929 ParameterView.prototype.template = function() {
1930 if (this.model.isList) {
1931 return Handlebars.templates.param_list;
1933 if (this.options.readOnly) {
1934 if (this.model.required) {
1935 return Handlebars.templates.param_readonly_required;
1937 return Handlebars.templates.param_readonly;
1940 if (this.model.required) {
1941 return Handlebars.templates.param_required;
1943 return Handlebars.templates.param;
1949 return ParameterView;
1954 __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; },
1955 __hasProp = {}.hasOwnProperty;
1957 ResourceView = (function(_super) {
1958 __extends(ResourceView, _super);
1960 function ResourceView() {
1961 return ResourceView.__super__.constructor.apply(this, arguments);
1964 ResourceView.prototype.initialize = function(opts) {
1968 this.auths = opts.auths;
1969 if ("" === this.model.description) {
1970 this.model.description = null;
1972 if (this.model.description != null) {
1973 return this.model.summary = this.model.description;
1977 ResourceView.prototype.render = function() {
1978 var counter, id, methods, operation, _i, _len, _ref;
1980 $(this.el).html(Handlebars.templates.resource(this.model));
1981 _ref = this.model.operationsArray;
1982 for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1983 operation = _ref[_i];
1985 id = operation.nickname;
1986 while (typeof methods[id] !== 'undefined') {
1987 id = id + "_" + counter;
1990 methods[id] = operation;
1991 operation.nickname = id;
1992 operation.parentId = this.model.id;
1993 this.addOperation(operation);
1995 $('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'));
1996 $('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource'));
1997 $('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource'));
2001 ResourceView.prototype.addOperation = function(operation) {
2003 operation.number = this.number;
2004 operationView = new OperationView({
2007 className: 'endpoint',
2008 swaggerOptions: this.options.swaggerOptions,
2011 $('.endpoints', $(this.el)).append(operationView.render().el);
2012 return this.number++;
2015 ResourceView.prototype.callDocs = function(fnName, e) {
2017 return Docs[fnName](e.currentTarget.getAttribute('data-id'));
2020 return ResourceView;
2024 this["Handlebars"]["templates"]["resource"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
2026 },"3":function(depth0,helpers,partials,data) {
2027 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
2028 return "<li>\n <a href='"
2029 + 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)))
2030 + "'>Raw</a>\n </li>";
2031 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2032 var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "<div class='heading'>\n <h2>\n <a href='#!/"
2033 + 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)))
2034 + "' class=\"toggleEndpointList\" data-id=\""
2035 + 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)))
2037 + 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)))
2039 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));
2040 if (!helpers.summary) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
2041 if (stack1 != null) { buffer += stack1; }
2042 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));
2043 if (stack1 != null) { buffer += stack1; }
2044 buffer += "\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/"
2045 + 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)))
2046 + "' id='endpointListTogger_"
2047 + 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)))
2048 + "' class=\"toggleEndpointList\" data-id=\""
2049 + 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)))
2050 + "\">Show/Hide</a>\n </li>\n <li>\n <a href='#' class=\"collapseResource\" data-id=\""
2051 + 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)))
2052 + "\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' class=\"expandResource\" data-id=\""
2053 + 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)))
2054 + "\">\n Expand Operations\n </a>\n </li>\n ";
2055 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));
2056 if (!helpers.url) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
2057 if (stack1 != null) { buffer += stack1; }
2058 return buffer + "\n </ul>\n</div>\n<ul class='endpoints' id='"
2059 + 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)))
2060 + "_endpoint_list' style='display:none'>\n\n</ul>\n";
2062 var ResponseContentTypeView,
2063 __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; },
2064 __hasProp = {}.hasOwnProperty;
2066 ResponseContentTypeView = (function(_super) {
2067 __extends(ResponseContentTypeView, _super);
2069 function ResponseContentTypeView() {
2070 return ResponseContentTypeView.__super__.constructor.apply(this, arguments);
2073 ResponseContentTypeView.prototype.initialize = function() {};
2075 ResponseContentTypeView.prototype.render = function() {
2077 template = this.template();
2078 $(this.el).html(template(this.model));
2079 $('label[for=responseContentType]', $(this.el)).text('Response Content Type');
2083 ResponseContentTypeView.prototype.template = function() {
2084 return Handlebars.templates.response_content_type;
2087 return ResponseContentTypeView;
2091 this["Handlebars"]["templates"]["response_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
2092 var stack1, buffer = "";
2093 stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
2094 if (stack1 != null) { buffer += stack1; }
2096 },"2":function(depth0,helpers,partials,data) {
2097 var stack1, lambda=this.lambda, buffer = " <option value=\"";
2098 stack1 = lambda(depth0, depth0);
2099 if (stack1 != null) { buffer += stack1; }
2101 stack1 = lambda(depth0, depth0);
2102 if (stack1 != null) { buffer += stack1; }
2103 return buffer + "</option>\n";
2104 },"4":function(depth0,helpers,partials,data) {
2105 return " <option value=\"application/json\">application/json</option>\n";
2106 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2107 var stack1, buffer = "<label for=\"responseContentType\"></label>\n<select name=\"responseContentType\">\n";
2108 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});
2109 if (stack1 != null) { buffer += stack1; }
2110 return buffer + "</select>\n";
2113 __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; },
2114 __hasProp = {}.hasOwnProperty;
2116 SignatureView = (function(_super) {
2117 __extends(SignatureView, _super);
2119 function SignatureView() {
2120 return SignatureView.__super__.constructor.apply(this, arguments);
2123 SignatureView.prototype.events = {
2124 'click a.description-link': 'switchToDescription',
2125 'click a.snippet-link': 'switchToSnippet',
2126 'mousedown .snippet': 'snippetToTextArea'
2129 SignatureView.prototype.initialize = function() {};
2131 SignatureView.prototype.render = function() {
2133 template = this.template();
2134 $(this.el).html(template(this.model));
2135 this.switchToSnippet();
2136 this.isParam = this.model.isParam;
2138 $('.notice', $(this.el)).text('Click to set as parameter value');
2143 SignatureView.prototype.template = function() {
2144 return Handlebars.templates.signature;
2147 SignatureView.prototype.switchToDescription = function(e) {
2151 $(".snippet", $(this.el)).hide();
2152 $(".description", $(this.el)).show();
2153 $('.description-link', $(this.el)).addClass('selected');
2154 return $('.snippet-link', $(this.el)).removeClass('selected');
2157 SignatureView.prototype.switchToSnippet = function(e) {
2161 $(".description", $(this.el)).hide();
2162 $(".snippet", $(this.el)).show();
2163 $('.snippet-link', $(this.el)).addClass('selected');
2164 return $('.description-link', $(this.el)).removeClass('selected');
2167 SignatureView.prototype.snippetToTextArea = function(e) {
2173 textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
2174 if ($.trim(textArea.val()) === '') {
2175 return textArea.val(this.model.sampleJSON);
2180 return SignatureView;
2184 this["Handlebars"]["templates"]["signature"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2185 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 ";
2186 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));
2187 if (stack1 != null) { buffer += stack1; }
2188 return buffer + "\n </div>\n\n <div class=\"snippet\">\n <pre><code>"
2189 + 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)))
2190 + "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
2193 __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; },
2194 __hasProp = {}.hasOwnProperty;
2196 StatusCodeView = (function(_super) {
2197 __extends(StatusCodeView, _super);
2199 function StatusCodeView() {
2200 return StatusCodeView.__super__.constructor.apply(this, arguments);
2203 StatusCodeView.prototype.initialize = function() {};
2205 StatusCodeView.prototype.render = function() {
2206 var responseModel, responseModelView, template;
2207 template = this.template();
2208 $(this.el).html(template(this.model));
2209 if (swaggerUi.api.models.hasOwnProperty(this.model.responseModel)) {
2211 sampleJSON: JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(), null, 2),
2213 signature: swaggerUi.api.models[this.model.responseModel].getMockSignature()
2215 responseModelView = new SignatureView({
2216 model: responseModel,
2219 $('.model-signature', this.$el).append(responseModelView.render().el);
2221 $('.model-signature', this.$el).html('');
2226 StatusCodeView.prototype.template = function() {
2227 return Handlebars.templates.status_code;
2230 return StatusCodeView;
2234 this["Handlebars"]["templates"]["status_code"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2235 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td width='15%' class='code'>"
2236 + 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)))
2238 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));
2239 if (stack1 != null) { buffer += stack1; }
2240 return buffer + "</td>\n<td width='50%'><span class=\"model-signature\" /></td>";