2 * Copyright 2016 ZTE Corporation.
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
17 * 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
19 * @link http://swagger.io
24 // Helper function for vertically aligning DOM elements
\r
25 // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
\r
26 $.fn.vAlign = function() {
\r
27 return this.each(function(i){
\r
28 var ah = $(this).height();
\r
29 var ph = $(this).parent().height();
\r
30 var mh = (ph - ah) / 2;
\r
31 $(this).css('margin-top', mh);
\r
35 $.fn.stretchFormtasticInputWidthToParent = function() {
\r
36 return this.each(function(i){
\r
37 var p_width = $(this).closest("form").innerWidth();
\r
38 var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10);
\r
39 var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
\r
40 $(this).css('width', p_width - p_padding - this_padding);
\r
44 $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
\r
46 // Vertically center these paragraphs
\r
47 // Parent may need a min-height for this to work..
\r
48 $('ul.downplayed li div.content p').vAlign();
\r
50 // When a sandbox form is submitted..
\r
51 $("form.sandbox").submit(function(){
\r
53 var error_free = true;
\r
55 // Cycle through the forms required inputs
\r
56 $(this).find("input.required").each(function() {
\r
58 // Remove any existing error styles from the input
\r
59 $(this).removeClass('error');
\r
61 // Tack the error style on if the input is empty..
\r
62 if ($(this).val() == '') {
\r
63 $(this).addClass('error');
\r
75 function clippyCopiedCallback(a) {
\r
76 $('#api_key_copied').fadeIn().delay(1000).fadeOut();
\r
78 // var b = $("#clippy_tooltip_" + a);
\r
79 // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
\r
80 // b.attr("title", "copy to clipboard")
\r
85 // Logging function that accounts for browsers that don't have window.console
\r
87 log.history = log.history || [];
\r
88 log.history.push(arguments);
\r
90 console.log( Array.prototype.slice.call(arguments)[0] );
\r
94 // Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
\r
95 if (Function.prototype.bind && console && typeof console.log == "object") {
\r
97 "log","info","warn","error","assert","dir","clear","profile","profileEnd"
\r
98 ].forEach(function (method) {
\r
99 console[method] = this.bind(console[method], console);
\r
100 }, Function.prototype.call);
\r
105 shebang: function() {
\r
107 // If shebang has an operation nickname in it..
\r
108 // e.g. /docs/#!/words/get_search
\r
109 var fragments = $.param.fragment().split('/');
\r
110 fragments.shift(); // get rid of the bang
\r
112 switch (fragments.length) {
\r
114 // Expand all operations for the resource and scroll to it
\r
115 var dom_id = 'resource_' + fragments[0];
\r
117 Docs.expandEndpointListForResource(fragments[0]);
\r
118 $("#"+dom_id).slideto({highlight: false});
\r
121 // Refer to the endpoint DOM element, e.g. #words_get_search
\r
124 Docs.expandEndpointListForResource(fragments[0]);
\r
125 $("#"+dom_id).slideto({highlight: false});
\r
127 // Expand operation
\r
128 var li_dom_id = fragments.join('_');
\r
129 var li_content_dom_id = li_dom_id + "_content";
\r
132 Docs.expandOperation($('#'+li_content_dom_id));
\r
133 $('#'+li_dom_id).slideto({highlight: false});
\r
139 toggleEndpointListForResource: function(resource) {
\r
140 var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
\r
141 if (elem.is(':visible')) {
\r
142 Docs.collapseEndpointListForResource(resource);
\r
144 Docs.expandEndpointListForResource(resource);
\r
149 expandEndpointListForResource: function(resource) {
\r
150 var resource = Docs.escapeResourceName(resource);
\r
151 if (resource == '') {
\r
152 $('.resource ul.endpoints').slideDown();
\r
156 $('li#resource_' + resource).addClass('active');
\r
158 var elem = $('li#resource_' + resource + ' ul.endpoints');
\r
162 // Collapse resource and mark as explicitly closed
\r
163 collapseEndpointListForResource: function(resource) {
\r
164 var resource = Docs.escapeResourceName(resource);
\r
165 if (resource == '') {
\r
166 $('.resource ul.endpoints').slideUp();
\r
170 $('li#resource_' + resource).removeClass('active');
\r
172 var elem = $('li#resource_' + resource + ' ul.endpoints');
\r
176 expandOperationsForResource: function(resource) {
\r
177 // Make sure the resource container is open..
\r
178 Docs.expandEndpointListForResource(resource);
\r
180 if (resource == '') {
\r
181 $('.resource ul.endpoints li.operation div.content').slideDown();
\r
185 $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
\r
186 Docs.expandOperation($(this));
\r
190 collapseOperationsForResource: function(resource) {
\r
191 // Make sure the resource container is open..
\r
192 Docs.expandEndpointListForResource(resource);
\r
194 if (resource == '') {
\r
195 $('.resource ul.endpoints li.operation div.content').slideUp();
\r
199 $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
\r
200 Docs.collapseOperation($(this));
\r
204 escapeResourceName: function(resource) {
\r
205 return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
\r
208 expandOperation: function(elem) {
\r
212 collapseOperation: function(elem) {
\r
217 this["Handlebars"] = this["Handlebars"] || {};
218 this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
219 this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
220 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
221 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'>"
222 + 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)))
223 + "</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";
226 __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; },
227 __hasProp = {}.hasOwnProperty;
229 SwaggerUi = (function(_super) {
230 __extends(SwaggerUi, _super);
232 function SwaggerUi() {
233 return SwaggerUi.__super__.constructor.apply(this, arguments);
236 SwaggerUi.prototype.dom_id = "swagger_ui";
238 SwaggerUi.prototype.options = null;
240 SwaggerUi.prototype.api = null;
242 SwaggerUi.prototype.headerView = null;
244 SwaggerUi.prototype.mainView = null;
246 SwaggerUi.prototype.initialize = function(options) {
247 if (options == null) {
250 if (options.dom_id != null) {
251 this.dom_id = options.dom_id;
252 delete options.dom_id;
254 if (options.supportedSubmitMethods == null) {
255 options.supportedSubmitMethods = ['get', 'put', 'post', 'delete', 'head', 'options', 'patch'];
257 if ($('#' + this.dom_id) == null) {
258 $('body').append('<div id="' + this.dom_id + '"></div>');
260 this.options = options;
261 this.options.success = (function(_this) {
263 return _this.render();
266 this.options.progress = (function(_this) {
268 return _this.showMessage(d);
271 this.options.failure = (function(_this) {
273 return _this.onLoadFailure(d);
276 this.headerView = new HeaderView({
279 return this.headerView.on('update-swagger-ui', (function(_this) {
280 return function(data) {
281 return _this.updateSwaggerUi(data);
286 SwaggerUi.prototype.setOption = function(option, value) {
287 return this.options[option] = value;
290 SwaggerUi.prototype.getOption = function(option) {
291 return this.options[option];
294 SwaggerUi.prototype.updateSwaggerUi = function(data) {
295 this.options.url = data.url;
299 SwaggerUi.prototype.load = function() {
301 if ((_ref = this.mainView) != null) {
304 url = this.options.url;
305 if (url && url.indexOf("http") !== 0) {
306 url = this.buildUrl(window.location.href.toString(), url);
308 this.options.url = url;
309 this.headerView.update(url);
310 return this.api = new SwaggerClient(this.options);
313 SwaggerUi.prototype.collapseAll = function() {
314 return Docs.collapseEndpointListForResource('');
317 SwaggerUi.prototype.listAll = function() {
318 return Docs.collapseOperationsForResource('');
321 SwaggerUi.prototype.expandAll = function() {
322 return Docs.expandOperationsForResource('');
325 SwaggerUi.prototype.render = function() {
326 this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
327 this.mainView = new MainView({
329 el: $('#' + this.dom_id),
330 swaggerOptions: this.options
333 switch (this.options.docExpansion) {
341 if (this.options.onComplete) {
342 this.options.onComplete(this.api, this);
344 return setTimeout((function(_this) {
346 return Docs.shebang();
351 SwaggerUi.prototype.buildUrl = function(base, url) {
352 var endOfPath, parts;
353 if (url.indexOf("/") === 0) {
354 parts = base.split("/");
355 base = parts[0] + "//" + parts[2];
358 endOfPath = base.length;
359 if (base.indexOf("?") > -1) {
360 endOfPath = Math.min(endOfPath, base.indexOf("?"));
362 if (base.indexOf("#") > -1) {
363 endOfPath = Math.min(endOfPath, base.indexOf("#"));
365 base = base.substring(0, endOfPath);
366 if (base.indexOf("/", base.length - 1) !== -1) {
369 return base + "/" + url;
373 SwaggerUi.prototype.showMessage = function(data) {
377 $('#message-bar').removeClass('message-fail');
378 $('#message-bar').addClass('message-success');
379 return $('#message-bar').html(data);
382 SwaggerUi.prototype.onLoadFailure = function(data) {
387 $('#message-bar').removeClass('message-success');
388 $('#message-bar').addClass('message-fail');
389 val = $('#message-bar').html(data);
390 if (this.options.onFailure != null) {
391 this.options.onFailure(data);
396 SwaggerUi.prototype.renderGFM = function(data) {
400 return $('.markdown').each(function(index) {
401 return $(this).html(marked($(this).html()));
409 window.SwaggerUi = SwaggerUi;
411 this["Handlebars"]["templates"]["basic_auth_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
412 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";
414 Handlebars.registerHelper('sanitize', function(html) {
415 html = html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
416 return new Handlebars.SafeString(html);
419 this["Handlebars"]["templates"]["content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
420 var stack1, buffer = "";
421 stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
422 if (stack1 != null) { buffer += stack1; }
424 },"2":function(depth0,helpers,partials,data) {
425 var stack1, lambda=this.lambda, buffer = " <option value=\"";
426 stack1 = lambda(depth0, depth0);
427 if (stack1 != null) { buffer += stack1; }
429 stack1 = lambda(depth0, depth0);
430 if (stack1 != null) { buffer += stack1; }
431 return buffer + "</option>\n";
432 },"4":function(depth0,helpers,partials,data) {
433 return " <option value=\"application/json\">application/json</option>\n";
434 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
435 var stack1, buffer = "<label for=\"contentType\"></label>\n<select name=\"contentType\">\n";
436 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});
437 if (stack1 != null) { buffer += stack1; }
438 return buffer + "</select>\n";
441 __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; },
442 __hasProp = {}.hasOwnProperty;
444 ApiKeyButton = (function(_super) {
445 __extends(ApiKeyButton, _super);
447 function ApiKeyButton() {
448 return ApiKeyButton.__super__.constructor.apply(this, arguments);
451 ApiKeyButton.prototype.initialize = function() {};
453 ApiKeyButton.prototype.render = function() {
455 template = this.template();
456 $(this.el).html(template(this.model));
460 ApiKeyButton.prototype.events = {
461 "click #apikey_button": "toggleApiKeyContainer",
462 "click #apply_api_key": "applyApiKey"
465 ApiKeyButton.prototype.applyApiKey = function() {
467 window.authorizations.add(this.model.name, new ApiKeyAuthorization(this.model.name, $("#input_apiKey_entry").val(), this.model["in"]));
468 window.swaggerUi.load();
469 return elem = $('#apikey_container').show();
472 ApiKeyButton.prototype.toggleApiKeyContainer = function() {
474 if ($('#apikey_container').length > 0) {
475 elem = $('#apikey_container').first();
476 if (elem.is(':visible')) {
479 $('.auth_container').hide();
485 ApiKeyButton.prototype.template = function() {
486 return Handlebars.templates.apikey_button_view;
493 this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
494 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <div class=\"info_title\">"
495 + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
496 + "</div>\n <div class=\"info_description markdown\">";
497 stack1 = lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.description : stack1), depth0);
498 if (stack1 != null) { buffer += stack1; }
499 buffer += "</div>\n ";
500 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});
501 if (stack1 != null) { buffer += stack1; }
503 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});
504 if (stack1 != null) { buffer += stack1; }
506 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});
507 if (stack1 != null) { buffer += stack1; }
509 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});
510 if (stack1 != null) { buffer += stack1; }
512 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});
513 if (stack1 != null) { buffer += stack1; }
514 return buffer + "\n";
515 },"2":function(depth0,helpers,partials,data) {
516 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
517 return "<div class=\"info_tos\"><a href=\""
518 + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), depth0))
519 + "\">Terms of service</a></div>";
520 },"4":function(depth0,helpers,partials,data) {
521 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
522 return "<div class='info_name'>Created by "
523 + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), depth0))
525 },"6":function(depth0,helpers,partials,data) {
526 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
527 return "<div class='info_url'>See more at <a href=\""
528 + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
530 + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
532 },"8":function(depth0,helpers,partials,data) {
533 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
534 return "<div class='info_email'><a href=\"mailto:"
535 + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), depth0))
537 + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
538 + "\">Contact the developer</a></div>";
539 },"10":function(depth0,helpers,partials,data) {
540 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
541 return "<div class='info_license'><a href='"
542 + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.url : stack1), depth0))
544 + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.name : stack1), depth0))
546 },"12":function(depth0,helpers,partials,data) {
547 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
548 return " , <span style=\"font-variant: small-caps\">api version</span>: "
549 + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), depth0))
551 },"14":function(depth0,helpers,partials,data) {
552 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
553 return " <span style=\"float:right\"><a href=\""
554 + 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)))
556 + 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)))
557 + "\"><img id=\"validator\" src=\""
558 + 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)))
560 + 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)))
561 + "\"></a>\n </span>\n";
562 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
563 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div class='info' id='api_info'>\n";
564 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.info : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
565 if (stack1 != null) { buffer += stack1; }
566 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>: "
567 + 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)))
569 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});
570 if (stack1 != null) { buffer += stack1; }
572 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.validatorUrl : depth0), {"name":"if","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data});
573 if (stack1 != null) { buffer += stack1; }
574 return buffer + " </h4>\n </div>\n</div>\n";
577 __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; },
578 __hasProp = {}.hasOwnProperty;
580 BasicAuthButton = (function(_super) {
581 __extends(BasicAuthButton, _super);
583 function BasicAuthButton() {
584 return BasicAuthButton.__super__.constructor.apply(this, arguments);
587 BasicAuthButton.prototype.initialize = function() {};
589 BasicAuthButton.prototype.render = function() {
591 template = this.template();
592 $(this.el).html(template(this.model));
596 BasicAuthButton.prototype.events = {
597 "click #basic_auth_button": "togglePasswordContainer",
598 "click #apply_basic_auth": "applyPassword"
601 BasicAuthButton.prototype.applyPassword = function() {
602 var elem, password, username;
603 username = $(".input_username").val();
604 password = $(".input_password").val();
605 window.authorizations.add(this.model.type, new PasswordAuthorization("basic", username, password));
606 window.swaggerUi.load();
607 return elem = $('#basic_auth_container').hide();
610 BasicAuthButton.prototype.togglePasswordContainer = function() {
612 if ($('#basic_auth_container').length > 0) {
613 elem = $('#basic_auth_container').show();
614 if (elem.is(':visible')) {
615 return elem.slideUp();
617 $('.auth_container').hide();
623 BasicAuthButton.prototype.template = function() {
624 return Handlebars.templates.basic_auth_button_view;
627 return BasicAuthButton;
631 this["Handlebars"]["templates"]["operation"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
633 },"3":function(depth0,helpers,partials,data) {
634 return " <h4>Warning: Deprecated</h4>\n";
635 },"5":function(depth0,helpers,partials,data) {
636 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, buffer = " <h4>Implementation Notes</h4>\n <p class=\"markdown\">";
637 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));
638 if (stack1 != null) { buffer += stack1; }
639 return buffer + "</p>\n";
640 },"7":function(depth0,helpers,partials,data) {
641 return " <div class=\"auth\">\n <span class=\"api-ic ic-error\"></span>";
642 },"9":function(depth0,helpers,partials,data) {
643 var stack1, buffer = " <div id=\"api_information_panel\" style=\"top: 526px; left: 776px; display: none;\">\n";
644 stack1 = helpers.each.call(depth0, depth0, {"name":"each","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
645 if (stack1 != null) { buffer += stack1; }
646 return buffer + " </div>\n";
647 },"10":function(depth0,helpers,partials,data) {
648 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <div title='";
649 stack1 = lambda((depth0 != null ? depth0.description : depth0), depth0);
650 if (stack1 != null) { buffer += stack1; }
652 + escapeExpression(lambda((depth0 != null ? depth0.scope : depth0), depth0))
654 },"12":function(depth0,helpers,partials,data) {
656 },"14":function(depth0,helpers,partials,data) {
657 return " <div class='access'>\n <span class=\"api-ic ic-off\" title=\"click to authenticate\"></span>\n </div>\n";
658 },"16":function(depth0,helpers,partials,data) {
659 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
660 return " <h4>Response Class (Status "
661 + 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)))
662 + ")</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n";
663 },"18":function(depth0,helpers,partials,data) {
664 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";
665 },"20":function(depth0,helpers,partials,data) {
666 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";
667 },"22":function(depth0,helpers,partials,data) {
669 },"24":function(depth0,helpers,partials,data) {
670 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";
671 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
672 var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "\n <ul class='operations' >\n <li class='"
673 + 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)))
675 + 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)))
677 + 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)))
678 + "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\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 + 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)))
684 + "</a>\n </span>\n <span class='path'>\n <a href='#!/"
685 + 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)))
687 + 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)))
688 + "' class=\"toggleOperation ";
689 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
690 if (stack1 != null) { buffer += stack1; }
692 + 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)))
693 + "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/"
694 + 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)))
696 + 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)))
697 + "' class=\"toggleOperation\">";
698 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));
699 if (stack1 != null) { buffer += stack1; }
700 buffer += "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='"
701 + 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)))
703 + 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)))
704 + "_content' style='display:none'>\n";
705 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data});
706 if (stack1 != null) { buffer += stack1; }
707 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.description : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.noop,"data":data});
708 if (stack1 != null) { buffer += stack1; }
709 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));
710 if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
711 if (stack1 != null) { buffer += stack1; }
713 stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.oauth : depth0), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
714 if (stack1 != null) { buffer += stack1; }
716 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));
717 if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
718 if (stack1 != null) { buffer += stack1; }
720 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));
721 if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
722 if (stack1 != null) { buffer += stack1; }
723 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.type : depth0), {"name":"if","hash":{},"fn":this.program(16, data),"inverse":this.noop,"data":data});
724 if (stack1 != null) { buffer += stack1; }
725 buffer += " <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n";
726 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.parameters : depth0), {"name":"if","hash":{},"fn":this.program(18, data),"inverse":this.noop,"data":data});
727 if (stack1 != null) { buffer += stack1; }
728 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.responseMessages : depth0), {"name":"if","hash":{},"fn":this.program(20, data),"inverse":this.noop,"data":data});
729 if (stack1 != null) { buffer += stack1; }
730 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});
731 if (stack1 != null) { buffer += stack1; }
732 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";
735 __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; },
736 __hasProp = {}.hasOwnProperty;
738 ContentTypeView = (function(_super) {
739 __extends(ContentTypeView, _super);
741 function ContentTypeView() {
742 return ContentTypeView.__super__.constructor.apply(this, arguments);
745 ContentTypeView.prototype.initialize = function() {};
747 ContentTypeView.prototype.render = function() {
749 template = this.template();
750 $(this.el).html(template(this.model));
751 $('label[for=contentType]', $(this.el)).text('Response Content Type');
755 ContentTypeView.prototype.template = function() {
756 return Handlebars.templates.content_type;
759 return ContentTypeView;
763 this["Handlebars"]["templates"]["param"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
764 var stack1, buffer = "";
765 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});
766 if (stack1 != null) { buffer += stack1; }
768 },"2":function(depth0,helpers,partials,data) {
769 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
770 return " <input type=\"file\" name='"
771 + 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)))
772 + "'/>\n <div class=\"parameter-content-type\" />\n";
773 },"4":function(depth0,helpers,partials,data) {
774 var stack1, buffer = "";
775 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});
776 if (stack1 != null) { buffer += stack1; }
778 },"5":function(depth0,helpers,partials,data) {
779 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
780 return " <textarea class='body-textarea' name='"
781 + 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)))
783 + 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)))
784 + "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
785 },"7":function(depth0,helpers,partials,data) {
786 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
787 return " <textarea class='body-textarea' 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 + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
790 },"9":function(depth0,helpers,partials,data) {
791 var stack1, buffer = "";
792 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});
793 if (stack1 != null) { buffer += stack1; }
795 },"10":function(depth0,helpers,partials,data) {
796 var stack1, buffer = "";
797 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});
798 if (stack1 != null) { buffer += stack1; }
800 },"11":function(depth0,helpers,partials,data) {
801 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
802 return " <input class='parameter' minlength='0' name='"
803 + 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)))
804 + "' placeholder='' type='text' value='"
805 + 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)))
807 },"13":function(depth0,helpers,partials,data) {
808 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
809 return " <input class='parameter' minlength='0' name='"
810 + 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)))
811 + "' placeholder='' type='text' value=''/>\n";
812 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
813 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
814 + 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)))
816 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});
817 if (stack1 != null) { buffer += stack1; }
818 buffer += "\n</td>\n<td class=\"markdown\">";
819 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));
820 if (stack1 != null) { buffer += stack1; }
821 buffer += "</td>\n<td>";
822 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));
823 if (stack1 != null) { buffer += stack1; }
824 return buffer + "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n";
827 __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; },
828 __hasProp = {}.hasOwnProperty;
830 HeaderView = (function(_super) {
831 __extends(HeaderView, _super);
833 function HeaderView() {
834 return HeaderView.__super__.constructor.apply(this, arguments);
837 HeaderView.prototype.events = {
838 'click #show-pet-store-icon': 'showPetStore',
839 'click #show-wordnik-dev-icon': 'showWordnikDev',
840 'click #explore': 'showCustom',
841 'keyup #input_baseUrl': 'showCustomOnKeyup',
842 'keyup #input_apiKey': 'showCustomOnKeyup'
845 HeaderView.prototype.initialize = function() {};
847 HeaderView.prototype.showPetStore = function(e) {
848 return this.trigger('update-swagger-ui', {
849 url: "http://petstore.swagger.wordnik.com/api/api-docs"
853 HeaderView.prototype.showWordnikDev = function(e) {
854 return this.trigger('update-swagger-ui', {
855 url: "http://api.wordnik.com/v4/resources.json"
859 HeaderView.prototype.showCustomOnKeyup = function(e) {
860 if (e.keyCode === 13) {
861 return this.showCustom();
865 HeaderView.prototype.showCustom = function(e) {
869 return this.trigger('update-swagger-ui', {
870 url: $('#input_baseUrl').val(),
871 apiKey: $('#input_apiKey').val()
875 HeaderView.prototype.update = function(url, apiKey, trigger) {
876 if (trigger == null) {
879 $('#input_baseUrl').val(url);
881 return this.trigger('update-swagger-ui', {
891 this["Handlebars"]["templates"]["param_list"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
892 return " multiple='multiple'";
893 },"3":function(depth0,helpers,partials,data) {
895 },"5":function(depth0,helpers,partials,data) {
896 var stack1, buffer = "";
897 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});
898 if (stack1 != null) { buffer += stack1; }
900 },"6":function(depth0,helpers,partials,data) {
901 var stack1, helperMissing=helpers.helperMissing, buffer = "";
902 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}));
903 if (stack1 != null) { buffer += stack1; }
905 },"7":function(depth0,helpers,partials,data) {
906 return " <option selected=\"\" value=''></option>\n";
907 },"9":function(depth0,helpers,partials,data) {
908 var stack1, buffer = "";
909 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});
910 if (stack1 != null) { buffer += stack1; }
912 },"10":function(depth0,helpers,partials,data) {
913 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
914 return " <option selected=\"\" value='"
915 + 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)))
917 + 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)))
918 + " (default)</option>\n";
919 },"12":function(depth0,helpers,partials,data) {
920 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
921 return " <option value='"
922 + 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)))
924 + 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)))
926 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
927 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
928 + 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)))
929 + "</td>\n<td>\n <select ";
930 stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}));
931 if (stack1 != null) { buffer += stack1; }
932 buffer += " class='parameter' name='"
933 + 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)))
935 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});
936 if (stack1 != null) { buffer += stack1; }
937 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});
938 if (stack1 != null) { buffer += stack1; }
939 buffer += " </select>\n</td>\n<td class=\"markdown\">";
940 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));
941 if (stack1 != null) { buffer += stack1; }
942 buffer += "</td>\n<td>";
943 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));
944 if (stack1 != null) { buffer += stack1; }
945 return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>";
948 __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; },
949 __hasProp = {}.hasOwnProperty;
951 MainView = (function(_super) {
954 __extends(MainView, _super);
956 function MainView() {
957 return MainView.__super__.constructor.apply(this, arguments);
961 'alpha': function(a, b) {
962 return a.path.localeCompare(b.path);
964 'method': function(a, b) {
965 return a.method.localeCompare(b.method);
969 MainView.prototype.initialize = function(opts) {
970 var auth, key, value, _ref;
974 this.model.auths = [];
975 _ref = this.model.securityDefinitions;
983 this.model.auths.push(auth);
985 if (this.model.swaggerVersion === "2.0") {
986 if ("validatorUrl" in opts.swaggerOptions) {
987 return this.model.validatorUrl = opts.swaggerOptions.validatorUrl;
988 } else if (this.model.url.indexOf("localhost") > 0) {
989 return this.model.validatorUrl = null;
991 return this.model.validatorUrl = "http://online.swagger.io/validator";
996 MainView.prototype.render = function() {
997 var auth, button, counter, id, name, resource, resources, _i, _len, _ref;
998 if (this.model.securityDefinitions) {
999 for (name in this.model.securityDefinitions) {
1000 auth = this.model.securityDefinitions[name];
1001 if (auth.type === "apiKey" && $("#apikey_button").length === 0) {
1002 button = new ApiKeyButton({
1005 $('.auth_main_container').append(button);
1007 if (auth.type === "basicAuth" && $("#basic_auth_button").length === 0) {
1008 button = new BasicAuthButton({
1011 $('.auth_main_container').append(button);
1015 $(this.el).html(Handlebars.templates.main(this.model));
1018 _ref = this.model.apisArray;
1019 for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1020 resource = _ref[_i];
1022 while (typeof resources[id] !== 'undefined') {
1023 id = id + "_" + counter;
1027 resources[id] = resource;
1028 this.addResource(resource, this.model.auths);
1030 $('.propWrap').hover(function() {
1031 return $('.optionsWrapper', $(this)).show();
1033 return $('.optionsWrapper', $(this)).hide();
1038 MainView.prototype.addResource = function(resource, auths) {
1040 resource.id = resource.id.replace(/\s/g, '_');
1041 resourceView = new ResourceView({
1044 id: 'resource_' + resource.id,
1045 className: 'resource',
1047 swaggerOptions: this.options.swaggerOptions
1049 return $('#resources').append(resourceView.render().el);
1052 MainView.prototype.clear = function() {
1053 return $(this.el).html('');
1060 this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1061 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1062 return " <textarea class='body-textarea' readonly='readonly' name='"
1063 + 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)))
1065 + 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)))
1067 },"3":function(depth0,helpers,partials,data) {
1068 var stack1, buffer = "";
1069 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});
1070 if (stack1 != null) { buffer += stack1; }
1072 },"4":function(depth0,helpers,partials,data) {
1073 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1075 + 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)))
1077 },"6":function(depth0,helpers,partials,data) {
1078 return " (empty)\n";
1079 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1080 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
1081 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1083 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});
1084 if (stack1 != null) { buffer += stack1; }
1085 buffer += "</td>\n<td class=\"markdown\">";
1086 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));
1087 if (stack1 != null) { buffer += stack1; }
1088 buffer += "</td>\n<td>";
1089 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));
1090 if (stack1 != null) { buffer += stack1; }
1091 return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1093 this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1094 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1095 return " <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"
1096 + 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)))
1098 + 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)))
1100 },"3":function(depth0,helpers,partials,data) {
1101 var stack1, buffer = "";
1102 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});
1103 if (stack1 != null) { buffer += stack1; }
1105 },"4":function(depth0,helpers,partials,data) {
1106 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1108 + 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)))
1110 },"6":function(depth0,helpers,partials,data) {
1111 return " (empty)\n";
1112 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1113 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
1114 + 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)))
1116 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});
1117 if (stack1 != null) { buffer += stack1; }
1118 buffer += "</td>\n<td class=\"markdown\">";
1119 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));
1120 if (stack1 != null) { buffer += stack1; }
1121 buffer += "</td>\n<td>";
1122 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));
1123 if (stack1 != null) { buffer += stack1; }
1124 return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1127 __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; },
1128 __hasProp = {}.hasOwnProperty;
1130 OperationView = (function(_super) {
1131 __extends(OperationView, _super);
1133 function OperationView() {
1134 return OperationView.__super__.constructor.apply(this, arguments);
1137 OperationView.prototype.invocationUrl = null;
1139 OperationView.prototype.events = {
1140 'submit .sandbox': 'submitOperation',
1141 'click .submit': 'submitOperation',
1142 'click .response_hider': 'hideResponse',
1143 'click .toggleOperation': 'toggleOperationContent',
1144 'mouseenter .api-ic': 'mouseEnter',
1145 'mouseout .api-ic': 'mouseExit'
1148 OperationView.prototype.initialize = function(opts) {
1152 this.auths = opts.auths;
1153 this.parentId = this.model.parentId;
1154 this.nickname = this.model.nickname;
1158 OperationView.prototype.mouseEnter = function(e) {
1159 var elem, hgh, pos, scMaxX, scMaxY, scX, scY, wd, x, y;
1160 elem = $(this.el).find('.content');
1163 scX = $(window).scrollLeft();
1164 scY = $(window).scrollTop();
1165 scMaxX = scX + $(window).width();
1166 scMaxY = scY + $(window).height();
1168 hgh = elem.height();
1169 if (x + wd > scMaxX) {
1175 if (y + hgh > scMaxY) {
1185 return $(e.currentTarget.parentNode).find('#api_information_panel').show();
1188 OperationView.prototype.mouseExit = function(e) {
1189 return $(e.currentTarget.parentNode).find('#api_information_panel').hide();
1192 OperationView.prototype.render = function() {
1193 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;
1194 isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
1195 if (!isMethodSubmissionSupported) {
1196 this.model.isReadOnly = true;
1198 this.model.description = this.model.description || this.model.notes;
1199 if (this.model.description) {
1200 this.model.description = this.model.description.replace(/(?:\r\n|\r|\n)/g, '<br />');
1202 this.model.oauth = null;
1203 modelAuths = this.model.authorizations || this.model.security;
1205 if (Array.isArray(modelAuths)) {
1206 for (_i = 0, _len = modelAuths.length; _i < _len; _i++) {
1207 auths = modelAuths[_i];
1208 for (key in auths) {
1210 for (a in this.auths) {
1211 auth = this.auths[a];
1212 if (auth.type === 'oauth2') {
1213 this.model.oauth = {};
1214 this.model.oauth.scopes = [];
1215 _ref = auth.value.scopes;
1218 scopeIndex = auths[key].indexOf(k);
1219 if (scopeIndex >= 0) {
1224 this.model.oauth.scopes.push(o);
1232 for (k in modelAuths) {
1234 if (k === "oauth2") {
1235 if (this.model.oauth === null) {
1236 this.model.oauth = {};
1238 if (this.model.oauth.scopes === void 0) {
1239 this.model.oauth.scopes = [];
1241 for (_j = 0, _len1 = v.length; _j < _len1; _j++) {
1243 this.model.oauth.scopes.push(o);
1249 if (typeof this.model.responses !== 'undefined') {
1250 this.model.responseMessages = [];
1251 _ref1 = this.model.responses;
1252 for (code in _ref1) {
1253 value = _ref1[code];
1255 schemaObj = this.model.responses[code].schema;
1256 if (schemaObj && schemaObj['$ref']) {
1257 schema = schemaObj['$ref'];
1258 if (schema.indexOf('#/definitions/') === 0) {
1259 schema = schema.substring('#/definitions/'.length);
1262 this.model.responseMessages.push({
1264 message: value.description,
1265 responseModel: schema
1269 if (typeof this.model.responseMessages === 'undefined') {
1270 this.model.responseMessages = [];
1272 signatureModel = null;
1273 if (this.model.successResponse) {
1274 successResponse = this.model.successResponse;
1275 for (key in successResponse) {
1276 value = successResponse[key];
1277 this.model.successCode = key;
1278 if (typeof value === 'object' && typeof value.createJSONSample === 'function') {
1280 sampleJSON: JSON.stringify(value.createJSONSample(), void 0, 2),
1282 signature: value.getMockSignature()
1286 } else if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
1288 sampleJSON: this.model.responseSampleJSON,
1290 signature: this.model.responseClassSignature
1293 $(this.el).html(Handlebars.templates.operation(this.model));
1294 if (signatureModel) {
1295 responseSignatureView = new SignatureView({
1296 model: signatureModel,
1299 $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
1301 this.model.responseClassSignature = 'string';
1302 $('.model-signature', $(this.el)).html(this.model.type);
1304 contentTypeModel = {
1307 contentTypeModel.consumes = this.model.consumes;
1308 contentTypeModel.produces = this.model.produces;
1309 _ref2 = this.model.parameters;
1310 for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1312 type = param.type || param.dataType || '';
1313 if (typeof type === 'undefined') {
1314 schema = param.schema;
1315 if (schema && schema['$ref']) {
1316 ref = schema['$ref'];
1317 if (ref.indexOf('#/definitions/') === 0) {
1318 type = ref.substring('#/definitions/'.length);
1324 if (type && type.toLowerCase() === 'file') {
1325 if (!contentTypeModel.consumes) {
1326 contentTypeModel.consumes = 'multipart/form-data';
1331 responseContentTypeView = new ResponseContentTypeView({
1332 model: contentTypeModel
1334 $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
1335 _ref3 = this.model.parameters;
1336 for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
1338 this.addParameter(param, contentTypeModel.consumes);
1340 _ref4 = this.model.responseMessages;
1341 for (_m = 0, _len4 = _ref4.length; _m < _len4; _m++) {
1342 statusCode = _ref4[_m];
1343 this.addStatusCode(statusCode);
1348 OperationView.prototype.addParameter = function(param, consumes) {
1350 param.consumes = consumes;
1351 paramView = new ParameterView({
1354 readOnly: this.model.isReadOnly
1356 return $('.operation-params', $(this.el)).append(paramView.render().el);
1359 OperationView.prototype.addStatusCode = function(statusCode) {
1361 statusCodeView = new StatusCodeView({
1365 return $('.operation-status', $(this.el)).append(statusCodeView.render().el);
1368 OperationView.prototype.submitOperation = function(e) {
1369 var error_free, form, isFileUpload, map, o, opts, val, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;
1373 form = $('.sandbox', $(this.el));
1375 form.find("input.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;
1389 form.find("textarea.required").each(function() {
1390 $(this).removeClass("error");
1391 if (jQuery.trim($(this).val()) === "") {
1392 $(this).addClass("error");
1394 callback: (function(_this) {
1396 return $(_this).focus();
1400 return error_free = false;
1408 isFileUpload = false;
1409 _ref = form.find("input");
1410 for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1412 if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1413 map[o.name] = o.value;
1415 if (o.type === "file") {
1416 map[o.name] = o.files[0];
1417 isFileUpload = true;
1420 _ref1 = form.find("textarea");
1421 for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
1423 if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1424 map[o.name] = o.value;
1427 _ref2 = form.find("select");
1428 for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1430 val = this.getSelectedValue(o);
1431 if ((val != null) && jQuery.trim(val).length > 0) {
1435 opts.responseContentType = $("div select[name=responseContentType]", $(this.el)).val();
1436 opts.requestContentType = $("div select[name=parameterContentType]", $(this.el)).val();
1437 $(".response_throbber", $(this.el)).show();
1439 return this.handleFileUpload(map, form);
1441 return this.model["do"](map, opts, this.showCompleteStatus, this.showErrorStatus, this);
1446 OperationView.prototype.success = function(response, parent) {
1447 return parent.showCompleteStatus(response);
1450 OperationView.prototype.handleFileUpload = function(map, form) {
1451 var bodyParam, el, headerParams, o, obj, param, params, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3;
1452 _ref = form.serializeArray();
1453 for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1455 if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1456 map[o.name] = o.value;
1459 bodyParam = new FormData();
1461 _ref1 = this.model.parameters;
1462 for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
1464 if (param.paramType === 'form' || param["in"] === 'formData') {
1465 if (param.type.toLowerCase() !== 'file' && map[param.name] !== void 0) {
1466 bodyParam.append(param.name, map[param.name]);
1471 _ref2 = this.model.parameters;
1472 for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1474 if (param.paramType === 'header') {
1475 headerParams[param.name] = map[param.name];
1478 _ref3 = form.find('input[type~="file"]');
1479 for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
1481 if (typeof el.files[0] !== 'undefined') {
1482 bodyParam.append($(el).attr('name'), el.files[0]);
1486 this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), delete headerParams['Content-Type'], this.model.urlify(map, false)) : this.model.urlify(map, true);
1487 $(".request_url", $(this.el)).html("<pre></pre>");
1488 $(".request_url pre", $(this.el)).text(this.invocationUrl);
1490 type: this.model.method,
1491 url: this.invocationUrl,
1492 headers: headerParams,
1497 error: (function(_this) {
1498 return function(data, textStatus, error) {
1499 return _this.showErrorStatus(_this.wrap(data), _this);
1502 success: (function(_this) {
1503 return function(data) {
1504 return _this.showResponse(data, _this);
1507 complete: (function(_this) {
1508 return function(data) {
1509 return _this.showCompleteStatus(_this.wrap(data), _this);
1513 if (window.authorizations) {
1514 window.authorizations.apply(obj);
1517 obj.data.append("fake", "true");
1523 OperationView.prototype.wrap = function(data) {
1524 var h, headerArray, headers, i, o, _i, _len;
1526 headerArray = data.getAllResponseHeaders().split("\r");
1527 for (_i = 0, _len = headerArray.length; _i < _len; _i++) {
1528 i = headerArray[_i];
1529 h = i.match(/^([^:]*?):(.*)$/);
1534 if (h[0] !== void 0 && h[1] !== void 0) {
1535 headers[h[0].trim()] = h[1].trim();
1540 o.content.data = data.responseText;
1541 o.headers = headers;
1543 o.request.url = this.invocationUrl;
1544 o.status = data.status;
1548 OperationView.prototype.getSelectedValue = function(select) {
1549 var opt, options, _i, _len, _ref;
1550 if (!select.multiple) {
1551 return select.value;
1554 _ref = select.options;
1555 for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1558 options.push(opt.value);
1561 if (options.length > 0) {
1569 OperationView.prototype.hideResponse = function(e) {
1573 $(".response", $(this.el)).slideUp();
1574 return $(".response_hider", $(this.el)).fadeOut();
1577 OperationView.prototype.showResponse = function(response) {
1579 prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>");
1580 return $(".response_body", $(this.el)).html(escape(prettyJson));
1583 OperationView.prototype.showErrorStatus = function(data, parent) {
1584 return parent.showStatus(data);
1587 OperationView.prototype.showCompleteStatus = function(data, parent) {
1588 return parent.showStatus(data);
1591 OperationView.prototype.formatXml = function(xml) {
1592 var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
1593 reg = /(>)(<)(\/*)/g;
1594 wsexp = /[ ]*(.*)[ ]+\n/g;
1595 contexp = /(<.+>)(.+\n)/g;
1596 xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
1599 lines = xml.split('\n');
1603 'single->single': 0,
1604 'single->closing': -1,
1605 'single->opening': 0,
1607 'closing->single': 0,
1608 'closing->closing': -1,
1609 'closing->opening': 0,
1610 'closing->other': 0,
1611 'opening->single': 1,
1612 'opening->closing': 0,
1613 'opening->opening': 1,
1614 'opening->other': 1,
1616 'other->closing': -1,
1617 'other->opening': 0,
1620 _fn = function(ln) {
1621 var fromTo, j, key, padding, type, types, value;
1623 single: Boolean(ln.match(/<.+\/>/)),
1624 closing: Boolean(ln.match(/<\/.+>/)),
1625 opening: Boolean(ln.match(/<[^!?].*>/))
1627 type = ((function() {
1630 for (key in types) {
1638 type = type === void 0 ? 'other' : type;
1639 fromTo = lastType + '->' + type;
1642 indent += transitions[fromTo];
1643 padding = ((function() {
1644 var _j, _ref, _results;
1646 for (j = _j = 0, _ref = indent; 0 <= _ref ? _j < _ref : _j > _ref; j = 0 <= _ref ? ++_j : --_j) {
1651 if (fromTo === 'opening->closing') {
1652 return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
1654 return formatted += padding + ln + '\n';
1657 for (_i = 0, _len = lines.length; _i < _len; _i++) {
1664 OperationView.prototype.showStatus = function(response) {
1665 var code, content, contentType, e, headers, json, opts, pre, response_body, response_body_el, url;
1666 if (response.content === void 0) {
1667 content = response.data;
1670 content = response.content.data;
1671 url = response.request.url;
1673 headers = response.headers;
1676 contentType = headers["Content-Type"] || headers["content-type"];
1678 contentType = contentType.split(";")[0].trim();
1681 $(".response_body", $(this.el)).removeClass('json');
1682 $(".response_body", $(this.el)).removeClass('xml');
1684 code = $('<code />').text("no content");
1685 pre = $('<pre class="json" />').append(code);
1686 } else if (contentType === "application/json" || /\+json$/.test(contentType)) {
1689 json = JSON.stringify(JSON.parse(content), null, " ");
1692 json = "can't parse JSON. Raw result:\n\n" + content;
1694 code = $('<code />').text(json);
1695 pre = $('<pre class="json" />').append(code);
1696 } else if (contentType === "application/xml" || /\+xml$/.test(contentType)) {
1697 code = $('<code />').text(this.formatXml(content));
1698 pre = $('<pre class="xml" />').append(code);
1699 } else if (contentType === "text/html") {
1700 code = $('<code />').html(_.escape(content));
1701 pre = $('<pre class="xml" />').append(code);
1702 } else if (/^image\//.test(contentType)) {
1703 pre = $('<img>').attr('src', url);
1705 code = $('<code />').text(content);
1706 pre = $('<pre class="json" />').append(code);
1708 response_body = pre;
1709 $(".request_url", $(this.el)).html("<pre></pre>");
1710 $(".request_url pre", $(this.el)).text(url);
1711 $(".response_code", $(this.el)).html("<pre>" + response.status + "</pre>");
1712 $(".response_body", $(this.el)).html(response_body);
1713 $(".response_headers", $(this.el)).html("<pre>" + _.escape(JSON.stringify(response.headers, null, " ")).replace(/\n/g, "<br>") + "</pre>");
1714 $(".response", $(this.el)).slideDown();
1715 $(".response_hider", $(this.el)).show();
1716 $(".response_throbber", $(this.el)).hide();
1717 response_body_el = $('.response_body', $(this.el))[0];
1718 opts = this.options.swaggerOptions;
1719 if (opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold) {
1720 return response_body_el;
1722 return hljs.highlightBlock(response_body_el);
1726 OperationView.prototype.toggleOperationContent = function() {
1728 elem = $('#' + Docs.escapeResourceName(this.parentId + "_" + this.nickname + "_content"));
1729 if (elem.is(':visible')) {
1730 return Docs.collapseOperation(elem);
1732 return Docs.expandOperation(elem);
1736 return OperationView;
1740 var ParameterContentTypeView,
1741 __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; },
1742 __hasProp = {}.hasOwnProperty;
1744 ParameterContentTypeView = (function(_super) {
1745 __extends(ParameterContentTypeView, _super);
1747 function ParameterContentTypeView() {
1748 return ParameterContentTypeView.__super__.constructor.apply(this, arguments);
1751 ParameterContentTypeView.prototype.initialize = function() {};
1753 ParameterContentTypeView.prototype.render = function() {
1755 template = this.template();
1756 $(this.el).html(template(this.model));
1757 $('label[for=parameterContentType]', $(this.el)).text('Parameter content type:');
1761 ParameterContentTypeView.prototype.template = function() {
1762 return Handlebars.templates.parameter_content_type;
1765 return ParameterContentTypeView;
1769 this["Handlebars"]["templates"]["param_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1770 var stack1, buffer = "";
1771 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});
1772 if (stack1 != null) { buffer += stack1; }
1774 },"2":function(depth0,helpers,partials,data) {
1775 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1776 return " <input type=\"file\" name='"
1777 + 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)))
1779 },"4":function(depth0,helpers,partials,data) {
1780 var stack1, buffer = "";
1781 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});
1782 if (stack1 != null) { buffer += stack1; }
1784 },"5":function(depth0,helpers,partials,data) {
1785 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1786 return " <textarea class='body-textarea required' placeholder='(required)' name='"
1787 + 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)))
1789 + 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)))
1790 + "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
1791 },"7":function(depth0,helpers,partials,data) {
1792 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1793 return " <textarea class='body-textarea required' placeholder='(required)' name='"
1794 + 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)))
1795 + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
1796 },"9":function(depth0,helpers,partials,data) {
1797 var stack1, buffer = "";
1798 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});
1799 if (stack1 != null) { buffer += stack1; }
1801 },"10":function(depth0,helpers,partials,data) {
1802 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1803 return " <input class='parameter' class='required' type='file' name='"
1804 + 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)))
1806 },"12":function(depth0,helpers,partials,data) {
1807 var stack1, buffer = "";
1808 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});
1809 if (stack1 != null) { buffer += stack1; }
1811 },"13":function(depth0,helpers,partials,data) {
1812 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1813 return " <input class='parameter required' minlength='1' name='"
1814 + 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)))
1815 + "' placeholder='(required)' type='text' value='"
1816 + 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)))
1818 },"15":function(depth0,helpers,partials,data) {
1819 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1820 return " <input class='parameter required' minlength='1' name='"
1821 + 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)))
1822 + "' placeholder='(required)' type='text' value=''/>\n";
1823 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1824 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
1825 + 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)))
1827 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});
1828 if (stack1 != null) { buffer += stack1; }
1829 buffer += "</td>\n<td>\n <strong><span class=\"markdown\">";
1830 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));
1831 if (stack1 != null) { buffer += stack1; }
1832 buffer += "</span></strong>\n</td>\n<td>";
1833 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));
1834 if (stack1 != null) { buffer += stack1; }
1835 return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1837 this["Handlebars"]["templates"]["parameter_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1838 var stack1, buffer = "";
1839 stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
1840 if (stack1 != null) { buffer += stack1; }
1842 },"2":function(depth0,helpers,partials,data) {
1843 var stack1, lambda=this.lambda, buffer = " <option value=\"";
1844 stack1 = lambda(depth0, depth0);
1845 if (stack1 != null) { buffer += stack1; }
1847 stack1 = lambda(depth0, depth0);
1848 if (stack1 != null) { buffer += stack1; }
1849 return buffer + "</option>\n";
1850 },"4":function(depth0,helpers,partials,data) {
1851 return " <option value=\"application/json\">application/json</option>\n";
1852 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1853 var stack1, buffer = "<label for=\"parameterContentType\"></label>\n<select name=\"parameterContentType\">\n";
1854 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});
1855 if (stack1 != null) { buffer += stack1; }
1856 return buffer + "</select>\n";
1859 __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; },
1860 __hasProp = {}.hasOwnProperty;
1862 ParameterView = (function(_super) {
1863 __extends(ParameterView, _super);
1865 function ParameterView() {
1866 return ParameterView.__super__.constructor.apply(this, arguments);
1869 ParameterView.prototype.initialize = function() {
1870 return Handlebars.registerHelper('isArray', function(param, opts) {
1871 if (param.type.toLowerCase() === 'array' || param.allowMultiple) {
1872 return opts.fn(this);
1874 return opts.inverse(this);
1879 ParameterView.prototype.render = function() {
1880 var contentTypeModel, isParam, parameterContentTypeView, ref, responseContentTypeView, schema, signatureModel, signatureView, template, type;
1881 type = this.model.type || this.model.dataType;
1882 if (typeof type === 'undefined') {
1883 schema = this.model.schema;
1884 if (schema && schema['$ref']) {
1885 ref = schema['$ref'];
1886 if (ref.indexOf('#/definitions/') === 0) {
1887 type = ref.substring('#/definitions/'.length);
1893 this.model.type = type;
1894 this.model.paramType = this.model["in"] || this.model.paramType;
1895 if (this.model.paramType === 'body' || this.model["in"] === 'body') {
1896 this.model.isBody = true;
1898 if (type && type.toLowerCase() === 'file') {
1899 this.model.isFile = true;
1901 this.model["default"] = this.model["default"] || this.model.defaultValue;
1902 if (this.model.allowableValues) {
1903 this.model.isList = true;
1905 template = this.template();
1906 $(this.el).html(template(this.model));
1908 sampleJSON: this.model.sampleJSON,
1910 signature: this.model.signature
1912 if (this.model.sampleJSON) {
1913 signatureView = new SignatureView({
1914 model: signatureModel,
1917 $('.model-signature', $(this.el)).append(signatureView.render().el);
1919 $('.model-signature', $(this.el)).html(this.model.signature);
1922 if (this.model.isBody) {
1925 contentTypeModel = {
1928 contentTypeModel.consumes = this.model.consumes;
1930 parameterContentTypeView = new ParameterContentTypeView({
1931 model: contentTypeModel
1933 $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el);
1935 responseContentTypeView = new ResponseContentTypeView({
1936 model: contentTypeModel
1938 $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
1943 ParameterView.prototype.template = function() {
1944 if (this.model.isList) {
1945 return Handlebars.templates.param_list;
1947 if (this.options.readOnly) {
1948 if (this.model.required) {
1949 return Handlebars.templates.param_readonly_required;
1951 return Handlebars.templates.param_readonly;
1954 if (this.model.required) {
1955 return Handlebars.templates.param_required;
1957 return Handlebars.templates.param;
1963 return ParameterView;
1968 __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; },
1969 __hasProp = {}.hasOwnProperty;
1971 ResourceView = (function(_super) {
1972 __extends(ResourceView, _super);
1974 function ResourceView() {
1975 return ResourceView.__super__.constructor.apply(this, arguments);
1978 ResourceView.prototype.initialize = function(opts) {
1982 this.auths = opts.auths;
1983 if ("" === this.model.description) {
1984 this.model.description = null;
1986 if (this.model.description != null) {
1987 return this.model.summary = this.model.description;
1991 ResourceView.prototype.render = function() {
1992 var counter, id, methods, operation, _i, _len, _ref;
1994 $(this.el).html(Handlebars.templates.resource(this.model));
1995 _ref = this.model.operationsArray;
1996 for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1997 operation = _ref[_i];
1999 id = operation.nickname;
2000 while (typeof methods[id] !== 'undefined') {
2001 id = id + "_" + counter;
2004 methods[id] = operation;
2005 operation.nickname = id;
2006 operation.parentId = this.model.id;
2007 this.addOperation(operation);
2009 $('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'));
2010 $('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource'));
2011 $('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource'));
2015 ResourceView.prototype.addOperation = function(operation) {
2017 operation.number = this.number;
2018 operationView = new OperationView({
2021 className: 'endpoint',
2022 swaggerOptions: this.options.swaggerOptions,
2025 $('.endpoints', $(this.el)).append(operationView.render().el);
2026 return this.number++;
2029 ResourceView.prototype.callDocs = function(fnName, e) {
2031 return Docs[fnName](e.currentTarget.getAttribute('data-id'));
2034 return ResourceView;
2038 this["Handlebars"]["templates"]["resource"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
2040 },"3":function(depth0,helpers,partials,data) {
2041 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
2042 return "<li>\n <a href='"
2043 + 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)))
2044 + "'>Raw</a>\n </li>";
2045 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2046 var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "<div class='heading'>\n <h2>\n <a href='#!/"
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)))
2051 + 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)))
2053 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));
2054 if (!helpers.summary) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
2055 if (stack1 != null) { buffer += stack1; }
2056 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));
2057 if (stack1 != null) { buffer += stack1; }
2058 buffer += "\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/"
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 + "' id='endpointListTogger_"
2061 + 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)))
2062 + "' class=\"toggleEndpointList\" data-id=\""
2063 + 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)))
2064 + "\">Show/Hide</a>\n </li>\n <li>\n <a href='#' class=\"collapseResource\" data-id=\""
2065 + 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)))
2066 + "\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' class=\"expandResource\" data-id=\""
2067 + 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)))
2068 + "\">\n Expand Operations\n </a>\n </li>\n ";
2069 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));
2070 if (!helpers.url) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
2071 if (stack1 != null) { buffer += stack1; }
2072 return buffer + "\n </ul>\n</div>\n<ul class='endpoints' id='"
2073 + 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)))
2074 + "_endpoint_list' style='display:none'>\n\n</ul>\n";
2076 var ResponseContentTypeView,
2077 __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; },
2078 __hasProp = {}.hasOwnProperty;
2080 ResponseContentTypeView = (function(_super) {
2081 __extends(ResponseContentTypeView, _super);
2083 function ResponseContentTypeView() {
2084 return ResponseContentTypeView.__super__.constructor.apply(this, arguments);
2087 ResponseContentTypeView.prototype.initialize = function() {};
2089 ResponseContentTypeView.prototype.render = function() {
2091 template = this.template();
2092 $(this.el).html(template(this.model));
2093 $('label[for=responseContentType]', $(this.el)).text('Response Content Type');
2097 ResponseContentTypeView.prototype.template = function() {
2098 return Handlebars.templates.response_content_type;
2101 return ResponseContentTypeView;
2105 this["Handlebars"]["templates"]["response_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
2106 var stack1, buffer = "";
2107 stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
2108 if (stack1 != null) { buffer += stack1; }
2110 },"2":function(depth0,helpers,partials,data) {
2111 var stack1, lambda=this.lambda, buffer = " <option value=\"";
2112 stack1 = lambda(depth0, depth0);
2113 if (stack1 != null) { buffer += stack1; }
2115 stack1 = lambda(depth0, depth0);
2116 if (stack1 != null) { buffer += stack1; }
2117 return buffer + "</option>\n";
2118 },"4":function(depth0,helpers,partials,data) {
2119 return " <option value=\"application/json\">application/json</option>\n";
2120 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2121 var stack1, buffer = "<label for=\"responseContentType\"></label>\n<select name=\"responseContentType\">\n";
2122 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});
2123 if (stack1 != null) { buffer += stack1; }
2124 return buffer + "</select>\n";
2127 __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; },
2128 __hasProp = {}.hasOwnProperty;
2130 SignatureView = (function(_super) {
2131 __extends(SignatureView, _super);
2133 function SignatureView() {
2134 return SignatureView.__super__.constructor.apply(this, arguments);
2137 SignatureView.prototype.events = {
2138 'click a.description-link': 'switchToDescription',
2139 'click a.snippet-link': 'switchToSnippet',
2140 'mousedown .snippet': 'snippetToTextArea'
2143 SignatureView.prototype.initialize = function() {};
2145 SignatureView.prototype.render = function() {
2147 template = this.template();
2148 $(this.el).html(template(this.model));
2149 this.switchToSnippet();
2150 this.isParam = this.model.isParam;
2152 $('.notice', $(this.el)).text('Click to set as parameter value');
2157 SignatureView.prototype.template = function() {
2158 return Handlebars.templates.signature;
2161 SignatureView.prototype.switchToDescription = function(e) {
2165 $(".snippet", $(this.el)).hide();
2166 $(".description", $(this.el)).show();
2167 $('.description-link', $(this.el)).addClass('selected');
2168 return $('.snippet-link', $(this.el)).removeClass('selected');
2171 SignatureView.prototype.switchToSnippet = function(e) {
2175 $(".description", $(this.el)).hide();
2176 $(".snippet", $(this.el)).show();
2177 $('.snippet-link', $(this.el)).addClass('selected');
2178 return $('.description-link', $(this.el)).removeClass('selected');
2181 SignatureView.prototype.snippetToTextArea = function(e) {
2187 textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
2188 if ($.trim(textArea.val()) === '') {
2189 return textArea.val(this.model.sampleJSON);
2194 return SignatureView;
2198 this["Handlebars"]["templates"]["signature"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2199 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 ";
2200 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));
2201 if (stack1 != null) { buffer += stack1; }
2202 return buffer + "\n </div>\n\n <div class=\"snippet\">\n <pre><code>"
2203 + 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)))
2204 + "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
2207 __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; },
2208 __hasProp = {}.hasOwnProperty;
2210 StatusCodeView = (function(_super) {
2211 __extends(StatusCodeView, _super);
2213 function StatusCodeView() {
2214 return StatusCodeView.__super__.constructor.apply(this, arguments);
2217 StatusCodeView.prototype.initialize = function() {};
2219 StatusCodeView.prototype.render = function() {
2220 var responseModel, responseModelView, template;
2221 template = this.template();
2222 $(this.el).html(template(this.model));
2223 if (swaggerUi.api.models.hasOwnProperty(this.model.responseModel)) {
2225 sampleJSON: JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(), null, 2),
2227 signature: swaggerUi.api.models[this.model.responseModel].getMockSignature()
2229 responseModelView = new SignatureView({
2230 model: responseModel,
2233 $('.model-signature', this.$el).append(responseModelView.render().el);
2235 $('.model-signature', this.$el).html('');
2240 StatusCodeView.prototype.template = function() {
2241 return Handlebars.templates.status_code;
2244 return StatusCodeView;
2248 this["Handlebars"]["templates"]["status_code"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2249 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td width='15%' class='code'>"
2250 + 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)))
2252 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));
2253 if (stack1 != null) { buffer += stack1; }
2254 return buffer + "</td>\n<td width='50%'><span class=\"model-signature\" /></td>";