5 // Helper function for vertically aligning DOM elements
6 // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
7 $.fn
.vAlign = function() {
8 return this.each(function(i
){
9 var ah
= $(this).height();
10 var ph
= $(this).parent().height();
11 var mh
= (ph
- ah
) / 2;
12 $(this).css('margin-top', mh
);
16 $.fn
.stretchFormtasticInputWidthToParent = function() {
17 return this.each(function(i
){
18 var p_width
= $(this).closest("form").innerWidth();
19 var p_padding
= parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10);
20 var this_padding
= parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
21 $(this).css('width', p_width
- p_padding
- this_padding
);
25 $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
27 // Vertically center these paragraphs
28 // Parent may need a min-height for this to work..
29 $('ul.downplayed li div.content p').vAlign();
31 // When a sandbox form is submitted..
32 $("form.sandbox").submit(function(){
34 var error_free
= true;
36 // Cycle through the forms required inputs
37 $(this).find("input.required").each(function() {
39 // Remove any existing error styles from the input
40 $(this).removeClass('error');
42 // Tack the error style on if the input is empty..
43 if ($(this).val() == '') {
44 $(this).addClass('error');
56 function clippyCopiedCallback(a
) {
57 $('#api_key_copied').fadeIn().delay(1000).fadeOut();
59 // var b = $("#clippy_tooltip_" + a);
60 // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
61 // b.attr("title", "copy to clipboard")
66 // Logging function that accounts for browsers that don't have window.console
68 log
.history
= log
.history
|| [];
69 log
.history
.push(arguments
);
71 console
.log( Array
.prototype.slice
.call(arguments
) );
75 // Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
76 if (Function
.prototype.bind
&& console
&& typeof console
.log
== "object") {
78 "log","info","warn","error","assert","dir","clear","profile","profileEnd"
79 ].forEach(function (method
) {
80 console
[method
] = this.bind(console
[method
], console
);
81 }, Function
.prototype.call
);
88 // If shebang has an operation nickname in it..
89 // e.g. /docs/#!/words/get_search
90 var fragments
= $.param
.fragment().split('/');
91 fragments
.shift(); // get rid of the bang
93 switch (fragments
.length
) {
95 // Expand all operations for the resource and scroll to it
96 log('shebang resource:' + fragments
[0]);
97 var dom_id
= 'resource_' + fragments
[0];
99 Docs
.expandEndpointListForResource(fragments
[0]);
100 $("#"+dom_id
).slideto({highlight
: false});
103 // Refer to the endpoint DOM element, e.g. #words_get_search
104 log('shebang endpoint: ' + fragments
.join('_'));
107 Docs
.expandEndpointListForResource(fragments
[0]);
108 $("#"+dom_id
).slideto({highlight
: false});
111 var li_dom_id
= fragments
.join('_');
112 var li_content_dom_id
= li_dom_id
+ "_content";
114 log("li_dom_id " + li_dom_id
);
115 log("li_content_dom_id " + li_content_dom_id
);
117 Docs
.expandOperation($('#'+li_content_dom_id
));
118 $('#'+li_dom_id
).slideto({highlight
: false});
124 toggleEndpointListForResource: function(resource
) {
125 var elem
= $('li#resource_' + Docs
.escapeResourceName(resource
) + ' ul.endpoints');
126 if (elem
.is(':visible')) {
127 Docs
.collapseEndpointListForResource(resource
);
129 Docs
.expandEndpointListForResource(resource
);
134 expandEndpointListForResource: function(resource
) {
135 var resource
= Docs
.escapeResourceName(resource
);
136 if (resource
== '') {
137 $('.resource ul.endpoints').slideDown();
141 $('li#resource_' + resource
).addClass('active');
143 var elem
= $('li#resource_' + resource
+ ' ul.endpoints');
147 // Collapse resource and mark as explicitly closed
148 collapseEndpointListForResource: function(resource
) {
149 var resource
= Docs
.escapeResourceName(resource
);
150 $('li#resource_' + resource
).removeClass('active');
152 var elem
= $('li#resource_' + resource
+ ' ul.endpoints');
156 expandOperationsForResource: function(resource
) {
157 // Make sure the resource container is open..
158 Docs
.expandEndpointListForResource(resource
);
160 if (resource
== '') {
161 $('.resource ul.endpoints li.operation div.content').slideDown();
165 $('li#resource_' + Docs
.escapeResourceName(resource
) + ' li.operation div.content').each(function() {
166 Docs
.expandOperation($(this));
170 collapseOperationsForResource: function(resource
) {
171 // Make sure the resource container is open..
172 Docs
.expandEndpointListForResource(resource
);
174 $('li#resource_' + Docs
.escapeResourceName(resource
) + ' li.operation div.content').each(function() {
175 Docs
.collapseOperation($(this));
179 escapeResourceName: function(resource
) {
180 return resource
.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
183 expandOperation: function(elem
) {
187 collapseOperation: function(elem
) {
191 var template
= Handlebars
.template
, templates
= Handlebars
.templates
= Handlebars
.templates
|| {};
192 templates
['content_type'] = template(function (Handlebars
,depth0
,helpers
,partials
,data
) {
193 this.compilerInfo
= [4,'>= 1.0.0'];
194 helpers
= this.merge(helpers
, Handlebars
.helpers
); data
= data
|| {};
195 var buffer
= "", stack1
, functionType
="function", self
=this;
197 function program1(depth0
,data
) {
199 var buffer
= "", stack1
;
201 stack1
= helpers
.each
.call(depth0
, depth0
.produces
, {hash
:{},inverse
:self
.noop
,fn
:self
.program(2, program2
, data
),data
:data
});
202 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
206 function program2(depth0
,data
) {
208 var buffer
= "", stack1
;
209 buffer
+= "\n <option value=\"";
210 stack1
= (typeof depth0
=== functionType
? depth0
.apply(depth0
) : depth0
);
211 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
213 stack1
= (typeof depth0
=== functionType
? depth0
.apply(depth0
) : depth0
);
214 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
215 buffer
+= "</option>\n ";
219 function program4(depth0
,data
) {
222 return "\n <option value=\"application/json\">application/json</option>\n";
225 buffer
+= "<label for=\"contentType\"></label>\n<select name=\"contentType\">\n";
226 stack1
= helpers
['if'].call(depth0
, depth0
.produces
, {hash
:{},inverse
:self
.program(4, program4
, data
),fn
:self
.program(1, program1
, data
),data
:data
});
227 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
228 buffer
+= "\n</select>\n";
234 var template
= Handlebars
.template
, templates
= Handlebars
.templates
= Handlebars
.templates
|| {};
235 templates
['main'] = template(function (Handlebars
,depth0
,helpers
,partials
,data
) {
236 this.compilerInfo
= [4,'>= 1.0.0'];
237 helpers
= this.merge(helpers
, Handlebars
.helpers
); data
= data
|| {};
238 var buffer
= "", stack1
, functionType
="function", escapeExpression
=this.escapeExpression
, self
=this;
240 function program1(depth0
,data
) {
242 var buffer
= "", stack1
, stack2
;
243 buffer
+= "\n <div class=\"info_title\">"
244 + escapeExpression(((stack1
= ((stack1
= depth0
.info
),stack1
== null || stack1
=== false ? stack1
: stack1
.title
)),typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
))
245 + "</div>\n <div class=\"info_description\">";
246 stack2
= ((stack1
= ((stack1
= depth0
.info
),stack1
== null || stack1
=== false ? stack1
: stack1
.description
)),typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
);
247 if(stack2
|| stack2
=== 0) { buffer
+= stack2
; }
248 buffer
+= "</div>\n ";
249 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
});
250 if(stack2
|| stack2
=== 0) { buffer
+= stack2
; }
252 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
});
253 if(stack2
|| stack2
=== 0) { buffer
+= stack2
; }
255 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
});
256 if(stack2
|| stack2
=== 0) { buffer
+= stack2
; }
260 function program2(depth0
,data
) {
262 var buffer
= "", stack1
;
263 buffer
+= "<div class=\"info_tos\"><a href=\""
264 + escapeExpression(((stack1
= ((stack1
= depth0
.info
),stack1
== null || stack1
=== false ? stack1
: stack1
.termsOfServiceUrl
)),typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
))
265 + "\">Terms of service</a></div>";
269 function program4(depth0
,data
) {
271 var buffer
= "", stack1
;
272 buffer
+= "<div class='info_contact'><a href=\"mailto:"
273 + escapeExpression(((stack1
= ((stack1
= depth0
.info
),stack1
== null || stack1
=== false ? stack1
: stack1
.contact
)),typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
))
274 + "\">Contact the developer</a></div>";
278 function program6(depth0
,data
) {
280 var buffer
= "", stack1
;
281 buffer
+= "<div class='info_license'><a href='"
282 + escapeExpression(((stack1
= ((stack1
= depth0
.info
),stack1
== null || stack1
=== false ? stack1
: stack1
.licenseUrl
)),typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
))
284 + escapeExpression(((stack1
= ((stack1
= depth0
.info
),stack1
== null || stack1
=== false ? stack1
: stack1
.license
)),typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
))
289 function program8(depth0
,data
) {
291 var buffer
= "", stack1
;
292 buffer
+= "\n , <span style=\"font-variant: small-caps\">api version</span>: ";
293 if (stack1
= helpers
.apiVersion
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
294 else { stack1
= depth0
.apiVersion
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
295 buffer
+= escapeExpression(stack1
)
300 buffer
+= "<div class='info' id='api_info'>\n ";
301 stack1
= helpers
['if'].call(depth0
, depth0
.info
, {hash
:{},inverse
:self
.noop
,fn
:self
.program(1, program1
, data
),data
:data
});
302 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
303 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>: ";
304 if (stack1
= helpers
.basePath
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
305 else { stack1
= depth0
.basePath
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
306 buffer
+= escapeExpression(stack1
)
308 stack1
= helpers
['if'].call(depth0
, depth0
.apiVersion
, {hash
:{},inverse
:self
.noop
,fn
:self
.program(8, program8
, data
),data
:data
});
309 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
310 buffer
+= "]</h4>\n </div>\n</div>\n";
316 var template
= Handlebars
.template
, templates
= Handlebars
.templates
= Handlebars
.templates
|| {};
317 templates
['operation'] = template(function (Handlebars
,depth0
,helpers
,partials
,data
) {
318 this.compilerInfo
= [4,'>= 1.0.0'];
319 helpers
= this.merge(helpers
, Handlebars
.helpers
); data
= data
|| {};
320 var buffer
= "", stack1
, options
, functionType
="function", escapeExpression
=this.escapeExpression
, self
=this, blockHelperMissing
=helpers
.blockHelperMissing
;
322 function program1(depth0
,data
) {
324 var buffer
= "", stack1
;
325 buffer
+= "\n <h4>Implementation Notes</h4>\n <p>";
326 if (stack1
= helpers
.notes
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
327 else { stack1
= depth0
.notes
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
328 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
333 function program3(depth0
,data
) {
336 return "\n <div class=\"auth\">\n <span class=\"api-ic ic-error\"></span>";
339 function program5(depth0
,data
) {
341 var buffer
= "", stack1
;
342 buffer
+= "\n <div id=\"api_information_panel\" style=\"top: 526px; left: 776px; display: none;\">\n ";
343 stack1
= helpers
.each
.call(depth0
, depth0
, {hash
:{},inverse
:self
.noop
,fn
:self
.program(6, program6
, data
),data
:data
});
344 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
345 buffer
+= "\n </div>\n ";
348 function program6(depth0
,data
) {
350 var buffer
= "", stack1
, stack2
;
351 buffer
+= "\n <div title='";
352 stack2
= ((stack1
= depth0
.description
),typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
);
353 if(stack2
|| stack2
=== 0) { buffer
+= stack2
; }
355 + escapeExpression(((stack1
= depth0
.scope
),typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
))
360 function program8(depth0
,data
) {
366 function program10(depth0
,data
) {
369 return "\n <div class='access'>\n <span class=\"api-ic ic-off\" title=\"click to authenticate\"></span>\n </div>\n ";
372 function program12(depth0
,data
) {
375 return "\n <h4>Response Class</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n ";
378 function program14(depth0
,data
) {
381 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 ";
384 function program16(depth0
,data
) {
387 return "\n <div style='margin:0;padding:0;display:inline'></div>\n <h4>Response Messages</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n <th>Response Model</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n ";
390 function program18(depth0
,data
) {
396 function program20(depth0
,data
) {
399 return "\n <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n <img alt='Throbber' class='response_throbber' src='images/throbber.gif' style='display:none' />\n </div>\n ";
402 buffer
+= "\n <ul class='operations' >\n <li class='";
403 if (stack1
= helpers
.method
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
404 else { stack1
= depth0
.method
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
405 buffer
+= escapeExpression(stack1
)
406 + " operation' id='";
407 if (stack1
= helpers
.parentId
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
408 else { stack1
= depth0
.parentId
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
409 buffer
+= escapeExpression(stack1
)
411 if (stack1
= helpers
.nickname
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
412 else { stack1
= depth0
.nickname
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
413 buffer
+= escapeExpression(stack1
)
414 + "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/";
415 if (stack1
= helpers
.parentId
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
416 else { stack1
= depth0
.parentId
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
417 buffer
+= escapeExpression(stack1
)
419 if (stack1
= helpers
.nickname
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
420 else { stack1
= depth0
.nickname
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
421 buffer
+= escapeExpression(stack1
)
422 + "' class=\"toggleOperation\">";
423 if (stack1
= helpers
.method
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
424 else { stack1
= depth0
.method
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
425 buffer
+= escapeExpression(stack1
)
426 + "</a>\n </span>\n <span class='path'>\n <a href='#!/";
427 if (stack1
= helpers
.parentId
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
428 else { stack1
= depth0
.parentId
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
429 buffer
+= escapeExpression(stack1
)
431 if (stack1
= helpers
.nickname
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
432 else { stack1
= depth0
.nickname
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
433 buffer
+= escapeExpression(stack1
)
434 + "' class=\"toggleOperation\">";
435 if (stack1
= helpers
.path
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
436 else { stack1
= depth0
.path
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
437 buffer
+= escapeExpression(stack1
)
438 + "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/";
439 if (stack1
= helpers
.parentId
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
440 else { stack1
= depth0
.parentId
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
441 buffer
+= escapeExpression(stack1
)
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 + "' class=\"toggleOperation\">";
447 if (stack1
= helpers
.summary
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
448 else { stack1
= depth0
.summary
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
449 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
450 buffer
+= "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='";
451 if (stack1
= helpers
.parentId
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
452 else { stack1
= depth0
.parentId
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
453 buffer
+= escapeExpression(stack1
)
455 if (stack1
= helpers
.nickname
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
456 else { stack1
= depth0
.nickname
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
457 buffer
+= escapeExpression(stack1
)
458 + "_content' style='display:none'>\n ";
459 stack1
= helpers
['if'].call(depth0
, depth0
.notes
, {hash
:{},inverse
:self
.noop
,fn
:self
.program(1, program1
, data
),data
:data
});
460 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
462 options
= {hash
:{},inverse
:self
.noop
,fn
:self
.program(3, program3
, data
),data
:data
};
463 if (stack1
= helpers
.oauth
) { stack1
= stack1
.call(depth0
, options
); }
464 else { stack1
= depth0
.oauth
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
465 if (!helpers
.oauth
) { stack1
= blockHelperMissing
.call(depth0
, stack1
, options
); }
466 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
468 stack1
= helpers
.each
.call(depth0
, depth0
.oauth
, {hash
:{},inverse
:self
.noop
,fn
:self
.program(5, program5
, data
),data
:data
});
469 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
471 options
= {hash
:{},inverse
:self
.noop
,fn
:self
.program(8, program8
, data
),data
:data
};
472 if (stack1
= helpers
.oauth
) { stack1
= stack1
.call(depth0
, options
); }
473 else { stack1
= depth0
.oauth
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
474 if (!helpers
.oauth
) { stack1
= blockHelperMissing
.call(depth0
, stack1
, options
); }
475 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
477 options
= {hash
:{},inverse
:self
.noop
,fn
:self
.program(10, program10
, data
),data
:data
};
478 if (stack1
= helpers
.oauth
) { stack1
= stack1
.call(depth0
, options
); }
479 else { stack1
= depth0
.oauth
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
480 if (!helpers
.oauth
) { stack1
= blockHelperMissing
.call(depth0
, stack1
, options
); }
481 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
483 stack1
= helpers
['if'].call(depth0
, depth0
.type
, {hash
:{},inverse
:self
.noop
,fn
:self
.program(12, program12
, data
),data
:data
});
484 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
485 buffer
+= "\n <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n ";
486 stack1
= helpers
['if'].call(depth0
, depth0
.parameters
, {hash
:{},inverse
:self
.noop
,fn
:self
.program(14, program14
, data
),data
:data
});
487 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
489 stack1
= helpers
['if'].call(depth0
, depth0
.responseMessages
, {hash
:{},inverse
:self
.noop
,fn
:self
.program(16, program16
, data
),data
:data
});
490 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
492 stack1
= helpers
['if'].call(depth0
, depth0
.isReadOnly
, {hash
:{},inverse
:self
.program(20, program20
, data
),fn
:self
.program(18, program18
, data
),data
:data
});
493 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
494 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";
500 var template
= Handlebars
.template
, templates
= Handlebars
.templates
= Handlebars
.templates
|| {};
501 templates
['param'] = template(function (Handlebars
,depth0
,helpers
,partials
,data
) {
502 this.compilerInfo
= [4,'>= 1.0.0'];
503 helpers
= this.merge(helpers
, Handlebars
.helpers
); data
= data
|| {};
504 var buffer
= "", stack1
, functionType
="function", escapeExpression
=this.escapeExpression
, self
=this;
506 function program1(depth0
,data
) {
508 var buffer
= "", stack1
;
510 stack1
= helpers
['if'].call(depth0
, depth0
.isFile
, {hash
:{},inverse
:self
.program(4, program4
, data
),fn
:self
.program(2, program2
, data
),data
:data
});
511 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
515 function program2(depth0
,data
) {
517 var buffer
= "", stack1
;
518 buffer
+= "\n <input type=\"file\" name='";
519 if (stack1
= helpers
.name
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
520 else { stack1
= depth0
.name
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
521 buffer
+= escapeExpression(stack1
)
522 + "'/>\n <div class=\"parameter-content-type\" />\n ";
526 function program4(depth0
,data
) {
528 var buffer
= "", stack1
;
530 stack1
= helpers
['if'].call(depth0
, depth0
.defaultValue
, {hash
:{},inverse
:self
.program(7, program7
, data
),fn
:self
.program(5, program5
, data
),data
:data
});
531 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
535 function program5(depth0
,data
) {
537 var buffer
= "", stack1
;
538 buffer
+= "\n <textarea class='body-textarea' name='";
539 if (stack1
= helpers
.name
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
540 else { stack1
= depth0
.name
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
541 buffer
+= escapeExpression(stack1
)
543 if (stack1
= helpers
.defaultValue
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
544 else { stack1
= depth0
.defaultValue
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
545 buffer
+= escapeExpression(stack1
)
550 function program7(depth0
,data
) {
552 var buffer
= "", stack1
;
553 buffer
+= "\n <textarea class='body-textarea' name='";
554 if (stack1
= helpers
.name
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
555 else { stack1
= depth0
.name
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
556 buffer
+= escapeExpression(stack1
)
557 + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n ";
561 function program9(depth0
,data
) {
563 var buffer
= "", stack1
;
565 stack1
= helpers
['if'].call(depth0
, depth0
.defaultValue
, {hash
:{},inverse
:self
.program(12, program12
, data
),fn
:self
.program(10, program10
, data
),data
:data
});
566 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
570 function program10(depth0
,data
) {
572 var buffer
= "", stack1
;
573 buffer
+= "\n <input class='parameter' minlength='0' name='";
574 if (stack1
= helpers
.name
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
575 else { stack1
= depth0
.name
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
576 buffer
+= escapeExpression(stack1
)
577 + "' placeholder='' type='text' value='";
578 if (stack1
= helpers
.defaultValue
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
579 else { stack1
= depth0
.defaultValue
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
580 buffer
+= escapeExpression(stack1
)
585 function program12(depth0
,data
) {
587 var buffer
= "", stack1
;
588 buffer
+= "\n <input class='parameter' minlength='0' name='";
589 if (stack1
= helpers
.name
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
590 else { stack1
= depth0
.name
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
591 buffer
+= escapeExpression(stack1
)
592 + "' placeholder='' type='text' value=''/>\n ";
596 buffer
+= "<td class='code'>";
597 if (stack1
= helpers
.name
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
598 else { stack1
= depth0
.name
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
599 buffer
+= escapeExpression(stack1
)
600 + "</td>\n<td>\n\n ";
601 stack1
= helpers
['if'].call(depth0
, depth0
.isBody
, {hash
:{},inverse
:self
.program(9, program9
, data
),fn
:self
.program(1, program1
, data
),data
:data
});
602 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
603 buffer
+= "\n\n</td>\n<td>";
604 if (stack1
= helpers
.description
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
605 else { stack1
= depth0
.description
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
606 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
607 buffer
+= "</td>\n<td>";
608 if (stack1
= helpers
.paramType
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
609 else { stack1
= depth0
.paramType
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
610 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
611 buffer
+= "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n";
617 var template
= Handlebars
.template
, templates
= Handlebars
.templates
= Handlebars
.templates
|| {};
618 templates
['param_list'] = template(function (Handlebars
,depth0
,helpers
,partials
,data
) {
619 this.compilerInfo
= [4,'>= 1.0.0'];
620 helpers
= this.merge(helpers
, Handlebars
.helpers
); data
= data
|| {};
621 var buffer
= "", stack1
, stack2
, options
, self
=this, helperMissing
=helpers
.helperMissing
, functionType
="function", escapeExpression
=this.escapeExpression
;
623 function program1(depth0
,data
) {
626 return " multiple='multiple'";
629 function program3(depth0
,data
) {
635 function program5(depth0
,data
) {
637 var buffer
= "", stack1
;
639 stack1
= helpers
['if'].call(depth0
, depth0
.defaultValue
, {hash
:{},inverse
:self
.program(8, program8
, data
),fn
:self
.program(6, program6
, data
),data
:data
});
640 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
644 function program6(depth0
,data
) {
650 function program8(depth0
,data
) {
652 var buffer
= "", stack1
, stack2
, options
;
654 options
= {hash
:{},inverse
:self
.program(11, program11
, data
),fn
:self
.program(9, program9
, data
),data
:data
};
655 stack2
= ((stack1
= helpers
.isArray
|| depth0
.isArray
),stack1
? stack1
.call(depth0
, depth0
, options
) : helperMissing
.call(depth0
, "isArray", depth0
, options
));
656 if(stack2
|| stack2
=== 0) { buffer
+= stack2
; }
660 function program9(depth0
,data
) {
666 function program11(depth0
,data
) {
669 return "\n <option selected=\"\" value=''></option>\n ";
672 function program13(depth0
,data
) {
674 var buffer
= "", stack1
;
676 stack1
= helpers
['if'].call(depth0
, depth0
.isDefault
, {hash
:{},inverse
:self
.program(16, program16
, data
),fn
:self
.program(14, program14
, data
),data
:data
});
677 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
681 function program14(depth0
,data
) {
683 var buffer
= "", stack1
;
684 buffer
+= "\n <option selected=\"\" value='";
685 if (stack1
= helpers
.value
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
686 else { stack1
= depth0
.value
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
687 buffer
+= escapeExpression(stack1
)
689 if (stack1
= helpers
.value
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
690 else { stack1
= depth0
.value
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
691 buffer
+= escapeExpression(stack1
)
692 + " (default)</option>\n ";
696 function program16(depth0
,data
) {
698 var buffer
= "", stack1
;
699 buffer
+= "\n <option value='";
700 if (stack1
= helpers
.value
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
701 else { stack1
= depth0
.value
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
702 buffer
+= escapeExpression(stack1
)
704 if (stack1
= helpers
.value
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
705 else { stack1
= depth0
.value
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
706 buffer
+= escapeExpression(stack1
)
711 buffer
+= "<td class='code'>";
712 if (stack1
= helpers
.name
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
713 else { stack1
= depth0
.name
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
714 buffer
+= escapeExpression(stack1
)
715 + "</td>\n<td>\n <select ";
716 options
= {hash
:{},inverse
:self
.noop
,fn
:self
.program(1, program1
, data
),data
:data
};
717 stack2
= ((stack1
= helpers
.isArray
|| depth0
.isArray
),stack1
? stack1
.call(depth0
, depth0
, options
) : helperMissing
.call(depth0
, "isArray", depth0
, options
));
718 if(stack2
|| stack2
=== 0) { buffer
+= stack2
; }
719 buffer
+= " class='parameter' name='";
720 if (stack2
= helpers
.name
) { stack2
= stack2
.call(depth0
, {hash
:{},data
:data
}); }
721 else { stack2
= depth0
.name
; stack2
= typeof stack2
=== functionType
? stack2
.apply(depth0
) : stack2
; }
722 buffer
+= escapeExpression(stack2
)
724 stack2
= helpers
['if'].call(depth0
, depth0
.required
, {hash
:{},inverse
:self
.program(5, program5
, data
),fn
:self
.program(3, program3
, data
),data
:data
});
725 if(stack2
|| stack2
=== 0) { buffer
+= stack2
; }
727 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
});
728 if(stack2
|| stack2
=== 0) { buffer
+= stack2
; }
729 buffer
+= "\n </select>\n</td>\n<td>";
730 if (stack2
= helpers
.description
) { stack2
= stack2
.call(depth0
, {hash
:{},data
:data
}); }
731 else { stack2
= depth0
.description
; stack2
= typeof stack2
=== functionType
? stack2
.apply(depth0
) : stack2
; }
732 if(stack2
|| stack2
=== 0) { buffer
+= stack2
; }
733 buffer
+= "</td>\n<td>";
734 if (stack2
= helpers
.paramType
) { stack2
= stack2
.call(depth0
, {hash
:{},data
:data
}); }
735 else { stack2
= depth0
.paramType
; stack2
= typeof stack2
=== functionType
? stack2
.apply(depth0
) : stack2
; }
736 if(stack2
|| stack2
=== 0) { buffer
+= stack2
; }
737 buffer
+= "</td>\n<td><span class=\"model-signature\"></span></td>";
743 var template
= Handlebars
.template
, templates
= Handlebars
.templates
= Handlebars
.templates
|| {};
744 templates
['param_readonly'] = template(function (Handlebars
,depth0
,helpers
,partials
,data
) {
745 this.compilerInfo
= [4,'>= 1.0.0'];
746 helpers
= this.merge(helpers
, Handlebars
.helpers
); data
= data
|| {};
747 var buffer
= "", stack1
, functionType
="function", escapeExpression
=this.escapeExpression
, self
=this;
749 function program1(depth0
,data
) {
751 var buffer
= "", stack1
;
752 buffer
+= "\n <textarea class='body-textarea' readonly='readonly' name='";
753 if (stack1
= helpers
.name
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
754 else { stack1
= depth0
.name
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
755 buffer
+= escapeExpression(stack1
)
757 if (stack1
= helpers
.defaultValue
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
758 else { stack1
= depth0
.defaultValue
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
759 buffer
+= escapeExpression(stack1
)
764 function program3(depth0
,data
) {
766 var buffer
= "", stack1
;
768 stack1
= helpers
['if'].call(depth0
, depth0
.defaultValue
, {hash
:{},inverse
:self
.program(6, program6
, data
),fn
:self
.program(4, program4
, data
),data
:data
});
769 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
773 function program4(depth0
,data
) {
775 var buffer
= "", stack1
;
777 if (stack1
= helpers
.defaultValue
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
778 else { stack1
= depth0
.defaultValue
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
779 buffer
+= escapeExpression(stack1
)
784 function program6(depth0
,data
) {
787 return "\n (empty)\n ";
790 buffer
+= "<td class='code'>";
791 if (stack1
= helpers
.name
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
792 else { stack1
= depth0
.name
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
793 buffer
+= escapeExpression(stack1
)
795 stack1
= helpers
['if'].call(depth0
, depth0
.isBody
, {hash
:{},inverse
:self
.program(3, program3
, data
),fn
:self
.program(1, program1
, data
),data
:data
});
796 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
797 buffer
+= "\n</td>\n<td>";
798 if (stack1
= helpers
.description
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
799 else { stack1
= depth0
.description
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
800 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
801 buffer
+= "</td>\n<td>";
802 if (stack1
= helpers
.paramType
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
803 else { stack1
= depth0
.paramType
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
804 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
805 buffer
+= "</td>\n<td><span class=\"model-signature\"></span></td>\n";
811 var template
= Handlebars
.template
, templates
= Handlebars
.templates
= Handlebars
.templates
|| {};
812 templates
['param_readonly_required'] = template(function (Handlebars
,depth0
,helpers
,partials
,data
) {
813 this.compilerInfo
= [4,'>= 1.0.0'];
814 helpers
= this.merge(helpers
, Handlebars
.helpers
); data
= data
|| {};
815 var buffer
= "", stack1
, functionType
="function", escapeExpression
=this.escapeExpression
, self
=this;
817 function program1(depth0
,data
) {
819 var buffer
= "", stack1
;
820 buffer
+= "\n <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='";
821 if (stack1
= helpers
.name
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
822 else { stack1
= depth0
.name
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
823 buffer
+= escapeExpression(stack1
)
825 if (stack1
= helpers
.defaultValue
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
826 else { stack1
= depth0
.defaultValue
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
827 buffer
+= escapeExpression(stack1
)
832 function program3(depth0
,data
) {
834 var buffer
= "", stack1
;
836 stack1
= helpers
['if'].call(depth0
, depth0
.defaultValue
, {hash
:{},inverse
:self
.program(6, program6
, data
),fn
:self
.program(4, program4
, data
),data
:data
});
837 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
841 function program4(depth0
,data
) {
843 var buffer
= "", stack1
;
845 if (stack1
= helpers
.defaultValue
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
846 else { stack1
= depth0
.defaultValue
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
847 buffer
+= escapeExpression(stack1
)
852 function program6(depth0
,data
) {
855 return "\n (empty)\n ";
858 buffer
+= "<td class='code required'>";
859 if (stack1
= helpers
.name
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
860 else { stack1
= depth0
.name
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
861 buffer
+= escapeExpression(stack1
)
863 stack1
= helpers
['if'].call(depth0
, depth0
.isBody
, {hash
:{},inverse
:self
.program(3, program3
, data
),fn
:self
.program(1, program1
, data
),data
:data
});
864 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
865 buffer
+= "\n</td>\n<td>";
866 if (stack1
= helpers
.description
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
867 else { stack1
= depth0
.description
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
868 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
869 buffer
+= "</td>\n<td>";
870 if (stack1
= helpers
.paramType
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
871 else { stack1
= depth0
.paramType
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
872 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
873 buffer
+= "</td>\n<td><span class=\"model-signature\"></span></td>\n";
879 var template
= Handlebars
.template
, templates
= Handlebars
.templates
= Handlebars
.templates
|| {};
880 templates
['param_required'] = template(function (Handlebars
,depth0
,helpers
,partials
,data
) {
881 this.compilerInfo
= [4,'>= 1.0.0'];
882 helpers
= this.merge(helpers
, Handlebars
.helpers
); data
= data
|| {};
883 var buffer
= "", stack1
, functionType
="function", escapeExpression
=this.escapeExpression
, self
=this;
885 function program1(depth0
,data
) {
887 var buffer
= "", stack1
;
889 stack1
= helpers
['if'].call(depth0
, depth0
.isFile
, {hash
:{},inverse
:self
.program(4, program4
, data
),fn
:self
.program(2, program2
, data
),data
:data
});
890 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
894 function program2(depth0
,data
) {
896 var buffer
= "", stack1
;
897 buffer
+= "\n <input type=\"file\" name='";
898 if (stack1
= helpers
.name
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
899 else { stack1
= depth0
.name
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
900 buffer
+= escapeExpression(stack1
)
905 function program4(depth0
,data
) {
907 var buffer
= "", stack1
;
909 stack1
= helpers
['if'].call(depth0
, depth0
.defaultValue
, {hash
:{},inverse
:self
.program(7, program7
, data
),fn
:self
.program(5, program5
, data
),data
:data
});
910 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
914 function program5(depth0
,data
) {
916 var buffer
= "", stack1
;
917 buffer
+= "\n <textarea class='body-textarea' placeholder='(required)' name='";
918 if (stack1
= helpers
.name
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
919 else { stack1
= depth0
.name
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
920 buffer
+= escapeExpression(stack1
)
922 if (stack1
= helpers
.defaultValue
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
923 else { stack1
= depth0
.defaultValue
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
924 buffer
+= escapeExpression(stack1
)
929 function program7(depth0
,data
) {
931 var buffer
= "", stack1
;
932 buffer
+= "\n <textarea class='body-textarea' placeholder='(required)' name='";
933 if (stack1
= helpers
.name
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
934 else { stack1
= depth0
.name
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
935 buffer
+= escapeExpression(stack1
)
936 + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n ";
940 function program9(depth0
,data
) {
942 var buffer
= "", stack1
;
944 stack1
= helpers
['if'].call(depth0
, depth0
.isFile
, {hash
:{},inverse
:self
.program(12, program12
, data
),fn
:self
.program(10, program10
, data
),data
:data
});
945 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
949 function program10(depth0
,data
) {
951 var buffer
= "", stack1
;
952 buffer
+= "\n <input class='parameter' class='required' type='file' name='";
953 if (stack1
= helpers
.name
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
954 else { stack1
= depth0
.name
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
955 buffer
+= escapeExpression(stack1
)
960 function program12(depth0
,data
) {
962 var buffer
= "", stack1
;
964 stack1
= helpers
['if'].call(depth0
, depth0
.defaultValue
, {hash
:{},inverse
:self
.program(15, program15
, data
),fn
:self
.program(13, program13
, data
),data
:data
});
965 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
969 function program13(depth0
,data
) {
971 var buffer
= "", stack1
;
972 buffer
+= "\n <input class='parameter required' minlength='1' name='";
973 if (stack1
= helpers
.name
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
974 else { stack1
= depth0
.name
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
975 buffer
+= escapeExpression(stack1
)
976 + "' placeholder='(required)' type='text' value='";
977 if (stack1
= helpers
.defaultValue
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
978 else { stack1
= depth0
.defaultValue
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
979 buffer
+= escapeExpression(stack1
)
984 function program15(depth0
,data
) {
986 var buffer
= "", stack1
;
987 buffer
+= "\n <input class='parameter required' minlength='1' name='";
988 if (stack1
= helpers
.name
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
989 else { stack1
= depth0
.name
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
990 buffer
+= escapeExpression(stack1
)
991 + "' placeholder='(required)' type='text' value=''/>\n ";
995 buffer
+= "<td class='code required'>";
996 if (stack1
= helpers
.name
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
997 else { stack1
= depth0
.name
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
998 buffer
+= escapeExpression(stack1
)
1000 stack1
= helpers
['if'].call(depth0
, depth0
.isBody
, {hash
:{},inverse
:self
.program(9, program9
, data
),fn
:self
.program(1, program1
, data
),data
:data
});
1001 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
1002 buffer
+= "\n</td>\n<td>\n <strong>";
1003 if (stack1
= helpers
.description
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
1004 else { stack1
= depth0
.description
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
1005 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
1006 buffer
+= "</strong>\n</td>\n<td>";
1007 if (stack1
= helpers
.paramType
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
1008 else { stack1
= depth0
.paramType
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
1009 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
1010 buffer
+= "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1016 var template
= Handlebars
.template
, templates
= Handlebars
.templates
= Handlebars
.templates
|| {};
1017 templates
['parameter_content_type'] = template(function (Handlebars
,depth0
,helpers
,partials
,data
) {
1018 this.compilerInfo
= [4,'>= 1.0.0'];
1019 helpers
= this.merge(helpers
, Handlebars
.helpers
); data
= data
|| {};
1020 var buffer
= "", stack1
, functionType
="function", self
=this;
1022 function program1(depth0
,data
) {
1024 var buffer
= "", stack1
;
1026 stack1
= helpers
.each
.call(depth0
, depth0
.consumes
, {hash
:{},inverse
:self
.noop
,fn
:self
.program(2, program2
, data
),data
:data
});
1027 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
1031 function program2(depth0
,data
) {
1033 var buffer
= "", stack1
;
1034 buffer
+= "\n <option value=\"";
1035 stack1
= (typeof depth0
=== functionType
? depth0
.apply(depth0
) : depth0
);
1036 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
1038 stack1
= (typeof depth0
=== functionType
? depth0
.apply(depth0
) : depth0
);
1039 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
1040 buffer
+= "</option>\n ";
1044 function program4(depth0
,data
) {
1047 return "\n <option value=\"application/json\">application/json</option>\n";
1050 buffer
+= "<label for=\"parameterContentType\"></label>\n<select name=\"parameterContentType\">\n";
1051 stack1
= helpers
['if'].call(depth0
, depth0
.consumes
, {hash
:{},inverse
:self
.program(4, program4
, data
),fn
:self
.program(1, program1
, data
),data
:data
});
1052 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
1053 buffer
+= "\n</select>\n";
1059 var template
= Handlebars
.template
, templates
= Handlebars
.templates
= Handlebars
.templates
|| {};
1060 templates
['resource'] = template(function (Handlebars
,depth0
,helpers
,partials
,data
) {
1061 this.compilerInfo
= [4,'>= 1.0.0'];
1062 helpers
= this.merge(helpers
, Handlebars
.helpers
); data
= data
|| {};
1063 var buffer
= "", stack1
, options
, functionType
="function", escapeExpression
=this.escapeExpression
, self
=this, blockHelperMissing
=helpers
.blockHelperMissing
;
1065 function program1(depth0
,data
) {
1071 buffer
+= "<div class='heading'>\n <h2>\n <a href='#!/";
1072 if (stack1
= helpers
.id
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
1073 else { stack1
= depth0
.id
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
1074 buffer
+= escapeExpression(stack1
)
1075 + "' onclick=\"Docs.toggleEndpointListForResource('";
1076 if (stack1
= helpers
.id
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
1077 else { stack1
= depth0
.id
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
1078 buffer
+= escapeExpression(stack1
)
1080 if (stack1
= helpers
.name
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
1081 else { stack1
= depth0
.name
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
1082 buffer
+= escapeExpression(stack1
)
1084 options
= {hash
:{},inverse
:self
.noop
,fn
:self
.program(1, program1
, data
),data
:data
};
1085 if (stack1
= helpers
.description
) { stack1
= stack1
.call(depth0
, options
); }
1086 else { stack1
= depth0
.description
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
1087 if (!helpers
.description
) { stack1
= blockHelperMissing
.call(depth0
, stack1
, options
); }
1088 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
1089 if (stack1
= helpers
.description
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
1090 else { stack1
= depth0
.description
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
1091 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
1092 buffer
+= "\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/";
1093 if (stack1
= helpers
.id
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
1094 else { stack1
= depth0
.id
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
1095 buffer
+= escapeExpression(stack1
)
1096 + "' id='endpointListTogger_";
1097 if (stack1
= helpers
.id
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
1098 else { stack1
= depth0
.id
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
1099 buffer
+= escapeExpression(stack1
)
1100 + "'\n onclick=\"Docs.toggleEndpointListForResource('";
1101 if (stack1
= helpers
.id
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
1102 else { stack1
= depth0
.id
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
1103 buffer
+= escapeExpression(stack1
)
1104 + "');\">Show/Hide</a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.collapseOperationsForResource('";
1105 if (stack1
= helpers
.id
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
1106 else { stack1
= depth0
.id
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
1107 buffer
+= escapeExpression(stack1
)
1108 + "'); return false;\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.expandOperationsForResource('";
1109 if (stack1
= helpers
.id
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
1110 else { stack1
= depth0
.id
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
1111 buffer
+= escapeExpression(stack1
)
1112 + "'); return false;\">\n Expand Operations\n </a>\n </li>\n <li>\n <a href='";
1113 if (stack1
= helpers
.url
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
1114 else { stack1
= depth0
.url
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
1115 buffer
+= escapeExpression(stack1
)
1116 + "'>Raw</a>\n </li>\n </ul>\n</div>\n<ul class='endpoints' id='";
1117 if (stack1
= helpers
.id
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
1118 else { stack1
= depth0
.id
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
1119 buffer
+= escapeExpression(stack1
)
1120 + "_endpoint_list' style='display:none'>\n\n</ul>\n";
1126 var template
= Handlebars
.template
, templates
= Handlebars
.templates
= Handlebars
.templates
|| {};
1127 templates
['response_content_type'] = template(function (Handlebars
,depth0
,helpers
,partials
,data
) {
1128 this.compilerInfo
= [4,'>= 1.0.0'];
1129 helpers
= this.merge(helpers
, Handlebars
.helpers
); data
= data
|| {};
1130 var buffer
= "", stack1
, functionType
="function", self
=this;
1132 function program1(depth0
,data
) {
1134 var buffer
= "", stack1
;
1136 stack1
= helpers
.each
.call(depth0
, depth0
.produces
, {hash
:{},inverse
:self
.noop
,fn
:self
.program(2, program2
, data
),data
:data
});
1137 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
1141 function program2(depth0
,data
) {
1143 var buffer
= "", stack1
;
1144 buffer
+= "\n <option value=\"";
1145 stack1
= (typeof depth0
=== functionType
? depth0
.apply(depth0
) : depth0
);
1146 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
1148 stack1
= (typeof depth0
=== functionType
? depth0
.apply(depth0
) : depth0
);
1149 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
1150 buffer
+= "</option>\n ";
1154 function program4(depth0
,data
) {
1157 return "\n <option value=\"application/json\">application/json</option>\n";
1160 buffer
+= "<label for=\"responseContentType\"></label>\n<select name=\"responseContentType\">\n";
1161 stack1
= helpers
['if'].call(depth0
, depth0
.produces
, {hash
:{},inverse
:self
.program(4, program4
, data
),fn
:self
.program(1, program1
, data
),data
:data
});
1162 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
1163 buffer
+= "\n</select>\n";
1169 var template
= Handlebars
.template
, templates
= Handlebars
.templates
= Handlebars
.templates
|| {};
1170 templates
['signature'] = template(function (Handlebars
,depth0
,helpers
,partials
,data
) {
1171 this.compilerInfo
= [4,'>= 1.0.0'];
1172 helpers
= this.merge(helpers
, Handlebars
.helpers
); data
= data
|| {};
1173 var buffer
= "", stack1
, functionType
="function", escapeExpression
=this.escapeExpression
;
1176 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 ";
1177 if (stack1
= helpers
.signature
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
1178 else { stack1
= depth0
.signature
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
1179 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
1180 buffer
+= "\n </div>\n\n <div class=\"snippet\">\n <pre><code>";
1181 if (stack1
= helpers
.sampleJSON
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
1182 else { stack1
= depth0
.sampleJSON
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
1183 buffer
+= escapeExpression(stack1
)
1184 + "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
1190 var template
= Handlebars
.template
, templates
= Handlebars
.templates
= Handlebars
.templates
|| {};
1191 templates
['status_code'] = template(function (Handlebars
,depth0
,helpers
,partials
,data
) {
1192 this.compilerInfo
= [4,'>= 1.0.0'];
1193 helpers
= this.merge(helpers
, Handlebars
.helpers
); data
= data
|| {};
1194 var buffer
= "", stack1
, functionType
="function", escapeExpression
=this.escapeExpression
;
1197 buffer
+= "<td width='15%' class='code'>";
1198 if (stack1
= helpers
.code
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
1199 else { stack1
= depth0
.code
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
1200 buffer
+= escapeExpression(stack1
)
1202 if (stack1
= helpers
.message
) { stack1
= stack1
.call(depth0
, {hash
:{},data
:data
}); }
1203 else { stack1
= depth0
.message
; stack1
= typeof stack1
=== functionType
? stack1
.apply(depth0
) : stack1
; }
1204 if(stack1
|| stack1
=== 0) { buffer
+= stack1
; }
1205 buffer
+= "</td>\n<td width='50%'><span class=\"model-signature\" /></td>";
1212 // Generated by CoffeeScript 1.6.3
1214 var ContentTypeView
, HeaderView
, MainView
, OperationView
, ParameterContentTypeView
, ParameterView
, ResourceView
, ResponseContentTypeView
, SignatureView
, StatusCodeView
, SwaggerUi
, _ref
, _ref1
, _ref10
, _ref2
, _ref3
, _ref4
, _ref5
, _ref6
, _ref7
, _ref8
, _ref9
,
1215 __hasProp
= {}.hasOwnProperty
,
1216 __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
; };
1218 SwaggerUi
= (function(_super
) {
1219 __extends(SwaggerUi
, _super
);
1221 function SwaggerUi() {
1222 _ref
= SwaggerUi
.__super__
.constructor.apply(this, arguments
);
1226 SwaggerUi
.prototype.dom_id
= "swagger_ui";
1228 SwaggerUi
.prototype.options
= null;
1230 SwaggerUi
.prototype.api
= null;
1232 SwaggerUi
.prototype.headerView
= null;
1234 SwaggerUi
.prototype.mainView
= null;
1236 SwaggerUi
.prototype.initialize = function(options
) {
1238 if (options
== null) {
1241 if (options
.dom_id
!= null) {
1242 this.dom_id
= options
.dom_id
;
1243 delete options
.dom_id
;
1245 if ($('#' + this.dom_id
) == null) {
1246 $('body').append('<div id="' + this.dom_id
+ '"></div>');
1248 this.options
= options
;
1249 this.options
.success = function() {
1250 return _this
.render();
1252 this.options
.progress = function(d
) {
1253 return _this
.showMessage(d
);
1255 this.options
.failure = function(d
) {
1256 return _this
.onLoadFailure(d
);
1258 this.headerView
= new HeaderView({
1261 return this.headerView
.on('update-swagger-ui', function(data
) {
1262 return _this
.updateSwaggerUi(data
);
1266 SwaggerUi
.prototype.updateSwaggerUi = function(data
) {
1267 this.options
.url
= data
.url
;
1271 SwaggerUi
.prototype.load = function() {
1273 if ((_ref1
= this.mainView
) != null) {
1276 url
= this.options
.url
;
1277 if (url
.indexOf("http") !== 0) {
1278 url
= this.buildUrl(window
.location
.href
.toString(), url
);
1280 this.options
.url
= url
;
1281 this.headerView
.update(url
);
1282 this.api
= new SwaggerApi(this.options
);
1287 SwaggerUi
.prototype.render = function() {
1289 this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
1290 this.mainView
= new MainView({
1292 el
: $('#' + this.dom_id
)
1295 switch (this.options
.docExpansion
) {
1297 Docs
.expandOperationsForResource('');
1300 Docs
.collapseOperationsForResource('');
1302 if (this.options
.onComplete
) {
1303 this.options
.onComplete(this.api
, this);
1305 return setTimeout(function() {
1306 return Docs
.shebang();
1310 SwaggerUi
.prototype.buildUrl = function(base
, url
) {
1311 var endOfPath
, parts
;
1312 log("base is " + base
);
1313 if (url
.indexOf("/") === 0) {
1314 parts
= base
.split("/");
1315 base
= parts
[0] + "//" + parts
[2];
1318 endOfPath
= base
.length
;
1319 if (base
.indexOf("?") > -1) {
1320 endOfPath
= Math
.min(endOfPath
, base
.indexOf("?"));
1322 if (base
.indexOf("#") > -1) {
1323 endOfPath
= Math
.min(endOfPath
, base
.indexOf("#"));
1325 base
= base
.substring(0, endOfPath
);
1326 if (base
.indexOf("/", base
.length
- 1) !== -1) {
1329 return base
+ "/" + url
;
1333 SwaggerUi
.prototype.showMessage = function(data
) {
1337 $('#message-bar').removeClass('message-fail');
1338 $('#message-bar').addClass('message-success');
1339 return $('#message-bar').html(data
);
1342 SwaggerUi
.prototype.onLoadFailure = function(data
) {
1347 $('#message-bar').removeClass('message-success');
1348 $('#message-bar').addClass('message-fail');
1349 val
= $('#message-bar').html(data
);
1350 if (this.options
.onFailure
!= null) {
1351 this.options
.onFailure(data
);
1358 })(Backbone
.Router
);
1360 window
.SwaggerUi
= SwaggerUi
;
1362 HeaderView
= (function(_super
) {
1363 __extends(HeaderView
, _super
);
1365 function HeaderView() {
1366 _ref1
= HeaderView
.__super__
.constructor.apply(this, arguments
);
1370 HeaderView
.prototype.events
= {
1371 'click #show-pet-store-icon': 'showPetStore',
1372 'click #show-wordnik-dev-icon': 'showWordnikDev',
1373 'click #explore': 'showCustom',
1374 'keyup #input_baseUrl': 'showCustomOnKeyup',
1375 'keyup #input_apiKey': 'showCustomOnKeyup'
1378 HeaderView
.prototype.initialize = function() {};
1380 HeaderView
.prototype.showPetStore = function(e
) {
1381 return this.trigger('update-swagger-ui', {
1382 url
: "http://petstore.swagger.wordnik.com/api/api-docs"
1386 HeaderView
.prototype.showWordnikDev = function(e
) {
1387 return this.trigger('update-swagger-ui', {
1388 url
: "http://api.wordnik.com/v4/resources.json"
1392 HeaderView
.prototype.showCustomOnKeyup = function(e
) {
1393 if (e
.keyCode
=== 13) {
1394 return this.showCustom();
1398 HeaderView
.prototype.showCustom = function(e
) {
1402 return this.trigger('update-swagger-ui', {
1403 url
: $('#input_baseUrl').val(),
1404 apiKey
: $('#input_apiKey').val()
1408 HeaderView
.prototype.update = function(url
, apiKey
, trigger
) {
1409 if (trigger
== null) {
1412 $('#input_baseUrl').val(url
);
1414 return this.trigger('update-swagger-ui', {
1424 MainView
= (function(_super
) {
1425 __extends(MainView
, _super
);
1427 function MainView() {
1428 _ref2
= MainView
.__super__
.constructor.apply(this, arguments
);
1432 MainView
.prototype.initialize = function() {};
1434 MainView
.prototype.render = function() {
1435 var counter
, id
, resource
, resources
, _i
, _len
, _ref3
;
1436 $(this.el
).html(Handlebars
.templates
.main(this.model
));
1439 _ref3
= this.model
.apisArray
;
1440 for (_i
= 0, _len
= _ref3
.length
; _i
< _len
; _i
++) {
1441 resource
= _ref3
[_i
];
1443 while (typeof resources
[id
] !== 'undefined') {
1444 id
= id
+ "_" + counter
;
1448 resources
[id
] = resource
;
1449 this.addResource(resource
);
1454 MainView
.prototype.addResource = function(resource
) {
1456 resourceView
= new ResourceView({
1459 id
: 'resource_' + resource
.id
,
1460 className
: 'resource'
1462 return $('#resources').append(resourceView
.render().el
);
1465 MainView
.prototype.clear = function() {
1466 return $(this.el
).html('');
1473 ResourceView
= (function(_super
) {
1474 __extends(ResourceView
, _super
);
1476 function ResourceView() {
1477 _ref3
= ResourceView
.__super__
.constructor.apply(this, arguments
);
1481 ResourceView
.prototype.initialize = function() {};
1483 ResourceView
.prototype.render = function() {
1484 var counter
, id
, methods
, operation
, _i
, _len
, _ref4
;
1485 $(this.el
).html(Handlebars
.templates
.resource(this.model
));
1487 _ref4
= this.model
.operationsArray
;
1488 for (_i
= 0, _len
= _ref4
.length
; _i
< _len
; _i
++) {
1489 operation
= _ref4
[_i
];
1491 id
= operation
.nickname
;
1492 while (typeof methods
[id
] !== 'undefined') {
1493 id
= id
+ "_" + counter
;
1496 methods
[id
] = operation
;
1497 operation
.nickname
= id
;
1498 operation
.parentId
= this.model
.id
;
1499 this.addOperation(operation
);
1504 ResourceView
.prototype.addOperation = function(operation
) {
1506 operation
.number
= this.number
;
1507 operationView
= new OperationView({
1510 className
: 'endpoint'
1512 $('.endpoints', $(this.el
)).append(operationView
.render().el
);
1513 return this.number
++;
1516 return ResourceView
;
1520 OperationView
= (function(_super
) {
1521 __extends(OperationView
, _super
);
1523 function OperationView() {
1524 _ref4
= OperationView
.__super__
.constructor.apply(this, arguments
);
1528 OperationView
.prototype.invocationUrl
= null;
1530 OperationView
.prototype.events
= {
1531 'submit .sandbox': 'submitOperation',
1532 'click .submit': 'submitOperation',
1533 'click .response_hider': 'hideResponse',
1534 'click .toggleOperation': 'toggleOperationContent',
1535 'mouseenter .api-ic': 'mouseEnter',
1536 'mouseout .api-ic': 'mouseExit'
1539 OperationView
.prototype.initialize = function() {};
1541 OperationView
.prototype.mouseEnter = function(e
) {
1542 var elem
, hgh
, pos
, scMaxX
, scMaxY
, scX
, scY
, wd
, x
, y
;
1543 elem
= $(e
.currentTarget
.parentNode
).find('#api_information_panel');
1546 scX
= $(window
).scrollLeft();
1547 scY
= $(window
).scrollTop();
1548 scMaxX
= scX
+ $(window
).width();
1549 scMaxY
= scY
+ $(window
).height();
1551 hgh
= elem
.height();
1552 if (x
+ wd
> scMaxX
) {
1558 if (y
+ hgh
> scMaxY
) {
1568 return $(e
.currentTarget
.parentNode
).find('#api_information_panel').show();
1571 OperationView
.prototype.mouseExit = function(e
) {
1572 return $(e
.currentTarget
.parentNode
).find('#api_information_panel').hide();
1575 OperationView
.prototype.render = function() {
1576 var contentTypeModel
, isMethodSubmissionSupported
, k
, o
, param
, responseContentTypeView
, responseSignatureView
, signatureModel
, statusCode
, type
, v
, _i
, _j
, _k
, _l
, _len
, _len1
, _len2
, _len3
, _ref5
, _ref6
, _ref7
, _ref8
;
1577 isMethodSubmissionSupported
= true;
1578 if (!isMethodSubmissionSupported
) {
1579 this.model
.isReadOnly
= true;
1581 this.model
.oauth
= null;
1582 if (this.model
.authorizations
) {
1583 _ref5
= this.model
.authorizations
;
1586 if (k
=== "oauth2") {
1587 if (this.model
.oauth
=== null) {
1588 this.model
.oauth
= {};
1590 if (this.model
.oauth
.scopes
=== void 0) {
1591 this.model
.oauth
.scopes
= [];
1593 for (_i
= 0, _len
= v
.length
; _i
< _len
; _i
++) {
1595 this.model
.oauth
.scopes
.push(o
);
1600 $(this.el
).html(Handlebars
.templates
.operation(this.model
));
1601 if (this.model
.responseClassSignature
&& this.model
.responseClassSignature
!== 'string') {
1603 sampleJSON
: this.model
.responseSampleJSON
,
1605 signature
: this.model
.responseClassSignature
1607 responseSignatureView
= new SignatureView({
1608 model
: signatureModel
,
1611 $('.model-signature', $(this.el
)).append(responseSignatureView
.render().el
);
1613 $('.model-signature', $(this.el
)).html(this.model
.type
);
1615 contentTypeModel
= {
1618 contentTypeModel
.consumes
= this.model
.consumes
;
1619 contentTypeModel
.produces
= this.model
.produces
;
1620 _ref6
= this.model
.parameters
;
1621 for (_j
= 0, _len1
= _ref6
.length
; _j
< _len1
; _j
++) {
1623 type
= param
.type
|| param
.dataType
;
1624 if (type
.toLowerCase() === 'file') {
1625 if (!contentTypeModel
.consumes
) {
1626 log("set content type ");
1627 contentTypeModel
.consumes
= 'multipart/form-data';
1631 responseContentTypeView
= new ResponseContentTypeView({
1632 model
: contentTypeModel
1634 $('.response-content-type', $(this.el
)).append(responseContentTypeView
.render().el
);
1635 _ref7
= this.model
.parameters
;
1636 for (_k
= 0, _len2
= _ref7
.length
; _k
< _len2
; _k
++) {
1638 this.addParameter(param
, contentTypeModel
.consumes
);
1640 _ref8
= this.model
.responseMessages
;
1641 for (_l
= 0, _len3
= _ref8
.length
; _l
< _len3
; _l
++) {
1642 statusCode
= _ref8
[_l
];
1643 this.addStatusCode(statusCode
);
1648 OperationView
.prototype.addParameter = function(param
, consumes
) {
1650 param
.consumes
= consumes
;
1651 paramView
= new ParameterView({
1654 readOnly
: this.model
.isReadOnly
1656 return $('.operation-params', $(this.el
)).append(paramView
.render().el
);
1659 OperationView
.prototype.addStatusCode = function(statusCode
) {
1661 statusCodeView
= new StatusCodeView({
1665 return $('.operation-status', $(this.el
)).append(statusCodeView
.render().el
);
1668 OperationView
.prototype.submitOperation = function(e
) {
1669 var error_free
, form
, isFileUpload
, map
, o
, opts
, val
, _i
, _j
, _k
, _len
, _len1
, _len2
, _ref5
, _ref6
, _ref7
;
1673 form
= $('.sandbox', $(this.el
));
1675 form
.find("input.required").each(function() {
1677 $(this).removeClass("error");
1678 if (jQuery
.trim($(this).val()) === "") {
1679 $(this).addClass("error");
1681 callback: function() {
1682 return $(_this
).focus();
1685 return error_free
= false;
1693 isFileUpload
= false;
1694 _ref5
= form
.find("input");
1695 for (_i
= 0, _len
= _ref5
.length
; _i
< _len
; _i
++) {
1697 if ((o
.value
!= null) && jQuery
.trim(o
.value
).length
> 0) {
1698 map
[o
.name
] = o
.value
;
1700 if (o
.type
=== "file") {
1701 isFileUpload
= true;
1704 _ref6
= form
.find("textarea");
1705 for (_j
= 0, _len1
= _ref6
.length
; _j
< _len1
; _j
++) {
1707 if ((o
.value
!= null) && jQuery
.trim(o
.value
).length
> 0) {
1708 map
["body"] = o
.value
;
1711 _ref7
= form
.find("select");
1712 for (_k
= 0, _len2
= _ref7
.length
; _k
< _len2
; _k
++) {
1714 val
= this.getSelectedValue(o
);
1715 if ((val
!= null) && jQuery
.trim(val
).length
> 0) {
1719 opts
.responseContentType
= $("div select[name=responseContentType]", $(this.el
)).val();
1720 opts
.requestContentType
= $("div select[name=parameterContentType]", $(this.el
)).val();
1721 $(".response_throbber", $(this.el
)).show();
1723 return this.handleFileUpload(map
, form
);
1725 return this.model
["do"](map
, opts
, this.showCompleteStatus
, this.showErrorStatus
, this);
1730 OperationView
.prototype.success = function(response
, parent
) {
1731 return parent
.showCompleteStatus(response
);
1734 OperationView
.prototype.handleFileUpload = function(map
, form
) {
1735 var bodyParam
, el
, headerParams
, o
, obj
, param
, params
, _i
, _j
, _k
, _l
, _len
, _len1
, _len2
, _len3
, _ref5
, _ref6
, _ref7
, _ref8
,
1737 _ref5
= form
.serializeArray();
1738 for (_i
= 0, _len
= _ref5
.length
; _i
< _len
; _i
++) {
1740 if ((o
.value
!= null) && jQuery
.trim(o
.value
).length
> 0) {
1741 map
[o
.name
] = o
.value
;
1744 bodyParam
= new FormData();
1746 _ref6
= this.model
.parameters
;
1747 for (_j
= 0, _len1
= _ref6
.length
; _j
< _len1
; _j
++) {
1749 if (param
.paramType
=== 'form') {
1750 if (map
[param
.name
] !== void 0) {
1751 bodyParam
.append(param
.name
, map
[param
.name
]);
1756 _ref7
= this.model
.parameters
;
1757 for (_k
= 0, _len2
= _ref7
.length
; _k
< _len2
; _k
++) {
1759 if (param
.paramType
=== 'header') {
1760 headerParams
[param
.name
] = map
[param
.name
];
1764 _ref8
= form
.find('input[type~="file"]');
1765 for (_l
= 0, _len3
= _ref8
.length
; _l
< _len3
; _l
++) {
1767 if (typeof el
.files
[0] !== 'undefined') {
1768 bodyParam
.append($(el
).attr('name'), el
.files
[0]);
1773 this.invocationUrl
= this.model
.supportHeaderParams() ? (headerParams
= this.model
.getHeaderParams(map
), this.model
.urlify(map
, false)) : this.model
.urlify(map
, true);
1774 $(".request_url", $(this.el
)).html("<pre>" + this.invocationUrl
+ "</pre>");
1776 type
: this.model
.method
,
1777 url
: this.invocationUrl
,
1778 headers
: headerParams
,
1783 error: function(data
, textStatus
, error
) {
1784 return _this
.showErrorStatus(_this
.wrap(data
), _this
);
1786 success: function(data
) {
1787 return _this
.showResponse(data
, _this
);
1789 complete: function(data
) {
1790 return _this
.showCompleteStatus(_this
.wrap(data
), _this
);
1793 if (window
.authorizations
) {
1794 window
.authorizations
.apply(obj
);
1797 obj
.data
.append("fake", "true");
1803 OperationView
.prototype.wrap = function(data
) {
1804 var h
, headerArray
, headers
, i
, o
, _i
, _len
;
1806 headerArray
= data
.getAllResponseHeaders().split("\r");
1807 for (_i
= 0, _len
= headerArray
.length
; _i
< _len
; _i
++) {
1808 i
= headerArray
[_i
];
1810 if (h
[0] !== void 0 && h
[1] !== void 0) {
1811 headers
[h
[0].trim()] = h
[1].trim();
1816 o
.content
.data
= data
.responseText
;
1817 o
.headers
= headers
;
1819 o
.request
.url
= this.invocationUrl
;
1820 o
.status
= data
.status
;
1824 OperationView
.prototype.getSelectedValue = function(select
) {
1825 var opt
, options
, _i
, _len
, _ref5
;
1826 if (!select
.multiple
) {
1827 return select
.value
;
1830 _ref5
= select
.options
;
1831 for (_i
= 0, _len
= _ref5
.length
; _i
< _len
; _i
++) {
1834 options
.push(opt
.value
);
1837 if (options
.length
> 0) {
1838 return options
.join(",");
1845 OperationView
.prototype.hideResponse = function(e
) {
1849 $(".response", $(this.el
)).slideUp();
1850 return $(".response_hider", $(this.el
)).fadeOut();
1853 OperationView
.prototype.showResponse = function(response
) {
1855 prettyJson
= JSON
.stringify(response
, null, "\t").replace(/\n/g, "<br>");
1856 return $(".response_body", $(this.el
)).html(escape(prettyJson
));
1859 OperationView
.prototype.showErrorStatus = function(data
, parent
) {
1860 return parent
.showStatus(data
);
1863 OperationView
.prototype.showCompleteStatus = function(data
, parent
) {
1864 return parent
.showStatus(data
);
1867 OperationView
.prototype.formatXml = function(xml
) {
1868 var contexp
, formatted
, indent
, lastType
, lines
, ln
, pad
, reg
, transitions
, wsexp
, _fn
, _i
, _len
;
1869 reg
= /(>)(<)(\/*)/g;
1870 wsexp
= /[ ]*(.*)[ ]+\n/g;
1871 contexp
= /(<.+>)(.+\n)/g;
1872 xml
= xml
.replace(reg
, '$1\n$2$3').replace(wsexp
, '$1\n').replace(contexp
, '$1\n$2');
1875 lines
= xml
.split('\n');
1879 'single->single': 0,
1880 'single->closing': -1,
1881 'single->opening': 0,
1883 'closing->single': 0,
1884 'closing->closing': -1,
1885 'closing->opening': 0,
1886 'closing->other': 0,
1887 'opening->single': 1,
1888 'opening->closing': 0,
1889 'opening->opening': 1,
1890 'opening->other': 1,
1892 'other->closing': -1,
1893 'other->opening': 0,
1896 _fn = function(ln
) {
1897 var fromTo
, j
, key
, padding
, type
, types
, value
;
1899 single
: Boolean(ln
.match(/<.+\/>/)),
1900 closing
: Boolean(ln
.match(/<\/.+>/)),
1901 opening
: Boolean(ln
.match(/<[^!?].*>/))
1903 type
= ((function() {
1906 for (key
in types
) {
1914 type
= type
=== void 0 ? 'other' : type
;
1915 fromTo
= lastType
+ '->' + type
;
1918 indent
+= transitions
[fromTo
];
1919 padding
= ((function() {
1920 var _j
, _ref5
, _results
;
1922 for (j
= _j
= 0, _ref5
= indent
; 0 <= _ref5
? _j
< _ref5
: _j
> _ref5
; j
= 0 <= _ref5
? ++_j
: --_j
) {
1927 if (fromTo
=== 'opening->closing') {
1928 return formatted
= formatted
.substr(0, formatted
.length
- 1) + ln
+ '\n';
1930 return formatted
+= padding
+ ln
+ '\n';
1933 for (_i
= 0, _len
= lines
.length
; _i
< _len
; _i
++) {
1940 OperationView
.prototype.showStatus = function(response
) {
1941 var code
, content
, contentType
, headers
, pre
, response_body
, url
;
1942 if (response
.content
=== void 0) {
1943 content
= response
.data
;
1946 content
= response
.content
.data
;
1947 url
= response
.request
.url
;
1949 headers
= response
.headers
;
1950 contentType
= headers
&& headers
["Content-Type"] ? headers
["Content-Type"].split(";")[0].trim() : null;
1952 code
= $('<code />').text("no content");
1953 pre
= $('<pre class="json" />').append(code
);
1954 } else if (contentType
=== "application/json" || /\+json
$/.test(contentType
)) {
1955 code
= $('<code />').text(JSON
.stringify(JSON
.parse(content
), null, " "));
1956 pre
= $('<pre class="json" />').append(code
);
1957 } else if (contentType
=== "application/xml" || /\+xml
$/.test(contentType
)) {
1958 code
= $('<code />').text(this.formatXml(content
));
1959 pre
= $('<pre class="xml" />').append(code
);
1960 } else if (contentType
=== "text/html") {
1961 code
= $('<code />').html(content
);
1962 pre
= $('<pre class="xml" />').append(code
);
1963 } else if (/^image\//.test(contentType
)) {
1964 pre
= $('<img>').attr('src', url
);
1966 code
= $('<code />').text(content
);
1967 pre
= $('<pre class="json" />').append(code
);
1969 response_body
= pre
;
1970 $(".request_url", $(this.el
)).html("<pre>" + url
+ "</pre>");
1971 $(".response_code", $(this.el
)).html("<pre>" + response
.status
+ "</pre>");
1972 $(".response_body", $(this.el
)).html(response_body
);
1973 $(".response_headers", $(this.el
)).html("<pre>" + JSON
.stringify(response
.headers
, null, " ").replace(/\n/g, "<br>") + "</pre>");
1974 $(".response", $(this.el
)).slideDown();
1975 $(".response_hider", $(this.el
)).show();
1976 $(".response_throbber", $(this.el
)).hide();
1977 return hljs
.highlightBlock($('.response_body', $(this.el
))[0]);
1980 OperationView
.prototype.toggleOperationContent = function() {
1982 elem
= $('#' + Docs
.escapeResourceName(this.model
.parentId
) + "_" + this.model
.nickname
+ "_content");
1983 if (elem
.is(':visible')) {
1984 return Docs
.collapseOperation(elem
);
1986 return Docs
.expandOperation(elem
);
1990 return OperationView
;
1994 StatusCodeView
= (function(_super
) {
1995 __extends(StatusCodeView
, _super
);
1997 function StatusCodeView() {
1998 _ref5
= StatusCodeView
.__super__
.constructor.apply(this, arguments
);
2002 StatusCodeView
.prototype.initialize = function() {};
2004 StatusCodeView
.prototype.render = function() {
2005 var responseModel
, responseModelView
, template
;
2006 template
= this.template();
2007 $(this.el
).html(template(this.model
));
2008 if (swaggerUi
.api
.models
.hasOwnProperty(this.model
.responseModel
)) {
2010 sampleJSON
: JSON
.stringify(swaggerUi
.api
.models
[this.model
.responseModel
].createJSONSample(), null, 2),
2012 signature
: swaggerUi
.api
.models
[this.model
.responseModel
].getMockSignature()
2014 responseModelView
= new SignatureView({
2015 model
: responseModel
,
2018 $('.model-signature', this.$el
).append(responseModelView
.render().el
);
2020 $('.model-signature', this.$el
).html('');
2025 StatusCodeView
.prototype.template = function() {
2026 return Handlebars
.templates
.status_code
;
2029 return StatusCodeView
;
2033 ParameterView
= (function(_super
) {
2034 __extends(ParameterView
, _super
);
2036 function ParameterView() {
2037 _ref6
= ParameterView
.__super__
.constructor.apply(this, arguments
);
2041 ParameterView
.prototype.initialize = function() {
2042 return Handlebars
.registerHelper('isArray', function(param
, opts
) {
2043 if (param
.type
.toLowerCase() === 'array' || param
.allowMultiple
) {
2044 return opts
.fn(this);
2046 return opts
.inverse(this);
2051 ParameterView
.prototype.render = function() {
2052 var contentTypeModel
, isParam
, parameterContentTypeView
, responseContentTypeView
, signatureModel
, signatureView
, template
, type
;
2053 type
= this.model
.type
|| this.model
.dataType
;
2054 if (this.model
.paramType
=== 'body') {
2055 this.model
.isBody
= true;
2057 if (type
.toLowerCase() === 'file') {
2058 this.model
.isFile
= true;
2060 template
= this.template();
2061 $(this.el
).html(template(this.model
));
2063 sampleJSON
: this.model
.sampleJSON
,
2065 signature
: this.model
.signature
2067 if (this.model
.sampleJSON
) {
2068 signatureView
= new SignatureView({
2069 model
: signatureModel
,
2072 $('.model-signature', $(this.el
)).append(signatureView
.render().el
);
2074 $('.model-signature', $(this.el
)).html(this.model
.signature
);
2077 if (this.model
.isBody
) {
2080 contentTypeModel
= {
2083 contentTypeModel
.consumes
= this.model
.consumes
;
2085 parameterContentTypeView
= new ParameterContentTypeView({
2086 model
: contentTypeModel
2088 $('.parameter-content-type', $(this.el
)).append(parameterContentTypeView
.render().el
);
2090 responseContentTypeView
= new ResponseContentTypeView({
2091 model
: contentTypeModel
2093 $('.response-content-type', $(this.el
)).append(responseContentTypeView
.render().el
);
2098 ParameterView
.prototype.template = function() {
2099 if (this.model
.isList
) {
2100 return Handlebars
.templates
.param_list
;
2102 if (this.options
.readOnly
) {
2103 if (this.model
.required
) {
2104 return Handlebars
.templates
.param_readonly_required
;
2106 return Handlebars
.templates
.param_readonly
;
2109 if (this.model
.required
) {
2110 return Handlebars
.templates
.param_required
;
2112 return Handlebars
.templates
.param
;
2118 return ParameterView
;
2122 SignatureView
= (function(_super
) {
2123 __extends(SignatureView
, _super
);
2125 function SignatureView() {
2126 _ref7
= SignatureView
.__super__
.constructor.apply(this, arguments
);
2130 SignatureView
.prototype.events
= {
2131 'click a.description-link': 'switchToDescription',
2132 'click a.snippet-link': 'switchToSnippet',
2133 'mousedown .snippet': 'snippetToTextArea'
2136 SignatureView
.prototype.initialize = function() {};
2138 SignatureView
.prototype.render = function() {
2140 template
= this.template();
2141 $(this.el
).html(template(this.model
));
2142 this.switchToDescription();
2143 this.isParam
= this.model
.isParam
;
2145 $('.notice', $(this.el
)).text('Click to set as parameter value');
2150 SignatureView
.prototype.template = function() {
2151 return Handlebars
.templates
.signature
;
2154 SignatureView
.prototype.switchToDescription = function(e
) {
2158 $(".snippet", $(this.el
)).hide();
2159 $(".description", $(this.el
)).show();
2160 $('.description-link', $(this.el
)).addClass('selected');
2161 return $('.snippet-link', $(this.el
)).removeClass('selected');
2164 SignatureView
.prototype.switchToSnippet = function(e
) {
2168 $(".description", $(this.el
)).hide();
2169 $(".snippet", $(this.el
)).show();
2170 $('.snippet-link', $(this.el
)).addClass('selected');
2171 return $('.description-link', $(this.el
)).removeClass('selected');
2174 SignatureView
.prototype.snippetToTextArea = function(e
) {
2180 textArea
= $('textarea', $(this.el
.parentNode
.parentNode
.parentNode
));
2181 if ($.trim(textArea
.val()) === '') {
2182 return textArea
.val(this.model
.sampleJSON
);
2187 return SignatureView
;
2191 ContentTypeView
= (function(_super
) {
2192 __extends(ContentTypeView
, _super
);
2194 function ContentTypeView() {
2195 _ref8
= ContentTypeView
.__super__
.constructor.apply(this, arguments
);
2199 ContentTypeView
.prototype.initialize = function() {};
2201 ContentTypeView
.prototype.render = function() {
2203 template
= this.template();
2204 $(this.el
).html(template(this.model
));
2205 $('label[for=contentType]', $(this.el
)).text('Response Content Type');
2209 ContentTypeView
.prototype.template = function() {
2210 return Handlebars
.templates
.content_type
;
2213 return ContentTypeView
;
2217 ResponseContentTypeView
= (function(_super
) {
2218 __extends(ResponseContentTypeView
, _super
);
2220 function ResponseContentTypeView() {
2221 _ref9
= ResponseContentTypeView
.__super__
.constructor.apply(this, arguments
);
2225 ResponseContentTypeView
.prototype.initialize = function() {};
2227 ResponseContentTypeView
.prototype.render = function() {
2229 template
= this.template();
2230 $(this.el
).html(template(this.model
));
2231 $('label[for=responseContentType]', $(this.el
)).text('Response Content Type');
2235 ResponseContentTypeView
.prototype.template = function() {
2236 return Handlebars
.templates
.response_content_type
;
2239 return ResponseContentTypeView
;
2243 ParameterContentTypeView
= (function(_super
) {
2244 __extends(ParameterContentTypeView
, _super
);
2246 function ParameterContentTypeView() {
2247 _ref10
= ParameterContentTypeView
.__super__
.constructor.apply(this, arguments
);
2251 ParameterContentTypeView
.prototype.initialize = function() {};
2253 ParameterContentTypeView
.prototype.render = function() {
2255 template
= this.template();
2256 $(this.el
).html(template(this.model
));
2257 $('label[for=parameterContentType]', $(this.el
)).text('Parameter content type:');
2261 ParameterContentTypeView
.prototype.template = function() {
2262 return Handlebars
.templates
.parameter_content_type
;
2265 return ParameterContentTypeView
;