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