swagui 0.0.1

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