swaggard 0.0.4 → 0.1.0

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