grape-swagger-rails 0.0.8 → 0.0.10

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