25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 

2240 satır
108 KiB

  1. /**
  2. * swagger-ui - Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API
  3. * @version v2.1.8-M1
  4. * @link http://swagger.io
  5. * @license Apache 2.0
  6. */
  7. $(function() {
  8. // Helper function for vertically aligning DOM elements
  9. // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
  10. $.fn.vAlign = function() {
  11. return this.each(function(i){
  12. var ah = $(this).height();
  13. var ph = $(this).parent().height();
  14. var mh = (ph - ah) / 2;
  15. $(this).css('margin-top', mh);
  16. });
  17. };
  18. $.fn.stretchFormtasticInputWidthToParent = function() {
  19. return this.each(function(i){
  20. var p_width = $(this).closest("form").innerWidth();
  21. var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10);
  22. var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
  23. $(this).css('width', p_width - p_padding - this_padding);
  24. });
  25. };
  26. $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
  27. // Vertically center these paragraphs
  28. // Parent may need a min-height for this to work..
  29. $('ul.downplayed li div.content p').vAlign();
  30. // When a sandbox form is submitted..
  31. $("form.sandbox").submit(function(){
  32. var error_free = true;
  33. // Cycle through the forms required inputs
  34. $(this).find("input.required").each(function() {
  35. // Remove any existing error styles from the input
  36. $(this).removeClass('error');
  37. // Tack the error style on if the input is empty..
  38. if ($(this).val() == '') {
  39. $(this).addClass('error');
  40. $(this).wiggle();
  41. error_free = false;
  42. }
  43. });
  44. return error_free;
  45. });
  46. });
  47. function clippyCopiedCallback(a) {
  48. $('#api_key_copied').fadeIn().delay(1000).fadeOut();
  49. // var b = $("#clippy_tooltip_" + a);
  50. // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
  51. // b.attr("title", "copy to clipboard")
  52. // },
  53. // 500))
  54. }
  55. // Logging function that accounts for browsers that don't have window.console
  56. log = function(){
  57. log.history = log.history || [];
  58. log.history.push(arguments);
  59. if(this.console){
  60. console.log( Array.prototype.slice.call(arguments)[0] );
  61. }
  62. };
  63. // Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
  64. if (Function.prototype.bind && console && typeof console.log == "object") {
  65. [
  66. "log","info","warn","error","assert","dir","clear","profile","profileEnd"
  67. ].forEach(function (method) {
  68. console[method] = this.bind(console[method], console);
  69. }, Function.prototype.call);
  70. }
  71. var Docs = {
  72. shebang: function() {
  73. // If shebang has an operation nickname in it..
  74. // e.g. /docs/#!/words/get_search
  75. var fragments = $.param.fragment().split('/');
  76. fragments.shift(); // get rid of the bang
  77. switch (fragments.length) {
  78. case 1:
  79. // Expand all operations for the resource and scroll to it
  80. var dom_id = 'resource_' + fragments[0];
  81. Docs.expandEndpointListForResource(fragments[0]);
  82. $("#"+dom_id).slideto({highlight: false});
  83. break;
  84. case 2:
  85. // Refer to the endpoint DOM element, e.g. #words_get_search
  86. // Expand Resource
  87. Docs.expandEndpointListForResource(fragments[0]);
  88. $("#"+dom_id).slideto({highlight: false});
  89. // Expand operation
  90. var li_dom_id = fragments.join('_');
  91. var li_content_dom_id = li_dom_id + "_content";
  92. Docs.expandOperation($('#'+li_content_dom_id));
  93. $('#'+li_dom_id).slideto({highlight: false});
  94. break;
  95. }
  96. },
  97. toggleEndpointListForResource: function(resource) {
  98. var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
  99. if (elem.is(':visible')) {
  100. Docs.collapseEndpointListForResource(resource);
  101. } else {
  102. Docs.expandEndpointListForResource(resource);
  103. }
  104. },
  105. // Expand resource
  106. expandEndpointListForResource: function(resource) {
  107. var resource = Docs.escapeResourceName(resource);
  108. if (resource == '') {
  109. $('.resource ul.endpoints').slideDown();
  110. return;
  111. }
  112. $('li#resource_' + resource).addClass('active');
  113. var elem = $('li#resource_' + resource + ' ul.endpoints');
  114. elem.slideDown();
  115. },
  116. // Collapse resource and mark as explicitly closed
  117. collapseEndpointListForResource: function(resource) {
  118. var resource = Docs.escapeResourceName(resource);
  119. if (resource == '') {
  120. $('.resource ul.endpoints').slideUp();
  121. return;
  122. }
  123. $('li#resource_' + resource).removeClass('active');
  124. var elem = $('li#resource_' + resource + ' ul.endpoints');
  125. elem.slideUp();
  126. },
  127. expandOperationsForResource: function(resource) {
  128. // Make sure the resource container is open..
  129. Docs.expandEndpointListForResource(resource);
  130. if (resource == '') {
  131. $('.resource ul.endpoints li.operation div.content').slideDown();
  132. return;
  133. }
  134. $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
  135. Docs.expandOperation($(this));
  136. });
  137. },
  138. collapseOperationsForResource: function(resource) {
  139. // Make sure the resource container is open..
  140. Docs.expandEndpointListForResource(resource);
  141. if (resource == '') {
  142. $('.resource ul.endpoints li.operation div.content').slideUp();
  143. return;
  144. }
  145. $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
  146. Docs.collapseOperation($(this));
  147. });
  148. },
  149. escapeResourceName: function(resource) {
  150. return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
  151. },
  152. expandOperation: function(elem) {
  153. elem.slideDown();
  154. },
  155. collapseOperation: function(elem) {
  156. elem.slideUp();
  157. }
  158. };
  159. var SwaggerUi,
  160. __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; },
  161. __hasProp = {}.hasOwnProperty;
  162. SwaggerUi = (function(_super) {
  163. __extends(SwaggerUi, _super);
  164. function SwaggerUi() {
  165. return SwaggerUi.__super__.constructor.apply(this, arguments);
  166. }
  167. SwaggerUi.prototype.dom_id = "swagger_ui";
  168. SwaggerUi.prototype.options = null;
  169. SwaggerUi.prototype.api = null;
  170. SwaggerUi.prototype.headerView = null;
  171. SwaggerUi.prototype.mainView = null;
  172. SwaggerUi.prototype.initialize = function(options) {
  173. if (options == null) {
  174. options = {};
  175. }
  176. if (options.dom_id != null) {
  177. this.dom_id = options.dom_id;
  178. delete options.dom_id;
  179. }
  180. if (options.supportedSubmitMethods == null) {
  181. options.supportedSubmitMethods = ['get', 'put', 'post', 'delete', 'head', 'options', 'patch'];
  182. }
  183. if ($('#' + this.dom_id) == null) {
  184. $('body').append('<div id="' + this.dom_id + '"></div>');
  185. }
  186. this.options = options;
  187. this.options.success = (function(_this) {
  188. return function() {
  189. return _this.render();
  190. };
  191. })(this);
  192. this.options.progress = (function(_this) {
  193. return function(d) {
  194. return _this.showMessage(d);
  195. };
  196. })(this);
  197. this.options.failure = (function(_this) {
  198. return function(d) {
  199. return _this.onLoadFailure(d);
  200. };
  201. })(this);
  202. this.headerView = new HeaderView({
  203. el: $('#header')
  204. });
  205. return this.headerView.on('update-swagger-ui', (function(_this) {
  206. return function(data) {
  207. return _this.updateSwaggerUi(data);
  208. };
  209. })(this));
  210. };
  211. SwaggerUi.prototype.setOption = function(option, value) {
  212. return this.options[option] = value;
  213. };
  214. SwaggerUi.prototype.getOption = function(option) {
  215. return this.options[option];
  216. };
  217. SwaggerUi.prototype.updateSwaggerUi = function(data) {
  218. this.options.url = data.url;
  219. return this.load();
  220. };
  221. SwaggerUi.prototype.load = function() {
  222. var url, _ref;
  223. if ((_ref = this.mainView) != null) {
  224. _ref.clear();
  225. }
  226. url = this.options.url;
  227. if (url && url.indexOf("http") !== 0) {
  228. url = this.buildUrl(window.location.href.toString(), url);
  229. }
  230. this.options.url = url;
  231. this.headerView.update(url);
  232. return this.api = new SwaggerClient(this.options);
  233. };
  234. SwaggerUi.prototype.collapseAll = function() {
  235. return Docs.collapseEndpointListForResource('');
  236. };
  237. SwaggerUi.prototype.listAll = function() {
  238. return Docs.collapseOperationsForResource('');
  239. };
  240. SwaggerUi.prototype.expandAll = function() {
  241. return Docs.expandOperationsForResource('');
  242. };
  243. SwaggerUi.prototype.render = function() {
  244. this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
  245. this.mainView = new MainView({
  246. model: this.api,
  247. el: $('#' + this.dom_id),
  248. swaggerOptions: this.options
  249. }).render();
  250. this.showMessage();
  251. switch (this.options.docExpansion) {
  252. case "full":
  253. this.expandAll();
  254. break;
  255. case "list":
  256. this.listAll();
  257. }
  258. this.renderGFM();
  259. if (this.options.onComplete) {
  260. this.options.onComplete(this.api, this);
  261. }
  262. return setTimeout((function(_this) {
  263. return function() {
  264. return Docs.shebang();
  265. };
  266. })(this), 100);
  267. };
  268. SwaggerUi.prototype.buildUrl = function(base, url) {
  269. var endOfPath, parts;
  270. if (url.indexOf("/") === 0) {
  271. parts = base.split("/");
  272. base = parts[0] + "//" + parts[2];
  273. return base + url;
  274. } else {
  275. endOfPath = base.length;
  276. if (base.indexOf("?") > -1) {
  277. endOfPath = Math.min(endOfPath, base.indexOf("?"));
  278. }
  279. if (base.indexOf("#") > -1) {
  280. endOfPath = Math.min(endOfPath, base.indexOf("#"));
  281. }
  282. base = base.substring(0, endOfPath);
  283. if (base.indexOf("/", base.length - 1) !== -1) {
  284. return base + url;
  285. }
  286. return base + "/" + url;
  287. }
  288. };
  289. SwaggerUi.prototype.showMessage = function(data) {
  290. if (data == null) {
  291. data = '';
  292. }
  293. $('#message-bar').removeClass('message-fail');
  294. $('#message-bar').addClass('message-success');
  295. return $('#message-bar').html(data);
  296. };
  297. SwaggerUi.prototype.onLoadFailure = function(data) {
  298. var val;
  299. if (data == null) {
  300. data = '';
  301. }
  302. $('#message-bar').removeClass('message-success');
  303. $('#message-bar').addClass('message-fail');
  304. val = $('#message-bar').html(data);
  305. if (this.options.onFailure != null) {
  306. this.options.onFailure(data);
  307. }
  308. return val;
  309. };
  310. SwaggerUi.prototype.renderGFM = function(data) {
  311. if (data == null) {
  312. data = '';
  313. }
  314. return $('.markdown').each(function(index) {
  315. return $(this).html(marked($(this).html()));
  316. });
  317. };
  318. return SwaggerUi;
  319. })(Backbone.Router);
  320. window.SwaggerUi = SwaggerUi;
  321. this["Handlebars"] = this["Handlebars"] || {};
  322. this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
  323. this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  324. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  325. 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'>"
  326. + 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)))
  327. + "</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";
  328. },"useData":true});
  329. Handlebars.registerHelper('sanitize', function(html) {
  330. html = html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
  331. return new Handlebars.SafeString(html);
  332. });
  333. this["Handlebars"]["templates"]["basic_auth_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  334. 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";
  335. },"useData":true});
  336. var ApiKeyButton,
  337. __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; },
  338. __hasProp = {}.hasOwnProperty;
  339. ApiKeyButton = (function(_super) {
  340. __extends(ApiKeyButton, _super);
  341. function ApiKeyButton() {
  342. return ApiKeyButton.__super__.constructor.apply(this, arguments);
  343. }
  344. ApiKeyButton.prototype.initialize = function() {};
  345. ApiKeyButton.prototype.render = function() {
  346. var template;
  347. template = this.template();
  348. $(this.el).html(template(this.model));
  349. return this;
  350. };
  351. ApiKeyButton.prototype.events = {
  352. "click #apikey_button": "toggleApiKeyContainer",
  353. "click #apply_api_key": "applyApiKey"
  354. };
  355. ApiKeyButton.prototype.applyApiKey = function() {
  356. var elem;
  357. window.authorizations.add(this.model.name, new ApiKeyAuthorization(this.model.name, $("#input_apiKey_entry").val(), this.model["in"]));
  358. window.swaggerUi.load();
  359. return elem = $('#apikey_container').show();
  360. };
  361. ApiKeyButton.prototype.toggleApiKeyContainer = function() {
  362. var elem;
  363. if ($('#apikey_container').length > 0) {
  364. elem = $('#apikey_container').first();
  365. if (elem.is(':visible')) {
  366. return elem.hide();
  367. } else {
  368. $('.auth_container').hide();
  369. return elem.show();
  370. }
  371. }
  372. };
  373. ApiKeyButton.prototype.template = function() {
  374. return Handlebars.templates.apikey_button_view;
  375. };
  376. return ApiKeyButton;
  377. })(Backbone.View);
  378. this["Handlebars"]["templates"]["content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  379. var stack1, buffer = "";
  380. stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
  381. if (stack1 != null) { buffer += stack1; }
  382. return buffer;
  383. },"2":function(depth0,helpers,partials,data) {
  384. var stack1, lambda=this.lambda, buffer = " <option value=\"";
  385. stack1 = lambda(depth0, depth0);
  386. if (stack1 != null) { buffer += stack1; }
  387. buffer += "\">";
  388. stack1 = lambda(depth0, depth0);
  389. if (stack1 != null) { buffer += stack1; }
  390. return buffer + "</option>\n";
  391. },"4":function(depth0,helpers,partials,data) {
  392. return " <option value=\"application/json\">application/json</option>\n";
  393. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  394. var stack1, buffer = "<label for=\"contentType\"></label>\n<select name=\"contentType\">\n";
  395. 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});
  396. if (stack1 != null) { buffer += stack1; }
  397. return buffer + "</select>\n";
  398. },"useData":true});
  399. this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  400. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <div class=\"info_title\">"
  401. + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
  402. + "</div>\n <div class=\"info_description markdown\">";
  403. stack1 = lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.description : stack1), depth0);
  404. if (stack1 != null) { buffer += stack1; }
  405. buffer += "</div>\n ";
  406. 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});
  407. if (stack1 != null) { buffer += stack1; }
  408. buffer += "\n ";
  409. 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});
  410. if (stack1 != null) { buffer += stack1; }
  411. buffer += "\n ";
  412. 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});
  413. if (stack1 != null) { buffer += stack1; }
  414. buffer += "\n ";
  415. 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});
  416. if (stack1 != null) { buffer += stack1; }
  417. buffer += "\n ";
  418. 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});
  419. if (stack1 != null) { buffer += stack1; }
  420. return buffer + "\n";
  421. },"2":function(depth0,helpers,partials,data) {
  422. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
  423. return "<div class=\"info_tos\"><a href=\""
  424. + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), depth0))
  425. + "\">Terms of service</a></div>";
  426. },"4":function(depth0,helpers,partials,data) {
  427. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
  428. return "<div class='info_name'>Created by "
  429. + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), depth0))
  430. + "</div>";
  431. },"6":function(depth0,helpers,partials,data) {
  432. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
  433. return "<div class='info_url'>See more at <a href=\""
  434. + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
  435. + "\">"
  436. + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
  437. + "</a></div>";
  438. },"8":function(depth0,helpers,partials,data) {
  439. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
  440. return "<div class='info_email'><a href=\"mailto:"
  441. + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), depth0))
  442. + "?subject="
  443. + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
  444. + "\">Contact the developer</a></div>";
  445. },"10":function(depth0,helpers,partials,data) {
  446. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
  447. return "<div class='info_license'><a href='"
  448. + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.url : stack1), depth0))
  449. + "'>"
  450. + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.name : stack1), depth0))
  451. + "</a></div>";
  452. },"12":function(depth0,helpers,partials,data) {
  453. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
  454. return " , <span style=\"font-variant: small-caps\">api version</span>: "
  455. + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), depth0))
  456. + "\n ";
  457. },"14":function(depth0,helpers,partials,data) {
  458. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  459. return " <span style=\"float:right\"><a href=\""
  460. + 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)))
  461. + "/debug?url="
  462. + 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)))
  463. + "\"><img id=\"validator\" src=\""
  464. + 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)))
  465. + "?url="
  466. + 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)))
  467. + "\"></a>\n </span>\n";
  468. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  469. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div class='info' id='api_info'>\n";
  470. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.info : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
  471. if (stack1 != null) { buffer += stack1; }
  472. 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>: "
  473. + 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)))
  474. + "\n";
  475. 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});
  476. if (stack1 != null) { buffer += stack1; }
  477. buffer += "]\n";
  478. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.validatorUrl : depth0), {"name":"if","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data});
  479. if (stack1 != null) { buffer += stack1; }
  480. return buffer + " </h4>\n </div>\n</div>\n";
  481. },"useData":true});
  482. var BasicAuthButton,
  483. __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; },
  484. __hasProp = {}.hasOwnProperty;
  485. BasicAuthButton = (function(_super) {
  486. __extends(BasicAuthButton, _super);
  487. function BasicAuthButton() {
  488. return BasicAuthButton.__super__.constructor.apply(this, arguments);
  489. }
  490. BasicAuthButton.prototype.initialize = function() {};
  491. BasicAuthButton.prototype.render = function() {
  492. var template;
  493. template = this.template();
  494. $(this.el).html(template(this.model));
  495. return this;
  496. };
  497. BasicAuthButton.prototype.events = {
  498. "click #basic_auth_button": "togglePasswordContainer",
  499. "click #apply_basic_auth": "applyPassword"
  500. };
  501. BasicAuthButton.prototype.applyPassword = function() {
  502. var elem, password, username;
  503. username = $(".input_username").val();
  504. password = $(".input_password").val();
  505. window.authorizations.add(this.model.type, new PasswordAuthorization("basic", username, password));
  506. window.swaggerUi.load();
  507. return elem = $('#basic_auth_container').hide();
  508. };
  509. BasicAuthButton.prototype.togglePasswordContainer = function() {
  510. var elem;
  511. if ($('#basic_auth_container').length > 0) {
  512. elem = $('#basic_auth_container').show();
  513. if (elem.is(':visible')) {
  514. return elem.slideUp();
  515. } else {
  516. $('.auth_container').hide();
  517. return elem.show();
  518. }
  519. }
  520. };
  521. BasicAuthButton.prototype.template = function() {
  522. return Handlebars.templates.basic_auth_button_view;
  523. };
  524. return BasicAuthButton;
  525. })(Backbone.View);
  526. this["Handlebars"]["templates"]["operation"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  527. return "deprecated";
  528. },"3":function(depth0,helpers,partials,data) {
  529. return " <h4>Warning: Deprecated</h4>\n";
  530. },"5":function(depth0,helpers,partials,data) {
  531. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, buffer = " <h4>Implementation Notes</h4>\n <p class=\"markdown\">";
  532. 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));
  533. if (stack1 != null) { buffer += stack1; }
  534. return buffer + "</p>\n";
  535. },"7":function(depth0,helpers,partials,data) {
  536. return " <div class=\"auth\">\n <span class=\"api-ic ic-error\"></span>";
  537. },"9":function(depth0,helpers,partials,data) {
  538. var stack1, buffer = " <div id=\"api_information_panel\" style=\"top: 526px; left: 776px; display: none;\">\n";
  539. stack1 = helpers.each.call(depth0, depth0, {"name":"each","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
  540. if (stack1 != null) { buffer += stack1; }
  541. return buffer + " </div>\n";
  542. },"10":function(depth0,helpers,partials,data) {
  543. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <div title='";
  544. stack1 = lambda((depth0 != null ? depth0.description : depth0), depth0);
  545. if (stack1 != null) { buffer += stack1; }
  546. return buffer + "'>"
  547. + escapeExpression(lambda((depth0 != null ? depth0.scope : depth0), depth0))
  548. + "</div>\n";
  549. },"12":function(depth0,helpers,partials,data) {
  550. return "</div>";
  551. },"14":function(depth0,helpers,partials,data) {
  552. return " <div class='access'>\n <span class=\"api-ic ic-off\" title=\"click to authenticate\"></span>\n </div>\n";
  553. },"16":function(depth0,helpers,partials,data) {
  554. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  555. return " <h4>Response Class (Status "
  556. + 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)))
  557. + ")</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n";
  558. },"18":function(depth0,helpers,partials,data) {
  559. 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";
  560. },"20":function(depth0,helpers,partials,data) {
  561. 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";
  562. },"22":function(depth0,helpers,partials,data) {
  563. return "";
  564. },"24":function(depth0,helpers,partials,data) {
  565. 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";
  566. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  567. var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "\n <ul class='operations' >\n <li class='"
  568. + 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)))
  569. + " operation' id='"
  570. + 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)))
  571. + "_"
  572. + 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)))
  573. + "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/"
  574. + 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)))
  575. + "/"
  576. + 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)))
  577. + "' class=\"toggleOperation\">"
  578. + 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)))
  579. + "</a>\n </span>\n <span class='path'>\n <a href='#!/"
  580. + 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)))
  581. + "/"
  582. + 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)))
  583. + "' class=\"toggleOperation ";
  584. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
  585. if (stack1 != null) { buffer += stack1; }
  586. buffer += "\">"
  587. + 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)))
  588. + "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/"
  589. + 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)))
  590. + "/"
  591. + 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)))
  592. + "' class=\"toggleOperation\">";
  593. 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));
  594. if (stack1 != null) { buffer += stack1; }
  595. buffer += "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='"
  596. + 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)))
  597. + "_"
  598. + 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)))
  599. + "_content' style='display:none'>\n";
  600. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data});
  601. if (stack1 != null) { buffer += stack1; }
  602. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.description : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.noop,"data":data});
  603. if (stack1 != null) { buffer += stack1; }
  604. 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));
  605. if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  606. if (stack1 != null) { buffer += stack1; }
  607. buffer += "\n";
  608. stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.oauth : depth0), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
  609. if (stack1 != null) { buffer += stack1; }
  610. buffer += " ";
  611. 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));
  612. if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  613. if (stack1 != null) { buffer += stack1; }
  614. buffer += "\n";
  615. 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));
  616. if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  617. if (stack1 != null) { buffer += stack1; }
  618. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.type : depth0), {"name":"if","hash":{},"fn":this.program(16, data),"inverse":this.noop,"data":data});
  619. if (stack1 != null) { buffer += stack1; }
  620. buffer += " <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n";
  621. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.parameters : depth0), {"name":"if","hash":{},"fn":this.program(18, data),"inverse":this.noop,"data":data});
  622. if (stack1 != null) { buffer += stack1; }
  623. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.responseMessages : depth0), {"name":"if","hash":{},"fn":this.program(20, data),"inverse":this.noop,"data":data});
  624. if (stack1 != null) { buffer += stack1; }
  625. 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});
  626. if (stack1 != null) { buffer += stack1; }
  627. 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";
  628. },"useData":true});
  629. var ContentTypeView,
  630. __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; },
  631. __hasProp = {}.hasOwnProperty;
  632. ContentTypeView = (function(_super) {
  633. __extends(ContentTypeView, _super);
  634. function ContentTypeView() {
  635. return ContentTypeView.__super__.constructor.apply(this, arguments);
  636. }
  637. ContentTypeView.prototype.initialize = function() {};
  638. ContentTypeView.prototype.render = function() {
  639. var template;
  640. template = this.template();
  641. $(this.el).html(template(this.model));
  642. $('label[for=contentType]', $(this.el)).text('Response Content Type');
  643. return this;
  644. };
  645. ContentTypeView.prototype.template = function() {
  646. return Handlebars.templates.content_type;
  647. };
  648. return ContentTypeView;
  649. })(Backbone.View);
  650. this["Handlebars"]["templates"]["param"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  651. var stack1, buffer = "";
  652. 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});
  653. if (stack1 != null) { buffer += stack1; }
  654. return buffer;
  655. },"2":function(depth0,helpers,partials,data) {
  656. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  657. return " <input type=\"file\" name='"
  658. + 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)))
  659. + "'/>\n <div class=\"parameter-content-type\" />\n";
  660. },"4":function(depth0,helpers,partials,data) {
  661. var stack1, buffer = "";
  662. 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});
  663. if (stack1 != null) { buffer += stack1; }
  664. return buffer;
  665. },"5":function(depth0,helpers,partials,data) {
  666. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  667. return " <textarea class='body-textarea' name='"
  668. + 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)))
  669. + "'>"
  670. + 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)))
  671. + "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
  672. },"7":function(depth0,helpers,partials,data) {
  673. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  674. return " <textarea class='body-textarea' name='"
  675. + 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)))
  676. + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
  677. },"9":function(depth0,helpers,partials,data) {
  678. var stack1, buffer = "";
  679. 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});
  680. if (stack1 != null) { buffer += stack1; }
  681. return buffer;
  682. },"10":function(depth0,helpers,partials,data) {
  683. var stack1, buffer = "";
  684. 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});
  685. if (stack1 != null) { buffer += stack1; }
  686. return buffer;
  687. },"11":function(depth0,helpers,partials,data) {
  688. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  689. return " <input class='parameter' minlength='0' name='"
  690. + 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)))
  691. + "' placeholder='' type='text' value='"
  692. + 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)))
  693. + "'/>\n";
  694. },"13":function(depth0,helpers,partials,data) {
  695. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  696. return " <input class='parameter' minlength='0' name='"
  697. + 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)))
  698. + "' placeholder='' type='text' value=''/>\n";
  699. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  700. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
  701. + 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)))
  702. + "</td>\n<td>\n\n";
  703. 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});
  704. if (stack1 != null) { buffer += stack1; }
  705. buffer += "\n</td>\n<td class=\"markdown\">";
  706. 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));
  707. if (stack1 != null) { buffer += stack1; }
  708. buffer += "</td>\n<td>";
  709. 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));
  710. if (stack1 != null) { buffer += stack1; }
  711. return buffer + "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n";
  712. },"useData":true});
  713. var HeaderView,
  714. __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; },
  715. __hasProp = {}.hasOwnProperty;
  716. HeaderView = (function(_super) {
  717. __extends(HeaderView, _super);
  718. function HeaderView() {
  719. return HeaderView.__super__.constructor.apply(this, arguments);
  720. }
  721. HeaderView.prototype.events = {
  722. 'click #show-pet-store-icon': 'showPetStore',
  723. 'click #show-wordnik-dev-icon': 'showWordnikDev',
  724. 'click #explore': 'showCustom',
  725. 'keyup #input_baseUrl': 'showCustomOnKeyup',
  726. 'keyup #input_apiKey': 'showCustomOnKeyup'
  727. };
  728. HeaderView.prototype.initialize = function() {};
  729. HeaderView.prototype.showPetStore = function(e) {
  730. return this.trigger('update-swagger-ui', {
  731. url: "http://petstore.swagger.wordnik.com/api/api-docs"
  732. });
  733. };
  734. HeaderView.prototype.showWordnikDev = function(e) {
  735. return this.trigger('update-swagger-ui', {
  736. url: "http://api.wordnik.com/v4/resources.json"
  737. });
  738. };
  739. HeaderView.prototype.showCustomOnKeyup = function(e) {
  740. if (e.keyCode === 13) {
  741. return this.showCustom();
  742. }
  743. };
  744. HeaderView.prototype.showCustom = function(e) {
  745. if (e != null) {
  746. e.preventDefault();
  747. }
  748. return this.trigger('update-swagger-ui', {
  749. url: $('#input_baseUrl').val(),
  750. apiKey: $('#input_apiKey').val()
  751. });
  752. };
  753. HeaderView.prototype.update = function(url, apiKey, trigger) {
  754. if (trigger == null) {
  755. trigger = false;
  756. }
  757. $('#input_baseUrl').val(url);
  758. if (trigger) {
  759. return this.trigger('update-swagger-ui', {
  760. url: url
  761. });
  762. }
  763. };
  764. return HeaderView;
  765. })(Backbone.View);
  766. this["Handlebars"]["templates"]["param_list"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  767. return " multiple='multiple'";
  768. },"3":function(depth0,helpers,partials,data) {
  769. return "";
  770. },"5":function(depth0,helpers,partials,data) {
  771. var stack1, buffer = "";
  772. 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});
  773. if (stack1 != null) { buffer += stack1; }
  774. return buffer;
  775. },"6":function(depth0,helpers,partials,data) {
  776. var stack1, helperMissing=helpers.helperMissing, buffer = "";
  777. 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}));
  778. if (stack1 != null) { buffer += stack1; }
  779. return buffer;
  780. },"7":function(depth0,helpers,partials,data) {
  781. return " <option selected=\"\" value=''></option>\n";
  782. },"9":function(depth0,helpers,partials,data) {
  783. var stack1, buffer = "";
  784. 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});
  785. if (stack1 != null) { buffer += stack1; }
  786. return buffer;
  787. },"10":function(depth0,helpers,partials,data) {
  788. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  789. return " <option selected=\"\" value='"
  790. + 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)))
  791. + "'>"
  792. + 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)))
  793. + " (default)</option>\n";
  794. },"12":function(depth0,helpers,partials,data) {
  795. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  796. return " <option value='"
  797. + 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)))
  798. + "'>"
  799. + 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)))
  800. + "</option>\n";
  801. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  802. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
  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. + "</td>\n<td>\n <select ";
  805. stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}));
  806. if (stack1 != null) { buffer += stack1; }
  807. buffer += " class='parameter' name='"
  808. + 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)))
  809. + "'>\n";
  810. 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});
  811. if (stack1 != null) { buffer += stack1; }
  812. 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});
  813. if (stack1 != null) { buffer += stack1; }
  814. buffer += " </select>\n</td>\n<td class=\"markdown\">";
  815. 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));
  816. if (stack1 != null) { buffer += stack1; }
  817. buffer += "</td>\n<td>";
  818. 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));
  819. if (stack1 != null) { buffer += stack1; }
  820. return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>";
  821. },"useData":true});
  822. var MainView,
  823. __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; },
  824. __hasProp = {}.hasOwnProperty;
  825. MainView = (function(_super) {
  826. var sorters;
  827. __extends(MainView, _super);
  828. function MainView() {
  829. return MainView.__super__.constructor.apply(this, arguments);
  830. }
  831. sorters = {
  832. 'alpha': function(a, b) {
  833. return a.path.localeCompare(b.path);
  834. },
  835. 'method': function(a, b) {
  836. return a.method.localeCompare(b.method);
  837. }
  838. };
  839. MainView.prototype.initialize = function(opts) {
  840. var auth, key, value, _ref;
  841. if (opts == null) {
  842. opts = {};
  843. }
  844. this.model.auths = [];
  845. _ref = this.model.securityDefinitions;
  846. for (key in _ref) {
  847. value = _ref[key];
  848. auth = {
  849. name: key,
  850. type: value.type,
  851. value: value
  852. };
  853. this.model.auths.push(auth);
  854. }
  855. if (this.model.swaggerVersion === "2.0") {
  856. if ("validatorUrl" in opts.swaggerOptions) {
  857. return this.model.validatorUrl = opts.swaggerOptions.validatorUrl;
  858. } else if (this.model.url.indexOf("localhost") > 0) {
  859. return this.model.validatorUrl = null;
  860. } else {
  861. return this.model.validatorUrl = "http://online.swagger.io/validator";
  862. }
  863. }
  864. };
  865. MainView.prototype.render = function() {
  866. var auth, button, counter, id, name, resource, resources, _i, _len, _ref;
  867. if (this.model.securityDefinitions) {
  868. for (name in this.model.securityDefinitions) {
  869. auth = this.model.securityDefinitions[name];
  870. if (auth.type === "apiKey" && $("#apikey_button").length === 0) {
  871. button = new ApiKeyButton({
  872. model: auth
  873. }).render().el;
  874. $('.auth_main_container').append(button);
  875. }
  876. if (auth.type === "basicAuth" && $("#basic_auth_button").length === 0) {
  877. button = new BasicAuthButton({
  878. model: auth
  879. }).render().el;
  880. $('.auth_main_container').append(button);
  881. }
  882. }
  883. }
  884. $(this.el).html(Handlebars.templates.main(this.model));
  885. resources = {};
  886. counter = 0;
  887. _ref = this.model.apisArray;
  888. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  889. resource = _ref[_i];
  890. id = resource.name;
  891. while (typeof resources[id] !== 'undefined') {
  892. id = id + "_" + counter;
  893. counter += 1;
  894. }
  895. resource.id = id;
  896. resources[id] = resource;
  897. this.addResource(resource, this.model.auths);
  898. }
  899. $('.propWrap').hover(function() {
  900. return $('.optionsWrapper', $(this)).show();
  901. }, function() {
  902. return $('.optionsWrapper', $(this)).hide();
  903. });
  904. return this;
  905. };
  906. MainView.prototype.addResource = function(resource, auths) {
  907. var resourceView;
  908. resource.id = resource.id.replace(/\s/g, '_');
  909. resourceView = new ResourceView({
  910. model: resource,
  911. tagName: 'li',
  912. id: 'resource_' + resource.id,
  913. className: 'resource',
  914. auths: auths,
  915. swaggerOptions: this.options.swaggerOptions
  916. });
  917. return $('#resources').append(resourceView.render().el);
  918. };
  919. MainView.prototype.clear = function() {
  920. return $(this.el).html('');
  921. };
  922. return MainView;
  923. })(Backbone.View);
  924. this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  925. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  926. return " <textarea class='body-textarea' readonly='readonly' name='"
  927. + 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)))
  928. + "'>"
  929. + 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)))
  930. + "</textarea>\n";
  931. },"3":function(depth0,helpers,partials,data) {
  932. var stack1, buffer = "";
  933. 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});
  934. if (stack1 != null) { buffer += stack1; }
  935. return buffer;
  936. },"4":function(depth0,helpers,partials,data) {
  937. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  938. return " "
  939. + 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)))
  940. + "\n";
  941. },"6":function(depth0,helpers,partials,data) {
  942. return " (empty)\n";
  943. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  944. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
  945. + 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)))
  946. + "</td>\n<td>\n";
  947. 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});
  948. if (stack1 != null) { buffer += stack1; }
  949. buffer += "</td>\n<td class=\"markdown\">";
  950. 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));
  951. if (stack1 != null) { buffer += stack1; }
  952. buffer += "</td>\n<td>";
  953. 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));
  954. if (stack1 != null) { buffer += stack1; }
  955. return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
  956. },"useData":true});
  957. var OperationView,
  958. __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; },
  959. __hasProp = {}.hasOwnProperty;
  960. OperationView = (function(_super) {
  961. __extends(OperationView, _super);
  962. function OperationView() {
  963. return OperationView.__super__.constructor.apply(this, arguments);
  964. }
  965. OperationView.prototype.invocationUrl = null;
  966. OperationView.prototype.events = {
  967. 'submit .sandbox': 'submitOperation',
  968. 'click .submit': 'submitOperation',
  969. 'click .response_hider': 'hideResponse',
  970. 'click .toggleOperation': 'toggleOperationContent',
  971. 'mouseenter .api-ic': 'mouseEnter',
  972. 'mouseout .api-ic': 'mouseExit'
  973. };
  974. OperationView.prototype.initialize = function(opts) {
  975. if (opts == null) {
  976. opts = {};
  977. }
  978. this.auths = opts.auths;
  979. this.parentId = this.model.parentId;
  980. this.nickname = this.model.nickname;
  981. return this;
  982. };
  983. OperationView.prototype.mouseEnter = function(e) {
  984. var elem, hgh, pos, scMaxX, scMaxY, scX, scY, wd, x, y;
  985. elem = $(this.el).find('.content');
  986. x = e.pageX;
  987. y = e.pageY;
  988. scX = $(window).scrollLeft();
  989. scY = $(window).scrollTop();
  990. scMaxX = scX + $(window).width();
  991. scMaxY = scY + $(window).height();
  992. wd = elem.width();
  993. hgh = elem.height();
  994. if (x + wd > scMaxX) {
  995. x = scMaxX - wd;
  996. }
  997. if (x < scX) {
  998. x = scX;
  999. }
  1000. if (y + hgh > scMaxY) {
  1001. y = scMaxY - hgh;
  1002. }
  1003. if (y < scY) {
  1004. y = scY;
  1005. }
  1006. pos = {};
  1007. pos.top = y;
  1008. pos.left = x;
  1009. elem.css(pos);
  1010. return $(e.currentTarget.parentNode).find('#api_information_panel').show();
  1011. };
  1012. OperationView.prototype.mouseExit = function(e) {
  1013. return $(e.currentTarget.parentNode).find('#api_information_panel').hide();
  1014. };
  1015. OperationView.prototype.render = function() {
  1016. 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;
  1017. isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
  1018. if (!isMethodSubmissionSupported) {
  1019. this.model.isReadOnly = true;
  1020. }
  1021. this.model.description = this.model.description || this.model.notes;
  1022. if (this.model.description) {
  1023. this.model.description = this.model.description.replace(/(?:\r\n|\r|\n)/g, '<br />');
  1024. }
  1025. this.model.oauth = null;
  1026. modelAuths = this.model.authorizations || this.model.security;
  1027. if (modelAuths) {
  1028. if (Array.isArray(modelAuths)) {
  1029. for (_i = 0, _len = modelAuths.length; _i < _len; _i++) {
  1030. auths = modelAuths[_i];
  1031. for (key in auths) {
  1032. auth = auths[key];
  1033. for (a in this.auths) {
  1034. auth = this.auths[a];
  1035. if (auth.type === 'oauth2') {
  1036. this.model.oauth = {};
  1037. this.model.oauth.scopes = [];
  1038. _ref = auth.value.scopes;
  1039. for (k in _ref) {
  1040. v = _ref[k];
  1041. scopeIndex = auths[key].indexOf(k);
  1042. if (scopeIndex >= 0) {
  1043. o = {
  1044. scope: k,
  1045. description: v
  1046. };
  1047. this.model.oauth.scopes.push(o);
  1048. }
  1049. }
  1050. }
  1051. }
  1052. }
  1053. }
  1054. } else {
  1055. for (k in modelAuths) {
  1056. v = modelAuths[k];
  1057. if (k === "oauth2") {
  1058. if (this.model.oauth === null) {
  1059. this.model.oauth = {};
  1060. }
  1061. if (this.model.oauth.scopes === void 0) {
  1062. this.model.oauth.scopes = [];
  1063. }
  1064. for (_j = 0, _len1 = v.length; _j < _len1; _j++) {
  1065. o = v[_j];
  1066. this.model.oauth.scopes.push(o);
  1067. }
  1068. }
  1069. }
  1070. }
  1071. }
  1072. if (typeof this.model.responses !== 'undefined') {
  1073. this.model.responseMessages = [];
  1074. _ref1 = this.model.responses;
  1075. for (code in _ref1) {
  1076. value = _ref1[code];
  1077. schema = null;
  1078. schemaObj = this.model.responses[code].schema;
  1079. if (schemaObj && schemaObj['$ref']) {
  1080. schema = schemaObj['$ref'];
  1081. if (schema.indexOf('#/definitions/') === 0) {
  1082. schema = schema.substring('#/definitions/'.length);
  1083. }
  1084. }
  1085. this.model.responseMessages.push({
  1086. code: code,
  1087. message: value.description,
  1088. responseModel: schema
  1089. });
  1090. }
  1091. }
  1092. if (typeof this.model.responseMessages === 'undefined') {
  1093. this.model.responseMessages = [];
  1094. }
  1095. signatureModel = null;
  1096. if (this.model.successResponse) {
  1097. successResponse = this.model.successResponse;
  1098. for (key in successResponse) {
  1099. value = successResponse[key];
  1100. this.model.successCode = key;
  1101. if (typeof value === 'object' && typeof value.createJSONSample === 'function') {
  1102. signatureModel = {
  1103. sampleJSON: JSON.stringify(value.createJSONSample(), void 0, 2),
  1104. isParam: false,
  1105. signature: value.getMockSignature()
  1106. };
  1107. }
  1108. }
  1109. } else if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
  1110. signatureModel = {
  1111. sampleJSON: this.model.responseSampleJSON,
  1112. isParam: false,
  1113. signature: this.model.responseClassSignature
  1114. };
  1115. }
  1116. $(this.el).html(Handlebars.templates.operation(this.model));
  1117. if (signatureModel) {
  1118. responseSignatureView = new SignatureView({
  1119. model: signatureModel,
  1120. tagName: 'div'
  1121. });
  1122. $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
  1123. } else {
  1124. this.model.responseClassSignature = 'string';
  1125. $('.model-signature', $(this.el)).html(this.model.type);
  1126. }
  1127. contentTypeModel = {
  1128. isParam: false
  1129. };
  1130. contentTypeModel.consumes = this.model.consumes;
  1131. contentTypeModel.produces = this.model.produces;
  1132. _ref2 = this.model.parameters;
  1133. for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
  1134. param = _ref2[_k];
  1135. type = param.type || param.dataType || '';
  1136. if (typeof type === 'undefined') {
  1137. schema = param.schema;
  1138. if (schema && schema['$ref']) {
  1139. ref = schema['$ref'];
  1140. if (ref.indexOf('#/definitions/') === 0) {
  1141. type = ref.substring('#/definitions/'.length);
  1142. } else {
  1143. type = ref;
  1144. }
  1145. }
  1146. }
  1147. if (type && type.toLowerCase() === 'file') {
  1148. if (!contentTypeModel.consumes) {
  1149. contentTypeModel.consumes = 'multipart/form-data';
  1150. }
  1151. }
  1152. param.type = type;
  1153. }
  1154. responseContentTypeView = new ResponseContentTypeView({
  1155. model: contentTypeModel
  1156. });
  1157. $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
  1158. _ref3 = this.model.parameters;
  1159. for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
  1160. param = _ref3[_l];
  1161. this.addParameter(param, contentTypeModel.consumes);
  1162. }
  1163. _ref4 = this.model.responseMessages;
  1164. for (_m = 0, _len4 = _ref4.length; _m < _len4; _m++) {
  1165. statusCode = _ref4[_m];
  1166. this.addStatusCode(statusCode);
  1167. }
  1168. return this;
  1169. };
  1170. OperationView.prototype.addParameter = function(param, consumes) {
  1171. var paramView;
  1172. param.consumes = consumes;
  1173. paramView = new ParameterView({
  1174. model: param,
  1175. tagName: 'tr',
  1176. readOnly: this.model.isReadOnly
  1177. });
  1178. return $('.operation-params', $(this.el)).append(paramView.render().el);
  1179. };
  1180. OperationView.prototype.addStatusCode = function(statusCode) {
  1181. var statusCodeView;
  1182. statusCodeView = new StatusCodeView({
  1183. model: statusCode,
  1184. tagName: 'tr'
  1185. });
  1186. return $('.operation-status', $(this.el)).append(statusCodeView.render().el);
  1187. };
  1188. OperationView.prototype.submitOperation = function(e) {
  1189. var error_free, form, isFileUpload, map, o, opts, val, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;
  1190. if (e != null) {
  1191. e.preventDefault();
  1192. }
  1193. form = $('.sandbox', $(this.el));
  1194. error_free = true;
  1195. form.find("input.required").each(function() {
  1196. $(this).removeClass("error");
  1197. if (jQuery.trim($(this).val()) === "") {
  1198. $(this).addClass("error");
  1199. $(this).wiggle({
  1200. callback: (function(_this) {
  1201. return function() {
  1202. return $(_this).focus();
  1203. };
  1204. })(this)
  1205. });
  1206. return error_free = false;
  1207. }
  1208. });
  1209. form.find("textarea.required").each(function() {
  1210. $(this).removeClass("error");
  1211. if (jQuery.trim($(this).val()) === "") {
  1212. $(this).addClass("error");
  1213. $(this).wiggle({
  1214. callback: (function(_this) {
  1215. return function() {
  1216. return $(_this).focus();
  1217. };
  1218. })(this)
  1219. });
  1220. return error_free = false;
  1221. }
  1222. });
  1223. if (error_free) {
  1224. map = {};
  1225. opts = {
  1226. parent: this
  1227. };
  1228. isFileUpload = false;
  1229. _ref = form.find("input");
  1230. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1231. o = _ref[_i];
  1232. if ((o.value != null) && jQuery.trim(o.value).length > 0) {
  1233. map[o.name] = o.value;
  1234. }
  1235. if (o.type === "file") {
  1236. map[o.name] = o.files[0];
  1237. isFileUpload = true;
  1238. }
  1239. }
  1240. _ref1 = form.find("textarea");
  1241. for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
  1242. o = _ref1[_j];
  1243. if ((o.value != null) && jQuery.trim(o.value).length > 0) {
  1244. map[o.name] = o.value;
  1245. }
  1246. }
  1247. _ref2 = form.find("select");
  1248. for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
  1249. o = _ref2[_k];
  1250. val = this.getSelectedValue(o);
  1251. if ((val != null) && jQuery.trim(val).length > 0) {
  1252. map[o.name] = val;
  1253. }
  1254. }
  1255. opts.responseContentType = $("div select[name=responseContentType]", $(this.el)).val();
  1256. opts.requestContentType = $("div select[name=parameterContentType]", $(this.el)).val();
  1257. $(".response_throbber", $(this.el)).show();
  1258. if (isFileUpload) {
  1259. return this.handleFileUpload(map, form);
  1260. } else {
  1261. return this.model["do"](map, opts, this.showCompleteStatus, this.showErrorStatus, this);
  1262. }
  1263. }
  1264. };
  1265. OperationView.prototype.success = function(response, parent) {
  1266. return parent.showCompleteStatus(response);
  1267. };
  1268. OperationView.prototype.handleFileUpload = function(map, form) {
  1269. var bodyParam, el, headerParams, o, obj, param, params, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3;
  1270. _ref = form.serializeArray();
  1271. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1272. o = _ref[_i];
  1273. if ((o.value != null) && jQuery.trim(o.value).length > 0) {
  1274. map[o.name] = o.value;
  1275. }
  1276. }
  1277. bodyParam = new FormData();
  1278. params = 0;
  1279. _ref1 = this.model.parameters;
  1280. for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
  1281. param = _ref1[_j];
  1282. if (param.paramType === 'form' || param["in"] === 'formData') {
  1283. if (param.type.toLowerCase() !== 'file' && map[param.name] !== void 0) {
  1284. bodyParam.append(param.name, map[param.name]);
  1285. }
  1286. }
  1287. }
  1288. headerParams = {};
  1289. _ref2 = this.model.parameters;
  1290. for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
  1291. param = _ref2[_k];
  1292. if (param.paramType === 'header') {
  1293. headerParams[param.name] = map[param.name];
  1294. }
  1295. }
  1296. _ref3 = form.find('input[type~="file"]');
  1297. for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
  1298. el = _ref3[_l];
  1299. if (typeof el.files[0] !== 'undefined') {
  1300. bodyParam.append($(el).attr('name'), el.files[0]);
  1301. params += 1;
  1302. }
  1303. }
  1304. this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), delete headerParams['Content-Type'], this.model.urlify(map, false)) : this.model.urlify(map, true);
  1305. $(".request_url", $(this.el)).html("<pre></pre>");
  1306. $(".request_url pre", $(this.el)).text(this.invocationUrl);
  1307. obj = {
  1308. type: this.model.method,
  1309. url: this.invocationUrl,
  1310. headers: headerParams,
  1311. data: bodyParam,
  1312. dataType: 'json',
  1313. contentType: false,
  1314. processData: false,
  1315. error: (function(_this) {
  1316. return function(data, textStatus, error) {
  1317. return _this.showErrorStatus(_this.wrap(data), _this);
  1318. };
  1319. })(this),
  1320. success: (function(_this) {
  1321. return function(data) {
  1322. return _this.showResponse(data, _this);
  1323. };
  1324. })(this),
  1325. complete: (function(_this) {
  1326. return function(data) {
  1327. return _this.showCompleteStatus(_this.wrap(data), _this);
  1328. };
  1329. })(this)
  1330. };
  1331. if (window.authorizations) {
  1332. window.authorizations.apply(obj);
  1333. }
  1334. if (params === 0) {
  1335. obj.data.append("fake", "true");
  1336. }
  1337. jQuery.ajax(obj);
  1338. return false;
  1339. };
  1340. OperationView.prototype.wrap = function(data) {
  1341. var h, headerArray, headers, i, o, _i, _len;
  1342. headers = {};
  1343. headerArray = data.getAllResponseHeaders().split("\r");
  1344. for (_i = 0, _len = headerArray.length; _i < _len; _i++) {
  1345. i = headerArray[_i];
  1346. h = i.match(/^([^:]*?):(.*)$/);
  1347. if (!h) {
  1348. h = [];
  1349. }
  1350. h.shift();
  1351. if (h[0] !== void 0 && h[1] !== void 0) {
  1352. headers[h[0].trim()] = h[1].trim();
  1353. }
  1354. }
  1355. o = {};
  1356. o.content = {};
  1357. o.content.data = data.responseText;
  1358. o.headers = headers;
  1359. o.request = {};
  1360. o.request.url = this.invocationUrl;
  1361. o.status = data.status;
  1362. return o;
  1363. };
  1364. OperationView.prototype.getSelectedValue = function(select) {
  1365. var opt, options, _i, _len, _ref;
  1366. if (!select.multiple) {
  1367. return select.value;
  1368. } else {
  1369. options = [];
  1370. _ref = select.options;
  1371. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1372. opt = _ref[_i];
  1373. if (opt.selected) {
  1374. options.push(opt.value);
  1375. }
  1376. }
  1377. if (options.length > 0) {
  1378. return options;
  1379. } else {
  1380. return null;
  1381. }
  1382. }
  1383. };
  1384. OperationView.prototype.hideResponse = function(e) {
  1385. if (e != null) {
  1386. e.preventDefault();
  1387. }
  1388. $(".response", $(this.el)).slideUp();
  1389. return $(".response_hider", $(this.el)).fadeOut();
  1390. };
  1391. OperationView.prototype.showResponse = function(response) {
  1392. var prettyJson;
  1393. prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>");
  1394. return $(".response_body", $(this.el)).html(escape(prettyJson));
  1395. };
  1396. OperationView.prototype.showErrorStatus = function(data, parent) {
  1397. return parent.showStatus(data);
  1398. };
  1399. OperationView.prototype.showCompleteStatus = function(data, parent) {
  1400. return parent.showStatus(data);
  1401. };
  1402. OperationView.prototype.formatXml = function(xml) {
  1403. var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
  1404. reg = /(>)(<)(\/*)/g;
  1405. wsexp = /[ ]*(.*)[ ]+\n/g;
  1406. contexp = /(<.+>)(.+\n)/g;
  1407. xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
  1408. pad = 0;
  1409. formatted = '';
  1410. lines = xml.split('\n');
  1411. indent = 0;
  1412. lastType = 'other';
  1413. transitions = {
  1414. 'single->single': 0,
  1415. 'single->closing': -1,
  1416. 'single->opening': 0,
  1417. 'single->other': 0,
  1418. 'closing->single': 0,
  1419. 'closing->closing': -1,
  1420. 'closing->opening': 0,
  1421. 'closing->other': 0,
  1422. 'opening->single': 1,
  1423. 'opening->closing': 0,
  1424. 'opening->opening': 1,
  1425. 'opening->other': 1,
  1426. 'other->single': 0,
  1427. 'other->closing': -1,
  1428. 'other->opening': 0,
  1429. 'other->other': 0
  1430. };
  1431. _fn = function(ln) {
  1432. var fromTo, j, key, padding, type, types, value;
  1433. types = {
  1434. single: Boolean(ln.match(/<.+\/>/)),
  1435. closing: Boolean(ln.match(/<\/.+>/)),
  1436. opening: Boolean(ln.match(/<[^!?].*>/))
  1437. };
  1438. type = ((function() {
  1439. var _results;
  1440. _results = [];
  1441. for (key in types) {
  1442. value = types[key];
  1443. if (value) {
  1444. _results.push(key);
  1445. }
  1446. }
  1447. return _results;
  1448. })())[0];
  1449. type = type === void 0 ? 'other' : type;
  1450. fromTo = lastType + '->' + type;
  1451. lastType = type;
  1452. padding = '';
  1453. indent += transitions[fromTo];
  1454. padding = ((function() {
  1455. var _j, _ref, _results;
  1456. _results = [];
  1457. for (j = _j = 0, _ref = indent; 0 <= _ref ? _j < _ref : _j > _ref; j = 0 <= _ref ? ++_j : --_j) {
  1458. _results.push(' ');
  1459. }
  1460. return _results;
  1461. })()).join('');
  1462. if (fromTo === 'opening->closing') {
  1463. return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
  1464. } else {
  1465. return formatted += padding + ln + '\n';
  1466. }
  1467. };
  1468. for (_i = 0, _len = lines.length; _i < _len; _i++) {
  1469. ln = lines[_i];
  1470. _fn(ln);
  1471. }
  1472. return formatted;
  1473. };
  1474. OperationView.prototype.showStatus = function(response) {
  1475. var code, content, contentType, e, headers, json, opts, pre, response_body, response_body_el, url;
  1476. if (response.content === void 0) {
  1477. content = response.data;
  1478. url = response.url;
  1479. } else {
  1480. content = response.content.data;
  1481. url = response.request.url;
  1482. }
  1483. headers = response.headers;
  1484. contentType = null;
  1485. if (headers) {
  1486. contentType = headers["Content-Type"] || headers["content-type"];
  1487. if (contentType) {
  1488. contentType = contentType.split(";")[0].trim();
  1489. }
  1490. }
  1491. $(".response_body", $(this.el)).removeClass('json');
  1492. $(".response_body", $(this.el)).removeClass('xml');
  1493. if (!content) {
  1494. code = $('<code />').text("no content");
  1495. pre = $('<pre class="json" />').append(code);
  1496. } else if (contentType === "application/json" || /\+json$/.test(contentType)) {
  1497. json = null;
  1498. try {
  1499. json = JSON.stringify(JSON.parse(content), null, " ");
  1500. } catch (_error) {
  1501. e = _error;
  1502. json = "can't parse JSON. Raw result:\n\n" + content;
  1503. }
  1504. code = $('<code />').text(json);
  1505. pre = $('<pre class="json" />').append(code);
  1506. } else if (contentType === "application/xml" || /\+xml$/.test(contentType)) {
  1507. code = $('<code />').text(this.formatXml(content));
  1508. pre = $('<pre class="xml" />').append(code);
  1509. } else if (contentType === "text/html") {
  1510. code = $('<code />').html(_.escape(content));
  1511. pre = $('<pre class="xml" />').append(code);
  1512. } else if (/^image\//.test(contentType)) {
  1513. pre = $('<img>').attr('src', url);
  1514. } else {
  1515. code = $('<code />').text(content);
  1516. pre = $('<pre class="json" />').append(code);
  1517. }
  1518. response_body = pre;
  1519. $(".request_url", $(this.el)).html("<pre></pre>");
  1520. $(".request_url pre", $(this.el)).text(url);
  1521. $(".response_code", $(this.el)).html("<pre>" + response.status + "</pre>");
  1522. $(".response_body", $(this.el)).html(response_body);
  1523. $(".response_headers", $(this.el)).html("<pre>" + _.escape(JSON.stringify(response.headers, null, " ")).replace(/\n/g, "<br>") + "</pre>");
  1524. $(".response", $(this.el)).slideDown();
  1525. $(".response_hider", $(this.el)).show();
  1526. $(".response_throbber", $(this.el)).hide();
  1527. response_body_el = $('.response_body', $(this.el))[0];
  1528. opts = this.options.swaggerOptions;
  1529. if (opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold) {
  1530. return response_body_el;
  1531. } else {
  1532. return hljs.highlightBlock(response_body_el);
  1533. }
  1534. };
  1535. OperationView.prototype.toggleOperationContent = function() {
  1536. var elem;
  1537. elem = $('#' + Docs.escapeResourceName(this.parentId + "_" + this.nickname + "_content"));
  1538. if (elem.is(':visible')) {
  1539. return Docs.collapseOperation(elem);
  1540. } else {
  1541. return Docs.expandOperation(elem);
  1542. }
  1543. };
  1544. return OperationView;
  1545. })(Backbone.View);
  1546. this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  1547. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1548. return " <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"
  1549. + 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)))
  1550. + "'>"
  1551. + 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)))
  1552. + "</textarea>\n";
  1553. },"3":function(depth0,helpers,partials,data) {
  1554. var stack1, buffer = "";
  1555. 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});
  1556. if (stack1 != null) { buffer += stack1; }
  1557. return buffer;
  1558. },"4":function(depth0,helpers,partials,data) {
  1559. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1560. return " "
  1561. + 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)))
  1562. + "\n";
  1563. },"6":function(depth0,helpers,partials,data) {
  1564. return " (empty)\n";
  1565. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  1566. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
  1567. + 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)))
  1568. + "</td>\n<td>\n";
  1569. 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});
  1570. if (stack1 != null) { buffer += stack1; }
  1571. buffer += "</td>\n<td class=\"markdown\">";
  1572. 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));
  1573. if (stack1 != null) { buffer += stack1; }
  1574. buffer += "</td>\n<td>";
  1575. 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));
  1576. if (stack1 != null) { buffer += stack1; }
  1577. return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
  1578. },"useData":true});
  1579. var ParameterContentTypeView,
  1580. __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; },
  1581. __hasProp = {}.hasOwnProperty;
  1582. ParameterContentTypeView = (function(_super) {
  1583. __extends(ParameterContentTypeView, _super);
  1584. function ParameterContentTypeView() {
  1585. return ParameterContentTypeView.__super__.constructor.apply(this, arguments);
  1586. }
  1587. ParameterContentTypeView.prototype.initialize = function() {};
  1588. ParameterContentTypeView.prototype.render = function() {
  1589. var template;
  1590. template = this.template();
  1591. $(this.el).html(template(this.model));
  1592. $('label[for=parameterContentType]', $(this.el)).text('Parameter content type:');
  1593. return this;
  1594. };
  1595. ParameterContentTypeView.prototype.template = function() {
  1596. return Handlebars.templates.parameter_content_type;
  1597. };
  1598. return ParameterContentTypeView;
  1599. })(Backbone.View);
  1600. this["Handlebars"]["templates"]["param_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  1601. var stack1, buffer = "";
  1602. 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});
  1603. if (stack1 != null) { buffer += stack1; }
  1604. return buffer;
  1605. },"2":function(depth0,helpers,partials,data) {
  1606. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1607. return " <input type=\"file\" name='"
  1608. + 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)))
  1609. + "'/>\n";
  1610. },"4":function(depth0,helpers,partials,data) {
  1611. var stack1, buffer = "";
  1612. 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});
  1613. if (stack1 != null) { buffer += stack1; }
  1614. return buffer;
  1615. },"5":function(depth0,helpers,partials,data) {
  1616. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1617. return " <textarea class='body-textarea required' placeholder='(required)' name='"
  1618. + 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)))
  1619. + "'>"
  1620. + 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)))
  1621. + "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
  1622. },"7":function(depth0,helpers,partials,data) {
  1623. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1624. return " <textarea class='body-textarea required' placeholder='(required)' name='"
  1625. + 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)))
  1626. + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
  1627. },"9":function(depth0,helpers,partials,data) {
  1628. var stack1, buffer = "";
  1629. 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});
  1630. if (stack1 != null) { buffer += stack1; }
  1631. return buffer;
  1632. },"10":function(depth0,helpers,partials,data) {
  1633. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1634. return " <input class='parameter' class='required' type='file' name='"
  1635. + 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)))
  1636. + "'/>\n";
  1637. },"12":function(depth0,helpers,partials,data) {
  1638. var stack1, buffer = "";
  1639. 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});
  1640. if (stack1 != null) { buffer += stack1; }
  1641. return buffer;
  1642. },"13":function(depth0,helpers,partials,data) {
  1643. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1644. return " <input class='parameter required' minlength='1' name='"
  1645. + 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)))
  1646. + "' placeholder='(required)' type='text' value='"
  1647. + 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)))
  1648. + "'/>\n";
  1649. },"15":function(depth0,helpers,partials,data) {
  1650. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1651. return " <input class='parameter required' minlength='1' name='"
  1652. + 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)))
  1653. + "' placeholder='(required)' type='text' value=''/>\n";
  1654. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  1655. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
  1656. + 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)))
  1657. + "</td>\n<td>\n";
  1658. 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});
  1659. if (stack1 != null) { buffer += stack1; }
  1660. buffer += "</td>\n<td>\n <strong><span class=\"markdown\">";
  1661. 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));
  1662. if (stack1 != null) { buffer += stack1; }
  1663. buffer += "</span></strong>\n</td>\n<td>";
  1664. 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));
  1665. if (stack1 != null) { buffer += stack1; }
  1666. return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
  1667. },"useData":true});
  1668. var ParameterView,
  1669. __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; },
  1670. __hasProp = {}.hasOwnProperty;
  1671. ParameterView = (function(_super) {
  1672. __extends(ParameterView, _super);
  1673. function ParameterView() {
  1674. return ParameterView.__super__.constructor.apply(this, arguments);
  1675. }
  1676. ParameterView.prototype.initialize = function() {
  1677. return Handlebars.registerHelper('isArray', function(param, opts) {
  1678. if (param.type.toLowerCase() === 'array' || param.allowMultiple) {
  1679. return opts.fn(this);
  1680. } else {
  1681. return opts.inverse(this);
  1682. }
  1683. });
  1684. };
  1685. ParameterView.prototype.render = function() {
  1686. var contentTypeModel, isParam, parameterContentTypeView, ref, responseContentTypeView, schema, signatureModel, signatureView, template, type;
  1687. type = this.model.type || this.model.dataType;
  1688. if (typeof type === 'undefined') {
  1689. schema = this.model.schema;
  1690. if (schema && schema['$ref']) {
  1691. ref = schema['$ref'];
  1692. if (ref.indexOf('#/definitions/') === 0) {
  1693. type = ref.substring('#/definitions/'.length);
  1694. } else {
  1695. type = ref;
  1696. }
  1697. }
  1698. }
  1699. this.model.type = type;
  1700. this.model.paramType = this.model["in"] || this.model.paramType;
  1701. if (this.model.paramType === 'body' || this.model["in"] === 'body') {
  1702. this.model.isBody = true;
  1703. }
  1704. if (type && type.toLowerCase() === 'file') {
  1705. this.model.isFile = true;
  1706. }
  1707. this.model["default"] = this.model["default"] || this.model.defaultValue;
  1708. if (this.model.allowableValues) {
  1709. this.model.isList = true;
  1710. }
  1711. template = this.template();
  1712. $(this.el).html(template(this.model));
  1713. signatureModel = {
  1714. sampleJSON: this.model.sampleJSON,
  1715. isParam: true,
  1716. signature: this.model.signature
  1717. };
  1718. if (this.model.sampleJSON) {
  1719. signatureView = new SignatureView({
  1720. model: signatureModel,
  1721. tagName: 'div'
  1722. });
  1723. $('.model-signature', $(this.el)).append(signatureView.render().el);
  1724. } else {
  1725. $('.model-signature', $(this.el)).html(this.model.signature);
  1726. }
  1727. isParam = false;
  1728. if (this.model.isBody) {
  1729. isParam = true;
  1730. }
  1731. contentTypeModel = {
  1732. isParam: isParam
  1733. };
  1734. contentTypeModel.consumes = this.model.consumes;
  1735. if (isParam) {
  1736. parameterContentTypeView = new ParameterContentTypeView({
  1737. model: contentTypeModel
  1738. });
  1739. $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el);
  1740. } else {
  1741. responseContentTypeView = new ResponseContentTypeView({
  1742. model: contentTypeModel
  1743. });
  1744. $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
  1745. }
  1746. return this;
  1747. };
  1748. ParameterView.prototype.template = function() {
  1749. if (this.model.isList) {
  1750. return Handlebars.templates.param_list;
  1751. } else {
  1752. if (this.options.readOnly) {
  1753. if (this.model.required) {
  1754. return Handlebars.templates.param_readonly_required;
  1755. } else {
  1756. return Handlebars.templates.param_readonly;
  1757. }
  1758. } else {
  1759. if (this.model.required) {
  1760. return Handlebars.templates.param_required;
  1761. } else {
  1762. return Handlebars.templates.param;
  1763. }
  1764. }
  1765. }
  1766. };
  1767. return ParameterView;
  1768. })(Backbone.View);
  1769. this["Handlebars"]["templates"]["parameter_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  1770. var stack1, buffer = "";
  1771. stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
  1772. if (stack1 != null) { buffer += stack1; }
  1773. return buffer;
  1774. },"2":function(depth0,helpers,partials,data) {
  1775. var stack1, lambda=this.lambda, buffer = " <option value=\"";
  1776. stack1 = lambda(depth0, depth0);
  1777. if (stack1 != null) { buffer += stack1; }
  1778. buffer += "\">";
  1779. stack1 = lambda(depth0, depth0);
  1780. if (stack1 != null) { buffer += stack1; }
  1781. return buffer + "</option>\n";
  1782. },"4":function(depth0,helpers,partials,data) {
  1783. return " <option value=\"application/json\">application/json</option>\n";
  1784. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  1785. var stack1, buffer = "<label for=\"parameterContentType\"></label>\n<select name=\"parameterContentType\">\n";
  1786. 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});
  1787. if (stack1 != null) { buffer += stack1; }
  1788. return buffer + "</select>\n";
  1789. },"useData":true});
  1790. var ResourceView,
  1791. __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; },
  1792. __hasProp = {}.hasOwnProperty;
  1793. ResourceView = (function(_super) {
  1794. __extends(ResourceView, _super);
  1795. function ResourceView() {
  1796. return ResourceView.__super__.constructor.apply(this, arguments);
  1797. }
  1798. ResourceView.prototype.initialize = function(opts) {
  1799. if (opts == null) {
  1800. opts = {};
  1801. }
  1802. this.auths = opts.auths;
  1803. if ("" === this.model.description) {
  1804. this.model.description = null;
  1805. }
  1806. if (this.model.description != null) {
  1807. return this.model.summary = this.model.description;
  1808. }
  1809. };
  1810. ResourceView.prototype.render = function() {
  1811. var counter, id, methods, operation, _i, _len, _ref;
  1812. methods = {};
  1813. $(this.el).html(Handlebars.templates.resource(this.model));
  1814. _ref = this.model.operationsArray;
  1815. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1816. operation = _ref[_i];
  1817. counter = 0;
  1818. id = operation.nickname;
  1819. while (typeof methods[id] !== 'undefined') {
  1820. id = id + "_" + counter;
  1821. counter += 1;
  1822. }
  1823. methods[id] = operation;
  1824. operation.nickname = id;
  1825. operation.parentId = this.model.id;
  1826. this.addOperation(operation);
  1827. }
  1828. $('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'));
  1829. $('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource'));
  1830. $('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource'));
  1831. return this;
  1832. };
  1833. ResourceView.prototype.addOperation = function(operation) {
  1834. var operationView;
  1835. operation.number = this.number;
  1836. operationView = new OperationView({
  1837. model: operation,
  1838. tagName: 'li',
  1839. className: 'endpoint',
  1840. swaggerOptions: this.options.swaggerOptions,
  1841. auths: this.auths
  1842. });
  1843. $('.endpoints', $(this.el)).append(operationView.render().el);
  1844. return this.number++;
  1845. };
  1846. ResourceView.prototype.callDocs = function(fnName, e) {
  1847. e.preventDefault();
  1848. return Docs[fnName](e.currentTarget.getAttribute('data-id'));
  1849. };
  1850. return ResourceView;
  1851. })(Backbone.View);
  1852. this["Handlebars"]["templates"]["resource"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  1853. return " : ";
  1854. },"3":function(depth0,helpers,partials,data) {
  1855. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1856. return "<li>\n <a href='"
  1857. + 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)))
  1858. + "'>Raw</a>\n </li>";
  1859. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  1860. var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "<div class='heading'>\n <h2>\n <a href='#!/"
  1861. + 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)))
  1862. + "' class=\"toggleEndpointList\" data-id=\""
  1863. + 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)))
  1864. + "\">"
  1865. + 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)))
  1866. + "</a> ";
  1867. 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));
  1868. if (!helpers.summary) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  1869. if (stack1 != null) { buffer += stack1; }
  1870. 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));
  1871. if (stack1 != null) { buffer += stack1; }
  1872. buffer += "\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/"
  1873. + 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)))
  1874. + "' id='endpointListTogger_"
  1875. + 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)))
  1876. + "' class=\"toggleEndpointList\" data-id=\""
  1877. + 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)))
  1878. + "\">Show/Hide</a>\n </li>\n <li>\n <a href='#' class=\"collapseResource\" data-id=\""
  1879. + 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)))
  1880. + "\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' class=\"expandResource\" data-id=\""
  1881. + 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)))
  1882. + "\">\n Expand Operations\n </a>\n </li>\n ";
  1883. 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));
  1884. if (!helpers.url) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  1885. if (stack1 != null) { buffer += stack1; }
  1886. return buffer + "\n </ul>\n</div>\n<ul class='endpoints' id='"
  1887. + 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)))
  1888. + "_endpoint_list' style='display:none'>\n\n</ul>\n";
  1889. },"useData":true});
  1890. var ResponseContentTypeView,
  1891. __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; },
  1892. __hasProp = {}.hasOwnProperty;
  1893. ResponseContentTypeView = (function(_super) {
  1894. __extends(ResponseContentTypeView, _super);
  1895. function ResponseContentTypeView() {
  1896. return ResponseContentTypeView.__super__.constructor.apply(this, arguments);
  1897. }
  1898. ResponseContentTypeView.prototype.initialize = function() {};
  1899. ResponseContentTypeView.prototype.render = function() {
  1900. var template;
  1901. template = this.template();
  1902. $(this.el).html(template(this.model));
  1903. $('label[for=responseContentType]', $(this.el)).text('Response Content Type');
  1904. return this;
  1905. };
  1906. ResponseContentTypeView.prototype.template = function() {
  1907. return Handlebars.templates.response_content_type;
  1908. };
  1909. return ResponseContentTypeView;
  1910. })(Backbone.View);
  1911. this["Handlebars"]["templates"]["response_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  1912. var stack1, buffer = "";
  1913. stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
  1914. if (stack1 != null) { buffer += stack1; }
  1915. return buffer;
  1916. },"2":function(depth0,helpers,partials,data) {
  1917. var stack1, lambda=this.lambda, buffer = " <option value=\"";
  1918. stack1 = lambda(depth0, depth0);
  1919. if (stack1 != null) { buffer += stack1; }
  1920. buffer += "\">";
  1921. stack1 = lambda(depth0, depth0);
  1922. if (stack1 != null) { buffer += stack1; }
  1923. return buffer + "</option>\n";
  1924. },"4":function(depth0,helpers,partials,data) {
  1925. return " <option value=\"application/json\">application/json</option>\n";
  1926. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  1927. var stack1, buffer = "<label for=\"responseContentType\"></label>\n<select name=\"responseContentType\">\n";
  1928. 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});
  1929. if (stack1 != null) { buffer += stack1; }
  1930. return buffer + "</select>\n";
  1931. },"useData":true});
  1932. var SignatureView,
  1933. __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; },
  1934. __hasProp = {}.hasOwnProperty;
  1935. SignatureView = (function(_super) {
  1936. __extends(SignatureView, _super);
  1937. function SignatureView() {
  1938. return SignatureView.__super__.constructor.apply(this, arguments);
  1939. }
  1940. SignatureView.prototype.events = {
  1941. 'click a.description-link': 'switchToDescription',
  1942. 'click a.snippet-link': 'switchToSnippet',
  1943. 'mousedown .snippet': 'snippetToTextArea'
  1944. };
  1945. SignatureView.prototype.initialize = function() {};
  1946. SignatureView.prototype.render = function() {
  1947. var template;
  1948. template = this.template();
  1949. $(this.el).html(template(this.model));
  1950. this.switchToSnippet();
  1951. this.isParam = this.model.isParam;
  1952. if (this.isParam) {
  1953. $('.notice', $(this.el)).text('Click to set as parameter value');
  1954. }
  1955. return this;
  1956. };
  1957. SignatureView.prototype.template = function() {
  1958. return Handlebars.templates.signature;
  1959. };
  1960. SignatureView.prototype.switchToDescription = function(e) {
  1961. if (e != null) {
  1962. e.preventDefault();
  1963. }
  1964. $(".snippet", $(this.el)).hide();
  1965. $(".description", $(this.el)).show();
  1966. $('.description-link', $(this.el)).addClass('selected');
  1967. return $('.snippet-link', $(this.el)).removeClass('selected');
  1968. };
  1969. SignatureView.prototype.switchToSnippet = function(e) {
  1970. if (e != null) {
  1971. e.preventDefault();
  1972. }
  1973. $(".description", $(this.el)).hide();
  1974. $(".snippet", $(this.el)).show();
  1975. $('.snippet-link', $(this.el)).addClass('selected');
  1976. return $('.description-link', $(this.el)).removeClass('selected');
  1977. };
  1978. SignatureView.prototype.snippetToTextArea = function(e) {
  1979. var textArea;
  1980. if (this.isParam) {
  1981. if (e != null) {
  1982. e.preventDefault();
  1983. }
  1984. textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
  1985. if ($.trim(textArea.val()) === '') {
  1986. return textArea.val(this.model.sampleJSON);
  1987. }
  1988. }
  1989. };
  1990. return SignatureView;
  1991. })(Backbone.View);
  1992. this["Handlebars"]["templates"]["signature"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  1993. 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 ";
  1994. 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));
  1995. if (stack1 != null) { buffer += stack1; }
  1996. return buffer + "\n </div>\n\n <div class=\"snippet\">\n <pre><code>"
  1997. + 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)))
  1998. + "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
  1999. },"useData":true});
  2000. var StatusCodeView,
  2001. __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; },
  2002. __hasProp = {}.hasOwnProperty;
  2003. StatusCodeView = (function(_super) {
  2004. __extends(StatusCodeView, _super);
  2005. function StatusCodeView() {
  2006. return StatusCodeView.__super__.constructor.apply(this, arguments);
  2007. }
  2008. StatusCodeView.prototype.initialize = function() {};
  2009. StatusCodeView.prototype.render = function() {
  2010. var responseModel, responseModelView, template;
  2011. template = this.template();
  2012. $(this.el).html(template(this.model));
  2013. if (swaggerUi.api.models.hasOwnProperty(this.model.responseModel)) {
  2014. responseModel = {
  2015. sampleJSON: JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(), null, 2),
  2016. isParam: false,
  2017. signature: swaggerUi.api.models[this.model.responseModel].getMockSignature()
  2018. };
  2019. responseModelView = new SignatureView({
  2020. model: responseModel,
  2021. tagName: 'div'
  2022. });
  2023. $('.model-signature', this.$el).append(responseModelView.render().el);
  2024. } else {
  2025. $('.model-signature', this.$el).html('');
  2026. }
  2027. return this;
  2028. };
  2029. StatusCodeView.prototype.template = function() {
  2030. return Handlebars.templates.status_code;
  2031. };
  2032. return StatusCodeView;
  2033. })(Backbone.View);
  2034. this["Handlebars"]["templates"]["status_code"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  2035. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td width='15%' class='code'>"
  2036. + 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)))
  2037. + "</td>\n<td>";
  2038. 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));
  2039. if (stack1 != null) { buffer += stack1; }
  2040. return buffer + "</td>\n<td width='50%'><span class=\"model-signature\" /></td>";
  2041. },"useData":true});