camaleon_cms 2.0.4.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of camaleon_cms might be problematic. Click here for more details.

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