swagger-ui.js 80 KB

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