25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

2240 lines
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.7-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. var BasicAuthButton,
  400. __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; },
  401. __hasProp = {}.hasOwnProperty;
  402. BasicAuthButton = (function(_super) {
  403. __extends(BasicAuthButton, _super);
  404. function BasicAuthButton() {
  405. return BasicAuthButton.__super__.constructor.apply(this, arguments);
  406. }
  407. BasicAuthButton.prototype.initialize = function() {};
  408. BasicAuthButton.prototype.render = function() {
  409. var template;
  410. template = this.template();
  411. $(this.el).html(template(this.model));
  412. return this;
  413. };
  414. BasicAuthButton.prototype.events = {
  415. "click #basic_auth_button": "togglePasswordContainer",
  416. "click #apply_basic_auth": "applyPassword"
  417. };
  418. BasicAuthButton.prototype.applyPassword = function() {
  419. var elem, password, username;
  420. username = $(".input_username").val();
  421. password = $(".input_password").val();
  422. window.authorizations.add(this.model.type, new PasswordAuthorization("basic", username, password));
  423. window.swaggerUi.load();
  424. return elem = $('#basic_auth_container').hide();
  425. };
  426. BasicAuthButton.prototype.togglePasswordContainer = function() {
  427. var elem;
  428. if ($('#basic_auth_container').length > 0) {
  429. elem = $('#basic_auth_container').show();
  430. if (elem.is(':visible')) {
  431. return elem.slideUp();
  432. } else {
  433. $('.auth_container').hide();
  434. return elem.show();
  435. }
  436. }
  437. };
  438. BasicAuthButton.prototype.template = function() {
  439. return Handlebars.templates.basic_auth_button_view;
  440. };
  441. return BasicAuthButton;
  442. })(Backbone.View);
  443. this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  444. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <div class=\"info_title\">"
  445. + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
  446. + "</div>\n <div class=\"info_description markdown\">";
  447. stack1 = lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.description : stack1), depth0);
  448. if (stack1 != null) { buffer += stack1; }
  449. buffer += "</div>\n ";
  450. 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});
  451. if (stack1 != null) { buffer += stack1; }
  452. buffer += "\n ";
  453. 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});
  454. if (stack1 != null) { buffer += stack1; }
  455. buffer += "\n ";
  456. 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});
  457. if (stack1 != null) { buffer += stack1; }
  458. buffer += "\n ";
  459. 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});
  460. if (stack1 != null) { buffer += stack1; }
  461. buffer += "\n ";
  462. 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});
  463. if (stack1 != null) { buffer += stack1; }
  464. return buffer + "\n";
  465. },"2":function(depth0,helpers,partials,data) {
  466. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
  467. return "<div class=\"info_tos\"><a href=\""
  468. + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), depth0))
  469. + "\">Terms of service</a></div>";
  470. },"4":function(depth0,helpers,partials,data) {
  471. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
  472. return "<div class='info_name'>Created by "
  473. + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), depth0))
  474. + "</div>";
  475. },"6":function(depth0,helpers,partials,data) {
  476. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
  477. return "<div class='info_url'>See more at <a href=\""
  478. + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
  479. + "\">"
  480. + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
  481. + "</a></div>";
  482. },"8":function(depth0,helpers,partials,data) {
  483. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
  484. return "<div class='info_email'><a href=\"mailto:"
  485. + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), depth0))
  486. + "?subject="
  487. + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
  488. + "\">Contact the developer</a></div>";
  489. },"10":function(depth0,helpers,partials,data) {
  490. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
  491. return "<div class='info_license'><a href='"
  492. + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.url : stack1), depth0))
  493. + "'>"
  494. + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.name : stack1), depth0))
  495. + "</a></div>";
  496. },"12":function(depth0,helpers,partials,data) {
  497. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
  498. return " , <span style=\"font-variant: small-caps\">api version</span>: "
  499. + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), depth0))
  500. + "\n ";
  501. },"14":function(depth0,helpers,partials,data) {
  502. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  503. return " <span style=\"float:right\"><a href=\""
  504. + 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)))
  505. + "/debug?url="
  506. + 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)))
  507. + "\"><img id=\"validator\" src=\""
  508. + 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)))
  509. + "?url="
  510. + 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)))
  511. + "\"></a>\n </span>\n";
  512. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  513. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div class='info' id='api_info'>\n";
  514. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.info : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
  515. if (stack1 != null) { buffer += stack1; }
  516. 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>: "
  517. + 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)))
  518. + "\n";
  519. 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});
  520. if (stack1 != null) { buffer += stack1; }
  521. buffer += "]\n";
  522. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.validatorUrl : depth0), {"name":"if","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data});
  523. if (stack1 != null) { buffer += stack1; }
  524. return buffer + " </h4>\n </div>\n</div>\n";
  525. },"useData":true});
  526. var ContentTypeView,
  527. __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; },
  528. __hasProp = {}.hasOwnProperty;
  529. ContentTypeView = (function(_super) {
  530. __extends(ContentTypeView, _super);
  531. function ContentTypeView() {
  532. return ContentTypeView.__super__.constructor.apply(this, arguments);
  533. }
  534. ContentTypeView.prototype.initialize = function() {};
  535. ContentTypeView.prototype.render = function() {
  536. var template;
  537. template = this.template();
  538. $(this.el).html(template(this.model));
  539. $('label[for=contentType]', $(this.el)).text('Response Content Type');
  540. return this;
  541. };
  542. ContentTypeView.prototype.template = function() {
  543. return Handlebars.templates.content_type;
  544. };
  545. return ContentTypeView;
  546. })(Backbone.View);
  547. this["Handlebars"]["templates"]["operation"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  548. return "deprecated";
  549. },"3":function(depth0,helpers,partials,data) {
  550. return " <h4>Warning: Deprecated</h4>\n";
  551. },"5":function(depth0,helpers,partials,data) {
  552. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, buffer = " <h4>Implementation Notes</h4>\n <p class=\"markdown\">";
  553. 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));
  554. if (stack1 != null) { buffer += stack1; }
  555. return buffer + "</p>\n";
  556. },"7":function(depth0,helpers,partials,data) {
  557. return " <div class=\"auth\">\n <span class=\"api-ic ic-error\"></span>";
  558. },"9":function(depth0,helpers,partials,data) {
  559. var stack1, buffer = " <div id=\"api_information_panel\" style=\"top: 526px; left: 776px; display: none;\">\n";
  560. stack1 = helpers.each.call(depth0, depth0, {"name":"each","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
  561. if (stack1 != null) { buffer += stack1; }
  562. return buffer + " </div>\n";
  563. },"10":function(depth0,helpers,partials,data) {
  564. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <div title='";
  565. stack1 = lambda((depth0 != null ? depth0.description : depth0), depth0);
  566. if (stack1 != null) { buffer += stack1; }
  567. return buffer + "'>"
  568. + escapeExpression(lambda((depth0 != null ? depth0.scope : depth0), depth0))
  569. + "</div>\n";
  570. },"12":function(depth0,helpers,partials,data) {
  571. return "</div>";
  572. },"14":function(depth0,helpers,partials,data) {
  573. return " <div class='access'>\n <span class=\"api-ic ic-off\" title=\"click to authenticate\"></span>\n </div>\n";
  574. },"16":function(depth0,helpers,partials,data) {
  575. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  576. return " <h4>Response Class (Status "
  577. + 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)))
  578. + ")</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n";
  579. },"18":function(depth0,helpers,partials,data) {
  580. 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";
  581. },"20":function(depth0,helpers,partials,data) {
  582. 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";
  583. },"22":function(depth0,helpers,partials,data) {
  584. return "";
  585. },"24":function(depth0,helpers,partials,data) {
  586. 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";
  587. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  588. var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "\n <ul class='operations' >\n <li class='"
  589. + 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)))
  590. + " operation' id='"
  591. + 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)))
  592. + "_"
  593. + 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)))
  594. + "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/"
  595. + 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)))
  596. + "/"
  597. + 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)))
  598. + "' class=\"toggleOperation\">"
  599. + 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)))
  600. + "</a>\n </span>\n <span class='path'>\n <a href='#!/"
  601. + 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)))
  602. + "/"
  603. + 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)))
  604. + "' class=\"toggleOperation ";
  605. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
  606. if (stack1 != null) { buffer += stack1; }
  607. buffer += "\">"
  608. + 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)))
  609. + "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/"
  610. + 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)))
  611. + "/"
  612. + 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)))
  613. + "' class=\"toggleOperation\">";
  614. 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));
  615. if (stack1 != null) { buffer += stack1; }
  616. buffer += "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='"
  617. + 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)))
  618. + "_"
  619. + 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)))
  620. + "_content' style='display:none'>\n";
  621. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data});
  622. if (stack1 != null) { buffer += stack1; }
  623. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.description : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.noop,"data":data});
  624. if (stack1 != null) { buffer += stack1; }
  625. 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));
  626. if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  627. if (stack1 != null) { buffer += stack1; }
  628. buffer += "\n";
  629. stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.oauth : depth0), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
  630. if (stack1 != null) { buffer += stack1; }
  631. buffer += " ";
  632. 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));
  633. if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  634. if (stack1 != null) { buffer += stack1; }
  635. buffer += "\n";
  636. 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));
  637. if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  638. if (stack1 != null) { buffer += stack1; }
  639. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.type : depth0), {"name":"if","hash":{},"fn":this.program(16, data),"inverse":this.noop,"data":data});
  640. if (stack1 != null) { buffer += stack1; }
  641. buffer += " <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n";
  642. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.parameters : depth0), {"name":"if","hash":{},"fn":this.program(18, data),"inverse":this.noop,"data":data});
  643. if (stack1 != null) { buffer += stack1; }
  644. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.responseMessages : depth0), {"name":"if","hash":{},"fn":this.program(20, data),"inverse":this.noop,"data":data});
  645. if (stack1 != null) { buffer += stack1; }
  646. 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});
  647. if (stack1 != null) { buffer += stack1; }
  648. 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";
  649. },"useData":true});
  650. var HeaderView,
  651. __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; },
  652. __hasProp = {}.hasOwnProperty;
  653. HeaderView = (function(_super) {
  654. __extends(HeaderView, _super);
  655. function HeaderView() {
  656. return HeaderView.__super__.constructor.apply(this, arguments);
  657. }
  658. HeaderView.prototype.events = {
  659. 'click #show-pet-store-icon': 'showPetStore',
  660. 'click #show-wordnik-dev-icon': 'showWordnikDev',
  661. 'click #explore': 'showCustom',
  662. 'keyup #input_baseUrl': 'showCustomOnKeyup',
  663. 'keyup #input_apiKey': 'showCustomOnKeyup'
  664. };
  665. HeaderView.prototype.initialize = function() {};
  666. HeaderView.prototype.showPetStore = function(e) {
  667. return this.trigger('update-swagger-ui', {
  668. url: "http://petstore.swagger.wordnik.com/api/api-docs"
  669. });
  670. };
  671. HeaderView.prototype.showWordnikDev = function(e) {
  672. return this.trigger('update-swagger-ui', {
  673. url: "http://api.wordnik.com/v4/resources.json"
  674. });
  675. };
  676. HeaderView.prototype.showCustomOnKeyup = function(e) {
  677. if (e.keyCode === 13) {
  678. return this.showCustom();
  679. }
  680. };
  681. HeaderView.prototype.showCustom = function(e) {
  682. if (e != null) {
  683. e.preventDefault();
  684. }
  685. return this.trigger('update-swagger-ui', {
  686. url: $('#input_baseUrl').val(),
  687. apiKey: $('#input_apiKey').val()
  688. });
  689. };
  690. HeaderView.prototype.update = function(url, apiKey, trigger) {
  691. if (trigger == null) {
  692. trigger = false;
  693. }
  694. $('#input_baseUrl').val(url);
  695. if (trigger) {
  696. return this.trigger('update-swagger-ui', {
  697. url: url
  698. });
  699. }
  700. };
  701. return HeaderView;
  702. })(Backbone.View);
  703. this["Handlebars"]["templates"]["param"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  704. var stack1, buffer = "";
  705. 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});
  706. if (stack1 != null) { buffer += stack1; }
  707. return buffer;
  708. },"2":function(depth0,helpers,partials,data) {
  709. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  710. return " <input type=\"file\" name='"
  711. + 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)))
  712. + "'/>\n <div class=\"parameter-content-type\" />\n";
  713. },"4":function(depth0,helpers,partials,data) {
  714. var stack1, buffer = "";
  715. 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});
  716. if (stack1 != null) { buffer += stack1; }
  717. return buffer;
  718. },"5":function(depth0,helpers,partials,data) {
  719. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  720. return " <textarea class='body-textarea' name='"
  721. + 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)))
  722. + "'>"
  723. + 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)))
  724. + "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
  725. },"7":function(depth0,helpers,partials,data) {
  726. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  727. return " <textarea class='body-textarea' name='"
  728. + 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)))
  729. + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
  730. },"9":function(depth0,helpers,partials,data) {
  731. var stack1, buffer = "";
  732. 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});
  733. if (stack1 != null) { buffer += stack1; }
  734. return buffer;
  735. },"10":function(depth0,helpers,partials,data) {
  736. var stack1, buffer = "";
  737. 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});
  738. if (stack1 != null) { buffer += stack1; }
  739. return buffer;
  740. },"11":function(depth0,helpers,partials,data) {
  741. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  742. return " <input class='parameter' minlength='0' name='"
  743. + 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)))
  744. + "' placeholder='' type='text' value='"
  745. + 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)))
  746. + "'/>\n";
  747. },"13":function(depth0,helpers,partials,data) {
  748. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  749. return " <input class='parameter' minlength='0' name='"
  750. + 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)))
  751. + "' placeholder='' type='text' value=''/>\n";
  752. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  753. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
  754. + 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)))
  755. + "</td>\n<td>\n\n";
  756. 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});
  757. if (stack1 != null) { buffer += stack1; }
  758. buffer += "\n</td>\n<td class=\"markdown\">";
  759. 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));
  760. if (stack1 != null) { buffer += stack1; }
  761. buffer += "</td>\n<td>";
  762. 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));
  763. if (stack1 != null) { buffer += stack1; }
  764. return buffer + "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n";
  765. },"useData":true});
  766. var MainView,
  767. __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; },
  768. __hasProp = {}.hasOwnProperty;
  769. MainView = (function(_super) {
  770. var sorters;
  771. __extends(MainView, _super);
  772. function MainView() {
  773. return MainView.__super__.constructor.apply(this, arguments);
  774. }
  775. sorters = {
  776. 'alpha': function(a, b) {
  777. return a.path.localeCompare(b.path);
  778. },
  779. 'method': function(a, b) {
  780. return a.method.localeCompare(b.method);
  781. }
  782. };
  783. MainView.prototype.initialize = function(opts) {
  784. var auth, key, value, _ref;
  785. if (opts == null) {
  786. opts = {};
  787. }
  788. this.model.auths = [];
  789. _ref = this.model.securityDefinitions;
  790. for (key in _ref) {
  791. value = _ref[key];
  792. auth = {
  793. name: key,
  794. type: value.type,
  795. value: value
  796. };
  797. this.model.auths.push(auth);
  798. }
  799. if (this.model.swaggerVersion === "2.0") {
  800. if ("validatorUrl" in opts.swaggerOptions) {
  801. return this.model.validatorUrl = opts.swaggerOptions.validatorUrl;
  802. } else if (this.model.url.indexOf("localhost") > 0) {
  803. return this.model.validatorUrl = null;
  804. } else {
  805. return this.model.validatorUrl = "http://online.swagger.io/validator";
  806. }
  807. }
  808. };
  809. MainView.prototype.render = function() {
  810. var auth, button, counter, id, name, resource, resources, _i, _len, _ref;
  811. if (this.model.securityDefinitions) {
  812. for (name in this.model.securityDefinitions) {
  813. auth = this.model.securityDefinitions[name];
  814. if (auth.type === "apiKey" && $("#apikey_button").length === 0) {
  815. button = new ApiKeyButton({
  816. model: auth
  817. }).render().el;
  818. $('.auth_main_container').append(button);
  819. }
  820. if (auth.type === "basicAuth" && $("#basic_auth_button").length === 0) {
  821. button = new BasicAuthButton({
  822. model: auth
  823. }).render().el;
  824. $('.auth_main_container').append(button);
  825. }
  826. }
  827. }
  828. $(this.el).html(Handlebars.templates.main(this.model));
  829. resources = {};
  830. counter = 0;
  831. _ref = this.model.apisArray;
  832. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  833. resource = _ref[_i];
  834. id = resource.name;
  835. while (typeof resources[id] !== 'undefined') {
  836. id = id + "_" + counter;
  837. counter += 1;
  838. }
  839. resource.id = id;
  840. resources[id] = resource;
  841. this.addResource(resource, this.model.auths);
  842. }
  843. $('.propWrap').hover(function() {
  844. return $('.optionsWrapper', $(this)).show();
  845. }, function() {
  846. return $('.optionsWrapper', $(this)).hide();
  847. });
  848. return this;
  849. };
  850. MainView.prototype.addResource = function(resource, auths) {
  851. var resourceView;
  852. resource.id = resource.id.replace(/\s/g, '_');
  853. resourceView = new ResourceView({
  854. model: resource,
  855. tagName: 'li',
  856. id: 'resource_' + resource.id,
  857. className: 'resource',
  858. auths: auths,
  859. swaggerOptions: this.options.swaggerOptions
  860. });
  861. return $('#resources').append(resourceView.render().el);
  862. };
  863. MainView.prototype.clear = function() {
  864. return $(this.el).html('');
  865. };
  866. return MainView;
  867. })(Backbone.View);
  868. this["Handlebars"]["templates"]["param_list"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  869. return " multiple='multiple'";
  870. },"3":function(depth0,helpers,partials,data) {
  871. return "";
  872. },"5":function(depth0,helpers,partials,data) {
  873. var stack1, buffer = "";
  874. 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});
  875. if (stack1 != null) { buffer += stack1; }
  876. return buffer;
  877. },"6":function(depth0,helpers,partials,data) {
  878. var stack1, helperMissing=helpers.helperMissing, buffer = "";
  879. 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}));
  880. if (stack1 != null) { buffer += stack1; }
  881. return buffer;
  882. },"7":function(depth0,helpers,partials,data) {
  883. return " <option selected=\"\" value=''></option>\n";
  884. },"9":function(depth0,helpers,partials,data) {
  885. var stack1, buffer = "";
  886. 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});
  887. if (stack1 != null) { buffer += stack1; }
  888. return buffer;
  889. },"10":function(depth0,helpers,partials,data) {
  890. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  891. return " <option selected=\"\" value='"
  892. + 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)))
  893. + "'>"
  894. + 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)))
  895. + " (default)</option>\n";
  896. },"12":function(depth0,helpers,partials,data) {
  897. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  898. return " <option value='"
  899. + 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)))
  900. + "'>"
  901. + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
  902. + "</option>\n";
  903. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  904. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
  905. + 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)))
  906. + "</td>\n<td>\n <select ";
  907. stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}));
  908. if (stack1 != null) { buffer += stack1; }
  909. buffer += " class='parameter' name='"
  910. + 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)))
  911. + "'>\n";
  912. 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});
  913. if (stack1 != null) { buffer += stack1; }
  914. 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});
  915. if (stack1 != null) { buffer += stack1; }
  916. buffer += " </select>\n</td>\n<td class=\"markdown\">";
  917. 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));
  918. if (stack1 != null) { buffer += stack1; }
  919. buffer += "</td>\n<td>";
  920. 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));
  921. if (stack1 != null) { buffer += stack1; }
  922. return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>";
  923. },"useData":true});
  924. var OperationView,
  925. __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; },
  926. __hasProp = {}.hasOwnProperty;
  927. OperationView = (function(_super) {
  928. __extends(OperationView, _super);
  929. function OperationView() {
  930. return OperationView.__super__.constructor.apply(this, arguments);
  931. }
  932. OperationView.prototype.invocationUrl = null;
  933. OperationView.prototype.events = {
  934. 'submit .sandbox': 'submitOperation',
  935. 'click .submit': 'submitOperation',
  936. 'click .response_hider': 'hideResponse',
  937. 'click .toggleOperation': 'toggleOperationContent',
  938. 'mouseenter .api-ic': 'mouseEnter',
  939. 'mouseout .api-ic': 'mouseExit'
  940. };
  941. OperationView.prototype.initialize = function(opts) {
  942. if (opts == null) {
  943. opts = {};
  944. }
  945. this.auths = opts.auths;
  946. this.parentId = this.model.parentId;
  947. this.nickname = this.model.nickname;
  948. return this;
  949. };
  950. OperationView.prototype.mouseEnter = function(e) {
  951. var elem, hgh, pos, scMaxX, scMaxY, scX, scY, wd, x, y;
  952. elem = $(this.el).find('.content');
  953. x = e.pageX;
  954. y = e.pageY;
  955. scX = $(window).scrollLeft();
  956. scY = $(window).scrollTop();
  957. scMaxX = scX + $(window).width();
  958. scMaxY = scY + $(window).height();
  959. wd = elem.width();
  960. hgh = elem.height();
  961. if (x + wd > scMaxX) {
  962. x = scMaxX - wd;
  963. }
  964. if (x < scX) {
  965. x = scX;
  966. }
  967. if (y + hgh > scMaxY) {
  968. y = scMaxY - hgh;
  969. }
  970. if (y < scY) {
  971. y = scY;
  972. }
  973. pos = {};
  974. pos.top = y;
  975. pos.left = x;
  976. elem.css(pos);
  977. return $(e.currentTarget.parentNode).find('#api_information_panel').show();
  978. };
  979. OperationView.prototype.mouseExit = function(e) {
  980. return $(e.currentTarget.parentNode).find('#api_information_panel').hide();
  981. };
  982. OperationView.prototype.render = function() {
  983. 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;
  984. isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
  985. if (!isMethodSubmissionSupported) {
  986. this.model.isReadOnly = true;
  987. }
  988. this.model.description = this.model.description || this.model.notes;
  989. if (this.model.description) {
  990. this.model.description = this.model.description.replace(/(?:\r\n|\r|\n)/g, '<br />');
  991. }
  992. this.model.oauth = null;
  993. modelAuths = this.model.authorizations || this.model.security;
  994. if (modelAuths) {
  995. if (Array.isArray(modelAuths)) {
  996. for (_i = 0, _len = modelAuths.length; _i < _len; _i++) {
  997. auths = modelAuths[_i];
  998. for (key in auths) {
  999. auth = auths[key];
  1000. for (a in this.auths) {
  1001. auth = this.auths[a];
  1002. if (auth.type === 'oauth2') {
  1003. this.model.oauth = {};
  1004. this.model.oauth.scopes = [];
  1005. _ref = auth.value.scopes;
  1006. for (k in _ref) {
  1007. v = _ref[k];
  1008. scopeIndex = auths[key].indexOf(k);
  1009. if (scopeIndex >= 0) {
  1010. o = {
  1011. scope: k,
  1012. description: v
  1013. };
  1014. this.model.oauth.scopes.push(o);
  1015. }
  1016. }
  1017. }
  1018. }
  1019. }
  1020. }
  1021. } else {
  1022. for (k in modelAuths) {
  1023. v = modelAuths[k];
  1024. if (k === "oauth2") {
  1025. if (this.model.oauth === null) {
  1026. this.model.oauth = {};
  1027. }
  1028. if (this.model.oauth.scopes === void 0) {
  1029. this.model.oauth.scopes = [];
  1030. }
  1031. for (_j = 0, _len1 = v.length; _j < _len1; _j++) {
  1032. o = v[_j];
  1033. this.model.oauth.scopes.push(o);
  1034. }
  1035. }
  1036. }
  1037. }
  1038. }
  1039. if (typeof this.model.responses !== 'undefined') {
  1040. this.model.responseMessages = [];
  1041. _ref1 = this.model.responses;
  1042. for (code in _ref1) {
  1043. value = _ref1[code];
  1044. schema = null;
  1045. schemaObj = this.model.responses[code].schema;
  1046. if (schemaObj && schemaObj['$ref']) {
  1047. schema = schemaObj['$ref'];
  1048. if (schema.indexOf('#/definitions/') === 0) {
  1049. schema = schema.substring('#/definitions/'.length);
  1050. }
  1051. }
  1052. this.model.responseMessages.push({
  1053. code: code,
  1054. message: value.description,
  1055. responseModel: schema
  1056. });
  1057. }
  1058. }
  1059. if (typeof this.model.responseMessages === 'undefined') {
  1060. this.model.responseMessages = [];
  1061. }
  1062. signatureModel = null;
  1063. if (this.model.successResponse) {
  1064. successResponse = this.model.successResponse;
  1065. for (key in successResponse) {
  1066. value = successResponse[key];
  1067. this.model.successCode = key;
  1068. if (typeof value === 'object' && typeof value.createJSONSample === 'function') {
  1069. signatureModel = {
  1070. sampleJSON: JSON.stringify(value.createJSONSample(), void 0, 2),
  1071. isParam: false,
  1072. signature: value.getMockSignature()
  1073. };
  1074. }
  1075. }
  1076. } else if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
  1077. signatureModel = {
  1078. sampleJSON: this.model.responseSampleJSON,
  1079. isParam: false,
  1080. signature: this.model.responseClassSignature
  1081. };
  1082. }
  1083. $(this.el).html(Handlebars.templates.operation(this.model));
  1084. if (signatureModel) {
  1085. responseSignatureView = new SignatureView({
  1086. model: signatureModel,
  1087. tagName: 'div'
  1088. });
  1089. $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
  1090. } else {
  1091. this.model.responseClassSignature = 'string';
  1092. $('.model-signature', $(this.el)).html(this.model.type);
  1093. }
  1094. contentTypeModel = {
  1095. isParam: false
  1096. };
  1097. contentTypeModel.consumes = this.model.consumes;
  1098. contentTypeModel.produces = this.model.produces;
  1099. _ref2 = this.model.parameters;
  1100. for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
  1101. param = _ref2[_k];
  1102. type = param.type || param.dataType || '';
  1103. if (typeof type === 'undefined') {
  1104. schema = param.schema;
  1105. if (schema && schema['$ref']) {
  1106. ref = schema['$ref'];
  1107. if (ref.indexOf('#/definitions/') === 0) {
  1108. type = ref.substring('#/definitions/'.length);
  1109. } else {
  1110. type = ref;
  1111. }
  1112. }
  1113. }
  1114. if (type && type.toLowerCase() === 'file') {
  1115. if (!contentTypeModel.consumes) {
  1116. contentTypeModel.consumes = 'multipart/form-data';
  1117. }
  1118. }
  1119. param.type = type;
  1120. }
  1121. responseContentTypeView = new ResponseContentTypeView({
  1122. model: contentTypeModel
  1123. });
  1124. $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
  1125. _ref3 = this.model.parameters;
  1126. for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
  1127. param = _ref3[_l];
  1128. this.addParameter(param, contentTypeModel.consumes);
  1129. }
  1130. _ref4 = this.model.responseMessages;
  1131. for (_m = 0, _len4 = _ref4.length; _m < _len4; _m++) {
  1132. statusCode = _ref4[_m];
  1133. this.addStatusCode(statusCode);
  1134. }
  1135. return this;
  1136. };
  1137. OperationView.prototype.addParameter = function(param, consumes) {
  1138. var paramView;
  1139. param.consumes = consumes;
  1140. paramView = new ParameterView({
  1141. model: param,
  1142. tagName: 'tr',
  1143. readOnly: this.model.isReadOnly
  1144. });
  1145. return $('.operation-params', $(this.el)).append(paramView.render().el);
  1146. };
  1147. OperationView.prototype.addStatusCode = function(statusCode) {
  1148. var statusCodeView;
  1149. statusCodeView = new StatusCodeView({
  1150. model: statusCode,
  1151. tagName: 'tr'
  1152. });
  1153. return $('.operation-status', $(this.el)).append(statusCodeView.render().el);
  1154. };
  1155. OperationView.prototype.submitOperation = function(e) {
  1156. var error_free, form, isFileUpload, map, o, opts, val, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;
  1157. if (e != null) {
  1158. e.preventDefault();
  1159. }
  1160. form = $('.sandbox', $(this.el));
  1161. error_free = true;
  1162. form.find("input.required").each(function() {
  1163. $(this).removeClass("error");
  1164. if (jQuery.trim($(this).val()) === "") {
  1165. $(this).addClass("error");
  1166. $(this).wiggle({
  1167. callback: (function(_this) {
  1168. return function() {
  1169. return $(_this).focus();
  1170. };
  1171. })(this)
  1172. });
  1173. return error_free = false;
  1174. }
  1175. });
  1176. form.find("textarea.required").each(function() {
  1177. $(this).removeClass("error");
  1178. if (jQuery.trim($(this).val()) === "") {
  1179. $(this).addClass("error");
  1180. $(this).wiggle({
  1181. callback: (function(_this) {
  1182. return function() {
  1183. return $(_this).focus();
  1184. };
  1185. })(this)
  1186. });
  1187. return error_free = false;
  1188. }
  1189. });
  1190. if (error_free) {
  1191. map = {};
  1192. opts = {
  1193. parent: this
  1194. };
  1195. isFileUpload = false;
  1196. _ref = form.find("input");
  1197. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1198. o = _ref[_i];
  1199. if ((o.value != null) && jQuery.trim(o.value).length > 0) {
  1200. map[o.name] = o.value;
  1201. }
  1202. if (o.type === "file") {
  1203. map[o.name] = o.files[0];
  1204. isFileUpload = true;
  1205. }
  1206. }
  1207. _ref1 = form.find("textarea");
  1208. for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
  1209. o = _ref1[_j];
  1210. if ((o.value != null) && jQuery.trim(o.value).length > 0) {
  1211. map[o.name] = o.value;
  1212. }
  1213. }
  1214. _ref2 = form.find("select");
  1215. for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
  1216. o = _ref2[_k];
  1217. val = this.getSelectedValue(o);
  1218. if ((val != null) && jQuery.trim(val).length > 0) {
  1219. map[o.name] = val;
  1220. }
  1221. }
  1222. opts.responseContentType = $("div select[name=responseContentType]", $(this.el)).val();
  1223. opts.requestContentType = $("div select[name=parameterContentType]", $(this.el)).val();
  1224. $(".response_throbber", $(this.el)).show();
  1225. if (isFileUpload) {
  1226. return this.handleFileUpload(map, form);
  1227. } else {
  1228. return this.model["do"](map, opts, this.showCompleteStatus, this.showErrorStatus, this);
  1229. }
  1230. }
  1231. };
  1232. OperationView.prototype.success = function(response, parent) {
  1233. return parent.showCompleteStatus(response);
  1234. };
  1235. OperationView.prototype.handleFileUpload = function(map, form) {
  1236. var bodyParam, el, headerParams, o, obj, param, params, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3;
  1237. _ref = form.serializeArray();
  1238. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1239. o = _ref[_i];
  1240. if ((o.value != null) && jQuery.trim(o.value).length > 0) {
  1241. map[o.name] = o.value;
  1242. }
  1243. }
  1244. bodyParam = new FormData();
  1245. params = 0;
  1246. _ref1 = this.model.parameters;
  1247. for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
  1248. param = _ref1[_j];
  1249. if (param.paramType === 'form' || param["in"] === 'formData') {
  1250. if (param.type.toLowerCase() !== 'file' && map[param.name] !== void 0) {
  1251. bodyParam.append(param.name, map[param.name]);
  1252. }
  1253. }
  1254. }
  1255. headerParams = {};
  1256. _ref2 = this.model.parameters;
  1257. for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
  1258. param = _ref2[_k];
  1259. if (param.paramType === 'header') {
  1260. headerParams[param.name] = map[param.name];
  1261. }
  1262. }
  1263. _ref3 = form.find('input[type~="file"]');
  1264. for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
  1265. el = _ref3[_l];
  1266. if (typeof el.files[0] !== 'undefined') {
  1267. bodyParam.append($(el).attr('name'), el.files[0]);
  1268. params += 1;
  1269. }
  1270. }
  1271. this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), delete headerParams['Content-Type'], this.model.urlify(map, false)) : this.model.urlify(map, true);
  1272. $(".request_url", $(this.el)).html("<pre></pre>");
  1273. $(".request_url pre", $(this.el)).text(this.invocationUrl);
  1274. obj = {
  1275. type: this.model.method,
  1276. url: this.invocationUrl,
  1277. headers: headerParams,
  1278. data: bodyParam,
  1279. dataType: 'json',
  1280. contentType: false,
  1281. processData: false,
  1282. error: (function(_this) {
  1283. return function(data, textStatus, error) {
  1284. return _this.showErrorStatus(_this.wrap(data), _this);
  1285. };
  1286. })(this),
  1287. success: (function(_this) {
  1288. return function(data) {
  1289. return _this.showResponse(data, _this);
  1290. };
  1291. })(this),
  1292. complete: (function(_this) {
  1293. return function(data) {
  1294. return _this.showCompleteStatus(_this.wrap(data), _this);
  1295. };
  1296. })(this)
  1297. };
  1298. if (window.authorizations) {
  1299. window.authorizations.apply(obj);
  1300. }
  1301. if (params === 0) {
  1302. obj.data.append("fake", "true");
  1303. }
  1304. jQuery.ajax(obj);
  1305. return false;
  1306. };
  1307. OperationView.prototype.wrap = function(data) {
  1308. var h, headerArray, headers, i, o, _i, _len;
  1309. headers = {};
  1310. headerArray = data.getAllResponseHeaders().split("\r");
  1311. for (_i = 0, _len = headerArray.length; _i < _len; _i++) {
  1312. i = headerArray[_i];
  1313. h = i.match(/^([^:]*?):(.*)$/);
  1314. if (!h) {
  1315. h = [];
  1316. }
  1317. h.shift();
  1318. if (h[0] !== void 0 && h[1] !== void 0) {
  1319. headers[h[0].trim()] = h[1].trim();
  1320. }
  1321. }
  1322. o = {};
  1323. o.content = {};
  1324. o.content.data = data.responseText;
  1325. o.headers = headers;
  1326. o.request = {};
  1327. o.request.url = this.invocationUrl;
  1328. o.status = data.status;
  1329. return o;
  1330. };
  1331. OperationView.prototype.getSelectedValue = function(select) {
  1332. var opt, options, _i, _len, _ref;
  1333. if (!select.multiple) {
  1334. return select.value;
  1335. } else {
  1336. options = [];
  1337. _ref = select.options;
  1338. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1339. opt = _ref[_i];
  1340. if (opt.selected) {
  1341. options.push(opt.value);
  1342. }
  1343. }
  1344. if (options.length > 0) {
  1345. return options;
  1346. } else {
  1347. return null;
  1348. }
  1349. }
  1350. };
  1351. OperationView.prototype.hideResponse = function(e) {
  1352. if (e != null) {
  1353. e.preventDefault();
  1354. }
  1355. $(".response", $(this.el)).slideUp();
  1356. return $(".response_hider", $(this.el)).fadeOut();
  1357. };
  1358. OperationView.prototype.showResponse = function(response) {
  1359. var prettyJson;
  1360. prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>");
  1361. return $(".response_body", $(this.el)).html(escape(prettyJson));
  1362. };
  1363. OperationView.prototype.showErrorStatus = function(data, parent) {
  1364. return parent.showStatus(data);
  1365. };
  1366. OperationView.prototype.showCompleteStatus = function(data, parent) {
  1367. return parent.showStatus(data);
  1368. };
  1369. OperationView.prototype.formatXml = function(xml) {
  1370. var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
  1371. reg = /(>)(<)(\/*)/g;
  1372. wsexp = /[ ]*(.*)[ ]+\n/g;
  1373. contexp = /(<.+>)(.+\n)/g;
  1374. xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
  1375. pad = 0;
  1376. formatted = '';
  1377. lines = xml.split('\n');
  1378. indent = 0;
  1379. lastType = 'other';
  1380. transitions = {
  1381. 'single->single': 0,
  1382. 'single->closing': -1,
  1383. 'single->opening': 0,
  1384. 'single->other': 0,
  1385. 'closing->single': 0,
  1386. 'closing->closing': -1,
  1387. 'closing->opening': 0,
  1388. 'closing->other': 0,
  1389. 'opening->single': 1,
  1390. 'opening->closing': 0,
  1391. 'opening->opening': 1,
  1392. 'opening->other': 1,
  1393. 'other->single': 0,
  1394. 'other->closing': -1,
  1395. 'other->opening': 0,
  1396. 'other->other': 0
  1397. };
  1398. _fn = function(ln) {
  1399. var fromTo, j, key, padding, type, types, value;
  1400. types = {
  1401. single: Boolean(ln.match(/<.+\/>/)),
  1402. closing: Boolean(ln.match(/<\/.+>/)),
  1403. opening: Boolean(ln.match(/<[^!?].*>/))
  1404. };
  1405. type = ((function() {
  1406. var _results;
  1407. _results = [];
  1408. for (key in types) {
  1409. value = types[key];
  1410. if (value) {
  1411. _results.push(key);
  1412. }
  1413. }
  1414. return _results;
  1415. })())[0];
  1416. type = type === void 0 ? 'other' : type;
  1417. fromTo = lastType + '->' + type;
  1418. lastType = type;
  1419. padding = '';
  1420. indent += transitions[fromTo];
  1421. padding = ((function() {
  1422. var _j, _ref, _results;
  1423. _results = [];
  1424. for (j = _j = 0, _ref = indent; 0 <= _ref ? _j < _ref : _j > _ref; j = 0 <= _ref ? ++_j : --_j) {
  1425. _results.push(' ');
  1426. }
  1427. return _results;
  1428. })()).join('');
  1429. if (fromTo === 'opening->closing') {
  1430. return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
  1431. } else {
  1432. return formatted += padding + ln + '\n';
  1433. }
  1434. };
  1435. for (_i = 0, _len = lines.length; _i < _len; _i++) {
  1436. ln = lines[_i];
  1437. _fn(ln);
  1438. }
  1439. return formatted;
  1440. };
  1441. OperationView.prototype.showStatus = function(response) {
  1442. var code, content, contentType, e, headers, json, opts, pre, response_body, response_body_el, url;
  1443. if (response.content === void 0) {
  1444. content = response.data;
  1445. url = response.url;
  1446. } else {
  1447. content = response.content.data;
  1448. url = response.request.url;
  1449. }
  1450. headers = response.headers;
  1451. contentType = null;
  1452. if (headers) {
  1453. contentType = headers["Content-Type"] || headers["content-type"];
  1454. if (contentType) {
  1455. contentType = contentType.split(";")[0].trim();
  1456. }
  1457. }
  1458. $(".response_body", $(this.el)).removeClass('json');
  1459. $(".response_body", $(this.el)).removeClass('xml');
  1460. if (!content) {
  1461. code = $('<code />').text("no content");
  1462. pre = $('<pre class="json" />').append(code);
  1463. } else if (contentType === "application/json" || /\+json$/.test(contentType)) {
  1464. json = null;
  1465. try {
  1466. json = JSON.stringify(JSON.parse(content), null, " ");
  1467. } catch (_error) {
  1468. e = _error;
  1469. json = "can't parse JSON. Raw result:\n\n" + content;
  1470. }
  1471. code = $('<code />').text(json);
  1472. pre = $('<pre class="json" />').append(code);
  1473. } else if (contentType === "application/xml" || /\+xml$/.test(contentType)) {
  1474. code = $('<code />').text(this.formatXml(content));
  1475. pre = $('<pre class="xml" />').append(code);
  1476. } else if (contentType === "text/html") {
  1477. code = $('<code />').html(_.escape(content));
  1478. pre = $('<pre class="xml" />').append(code);
  1479. } else if (/^image\//.test(contentType)) {
  1480. pre = $('<img>').attr('src', url);
  1481. } else {
  1482. code = $('<code />').text(content);
  1483. pre = $('<pre class="json" />').append(code);
  1484. }
  1485. response_body = pre;
  1486. $(".request_url", $(this.el)).html("<pre></pre>");
  1487. $(".request_url pre", $(this.el)).text(url);
  1488. $(".response_code", $(this.el)).html("<pre>" + response.status + "</pre>");
  1489. $(".response_body", $(this.el)).html(response_body);
  1490. $(".response_headers", $(this.el)).html("<pre>" + _.escape(JSON.stringify(response.headers, null, " ")).replace(/\n/g, "<br>") + "</pre>");
  1491. $(".response", $(this.el)).slideDown();
  1492. $(".response_hider", $(this.el)).show();
  1493. $(".response_throbber", $(this.el)).hide();
  1494. response_body_el = $('.response_body', $(this.el))[0];
  1495. opts = this.options.swaggerOptions;
  1496. if (opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold) {
  1497. return response_body_el;
  1498. } else {
  1499. return hljs.highlightBlock(response_body_el);
  1500. }
  1501. };
  1502. OperationView.prototype.toggleOperationContent = function() {
  1503. var elem;
  1504. elem = $('#' + Docs.escapeResourceName(this.parentId + "_" + this.nickname + "_content"));
  1505. if (elem.is(':visible')) {
  1506. return Docs.collapseOperation(elem);
  1507. } else {
  1508. return Docs.expandOperation(elem);
  1509. }
  1510. };
  1511. return OperationView;
  1512. })(Backbone.View);
  1513. this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  1514. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1515. return " <textarea class='body-textarea' readonly='readonly' name='"
  1516. + 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)))
  1517. + "'>"
  1518. + 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)))
  1519. + "</textarea>\n";
  1520. },"3":function(depth0,helpers,partials,data) {
  1521. var stack1, buffer = "";
  1522. 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});
  1523. if (stack1 != null) { buffer += stack1; }
  1524. return buffer;
  1525. },"4":function(depth0,helpers,partials,data) {
  1526. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1527. return " "
  1528. + 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)))
  1529. + "\n";
  1530. },"6":function(depth0,helpers,partials,data) {
  1531. return " (empty)\n";
  1532. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  1533. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
  1534. + 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)))
  1535. + "</td>\n<td>\n";
  1536. 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});
  1537. if (stack1 != null) { buffer += stack1; }
  1538. buffer += "</td>\n<td class=\"markdown\">";
  1539. 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));
  1540. if (stack1 != null) { buffer += stack1; }
  1541. buffer += "</td>\n<td>";
  1542. 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));
  1543. if (stack1 != null) { buffer += stack1; }
  1544. return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
  1545. },"useData":true});
  1546. var ParameterContentTypeView,
  1547. __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; },
  1548. __hasProp = {}.hasOwnProperty;
  1549. ParameterContentTypeView = (function(_super) {
  1550. __extends(ParameterContentTypeView, _super);
  1551. function ParameterContentTypeView() {
  1552. return ParameterContentTypeView.__super__.constructor.apply(this, arguments);
  1553. }
  1554. ParameterContentTypeView.prototype.initialize = function() {};
  1555. ParameterContentTypeView.prototype.render = function() {
  1556. var template;
  1557. template = this.template();
  1558. $(this.el).html(template(this.model));
  1559. $('label[for=parameterContentType]', $(this.el)).text('Parameter content type:');
  1560. return this;
  1561. };
  1562. ParameterContentTypeView.prototype.template = function() {
  1563. return Handlebars.templates.parameter_content_type;
  1564. };
  1565. return ParameterContentTypeView;
  1566. })(Backbone.View);
  1567. this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  1568. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1569. return " <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"
  1570. + 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)))
  1571. + "'>"
  1572. + 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)))
  1573. + "</textarea>\n";
  1574. },"3":function(depth0,helpers,partials,data) {
  1575. var stack1, buffer = "";
  1576. 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});
  1577. if (stack1 != null) { buffer += stack1; }
  1578. return buffer;
  1579. },"4":function(depth0,helpers,partials,data) {
  1580. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1581. return " "
  1582. + 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)))
  1583. + "\n";
  1584. },"6":function(depth0,helpers,partials,data) {
  1585. return " (empty)\n";
  1586. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  1587. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
  1588. + 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)))
  1589. + "</td>\n<td>\n";
  1590. 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});
  1591. if (stack1 != null) { buffer += stack1; }
  1592. buffer += "</td>\n<td class=\"markdown\">";
  1593. 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));
  1594. if (stack1 != null) { buffer += stack1; }
  1595. buffer += "</td>\n<td>";
  1596. 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));
  1597. if (stack1 != null) { buffer += stack1; }
  1598. return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
  1599. },"useData":true});
  1600. var ParameterView,
  1601. __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; },
  1602. __hasProp = {}.hasOwnProperty;
  1603. ParameterView = (function(_super) {
  1604. __extends(ParameterView, _super);
  1605. function ParameterView() {
  1606. return ParameterView.__super__.constructor.apply(this, arguments);
  1607. }
  1608. ParameterView.prototype.initialize = function() {
  1609. return Handlebars.registerHelper('isArray', function(param, opts) {
  1610. if (param.type.toLowerCase() === 'array' || param.allowMultiple) {
  1611. return opts.fn(this);
  1612. } else {
  1613. return opts.inverse(this);
  1614. }
  1615. });
  1616. };
  1617. ParameterView.prototype.render = function() {
  1618. var contentTypeModel, isParam, parameterContentTypeView, ref, responseContentTypeView, schema, signatureModel, signatureView, template, type;
  1619. type = this.model.type || this.model.dataType;
  1620. if (typeof type === 'undefined') {
  1621. schema = this.model.schema;
  1622. if (schema && schema['$ref']) {
  1623. ref = schema['$ref'];
  1624. if (ref.indexOf('#/definitions/') === 0) {
  1625. type = ref.substring('#/definitions/'.length);
  1626. } else {
  1627. type = ref;
  1628. }
  1629. }
  1630. }
  1631. this.model.type = type;
  1632. this.model.paramType = this.model["in"] || this.model.paramType;
  1633. if (this.model.paramType === 'body' || this.model["in"] === 'body') {
  1634. this.model.isBody = true;
  1635. }
  1636. if (type && type.toLowerCase() === 'file') {
  1637. this.model.isFile = true;
  1638. }
  1639. this.model["default"] = this.model["default"] || this.model.defaultValue;
  1640. if (this.model.allowableValues) {
  1641. this.model.isList = true;
  1642. }
  1643. template = this.template();
  1644. $(this.el).html(template(this.model));
  1645. signatureModel = {
  1646. sampleJSON: this.model.sampleJSON,
  1647. isParam: true,
  1648. signature: this.model.signature
  1649. };
  1650. if (this.model.sampleJSON) {
  1651. signatureView = new SignatureView({
  1652. model: signatureModel,
  1653. tagName: 'div'
  1654. });
  1655. $('.model-signature', $(this.el)).append(signatureView.render().el);
  1656. } else {
  1657. $('.model-signature', $(this.el)).html(this.model.signature);
  1658. }
  1659. isParam = false;
  1660. if (this.model.isBody) {
  1661. isParam = true;
  1662. }
  1663. contentTypeModel = {
  1664. isParam: isParam
  1665. };
  1666. contentTypeModel.consumes = this.model.consumes;
  1667. if (isParam) {
  1668. parameterContentTypeView = new ParameterContentTypeView({
  1669. model: contentTypeModel
  1670. });
  1671. $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el);
  1672. } else {
  1673. responseContentTypeView = new ResponseContentTypeView({
  1674. model: contentTypeModel
  1675. });
  1676. $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
  1677. }
  1678. return this;
  1679. };
  1680. ParameterView.prototype.template = function() {
  1681. if (this.model.isList) {
  1682. return Handlebars.templates.param_list;
  1683. } else {
  1684. if (this.options.readOnly) {
  1685. if (this.model.required) {
  1686. return Handlebars.templates.param_readonly_required;
  1687. } else {
  1688. return Handlebars.templates.param_readonly;
  1689. }
  1690. } else {
  1691. if (this.model.required) {
  1692. return Handlebars.templates.param_required;
  1693. } else {
  1694. return Handlebars.templates.param;
  1695. }
  1696. }
  1697. }
  1698. };
  1699. return ParameterView;
  1700. })(Backbone.View);
  1701. this["Handlebars"]["templates"]["param_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  1702. var stack1, buffer = "";
  1703. 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});
  1704. if (stack1 != null) { buffer += stack1; }
  1705. return buffer;
  1706. },"2":function(depth0,helpers,partials,data) {
  1707. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1708. return " <input type=\"file\" name='"
  1709. + 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)))
  1710. + "'/>\n";
  1711. },"4":function(depth0,helpers,partials,data) {
  1712. var stack1, buffer = "";
  1713. 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});
  1714. if (stack1 != null) { buffer += stack1; }
  1715. return buffer;
  1716. },"5":function(depth0,helpers,partials,data) {
  1717. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1718. return " <textarea class='body-textarea required' placeholder='(required)' name='"
  1719. + 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)))
  1720. + "'>"
  1721. + 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)))
  1722. + "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
  1723. },"7":function(depth0,helpers,partials,data) {
  1724. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1725. return " <textarea class='body-textarea required' placeholder='(required)' name='"
  1726. + 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)))
  1727. + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
  1728. },"9":function(depth0,helpers,partials,data) {
  1729. var stack1, buffer = "";
  1730. 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});
  1731. if (stack1 != null) { buffer += stack1; }
  1732. return buffer;
  1733. },"10":function(depth0,helpers,partials,data) {
  1734. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1735. return " <input class='parameter' class='required' type='file' name='"
  1736. + 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)))
  1737. + "'/>\n";
  1738. },"12":function(depth0,helpers,partials,data) {
  1739. var stack1, buffer = "";
  1740. 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});
  1741. if (stack1 != null) { buffer += stack1; }
  1742. return buffer;
  1743. },"13":function(depth0,helpers,partials,data) {
  1744. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1745. return " <input class='parameter required' minlength='1' name='"
  1746. + 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)))
  1747. + "' placeholder='(required)' type='text' value='"
  1748. + 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)))
  1749. + "'/>\n";
  1750. },"15":function(depth0,helpers,partials,data) {
  1751. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1752. return " <input class='parameter required' minlength='1' name='"
  1753. + 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)))
  1754. + "' placeholder='(required)' type='text' value=''/>\n";
  1755. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  1756. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
  1757. + 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)))
  1758. + "</td>\n<td>\n";
  1759. 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});
  1760. if (stack1 != null) { buffer += stack1; }
  1761. buffer += "</td>\n<td>\n <strong><span class=\"markdown\">";
  1762. 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));
  1763. if (stack1 != null) { buffer += stack1; }
  1764. buffer += "</span></strong>\n</td>\n<td>";
  1765. 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));
  1766. if (stack1 != null) { buffer += stack1; }
  1767. return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
  1768. },"useData":true});
  1769. var ResourceView,
  1770. __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; },
  1771. __hasProp = {}.hasOwnProperty;
  1772. ResourceView = (function(_super) {
  1773. __extends(ResourceView, _super);
  1774. function ResourceView() {
  1775. return ResourceView.__super__.constructor.apply(this, arguments);
  1776. }
  1777. ResourceView.prototype.initialize = function(opts) {
  1778. if (opts == null) {
  1779. opts = {};
  1780. }
  1781. this.auths = opts.auths;
  1782. if ("" === this.model.description) {
  1783. this.model.description = null;
  1784. }
  1785. if (this.model.description != null) {
  1786. return this.model.summary = this.model.description;
  1787. }
  1788. };
  1789. ResourceView.prototype.render = function() {
  1790. var counter, id, methods, operation, _i, _len, _ref;
  1791. methods = {};
  1792. $(this.el).html(Handlebars.templates.resource(this.model));
  1793. _ref = this.model.operationsArray;
  1794. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1795. operation = _ref[_i];
  1796. counter = 0;
  1797. id = operation.nickname;
  1798. while (typeof methods[id] !== 'undefined') {
  1799. id = id + "_" + counter;
  1800. counter += 1;
  1801. }
  1802. methods[id] = operation;
  1803. operation.nickname = id;
  1804. operation.parentId = this.model.id;
  1805. this.addOperation(operation);
  1806. }
  1807. $('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'));
  1808. $('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource'));
  1809. $('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource'));
  1810. return this;
  1811. };
  1812. ResourceView.prototype.addOperation = function(operation) {
  1813. var operationView;
  1814. operation.number = this.number;
  1815. operationView = new OperationView({
  1816. model: operation,
  1817. tagName: 'li',
  1818. className: 'endpoint',
  1819. swaggerOptions: this.options.swaggerOptions,
  1820. auths: this.auths
  1821. });
  1822. $('.endpoints', $(this.el)).append(operationView.render().el);
  1823. return this.number++;
  1824. };
  1825. ResourceView.prototype.callDocs = function(fnName, e) {
  1826. e.preventDefault();
  1827. return Docs[fnName](e.currentTarget.getAttribute('data-id'));
  1828. };
  1829. return ResourceView;
  1830. })(Backbone.View);
  1831. this["Handlebars"]["templates"]["parameter_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  1832. var stack1, buffer = "";
  1833. stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
  1834. if (stack1 != null) { buffer += stack1; }
  1835. return buffer;
  1836. },"2":function(depth0,helpers,partials,data) {
  1837. var stack1, lambda=this.lambda, buffer = " <option value=\"";
  1838. stack1 = lambda(depth0, depth0);
  1839. if (stack1 != null) { buffer += stack1; }
  1840. buffer += "\">";
  1841. stack1 = lambda(depth0, depth0);
  1842. if (stack1 != null) { buffer += stack1; }
  1843. return buffer + "</option>\n";
  1844. },"4":function(depth0,helpers,partials,data) {
  1845. return " <option value=\"application/json\">application/json</option>\n";
  1846. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  1847. var stack1, buffer = "<label for=\"parameterContentType\"></label>\n<select name=\"parameterContentType\">\n";
  1848. 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});
  1849. if (stack1 != null) { buffer += stack1; }
  1850. return buffer + "</select>\n";
  1851. },"useData":true});
  1852. var ResponseContentTypeView,
  1853. __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; },
  1854. __hasProp = {}.hasOwnProperty;
  1855. ResponseContentTypeView = (function(_super) {
  1856. __extends(ResponseContentTypeView, _super);
  1857. function ResponseContentTypeView() {
  1858. return ResponseContentTypeView.__super__.constructor.apply(this, arguments);
  1859. }
  1860. ResponseContentTypeView.prototype.initialize = function() {};
  1861. ResponseContentTypeView.prototype.render = function() {
  1862. var template;
  1863. template = this.template();
  1864. $(this.el).html(template(this.model));
  1865. $('label[for=responseContentType]', $(this.el)).text('Response Content Type');
  1866. return this;
  1867. };
  1868. ResponseContentTypeView.prototype.template = function() {
  1869. return Handlebars.templates.response_content_type;
  1870. };
  1871. return ResponseContentTypeView;
  1872. })(Backbone.View);
  1873. this["Handlebars"]["templates"]["resource"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  1874. return " : ";
  1875. },"3":function(depth0,helpers,partials,data) {
  1876. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  1877. return "<li>\n <a href='"
  1878. + 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)))
  1879. + "'>Raw</a>\n </li>";
  1880. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  1881. var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "<div class='heading'>\n <h2>\n <a href='#!/"
  1882. + 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)))
  1883. + "' class=\"toggleEndpointList\" data-id=\""
  1884. + 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)))
  1885. + "\">"
  1886. + 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)))
  1887. + "</a> ";
  1888. 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));
  1889. if (!helpers.summary) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  1890. if (stack1 != null) { buffer += stack1; }
  1891. 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));
  1892. if (stack1 != null) { buffer += stack1; }
  1893. buffer += "\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/"
  1894. + 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)))
  1895. + "' id='endpointListTogger_"
  1896. + 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)))
  1897. + "' class=\"toggleEndpointList\" data-id=\""
  1898. + 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)))
  1899. + "\">Show/Hide</a>\n </li>\n <li>\n <a href='#' class=\"collapseResource\" data-id=\""
  1900. + 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)))
  1901. + "\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' class=\"expandResource\" data-id=\""
  1902. + 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)))
  1903. + "\">\n Expand Operations\n </a>\n </li>\n ";
  1904. 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));
  1905. if (!helpers.url) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  1906. if (stack1 != null) { buffer += stack1; }
  1907. return buffer + "\n </ul>\n</div>\n<ul class='endpoints' id='"
  1908. + 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)))
  1909. + "_endpoint_list' style='display:none'>\n\n</ul>\n";
  1910. },"useData":true});
  1911. var SignatureView,
  1912. __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; },
  1913. __hasProp = {}.hasOwnProperty;
  1914. SignatureView = (function(_super) {
  1915. __extends(SignatureView, _super);
  1916. function SignatureView() {
  1917. return SignatureView.__super__.constructor.apply(this, arguments);
  1918. }
  1919. SignatureView.prototype.events = {
  1920. 'click a.description-link': 'switchToDescription',
  1921. 'click a.snippet-link': 'switchToSnippet',
  1922. 'mousedown .snippet': 'snippetToTextArea'
  1923. };
  1924. SignatureView.prototype.initialize = function() {};
  1925. SignatureView.prototype.render = function() {
  1926. var template;
  1927. template = this.template();
  1928. $(this.el).html(template(this.model));
  1929. this.switchToSnippet();
  1930. this.isParam = this.model.isParam;
  1931. if (this.isParam) {
  1932. $('.notice', $(this.el)).text('Click to set as parameter value');
  1933. }
  1934. return this;
  1935. };
  1936. SignatureView.prototype.template = function() {
  1937. return Handlebars.templates.signature;
  1938. };
  1939. SignatureView.prototype.switchToDescription = function(e) {
  1940. if (e != null) {
  1941. e.preventDefault();
  1942. }
  1943. $(".snippet", $(this.el)).hide();
  1944. $(".description", $(this.el)).show();
  1945. $('.description-link', $(this.el)).addClass('selected');
  1946. return $('.snippet-link', $(this.el)).removeClass('selected');
  1947. };
  1948. SignatureView.prototype.switchToSnippet = function(e) {
  1949. if (e != null) {
  1950. e.preventDefault();
  1951. }
  1952. $(".description", $(this.el)).hide();
  1953. $(".snippet", $(this.el)).show();
  1954. $('.snippet-link', $(this.el)).addClass('selected');
  1955. return $('.description-link', $(this.el)).removeClass('selected');
  1956. };
  1957. SignatureView.prototype.snippetToTextArea = function(e) {
  1958. var textArea;
  1959. if (this.isParam) {
  1960. if (e != null) {
  1961. e.preventDefault();
  1962. }
  1963. textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
  1964. if ($.trim(textArea.val()) === '') {
  1965. return textArea.val(this.model.sampleJSON);
  1966. }
  1967. }
  1968. };
  1969. return SignatureView;
  1970. })(Backbone.View);
  1971. this["Handlebars"]["templates"]["response_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  1972. var stack1, buffer = "";
  1973. stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
  1974. if (stack1 != null) { buffer += stack1; }
  1975. return buffer;
  1976. },"2":function(depth0,helpers,partials,data) {
  1977. var stack1, lambda=this.lambda, buffer = " <option value=\"";
  1978. stack1 = lambda(depth0, depth0);
  1979. if (stack1 != null) { buffer += stack1; }
  1980. buffer += "\">";
  1981. stack1 = lambda(depth0, depth0);
  1982. if (stack1 != null) { buffer += stack1; }
  1983. return buffer + "</option>\n";
  1984. },"4":function(depth0,helpers,partials,data) {
  1985. return " <option value=\"application/json\">application/json</option>\n";
  1986. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  1987. var stack1, buffer = "<label for=\"responseContentType\"></label>\n<select name=\"responseContentType\">\n";
  1988. 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});
  1989. if (stack1 != null) { buffer += stack1; }
  1990. return buffer + "</select>\n";
  1991. },"useData":true});
  1992. var StatusCodeView,
  1993. __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; },
  1994. __hasProp = {}.hasOwnProperty;
  1995. StatusCodeView = (function(_super) {
  1996. __extends(StatusCodeView, _super);
  1997. function StatusCodeView() {
  1998. return StatusCodeView.__super__.constructor.apply(this, arguments);
  1999. }
  2000. StatusCodeView.prototype.initialize = function() {};
  2001. StatusCodeView.prototype.render = function() {
  2002. var responseModel, responseModelView, template;
  2003. template = this.template();
  2004. $(this.el).html(template(this.model));
  2005. if (swaggerUi.api.models.hasOwnProperty(this.model.responseModel)) {
  2006. responseModel = {
  2007. sampleJSON: JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(), null, 2),
  2008. isParam: false,
  2009. signature: swaggerUi.api.models[this.model.responseModel].getMockSignature()
  2010. };
  2011. responseModelView = new SignatureView({
  2012. model: responseModel,
  2013. tagName: 'div'
  2014. });
  2015. $('.model-signature', this.$el).append(responseModelView.render().el);
  2016. } else {
  2017. $('.model-signature', this.$el).html('');
  2018. }
  2019. return this;
  2020. };
  2021. StatusCodeView.prototype.template = function() {
  2022. return Handlebars.templates.status_code;
  2023. };
  2024. return StatusCodeView;
  2025. })(Backbone.View);
  2026. this["Handlebars"]["templates"]["signature"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  2027. 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 ";
  2028. 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));
  2029. if (stack1 != null) { buffer += stack1; }
  2030. return buffer + "\n </div>\n\n <div class=\"snippet\">\n <pre><code>"
  2031. + 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)))
  2032. + "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
  2033. },"useData":true});
  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});