grape-swagger-ui 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/.gitignore +18 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +54 -0
  5. data/Rakefile +1 -0
  6. data/app/controllers/swagger_controller.rb +8 -0
  7. data/app/views/layouts/swagger.html.haml +49 -0
  8. data/app/views/swagger/index.html +0 -0
  9. data/config/routes.rb +4 -0
  10. data/grape-swagger-ui.gemspec +22 -0
  11. data/lib/generators/swagger/layout/USAGE +8 -0
  12. data/lib/generators/swagger/layout/layout_generator.rb +15 -0
  13. data/lib/generators/swagger/layout/templates/swagger.html.haml +49 -0
  14. data/lib/grape-swagger-ui.rb +10 -0
  15. data/lib/grape-swagger-ui/version.rb +7 -0
  16. data/vendor/assets/images/logo_small.png +0 -0
  17. data/vendor/assets/images/pet_store_api.png +0 -0
  18. data/vendor/assets/images/throbber.gif +0 -0
  19. data/vendor/assets/images/wordnik_api.png +0 -0
  20. data/vendor/assets/javascripts/lib/backbone-min.js +38 -0
  21. data/vendor/assets/javascripts/lib/handlebars-1.0.rc.1.js +1920 -0
  22. data/vendor/assets/javascripts/lib/highlight.7.3.pack.js +1 -0
  23. data/vendor/assets/javascripts/lib/jquery-1.8.0.min.js +2 -0
  24. data/vendor/assets/javascripts/lib/jquery.ba-bbq.min.js +18 -0
  25. data/vendor/assets/javascripts/lib/jquery.slideto.min.js +1 -0
  26. data/vendor/assets/javascripts/lib/jquery.wiggle.min.js +8 -0
  27. data/vendor/assets/javascripts/lib/swagger.js +765 -0
  28. data/vendor/assets/javascripts/lib/underscore-min.js +32 -0
  29. data/vendor/assets/javascripts/swagger-ui.js +1943 -0
  30. data/vendor/assets/javascripts/swagger_ui.js +23 -0
  31. data/vendor/assets/stylesheets/hightlight.default.css +135 -0
  32. data/vendor/assets/stylesheets/screen.css +1590 -0
  33. data/vendor/assets/stylesheets/swagger_ui.css +13 -0
  34. metadata +110 -0
@@ -0,0 +1,32 @@
1
+ // Underscore.js 1.3.3
2
+ // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
3
+ // Underscore is freely distributable under the MIT license.
4
+ // Portions of Underscore are inspired or borrowed from Prototype,
5
+ // Oliver Steele's Functional, and John Resig's Micro-Templating.
6
+ // For all details and documentation:
7
+ // http://documentcloud.github.com/underscore
8
+ (function(){function r(a,c,d){if(a===c)return 0!==a||1/a==1/c;if(null==a||null==c)return a===c;a._chain&&(a=a._wrapped);c._chain&&(c=c._wrapped);if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return!1;switch(e){case "[object String]":return a==""+c;case "[object Number]":return a!=+a?c!=+c:0==a?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source==
9
+ c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if("object"!=typeof a||"object"!=typeof c)return!1;for(var f=d.length;f--;)if(d[f]==a)return!0;d.push(a);var f=0,g=!0;if("[object Array]"==e){if(f=a.length,g=f==c.length)for(;f--&&(g=f in a==f in c&&r(a[f],c[f],d)););}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return!1;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&r(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c,h)&&!f--)break;
10
+ g=!f}}d.pop();return g}var s=this,I=s._,o={},k=Array.prototype,p=Object.prototype,i=k.slice,J=k.unshift,l=p.toString,K=p.hasOwnProperty,y=k.forEach,z=k.map,A=k.reduce,B=k.reduceRight,C=k.filter,D=k.every,E=k.some,q=k.indexOf,F=k.lastIndexOf,p=Array.isArray,L=Object.keys,t=Function.prototype.bind,b=function(a){return new m(a)};"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=b),exports._=b):s._=b;b.VERSION="1.3.3";var j=b.each=b.forEach=function(a,
11
+ c,d){if(a!=null)if(y&&a.forEach===y)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e<f;e++){if(e in a&&c.call(d,a[e],e,a)===o)break}else for(e in a)if(b.has(a,e)&&c.call(d,a[e],e,a)===o)break};b.map=b.collect=function(a,c,b){var e=[];if(a==null)return e;if(z&&a.map===z)return a.map(c,b);j(a,function(a,g,h){e[e.length]=c.call(b,a,g,h)});if(a.length===+a.length)e.length=a.length;return e};b.reduce=b.foldl=b.inject=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(A&&
12
+ a.reduce===A){e&&(c=b.bind(c,e));return f?a.reduce(c,d):a.reduce(c)}j(a,function(a,b,i){if(f)d=c.call(e,d,a,b,i);else{d=a;f=true}});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(B&&a.reduceRight===B){e&&(c=b.bind(c,e));return f?a.reduceRight(c,d):a.reduceRight(c)}var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=function(a,
13
+ c,b){var e;G(a,function(a,g,h){if(c.call(b,a,g,h)){e=a;return true}});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(C&&a.filter===C)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(D&&a.every===D)return a.every(c,b);j(a,function(a,g,h){if(!(e=e&&c.call(b,
14
+ a,g,h)))return o});return!!e};var G=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(E&&a.some===E)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return o});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;if(q&&a.indexOf===q)return a.indexOf(c)!=-1;return b=G(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck=
15
+ function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0])return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0])return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b<e.computed&&
16
+ (e={value:a,computed:b})});return e.value};b.shuffle=function(a){var b=[],d;j(a,function(a,f){d=Math.floor(Math.random()*(f+1));b[f]=b[d];b[d]=a});return b};b.sortBy=function(a,c,d){var e=b.isFunction(c)?c:function(a){return a[c]};return b.pluck(b.map(a,function(a,b,c){return{value:a,criteria:e.call(d,a,b,c)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c===void 0?1:d===void 0?-1:c<d?-1:c>d?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};
17
+ j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a,c,d){d||(d=b.identity);for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?e=g+1:f=g}return e};b.toArray=function(a){return!a?[]:b.isArray(a)||b.isArguments(a)?i.call(a):a.toArray&&b.isFunction(a.toArray)?a.toArray():b.values(a)};b.size=function(a){return b.isArray(a)?a.length:b.keys(a).length};b.first=b.head=b.take=function(a,b,d){return b!=null&&!d?i.call(a,0,b):a[0]};b.initial=function(a,b,d){return i.call(a,
18
+ 0,a.length-(b==null||d?1:b))};b.last=function(a,b,d){return b!=null&&!d?i.call(a,Math.max(a.length-b,0)):a[a.length-1]};b.rest=b.tail=function(a,b,d){return i.call(a,b==null||d?1:b)};b.compact=function(a){return b.filter(a,function(a){return!!a})};b.flatten=function(a,c){return b.reduce(a,function(a,e){if(b.isArray(e))return a.concat(c?e:b.flatten(e));a[a.length]=e;return a},[])};b.without=function(a){return b.difference(a,i.call(arguments,1))};b.uniq=b.unique=function(a,c,d){var d=d?b.map(a,d):a,
19
+ e=[];a.length<3&&(c=true);b.reduce(d,function(d,g,h){if(c?b.last(d)!==g||!d.length:!b.include(d,g)){d.push(g);e.push(a[h])}return d},[]);return e};b.union=function(){return b.uniq(b.flatten(arguments,true))};b.intersection=b.intersect=function(a){var c=i.call(arguments,1);return b.filter(b.uniq(a),function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1),true);return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=
20
+ i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.indexOf=function(a,c,d){if(a==null)return-1;var e;if(d){d=b.sortedIndex(a,c);return a[d]===c?d:-1}if(q&&a.indexOf===q)return a.indexOf(c);d=0;for(e=a.length;d<e;d++)if(d in a&&a[d]===c)return d;return-1};b.lastIndexOf=function(a,b){if(a==null)return-1;if(F&&a.lastIndexOf===F)return a.lastIndexOf(b);for(var d=a.length;d--;)if(d in a&&a[d]===b)return d;return-1};b.range=function(a,b,d){if(arguments.length<=
21
+ 1){b=a||0;a=0}for(var d=arguments[2]||1,e=Math.max(Math.ceil((b-a)/d),0),f=0,g=Array(e);f<e;){g[f++]=a;a=a+d}return g};var H=function(){};b.bind=function(a,c){var d,e;if(a.bind===t&&t)return t.apply(a,i.call(arguments,1));if(!b.isFunction(a))throw new TypeError;e=i.call(arguments,2);return d=function(){if(!(this instanceof d))return a.apply(c,e.concat(i.call(arguments)));H.prototype=a.prototype;var b=new H,g=a.apply(b,e.concat(i.call(arguments)));return Object(g)===g?g:b}};b.bindAll=function(a){var c=
22
+ i.call(arguments,1);c.length==0&&(c=b.functions(a));j(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,c){var d={};c||(c=b.identity);return function(){var e=c.apply(this,arguments);return b.has(d,e)?d[e]:d[e]=a.apply(this,arguments)}};b.delay=function(a,b){var d=i.call(arguments,2);return setTimeout(function(){return a.apply(null,d)},b)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(i.call(arguments,1)))};b.throttle=function(a,c){var d,e,f,g,h,i,j=b.debounce(function(){h=
23
+ g=false},c);return function(){d=this;e=arguments;f||(f=setTimeout(function(){f=null;h&&a.apply(d,e);j()},c));g?h=true:i=a.apply(d,e);j();g=true;return i}};b.debounce=function(a,b,d){var e;return function(){var f=this,g=arguments;d&&!e&&a.apply(f,g);clearTimeout(e);e=setTimeout(function(){e=null;d||a.apply(f,g)},b)}};b.once=function(a){var b=false,d;return function(){if(b)return d;b=true;return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(i.call(arguments,0));
24
+ return b.apply(this,d)}};b.compose=function(){var a=arguments;return function(){for(var b=arguments,d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=L||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&
25
+ c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.pick=function(a){var c={};j(b.flatten(i.call(arguments,1)),function(b){b in a&&(c[b]=a[b])});return c};b.defaults=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return r(a,b,[])};b.isEmpty=
26
+ function(a){if(a==null)return true;if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=p||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};b.isArguments=function(a){return l.call(a)=="[object Arguments]"};b.isArguments(arguments)||(b.isArguments=function(a){return!(!a||!b.has(a,"callee"))});b.isFunction=function(a){return l.call(a)=="[object Function]"};
27
+ b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isFinite=function(a){return b.isNumber(a)&&isFinite(a)};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"};b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,
28
+ b){return K.call(a,b)};b.noConflict=function(){s._=I;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};b.escape=function(a){return(""+a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")};b.result=function(a,c){if(a==null)return null;var d=a[c];return b.isFunction(d)?d.call(a):d};b.mixin=function(a){j(b.functions(a),function(c){M(c,b[c]=a[c])})};var N=0;b.uniqueId=
29
+ function(a){var b=N++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var u=/.^/,n={"\\":"\\","'":"'",r:"\r",n:"\n",t:"\t",u2028:"\u2028",u2029:"\u2029"},v;for(v in n)n[n[v]]=v;var O=/\\|'|\r|\n|\t|\u2028|\u2029/g,P=/\\(\\|'|r|n|t|u2028|u2029)/g,w=function(a){return a.replace(P,function(a,b){return n[b]})};b.template=function(a,c,d){d=b.defaults(d||{},b.templateSettings);a="__p+='"+a.replace(O,function(a){return"\\"+n[a]}).replace(d.escape||
30
+ u,function(a,b){return"'+\n_.escape("+w(b)+")+\n'"}).replace(d.interpolate||u,function(a,b){return"'+\n("+w(b)+")+\n'"}).replace(d.evaluate||u,function(a,b){return"';\n"+w(b)+"\n;__p+='"})+"';\n";d.variable||(a="with(obj||{}){\n"+a+"}\n");var a="var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n"+a+"return __p;\n",e=new Function(d.variable||"obj","_",a);if(c)return e(c,b);c=function(a){return e.call(this,a,b)};c.source="function("+(d.variable||"obj")+"){\n"+a+"}";return c};
31
+ b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var x=function(a,c){return c?b(a).chain():a},M=function(a,c){m.prototype[a]=function(){var a=i.call(arguments);J.call(a,this._wrapped);return x(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return x(d,
32
+ this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return x(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain=true;return this};m.prototype.value=function(){return this._wrapped}}).call(this);
@@ -0,0 +1,1943 @@
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>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='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 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 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 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;
785
+ buffer += "\n ";
786
+ foundHelper = helpers.defaultValue;
787
+ stack1 = foundHelper || depth0.defaultValue;
788
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
789
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
790
+ buffer += escapeExpression(stack1) + "\n ";
791
+ return buffer;}
792
+
793
+ buffer += "<td class='code'>";
794
+ foundHelper = helpers.name;
795
+ stack1 = foundHelper || depth0.name;
796
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
797
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
798
+ buffer += escapeExpression(stack1) + "</td>\n<td>\n ";
799
+ foundHelper = helpers.isBody;
800
+ stack1 = foundHelper || depth0.isBody;
801
+ stack2 = helpers['if'];
802
+ tmp1 = self.program(1, program1, data);
803
+ tmp1.hash = {};
804
+ tmp1.fn = tmp1;
805
+ tmp1.inverse = self.program(3, program3, data);
806
+ stack1 = stack2.call(depth0, stack1, tmp1);
807
+ if(stack1 || stack1 === 0) { buffer += stack1; }
808
+ buffer += "\n</td>\n<td>";
809
+ foundHelper = helpers.description;
810
+ stack1 = foundHelper || depth0.description;
811
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
812
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
813
+ if(stack1 || stack1 === 0) { buffer += stack1; }
814
+ buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n";
815
+ return buffer;});
816
+ })();
817
+
818
+ (function() {
819
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
820
+ templates['param_readonly_required'] = template(function (Handlebars,depth0,helpers,partials,data) {
821
+ helpers = helpers || Handlebars.helpers;
822
+ var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
823
+
824
+ function program1(depth0,data) {
825
+
826
+ var buffer = "", stack1;
827
+ buffer += "\n <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='";
828
+ foundHelper = helpers.name;
829
+ stack1 = foundHelper || depth0.name;
830
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
831
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
832
+ buffer += escapeExpression(stack1) + "'>";
833
+ foundHelper = helpers.defaultValue;
834
+ stack1 = foundHelper || depth0.defaultValue;
835
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
836
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
837
+ buffer += escapeExpression(stack1) + "</textarea>\n ";
838
+ return buffer;}
839
+
840
+ function program3(depth0,data) {
841
+
842
+ var buffer = "", stack1;
843
+ buffer += "\n ";
844
+ foundHelper = helpers.defaultValue;
845
+ stack1 = foundHelper || depth0.defaultValue;
846
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
847
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
848
+ buffer += escapeExpression(stack1) + "\n ";
849
+ return buffer;}
850
+
851
+ buffer += "<td class='code required'>";
852
+ foundHelper = helpers.name;
853
+ stack1 = foundHelper || depth0.name;
854
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
855
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
856
+ buffer += escapeExpression(stack1) + "</td>\n<td>\n ";
857
+ foundHelper = helpers.isBody;
858
+ stack1 = foundHelper || depth0.isBody;
859
+ stack2 = helpers['if'];
860
+ tmp1 = self.program(1, program1, data);
861
+ tmp1.hash = {};
862
+ tmp1.fn = tmp1;
863
+ tmp1.inverse = self.program(3, program3, data);
864
+ stack1 = stack2.call(depth0, stack1, tmp1);
865
+ if(stack1 || stack1 === 0) { buffer += stack1; }
866
+ buffer += "\n</td>\n<td>";
867
+ foundHelper = helpers.description;
868
+ stack1 = foundHelper || depth0.description;
869
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
870
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
871
+ if(stack1 || stack1 === 0) { buffer += stack1; }
872
+ buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n";
873
+ return buffer;});
874
+ })();
875
+
876
+ (function() {
877
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
878
+ templates['param_required'] = template(function (Handlebars,depth0,helpers,partials,data) {
879
+ helpers = helpers || Handlebars.helpers;
880
+ var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
881
+
882
+ function program1(depth0,data) {
883
+
884
+ var buffer = "", stack1, stack2;
885
+ buffer += "\n ";
886
+ foundHelper = helpers.isFile;
887
+ stack1 = foundHelper || depth0.isFile;
888
+ stack2 = helpers['if'];
889
+ tmp1 = self.program(2, program2, data);
890
+ tmp1.hash = {};
891
+ tmp1.fn = tmp1;
892
+ tmp1.inverse = self.program(4, program4, data);
893
+ stack1 = stack2.call(depth0, stack1, tmp1);
894
+ if(stack1 || stack1 === 0) { buffer += stack1; }
895
+ buffer += "\n ";
896
+ return buffer;}
897
+ function program2(depth0,data) {
898
+
899
+ var buffer = "", stack1;
900
+ buffer += "\n <input type=\"file\" name='";
901
+ foundHelper = helpers.name;
902
+ stack1 = foundHelper || depth0.name;
903
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
904
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
905
+ buffer += escapeExpression(stack1) + "'/>\n ";
906
+ return buffer;}
907
+
908
+ function program4(depth0,data) {
909
+
910
+ var buffer = "", stack1, stack2;
911
+ buffer += "\n ";
912
+ foundHelper = helpers.defaultValue;
913
+ stack1 = foundHelper || depth0.defaultValue;
914
+ stack2 = helpers['if'];
915
+ tmp1 = self.program(5, program5, data);
916
+ tmp1.hash = {};
917
+ tmp1.fn = tmp1;
918
+ tmp1.inverse = self.program(7, program7, data);
919
+ stack1 = stack2.call(depth0, stack1, tmp1);
920
+ if(stack1 || stack1 === 0) { buffer += stack1; }
921
+ buffer += "\n ";
922
+ return buffer;}
923
+ function program5(depth0,data) {
924
+
925
+ var buffer = "", stack1;
926
+ buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='";
927
+ foundHelper = helpers.name;
928
+ stack1 = foundHelper || depth0.name;
929
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
930
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
931
+ buffer += escapeExpression(stack1) + "'>";
932
+ foundHelper = helpers.defaultValue;
933
+ stack1 = foundHelper || depth0.defaultValue;
934
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
935
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
936
+ buffer += escapeExpression(stack1) + "</textarea>\n ";
937
+ return buffer;}
938
+
939
+ function program7(depth0,data) {
940
+
941
+ var buffer = "", stack1;
942
+ buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='";
943
+ foundHelper = helpers.name;
944
+ stack1 = foundHelper || depth0.name;
945
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
946
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
947
+ buffer += escapeExpression(stack1) + "'></textarea>\n <br />\n <div class=\"content-type\" />\n ";
948
+ return buffer;}
949
+
950
+ function program9(depth0,data) {
951
+
952
+ var buffer = "", stack1, stack2;
953
+ buffer += "\n ";
954
+ foundHelper = helpers.isFile;
955
+ stack1 = foundHelper || depth0.isFile;
956
+ stack2 = helpers['if'];
957
+ tmp1 = self.program(10, program10, data);
958
+ tmp1.hash = {};
959
+ tmp1.fn = tmp1;
960
+ tmp1.inverse = self.program(12, program12, data);
961
+ stack1 = stack2.call(depth0, stack1, tmp1);
962
+ if(stack1 || stack1 === 0) { buffer += stack1; }
963
+ buffer += "\n ";
964
+ return buffer;}
965
+ function program10(depth0,data) {
966
+
967
+ var buffer = "", stack1;
968
+ buffer += "\n <input class='required' type='file' name='";
969
+ foundHelper = helpers.name;
970
+ stack1 = foundHelper || depth0.name;
971
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
972
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
973
+ buffer += escapeExpression(stack1) + "'/>\n ";
974
+ return buffer;}
975
+
976
+ function program12(depth0,data) {
977
+
978
+ var buffer = "", stack1, stack2;
979
+ buffer += "\n ";
980
+ foundHelper = helpers.defaultValue;
981
+ stack1 = foundHelper || depth0.defaultValue;
982
+ stack2 = helpers['if'];
983
+ tmp1 = self.program(13, program13, data);
984
+ tmp1.hash = {};
985
+ tmp1.fn = tmp1;
986
+ tmp1.inverse = self.program(15, program15, data);
987
+ stack1 = stack2.call(depth0, stack1, tmp1);
988
+ if(stack1 || stack1 === 0) { buffer += stack1; }
989
+ buffer += "\n ";
990
+ return buffer;}
991
+ function program13(depth0,data) {
992
+
993
+ var buffer = "", stack1;
994
+ buffer += "\n <input class='required' minlength='1' name='";
995
+ foundHelper = helpers.name;
996
+ stack1 = foundHelper || depth0.name;
997
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
998
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
999
+ buffer += escapeExpression(stack1) + "' placeholder='(required)' type='text' value='";
1000
+ foundHelper = helpers.defaultValue;
1001
+ stack1 = foundHelper || depth0.defaultValue;
1002
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
1003
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
1004
+ buffer += escapeExpression(stack1) + "'/>\n ";
1005
+ return buffer;}
1006
+
1007
+ function program15(depth0,data) {
1008
+
1009
+ var buffer = "", stack1;
1010
+ buffer += "\n <input class='required' minlength='1' name='";
1011
+ foundHelper = helpers.name;
1012
+ stack1 = foundHelper || depth0.name;
1013
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
1014
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
1015
+ buffer += escapeExpression(stack1) + "' placeholder='(required)' type='text' value=''/>\n ";
1016
+ return buffer;}
1017
+
1018
+ buffer += "<td class='code required'>";
1019
+ foundHelper = helpers.name;
1020
+ stack1 = foundHelper || depth0.name;
1021
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
1022
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
1023
+ buffer += escapeExpression(stack1) + "</td>\n<td>\n ";
1024
+ foundHelper = helpers.isBody;
1025
+ stack1 = foundHelper || depth0.isBody;
1026
+ stack2 = helpers['if'];
1027
+ tmp1 = self.program(1, program1, data);
1028
+ tmp1.hash = {};
1029
+ tmp1.fn = tmp1;
1030
+ tmp1.inverse = self.program(9, program9, data);
1031
+ stack1 = stack2.call(depth0, stack1, tmp1);
1032
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1033
+ buffer += "\n</td>\n<td>\n <strong>";
1034
+ foundHelper = helpers.description;
1035
+ stack1 = foundHelper || depth0.description;
1036
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
1037
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
1038
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1039
+ buffer += "</strong>\n</td>\n<td><span class=\"model-signature\"></span></td>\n";
1040
+ return buffer;});
1041
+ })();
1042
+
1043
+ (function() {
1044
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1045
+ templates['resource'] = template(function (Handlebars,depth0,helpers,partials,data) {
1046
+ helpers = helpers || Handlebars.helpers;
1047
+ var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
1048
+
1049
+
1050
+ buffer += "<div class='heading'>\n <h2>\n <a href='#!/";
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) + "' onclick=\"Docs.toggleEndpointListForResource('";
1056
+ foundHelper = helpers.name;
1057
+ stack1 = foundHelper || depth0.name;
1058
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
1059
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
1060
+ buffer += escapeExpression(stack1) + "');\">/";
1061
+ foundHelper = helpers.name;
1062
+ stack1 = foundHelper || depth0.name;
1063
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
1064
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
1065
+ buffer += escapeExpression(stack1) + "</a>\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/";
1066
+ foundHelper = helpers.name;
1067
+ stack1 = foundHelper || depth0.name;
1068
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
1069
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
1070
+ buffer += escapeExpression(stack1) + "' id='endpointListTogger_";
1071
+ foundHelper = helpers.name;
1072
+ stack1 = foundHelper || depth0.name;
1073
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
1074
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
1075
+ buffer += escapeExpression(stack1) + "'\n onclick=\"Docs.toggleEndpointListForResource('";
1076
+ foundHelper = helpers.name;
1077
+ stack1 = foundHelper || depth0.name;
1078
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
1079
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
1080
+ buffer += escapeExpression(stack1) + "');\">Show/Hide</a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.collapseOperationsForResource('";
1081
+ foundHelper = helpers.name;
1082
+ stack1 = foundHelper || depth0.name;
1083
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
1084
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
1085
+ buffer += escapeExpression(stack1) + "'); return false;\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.expandOperationsForResource('";
1086
+ foundHelper = helpers.name;
1087
+ stack1 = foundHelper || depth0.name;
1088
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
1089
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
1090
+ buffer += escapeExpression(stack1) + "'); return false;\">\n Expand Operations\n </a>\n </li>\n <li>\n <a href='";
1091
+ foundHelper = helpers.url;
1092
+ stack1 = foundHelper || depth0.url;
1093
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
1094
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "url", { hash: {} }); }
1095
+ buffer += escapeExpression(stack1) + "'>Raw</a>\n </li>\n </ul>\n</div>\n<ul class='endpoints' id='";
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) + "_endpoint_list' style='display:none'>\n\n</ul>\n";
1101
+ return buffer;});
1102
+ })();
1103
+
1104
+ (function() {
1105
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1106
+ templates['signature'] = template(function (Handlebars,depth0,helpers,partials,data) {
1107
+ helpers = helpers || Handlebars.helpers;
1108
+ var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
1109
+
1110
+
1111
+ 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 ";
1112
+ foundHelper = helpers.signature;
1113
+ stack1 = foundHelper || depth0.signature;
1114
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
1115
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "signature", { hash: {} }); }
1116
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1117
+ buffer += "\n </div>\n\n <div class=\"snippet\">\n <pre><code>";
1118
+ foundHelper = helpers.sampleJSON;
1119
+ stack1 = foundHelper || depth0.sampleJSON;
1120
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
1121
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "sampleJSON", { hash: {} }); }
1122
+ buffer += escapeExpression(stack1) + "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
1123
+ return buffer;});
1124
+ })();
1125
+
1126
+ (function() {
1127
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
1128
+ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials,data) {
1129
+ helpers = helpers || Handlebars.helpers;
1130
+ var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
1131
+
1132
+
1133
+ buffer += "<td width='15%' class='code'>";
1134
+ foundHelper = helpers.code;
1135
+ stack1 = foundHelper || depth0.code;
1136
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
1137
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "code", { hash: {} }); }
1138
+ buffer += escapeExpression(stack1) + "</td>\n<td>";
1139
+ foundHelper = helpers.reason;
1140
+ stack1 = foundHelper || depth0.reason;
1141
+ if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
1142
+ else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "reason", { hash: {} }); }
1143
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1144
+ buffer += "</td>\n\n";
1145
+ return buffer;});
1146
+ })();
1147
+
1148
+
1149
+
1150
+ // Generated by CoffeeScript 1.4.0
1151
+ (function() {
1152
+ var ContentTypeView, HeaderView, MainView, OperationView, ParameterView, ResourceView, SignatureView, StatusCodeView, SwaggerUi,
1153
+ __hasProp = {}.hasOwnProperty,
1154
+ __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; };
1155
+
1156
+ SwaggerUi = (function(_super) {
1157
+
1158
+ __extends(SwaggerUi, _super);
1159
+
1160
+ function SwaggerUi() {
1161
+ return SwaggerUi.__super__.constructor.apply(this, arguments);
1162
+ }
1163
+
1164
+ SwaggerUi.prototype.dom_id = "swagger_ui";
1165
+
1166
+ SwaggerUi.prototype.options = null;
1167
+
1168
+ SwaggerUi.prototype.api = null;
1169
+
1170
+ SwaggerUi.prototype.headerView = null;
1171
+
1172
+ SwaggerUi.prototype.mainView = null;
1173
+
1174
+ SwaggerUi.prototype.initialize = function(options) {
1175
+ var _this = this;
1176
+ if (options == null) {
1177
+ options = {};
1178
+ }
1179
+ if (options.dom_id != null) {
1180
+ this.dom_id = options.dom_id;
1181
+ delete options.dom_id;
1182
+ }
1183
+ if (!($('#' + this.dom_id) != null)) {
1184
+ $('body').append('<div id="' + this.dom_id + '"></div>');
1185
+ }
1186
+ this.options = options;
1187
+ this.options.success = function() {
1188
+ return _this.render();
1189
+ };
1190
+ this.options.progress = function(d) {
1191
+ return _this.showMessage(d);
1192
+ };
1193
+ this.options.failure = function(d) {
1194
+ return _this.onLoadFailure(d);
1195
+ };
1196
+ this.headerView = new HeaderView({
1197
+ el: $('#header')
1198
+ });
1199
+ return this.headerView.on('update-swagger-ui', function(data) {
1200
+ return _this.updateSwaggerUi(data);
1201
+ });
1202
+ };
1203
+
1204
+ SwaggerUi.prototype.updateSwaggerUi = function(data) {
1205
+ this.options.discoveryUrl = data.discoveryUrl;
1206
+ this.options.apiKey = data.apiKey;
1207
+ return this.load();
1208
+ };
1209
+
1210
+ SwaggerUi.prototype.load = function() {
1211
+ var _ref;
1212
+ if ((_ref = this.mainView) != null) {
1213
+ _ref.clear();
1214
+ }
1215
+ this.headerView.update(this.options.discoveryUrl, this.options.apiKey);
1216
+ return this.api = new SwaggerApi(this.options);
1217
+ };
1218
+
1219
+ SwaggerUi.prototype.render = function() {
1220
+ var _this = this;
1221
+ this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
1222
+ this.mainView = new MainView({
1223
+ model: this.api,
1224
+ el: $('#' + this.dom_id)
1225
+ }).render();
1226
+ this.showMessage();
1227
+ switch (this.options.docExpansion) {
1228
+ case "full":
1229
+ Docs.expandOperationsForResource('');
1230
+ break;
1231
+ case "list":
1232
+ Docs.collapseOperationsForResource('');
1233
+ }
1234
+ if (this.options.onComplete) {
1235
+ this.options.onComplete(this.api, this);
1236
+ }
1237
+ return setTimeout(function() {
1238
+ return Docs.shebang();
1239
+ }, 400);
1240
+ };
1241
+
1242
+ SwaggerUi.prototype.showMessage = function(data) {
1243
+ if (data == null) {
1244
+ data = '';
1245
+ }
1246
+ $('#message-bar').removeClass('message-fail');
1247
+ $('#message-bar').addClass('message-success');
1248
+ return $('#message-bar').html(data);
1249
+ };
1250
+
1251
+ SwaggerUi.prototype.onLoadFailure = function(data) {
1252
+ var val;
1253
+ if (data == null) {
1254
+ data = '';
1255
+ }
1256
+ $('#message-bar').removeClass('message-success');
1257
+ $('#message-bar').addClass('message-fail');
1258
+ val = $('#message-bar').html(data);
1259
+ if (this.options.onFailure != null) {
1260
+ this.options.onFailure(data);
1261
+ }
1262
+ return val;
1263
+ };
1264
+
1265
+ return SwaggerUi;
1266
+
1267
+ })(Backbone.Router);
1268
+
1269
+ window.SwaggerUi = SwaggerUi;
1270
+
1271
+ HeaderView = (function(_super) {
1272
+
1273
+ __extends(HeaderView, _super);
1274
+
1275
+ function HeaderView() {
1276
+ return HeaderView.__super__.constructor.apply(this, arguments);
1277
+ }
1278
+
1279
+ HeaderView.prototype.events = {
1280
+ 'click #show-pet-store-icon': 'showPetStore',
1281
+ 'click #show-wordnik-dev-icon': 'showWordnikDev',
1282
+ 'click #explore': 'showCustom',
1283
+ 'keyup #input_baseUrl': 'showCustomOnKeyup',
1284
+ 'keyup #input_apiKey': 'showCustomOnKeyup'
1285
+ };
1286
+
1287
+ HeaderView.prototype.initialize = function() {};
1288
+
1289
+ HeaderView.prototype.showPetStore = function(e) {
1290
+ return this.trigger('update-swagger-ui', {
1291
+ discoveryUrl: "http://petstore.swagger.wordnik.com/api/api-docs.json",
1292
+ apiKey: "special-key"
1293
+ });
1294
+ };
1295
+
1296
+ HeaderView.prototype.showWordnikDev = function(e) {
1297
+ return this.trigger('update-swagger-ui', {
1298
+ discoveryUrl: "http://api.wordnik.com/v4/resources.json",
1299
+ apiKey: ""
1300
+ });
1301
+ };
1302
+
1303
+ HeaderView.prototype.showCustomOnKeyup = function(e) {
1304
+ if (e.keyCode === 13) {
1305
+ return this.showCustom();
1306
+ }
1307
+ };
1308
+
1309
+ HeaderView.prototype.showCustom = function(e) {
1310
+ if (e != null) {
1311
+ e.preventDefault();
1312
+ }
1313
+ return this.trigger('update-swagger-ui', {
1314
+ discoveryUrl: $('#input_baseUrl').val(),
1315
+ apiKey: $('#input_apiKey').val()
1316
+ });
1317
+ };
1318
+
1319
+ HeaderView.prototype.update = function(url, apiKey, trigger) {
1320
+ if (trigger == null) {
1321
+ trigger = false;
1322
+ }
1323
+ $('#input_baseUrl').val(url);
1324
+ $('#input_apiKey').val(apiKey);
1325
+ if (trigger) {
1326
+ return this.trigger('update-swagger-ui', {
1327
+ discoveryUrl: url,
1328
+ apiKey: apiKey
1329
+ });
1330
+ }
1331
+ };
1332
+
1333
+ return HeaderView;
1334
+
1335
+ })(Backbone.View);
1336
+
1337
+ MainView = (function(_super) {
1338
+
1339
+ __extends(MainView, _super);
1340
+
1341
+ function MainView() {
1342
+ return MainView.__super__.constructor.apply(this, arguments);
1343
+ }
1344
+
1345
+ MainView.prototype.initialize = function() {};
1346
+
1347
+ MainView.prototype.render = function() {
1348
+ var resource, _i, _len, _ref;
1349
+ $(this.el).html(Handlebars.templates.main(this.model));
1350
+ _ref = this.model.apisArray;
1351
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1352
+ resource = _ref[_i];
1353
+ this.addResource(resource);
1354
+ }
1355
+ return this;
1356
+ };
1357
+
1358
+ MainView.prototype.addResource = function(resource) {
1359
+ var resourceView;
1360
+ resourceView = new ResourceView({
1361
+ model: resource,
1362
+ tagName: 'li',
1363
+ id: 'resource_' + resource.name,
1364
+ className: 'resource'
1365
+ });
1366
+ return $('#resources').append(resourceView.render().el);
1367
+ };
1368
+
1369
+ MainView.prototype.clear = function() {
1370
+ return $(this.el).html('');
1371
+ };
1372
+
1373
+ return MainView;
1374
+
1375
+ })(Backbone.View);
1376
+
1377
+ ResourceView = (function(_super) {
1378
+
1379
+ __extends(ResourceView, _super);
1380
+
1381
+ function ResourceView() {
1382
+ return ResourceView.__super__.constructor.apply(this, arguments);
1383
+ }
1384
+
1385
+ ResourceView.prototype.initialize = function() {};
1386
+
1387
+ ResourceView.prototype.render = function() {
1388
+ var operation, _i, _len, _ref;
1389
+ $(this.el).html(Handlebars.templates.resource(this.model));
1390
+ this.number = 0;
1391
+ _ref = this.model.operationsArray;
1392
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1393
+ operation = _ref[_i];
1394
+ this.addOperation(operation);
1395
+ }
1396
+ return this;
1397
+ };
1398
+
1399
+ ResourceView.prototype.addOperation = function(operation) {
1400
+ var operationView;
1401
+ operation.number = this.number;
1402
+ operationView = new OperationView({
1403
+ model: operation,
1404
+ tagName: 'li',
1405
+ className: 'endpoint'
1406
+ });
1407
+ $('.endpoints', $(this.el)).append(operationView.render().el);
1408
+ return this.number++;
1409
+ };
1410
+
1411
+ return ResourceView;
1412
+
1413
+ })(Backbone.View);
1414
+
1415
+ OperationView = (function(_super) {
1416
+
1417
+ __extends(OperationView, _super);
1418
+
1419
+ function OperationView() {
1420
+ return OperationView.__super__.constructor.apply(this, arguments);
1421
+ }
1422
+
1423
+ OperationView.prototype.events = {
1424
+ 'submit .sandbox': 'submitOperation',
1425
+ 'click .submit': 'submitOperation',
1426
+ 'click .response_hider': 'hideResponse',
1427
+ 'click .toggleOperation': 'toggleOperationContent'
1428
+ };
1429
+
1430
+ OperationView.prototype.initialize = function() {};
1431
+
1432
+ OperationView.prototype.render = function() {
1433
+ var contentTypeModel, contentTypeView, isMethodSubmissionSupported, param, responseSignatureView, signatureModel, statusCode, _i, _j, _len, _len1, _ref, _ref1;
1434
+ isMethodSubmissionSupported = jQuery.inArray(this.model.httpMethod, this.model.supportedSubmitMethods()) >= 0;
1435
+ if (!isMethodSubmissionSupported) {
1436
+ this.model.isReadOnly = true;
1437
+ }
1438
+ $(this.el).html(Handlebars.templates.operation(this.model));
1439
+ if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
1440
+ signatureModel = {
1441
+ sampleJSON: this.model.responseSampleJSON,
1442
+ isParam: false,
1443
+ signature: this.model.responseClassSignature
1444
+ };
1445
+ responseSignatureView = new SignatureView({
1446
+ model: signatureModel,
1447
+ tagName: 'div'
1448
+ });
1449
+ $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
1450
+ } else {
1451
+ $('.model-signature', $(this.el)).html(this.model.responseClass);
1452
+ }
1453
+ contentTypeModel = {
1454
+ isParam: false
1455
+ };
1456
+ if (this.model.supportedContentTypes) {
1457
+ contentTypeModel.produces = this.model.supportedContentTypes;
1458
+ }
1459
+ if (this.model.produces) {
1460
+ contentTypeModel.produces = this.model.produces;
1461
+ }
1462
+ contentTypeView = new ContentTypeView({
1463
+ model: contentTypeModel
1464
+ });
1465
+ $('.content-type', $(this.el)).append(contentTypeView.render().el);
1466
+ _ref = this.model.parameters;
1467
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1468
+ param = _ref[_i];
1469
+ this.addParameter(param);
1470
+ }
1471
+ _ref1 = this.model.errorResponses;
1472
+ for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
1473
+ statusCode = _ref1[_j];
1474
+ this.addStatusCode(statusCode);
1475
+ }
1476
+ return this;
1477
+ };
1478
+
1479
+ OperationView.prototype.addParameter = function(param) {
1480
+ var paramView;
1481
+ paramView = new ParameterView({
1482
+ model: param,
1483
+ tagName: 'tr',
1484
+ readOnly: this.model.isReadOnly
1485
+ });
1486
+ return $('.operation-params', $(this.el)).append(paramView.render().el);
1487
+ };
1488
+
1489
+ OperationView.prototype.addStatusCode = function(statusCode) {
1490
+ var statusCodeView;
1491
+ statusCodeView = new StatusCodeView({
1492
+ model: statusCode,
1493
+ tagName: 'tr'
1494
+ });
1495
+ return $('.operation-status', $(this.el)).append(statusCodeView.render().el);
1496
+ };
1497
+
1498
+ OperationView.prototype.submitOperation = function(e) {
1499
+ 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,
1500
+ _this = this;
1501
+ if (e != null) {
1502
+ e.preventDefault();
1503
+ }
1504
+ form = $('.sandbox', $(this.el));
1505
+ error_free = true;
1506
+ form.find("input.required").each(function() {
1507
+ var _this = this;
1508
+ $(this).removeClass("error");
1509
+ if (jQuery.trim($(this).val()) === "") {
1510
+ $(this).addClass("error");
1511
+ $(this).wiggle({
1512
+ callback: function() {
1513
+ return $(_this).focus();
1514
+ }
1515
+ });
1516
+ return error_free = false;
1517
+ }
1518
+ });
1519
+ if (error_free) {
1520
+ map = {};
1521
+ _ref = form.serializeArray();
1522
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1523
+ o = _ref[_i];
1524
+ if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1525
+ map[o.name] = o.value;
1526
+ }
1527
+ }
1528
+ isFileUpload = form.children().find('input[type~="file"]').size() !== 0;
1529
+ isFormPost = false;
1530
+ consumes = "application/json";
1531
+ if (this.model.consumes && this.model.consumes.length > 0) {
1532
+ consumes = this.model.consumes[0];
1533
+ } else {
1534
+ _ref1 = this.model.parameters;
1535
+ for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
1536
+ o = _ref1[_j];
1537
+ if (o.paramType === 'form') {
1538
+ isFormPost = true;
1539
+ consumes = false;
1540
+ }
1541
+ }
1542
+ if (isFileUpload) {
1543
+ consumes = false;
1544
+ } else if (this.model.httpMethod.toLowerCase() === "post" && isFormPost === false) {
1545
+ consumes = "application/json";
1546
+ }
1547
+ }
1548
+ if (isFileUpload) {
1549
+ bodyParam = new FormData();
1550
+ _ref2 = this.model.parameters;
1551
+ for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1552
+ param = _ref2[_k];
1553
+ if (param.paramType === 'body' && param.name !== 'file') {
1554
+ bodyParam.append(param.name, map[param.name]);
1555
+ }
1556
+ }
1557
+ $.each(form.children().find('input[type~="file"]'), function(i, el) {
1558
+ return bodyParam.append($(el).attr('name'), el.files[0]);
1559
+ });
1560
+ console.log(bodyParam);
1561
+ } else if (isFormPost) {
1562
+ bodyParam = new FormData();
1563
+ _ref3 = this.model.parameters;
1564
+ for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
1565
+ param = _ref3[_l];
1566
+ bodyParam.append(param.name, map[param.name]);
1567
+ }
1568
+ } else {
1569
+ bodyParam = null;
1570
+ _ref4 = this.model.parameters;
1571
+ for (_m = 0, _len4 = _ref4.length; _m < _len4; _m++) {
1572
+ param = _ref4[_m];
1573
+ if (param.paramType === 'body') {
1574
+ bodyParam = map[param.name];
1575
+ }
1576
+ }
1577
+ }
1578
+ log("bodyParam = " + bodyParam);
1579
+ headerParams = null;
1580
+ invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), this.model.urlify(map, false)) : this.model.urlify(map, true);
1581
+ log('submitting ' + invocationUrl);
1582
+ $(".request_url", $(this.el)).html("<pre>" + invocationUrl + "</pre>");
1583
+ $(".response_throbber", $(this.el)).show();
1584
+ obj = {
1585
+ type: this.model.httpMethod,
1586
+ url: invocationUrl,
1587
+ headers: headerParams,
1588
+ data: bodyParam,
1589
+ contentType: consumes,
1590
+ dataType: 'json',
1591
+ processData: false,
1592
+ error: function(xhr, textStatus, error) {
1593
+ return _this.showErrorStatus(xhr, textStatus, error);
1594
+ },
1595
+ success: function(data) {
1596
+ return _this.showResponse(data);
1597
+ },
1598
+ complete: function(data) {
1599
+ return _this.showCompleteStatus(data);
1600
+ }
1601
+ };
1602
+ paramContentTypeField = $("td select[name=contentType]", $(this.el)).val();
1603
+ if (paramContentTypeField) {
1604
+ obj.contentType = paramContentTypeField;
1605
+ }
1606
+ responseContentTypeField = $('.content > .content-type > div > select[name=contentType]', $(this.el)).val();
1607
+ if (responseContentTypeField) {
1608
+ obj.headers = obj.headers != null ? obj.headers : {};
1609
+ obj.headers.accept = responseContentTypeField;
1610
+ }
1611
+ jQuery.ajax(obj);
1612
+ return false;
1613
+ }
1614
+ };
1615
+
1616
+ OperationView.prototype.hideResponse = function(e) {
1617
+ if (e != null) {
1618
+ e.preventDefault();
1619
+ }
1620
+ $(".response", $(this.el)).slideUp();
1621
+ return $(".response_hider", $(this.el)).fadeOut();
1622
+ };
1623
+
1624
+ OperationView.prototype.showResponse = function(response) {
1625
+ var prettyJson;
1626
+ prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>");
1627
+ return $(".response_body", $(this.el)).html(escape(prettyJson));
1628
+ };
1629
+
1630
+ OperationView.prototype.showErrorStatus = function(data) {
1631
+ return this.showStatus(data);
1632
+ };
1633
+
1634
+ OperationView.prototype.showCompleteStatus = function(data) {
1635
+ return this.showStatus(data);
1636
+ };
1637
+
1638
+ OperationView.prototype.formatXml = function(xml) {
1639
+ var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
1640
+ reg = /(>)(<)(\/*)/g;
1641
+ wsexp = /[ ]*(.*)[ ]+\n/g;
1642
+ contexp = /(<.+>)(.+\n)/g;
1643
+ xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
1644
+ pad = 0;
1645
+ formatted = '';
1646
+ lines = xml.split('\n');
1647
+ indent = 0;
1648
+ lastType = 'other';
1649
+ transitions = {
1650
+ 'single->single': 0,
1651
+ 'single->closing': -1,
1652
+ 'single->opening': 0,
1653
+ 'single->other': 0,
1654
+ 'closing->single': 0,
1655
+ 'closing->closing': -1,
1656
+ 'closing->opening': 0,
1657
+ 'closing->other': 0,
1658
+ 'opening->single': 1,
1659
+ 'opening->closing': 0,
1660
+ 'opening->opening': 1,
1661
+ 'opening->other': 1,
1662
+ 'other->single': 0,
1663
+ 'other->closing': -1,
1664
+ 'other->opening': 0,
1665
+ 'other->other': 0
1666
+ };
1667
+ _fn = function(ln) {
1668
+ var fromTo, j, key, padding, type, types, value;
1669
+ types = {
1670
+ single: Boolean(ln.match(/<.+\/>/)),
1671
+ closing: Boolean(ln.match(/<\/.+>/)),
1672
+ opening: Boolean(ln.match(/<[^!?].*>/))
1673
+ };
1674
+ type = ((function() {
1675
+ var _results;
1676
+ _results = [];
1677
+ for (key in types) {
1678
+ value = types[key];
1679
+ if (value) {
1680
+ _results.push(key);
1681
+ }
1682
+ }
1683
+ return _results;
1684
+ })())[0];
1685
+ type = type === void 0 ? 'other' : type;
1686
+ fromTo = lastType + '->' + type;
1687
+ lastType = type;
1688
+ padding = '';
1689
+ indent += transitions[fromTo];
1690
+ padding = ((function() {
1691
+ var _j, _ref, _results;
1692
+ _results = [];
1693
+ for (j = _j = 0, _ref = indent; 0 <= _ref ? _j < _ref : _j > _ref; j = 0 <= _ref ? ++_j : --_j) {
1694
+ _results.push(' ');
1695
+ }
1696
+ return _results;
1697
+ })()).join('');
1698
+ if (fromTo === 'opening->closing') {
1699
+ return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
1700
+ } else {
1701
+ return formatted += padding + ln + '\n';
1702
+ }
1703
+ };
1704
+ for (_i = 0, _len = lines.length; _i < _len; _i++) {
1705
+ ln = lines[_i];
1706
+ _fn(ln);
1707
+ }
1708
+ return formatted;
1709
+ };
1710
+
1711
+ OperationView.prototype.showStatus = function(data) {
1712
+ var code, pre, response_body;
1713
+ try {
1714
+ code = $('<code />').text(JSON.stringify(JSON.parse(data.responseText), null, 2));
1715
+ pre = $('<pre class="json" />').append(code);
1716
+ } catch (error) {
1717
+ code = $('<code />').text(this.formatXml(data.responseText));
1718
+ pre = $('<pre class="xml" />').append(code);
1719
+ }
1720
+ response_body = pre;
1721
+ $(".response_code", $(this.el)).html("<pre>" + data.status + "</pre>");
1722
+ $(".response_body", $(this.el)).html(response_body);
1723
+ $(".response_headers", $(this.el)).html("<pre>" + data.getAllResponseHeaders() + "</pre>");
1724
+ $(".response", $(this.el)).slideDown();
1725
+ $(".response_hider", $(this.el)).show();
1726
+ $(".response_throbber", $(this.el)).hide();
1727
+ return hljs.highlightBlock($('.response_body', $(this.el))[0]);
1728
+ };
1729
+
1730
+ OperationView.prototype.toggleOperationContent = function() {
1731
+ var elem;
1732
+ elem = $('#' + this.model.resourceName + "_" + this.model.nickname + "_" + this.model.httpMethod + "_" + this.model.number + "_content");
1733
+ if (elem.is(':visible')) {
1734
+ return Docs.collapseOperation(elem);
1735
+ } else {
1736
+ return Docs.expandOperation(elem);
1737
+ }
1738
+ };
1739
+
1740
+ return OperationView;
1741
+
1742
+ })(Backbone.View);
1743
+
1744
+ StatusCodeView = (function(_super) {
1745
+
1746
+ __extends(StatusCodeView, _super);
1747
+
1748
+ function StatusCodeView() {
1749
+ return StatusCodeView.__super__.constructor.apply(this, arguments);
1750
+ }
1751
+
1752
+ StatusCodeView.prototype.initialize = function() {};
1753
+
1754
+ StatusCodeView.prototype.render = function() {
1755
+ var template;
1756
+ template = this.template();
1757
+ $(this.el).html(template(this.model));
1758
+ return this;
1759
+ };
1760
+
1761
+ StatusCodeView.prototype.template = function() {
1762
+ return Handlebars.templates.status_code;
1763
+ };
1764
+
1765
+ return StatusCodeView;
1766
+
1767
+ })(Backbone.View);
1768
+
1769
+ ParameterView = (function(_super) {
1770
+
1771
+ __extends(ParameterView, _super);
1772
+
1773
+ function ParameterView() {
1774
+ return ParameterView.__super__.constructor.apply(this, arguments);
1775
+ }
1776
+
1777
+ ParameterView.prototype.initialize = function() {};
1778
+
1779
+ ParameterView.prototype.render = function() {
1780
+ var contentTypeModel, contentTypeView, signatureModel, signatureView, template;
1781
+ if (this.model.paramType === 'body') {
1782
+ this.model.isBody = true;
1783
+ }
1784
+ if (this.model.dataType === 'file') {
1785
+ this.model.isFile = true;
1786
+ }
1787
+ template = this.template();
1788
+ $(this.el).html(template(this.model));
1789
+ signatureModel = {
1790
+ sampleJSON: this.model.sampleJSON,
1791
+ isParam: true,
1792
+ signature: this.model.signature
1793
+ };
1794
+ if (this.model.sampleJSON) {
1795
+ signatureView = new SignatureView({
1796
+ model: signatureModel,
1797
+ tagName: 'div'
1798
+ });
1799
+ $('.model-signature', $(this.el)).append(signatureView.render().el);
1800
+ } else {
1801
+ $('.model-signature', $(this.el)).html(this.model.signature);
1802
+ }
1803
+ contentTypeModel = {
1804
+ isParam: false
1805
+ };
1806
+ if (this.model.supportedContentTypes) {
1807
+ contentTypeModel.produces = this.model.supportedContentTypes;
1808
+ }
1809
+ if (this.model.produces) {
1810
+ contentTypeModel.produces = this.model.produces;
1811
+ }
1812
+ contentTypeView = new ContentTypeView({
1813
+ model: contentTypeModel
1814
+ });
1815
+ $('.content-type', $(this.el)).append(contentTypeView.render().el);
1816
+ return this;
1817
+ };
1818
+
1819
+ ParameterView.prototype.template = function() {
1820
+ if (this.model.isList) {
1821
+ return Handlebars.templates.param_list;
1822
+ } else {
1823
+ if (this.options.readOnly) {
1824
+ if (this.model.required) {
1825
+ return Handlebars.templates.param_readonly_required;
1826
+ } else {
1827
+ return Handlebars.templates.param_readonly;
1828
+ }
1829
+ } else {
1830
+ if (this.model.required) {
1831
+ return Handlebars.templates.param_required;
1832
+ } else {
1833
+ return Handlebars.templates.param;
1834
+ }
1835
+ }
1836
+ }
1837
+ };
1838
+
1839
+ return ParameterView;
1840
+
1841
+ })(Backbone.View);
1842
+
1843
+ SignatureView = (function(_super) {
1844
+
1845
+ __extends(SignatureView, _super);
1846
+
1847
+ function SignatureView() {
1848
+ return SignatureView.__super__.constructor.apply(this, arguments);
1849
+ }
1850
+
1851
+ SignatureView.prototype.events = {
1852
+ 'click a.description-link': 'switchToDescription',
1853
+ 'click a.snippet-link': 'switchToSnippet',
1854
+ 'mousedown .snippet': 'snippetToTextArea'
1855
+ };
1856
+
1857
+ SignatureView.prototype.initialize = function() {};
1858
+
1859
+ SignatureView.prototype.render = function() {
1860
+ var template;
1861
+ template = this.template();
1862
+ $(this.el).html(template(this.model));
1863
+ this.switchToDescription();
1864
+ this.isParam = this.model.isParam;
1865
+ if (this.isParam) {
1866
+ $('.notice', $(this.el)).text('Click to set as parameter value');
1867
+ }
1868
+ return this;
1869
+ };
1870
+
1871
+ SignatureView.prototype.template = function() {
1872
+ return Handlebars.templates.signature;
1873
+ };
1874
+
1875
+ SignatureView.prototype.switchToDescription = function(e) {
1876
+ if (e != null) {
1877
+ e.preventDefault();
1878
+ }
1879
+ $(".snippet", $(this.el)).hide();
1880
+ $(".description", $(this.el)).show();
1881
+ $('.description-link', $(this.el)).addClass('selected');
1882
+ return $('.snippet-link', $(this.el)).removeClass('selected');
1883
+ };
1884
+
1885
+ SignatureView.prototype.switchToSnippet = function(e) {
1886
+ if (e != null) {
1887
+ e.preventDefault();
1888
+ }
1889
+ $(".description", $(this.el)).hide();
1890
+ $(".snippet", $(this.el)).show();
1891
+ $('.snippet-link', $(this.el)).addClass('selected');
1892
+ return $('.description-link', $(this.el)).removeClass('selected');
1893
+ };
1894
+
1895
+ SignatureView.prototype.snippetToTextArea = function(e) {
1896
+ var textArea;
1897
+ if (this.isParam) {
1898
+ if (e != null) {
1899
+ e.preventDefault();
1900
+ }
1901
+ textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
1902
+ if ($.trim(textArea.val()) === '') {
1903
+ return textArea.val(this.model.sampleJSON);
1904
+ }
1905
+ }
1906
+ };
1907
+
1908
+ return SignatureView;
1909
+
1910
+ })(Backbone.View);
1911
+
1912
+ ContentTypeView = (function(_super) {
1913
+
1914
+ __extends(ContentTypeView, _super);
1915
+
1916
+ function ContentTypeView() {
1917
+ return ContentTypeView.__super__.constructor.apply(this, arguments);
1918
+ }
1919
+
1920
+ ContentTypeView.prototype.initialize = function() {};
1921
+
1922
+ ContentTypeView.prototype.render = function() {
1923
+ var template;
1924
+ template = this.template();
1925
+ $(this.el).html(template(this.model));
1926
+ this.isParam = this.model.isParam;
1927
+ if (this.isParam) {
1928
+ $('label[for=contentType]', $(this.el)).text('Parameter content type:');
1929
+ } else {
1930
+ $('label[for=contentType]', $(this.el)).text('Response Content Type');
1931
+ }
1932
+ return this;
1933
+ };
1934
+
1935
+ ContentTypeView.prototype.template = function() {
1936
+ return Handlebars.templates.content_type;
1937
+ };
1938
+
1939
+ return ContentTypeView;
1940
+
1941
+ })(Backbone.View);
1942
+
1943
+ }).call(this);