joosy 1.2.0.beta.4 → 1.2.0.rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.codoopts +1 -1
  3. data/Gruntfile.coffee +3 -3
  4. data/README.md +4 -0
  5. data/bower.json +1 -1
  6. data/build/joosy.js +2 -2
  7. data/build/joosy/form.js +1 -1
  8. data/build/joosy/resources.js +1 -1
  9. data/package.json +2 -2
  10. data/source/joosy/application.coffee +2 -2
  11. data/source/joosy/form.coffee +4 -4
  12. data/source/joosy/helpers/form.coffee +12 -3
  13. data/source/joosy/helpers/index.coffee +0 -1
  14. data/source/joosy/helpers/view.coffee +16 -3
  15. data/source/joosy/layout.coffee +0 -4
  16. data/source/joosy/module.coffee +16 -1
  17. data/source/joosy/modules/dom.coffee +106 -101
  18. data/source/joosy/modules/events.coffee +44 -10
  19. data/source/joosy/modules/filters.coffee +64 -60
  20. data/source/joosy/modules/page.coffee +3 -0
  21. data/source/joosy/modules/page/scrolling.coffee +46 -29
  22. data/source/joosy/modules/page/title.coffee +14 -0
  23. data/source/joosy/modules/renderer.coffee +219 -190
  24. data/source/joosy/modules/resources.coffee +3 -0
  25. data/source/joosy/modules/resources/cacher.coffee +81 -10
  26. data/source/joosy/modules/resources/function.coffee +26 -29
  27. data/source/joosy/modules/resources/identity_map.coffee +64 -42
  28. data/source/joosy/modules/resources/model.coffee +127 -73
  29. data/source/joosy/modules/time_manager.coffee +2 -0
  30. data/source/joosy/page.coffee +3 -6
  31. data/source/joosy/resources/array.coffee +87 -2
  32. data/source/joosy/resources/hash.coffee +53 -1
  33. data/source/joosy/resources/rest.coffee +59 -3
  34. data/source/joosy/resources/scalar.coffee +47 -1
  35. data/source/joosy/router.coffee +63 -21
  36. data/source/joosy/templaters/jst.coffee +3 -0
  37. data/source/joosy/widget.coffee +17 -11
  38. data/spec/joosy/core/helpers/view_spec.coffee +14 -0
  39. data/spec/joosy/core/modules/dom_spec.coffee +1 -1
  40. data/spec/joosy/core/modules/filters_spec.coffee +2 -2
  41. data/spec/joosy/core/modules/module_spec.coffee +1 -1
  42. data/spec/joosy/core/modules/renderer_spec.coffee +19 -1
  43. data/spec/joosy/core/router_spec.coffee +80 -45
  44. data/spec/joosy/core/widget_spec.coffee +9 -0
  45. data/spec/joosy/resources/modules/cacher_spec.coffee +3 -3
  46. data/spec/joosy/resources/modules/function_spec.coffee +2 -2
  47. data/spec/joosy/resources/modules/identity_map_spec.coffee +2 -2
  48. data/spec/joosy/resources/modules/model_spec.coffee +1 -1
  49. metadata +2 -5
  50. data/source/joosy/helpers/routes.coffee +0 -17
  51. data/source/joosy/modules/widgets_manager.coffee +0 -90
  52. data/spec/joosy/core/helpers/routes_spec.coffee +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10adb0d6b43ebfb3e644dd8b792ee3a4c029e255
4
- data.tar.gz: 4783c2624ca52c8fa1b5d7e0e058180e6fdf1123
3
+ metadata.gz: d28529aaa7ecbcfbf263aa5bd6bc108eebbeda34
4
+ data.tar.gz: 9225b2aa9696afcb4c0ba9798f1e28d5b51c8978
5
5
  SHA512:
6
- metadata.gz: eb988dd1b1c2bfcf07f15be830930c09e1bfa2fad67b95b0b57df61e1f0d61cccd3649253d4173ddd0b4843b90fc44c604527e4cf858db7e9bbbb28f42e1d889
7
- data.tar.gz: dd84f8d265b11cb8cb6bbbd3127bfeee8182559155823a86bcfda01e7d0d62622585a99c1768c0847276cfc8938e1102a06b70dbb5de7f8c99ece28c1a03fd31
6
+ metadata.gz: a2f9b9155e327833f17ca1dc96a8871c93862d3853c00d61060d4b696e83f205537a36a7d60d393e20f5505b42c7f001a0f02144caba9436f82f4a446e9735c2
7
+ data.tar.gz: b68271c59052fcf912994c0653b714dc34650a927abc6106d26a762a4581e771a6551460cd436d6104c9c573df2f4a5cf3ef65b76cd99be66b17c034c62f6a3b
data/.codoopts CHANGED
@@ -1,2 +1,2 @@
1
- --output-dir ./doc.tmp
1
+ --output ./doc.tmp
2
2
  source
@@ -146,12 +146,12 @@ module.exports = (grunt) ->
146
146
 
147
147
  grunt.registerTask 'compile', ['bowerize', 'grill:compile', 'uglify']
148
148
 
149
- grunt.registerTask 'test', ->
149
+ grunt.registerTask 'spec', ->
150
150
  grunt.task.run 'coffeelint'
151
151
  grunt.task.run if @args[0] then "testem:run:#{@args[0]}" else 'testem'
152
152
 
153
153
  grunt.registerTask 'publish', [
154
- 'test',
154
+ 'spec',
155
155
  'compile',
156
156
  'ensureCommits',
157
157
  'gh-pages',
@@ -214,7 +214,7 @@ module.exports = (grunt) ->
214
214
  return undefined unless version
215
215
  moment(grunt.file.read "doc/#{version}/DATE").format "D MMMM YYYY"
216
216
 
217
- args = ['source', '--output-dir', destination]
217
+ args = ['source', '--output', destination]
218
218
  grunt.file.delete destination if grunt.file.exists destination
219
219
 
220
220
  grunt.util.spawn {cmd: "codo", args: args, opts: {stdio: [0,1,2]}}, (error, result) ->
data/README.md CHANGED
@@ -110,3 +110,7 @@ environment is Node.js.
110
110
  Copyright 2011-2013 [Boris Staal](http://staal.io)
111
111
 
112
112
  It is free software, and may be redistributed under the terms of MIT license.
113
+
114
+
115
+ [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/joosy/joosy/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
116
+
data/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joosy",
3
- "version": "1.2.0-beta.4",
3
+ "version": "1.2.0-rc.1",
4
4
  "main": "build/joosy.js",
5
5
  "ignore": [
6
6
  "lib",
@@ -1,2 +1,2 @@
1
- !function(a){"function"==typeof YUI?YUI.add("es5",a):a()}(function(){function a(){}function b(a){return a=+a,a!==a?a=0:0!==a&&a!==1/0&&a!==-(1/0)&&(a=(a>0||-1)*Math.floor(Math.abs(a))),a}function c(a){var b=typeof a;return null===a||"undefined"===b||"boolean"===b||"number"===b||"string"===b}function d(a){var b,d,e;if(c(a))return a;if(d=a.valueOf,"function"==typeof d&&(b=d.call(a),c(b)))return b;if(e=a.toString,"function"==typeof e&&(b=e.call(a),c(b)))return b;throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if("function"!=typeof c)throw new TypeError("Function.prototype.bind called on incompatible "+c);var d=m.call(arguments,1),e=function(){if(this instanceof e){var a=c.apply(this,d.concat(m.call(arguments)));return Object(a)===a?a:this}return c.apply(b,d.concat(m.call(arguments)))};return c.prototype&&(a.prototype=c.prototype,e.prototype=new a,a.prototype=null),e});var e,f,g,h,i,j=Function.prototype.call,k=Array.prototype,l=Object.prototype,m=k.slice,n=j.bind(l.toString),o=j.bind(l.hasOwnProperty);if((i=o(l,"__defineGetter__"))&&(e=j.bind(l.__defineGetter__),f=j.bind(l.__defineSetter__),g=j.bind(l.__lookupGetter__),h=j.bind(l.__lookupSetter__)),2!=[1,2].splice(0).length){var p=Array.prototype.splice;Array.prototype.splice=function(){function a(a){for(var b=[];a--;)b.unshift(a);return b}var b,c=[];return c.splice.bind(c,0,0).apply(null,a(20)),c.splice.bind(c,0,0).apply(null,a(26)),b=c.length,c.splice(5,0,"XXX"),b+1==c.length?!0:void 0}()?function(a,b){return arguments.length?p.apply(this,[void 0===a?0:a,void 0===b?this.length-a:b].concat(m.call(arguments,2))):[]}:function(a,b){var c,d=m.call(arguments,2),e=d.length;if(!arguments.length)return[];if(void 0===a&&(a=0),void 0===b&&(b=this.length-a),e>0){if(0>=b){if(a==this.length)return this.push.apply(this,d),[];if(0==a)return this.unshift.apply(this,d),[]}return c=m.call(this,a,a+b),d.push.apply(d,m.call(this,a+b,this.length)),d.unshift.apply(d,m.call(this,0,a)),d.unshift(0,this.length),p.apply(this,d),c}return p.call(this,a,b)}}if(1!=[].unshift(0)){var q=Array.prototype.unshift;Array.prototype.unshift=function(){return q.apply(this,arguments),this.length}}Array.isArray||(Array.isArray=function(a){return"[object Array]"==n(a)});var r=Object("a"),s="a"!=r[0]||!(0 in r);if(Array.prototype.forEach||(Array.prototype.forEach=function(a){var b=G(this),c=s&&"[object String]"==n(this)?this.split(""):b,d=arguments[1],e=-1,f=c.length>>>0;if("[object Function]"!=n(a))throw new TypeError;for(;++e<f;)e in c&&a.call(d,c[e],e,b)}),Array.prototype.map||(Array.prototype.map=function(a){var b=G(this),c=s&&"[object String]"==n(this)?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if("[object Function]"!=n(a))throw new TypeError(a+" is not a function");for(var g=0;d>g;g++)g in c&&(e[g]=a.call(f,c[g],g,b));return e}),Array.prototype.filter||(Array.prototype.filter=function(a){var b,c=G(this),d=s&&"[object String]"==n(this)?this.split(""):c,e=d.length>>>0,f=[],g=arguments[1];if("[object Function]"!=n(a))throw new TypeError(a+" is not a function");for(var h=0;e>h;h++)h in d&&(b=d[h],a.call(g,b,h,c)&&f.push(b));return f}),Array.prototype.every||(Array.prototype.every=function(a){var b=G(this),c=s&&"[object String]"==n(this)?this.split(""):b,d=c.length>>>0,e=arguments[1];if("[object Function]"!=n(a))throw new TypeError(a+" is not a function");for(var f=0;d>f;f++)if(f in c&&!a.call(e,c[f],f,b))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(a){var b=G(this),c=s&&"[object String]"==n(this)?this.split(""):b,d=c.length>>>0,e=arguments[1];if("[object Function]"!=n(a))throw new TypeError(a+" is not a function");for(var f=0;d>f;f++)if(f in c&&a.call(e,c[f],f,b))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(a){var b=G(this),c=s&&"[object String]"==n(this)?this.split(""):b,d=c.length>>>0;if("[object Function]"!=n(a))throw new TypeError(a+" is not a function");if(!d&&1==arguments.length)throw new TypeError("reduce of empty array with no initial value");var e,f=0;if(arguments.length>=2)e=arguments[1];else for(;;){if(f in c){e=c[f++];break}if(++f>=d)throw new TypeError("reduce of empty array with no initial value")}for(;d>f;f++)f in c&&(e=a.call(void 0,e,c[f],f,b));return e}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(a){var b=G(this),c=s&&"[object String]"==n(this)?this.split(""):b,d=c.length>>>0;if("[object Function]"!=n(a))throw new TypeError(a+" is not a function");if(!d&&1==arguments.length)throw new TypeError("reduceRight of empty array with no initial value");var e,f=d-1;if(arguments.length>=2)e=arguments[1];else for(;;){if(f in c){e=c[f--];break}if(--f<0)throw new TypeError("reduceRight of empty array with no initial value")}if(0>f)return e;do f in this&&(e=a.call(void 0,e,c[f],f,b));while(f--);return e}),Array.prototype.indexOf&&-1==[0,1].indexOf(1,2)||(Array.prototype.indexOf=function(a){var c=s&&"[object String]"==n(this)?this.split(""):G(this),d=c.length>>>0;if(!d)return-1;var e=0;for(arguments.length>1&&(e=b(arguments[1])),e=e>=0?e:Math.max(0,d+e);d>e;e++)if(e in c&&c[e]===a)return e;return-1}),Array.prototype.lastIndexOf&&-1==[0,1].lastIndexOf(0,-3)||(Array.prototype.lastIndexOf=function(a){var c=s&&"[object String]"==n(this)?this.split(""):G(this),d=c.length>>>0;if(!d)return-1;var e=d-1;for(arguments.length>1&&(e=Math.min(e,b(arguments[1]))),e=e>=0?e:d-Math.abs(e);e>=0;e--)if(e in c&&a===c[e])return e;return-1}),!Object.keys){var t=!0,u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],v=u.length;for(var w in{toString:null})t=!1;Object.keys=function H(a){if("object"!=typeof a&&"function"!=typeof a||null===a)throw new TypeError("Object.keys called on a non-object");var H=[];for(var b in a)o(a,b)&&H.push(b);if(t)for(var c=0,d=v;d>c;c++){var e=u[c];o(a,e)&&H.push(e)}return H}}var x=-621987552e5,y="-000001";Date.prototype.toISOString&&-1!==new Date(x).toISOString().indexOf(y)||(Date.prototype.toISOString=function(){var a,b,c,d,e;if(!isFinite(this))throw new RangeError("Date.prototype.toISOString called on non-finite value.");for(d=this.getUTCFullYear(),e=this.getUTCMonth(),d+=Math.floor(e/12),e=(e%12+12)%12,a=[e+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()],d=(0>d?"-":d>9999?"+":"")+("00000"+Math.abs(d)).slice(d>=0&&9999>=d?-4:-6),b=a.length;b--;)c=a[b],10>c&&(a[b]="0"+c);return d+"-"+a.slice(0,2).join("-")+"T"+a.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"});var z=!1;try{z=Date.prototype.toJSON&&null===new Date(0/0).toJSON()&&-1!==new Date(x).toJSON().indexOf(y)&&Date.prototype.toJSON.call({toISOString:function(){return!0}})}catch(A){}z||(Date.prototype.toJSON=function(){var a,b=Object(this),c=d(b);if("number"==typeof c&&!isFinite(c))return null;if(a=b.toISOString,"function"!=typeof a)throw new TypeError("toISOString property is not callable");return a.call(b)}),Date=function(a){function b(c,d,e,f,g,h,i){var j=arguments.length;if(this instanceof a){var k=1==j&&String(c)===c?new a(b.parse(c)):j>=7?new a(c,d,e,f,g,h,i):j>=6?new a(c,d,e,f,g,h):j>=5?new a(c,d,e,f,g):j>=4?new a(c,d,e,f):j>=3?new a(c,d,e):j>=2?new a(c,d):j>=1?new a(c):new a;return k.constructor=b,k}return a.apply(this,arguments)}function c(a,b){var c=b>1?1:0;return f[b]+Math.floor((a-1969+c)/4)-Math.floor((a-1901+c)/100)+Math.floor((a-1601+c)/400)+365*(a-1970)}function d(b){return Number(new a(1970,0,1,0,0,0,b))}var e=new RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:(\\.\\d{1,}))?)?(Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$"),f=[0,31,59,90,120,151,181,212,243,273,304,334,365];for(var g in a)b[g]=a[g];return b.now=a.now,b.UTC=a.UTC,b.prototype=a.prototype,b.prototype.constructor=b,b.parse=function(b){var f=e.exec(b);if(f){var g,h=Number(f[1]),i=Number(f[2]||1)-1,j=Number(f[3]||1)-1,k=Number(f[4]||0),l=Number(f[5]||0),m=Number(f[6]||0),n=Math.floor(1e3*Number(f[7]||0)),o=Boolean(f[4]&&!f[8]),p="-"===f[9]?1:-1,q=Number(f[10]||0),r=Number(f[11]||0);return(l>0||m>0||n>0?24:25)>k&&60>l&&60>m&&1e3>n&&i>-1&&12>i&&24>q&&60>r&&j>-1&&j<c(h,i+1)-c(h,i)&&(g=60*(24*(c(h,i)+j)+k+q*p),g=1e3*(60*(g+l+r*p)+m)+n,o&&(g=d(g)),g>=-864e13&&864e13>=g)?g:0/0}return a.parse.apply(this,arguments)},b}(Date),Date.now||(Date.now=function(){return(new Date).getTime()}),Number.prototype.toFixed&&"0.000"===8e-5.toFixed(3)&&"0"!==.9.toFixed(0)&&"1.25"===1.255.toFixed(2)&&"1000000000000000128"===0xde0b6b3a7640080.toFixed(0)||!function(){function a(a,b){for(var c=-1;++c<g;)b+=a*h[c],h[c]=b%f,b=Math.floor(b/f)}function b(a){for(var b=g,c=0;--b>=0;)c+=h[b],h[b]=Math.floor(c/a),c=c%a*f}function c(){for(var a=g,b="";--a>=0;)if(""!==b||0===a||0!==h[a]){var c=String(h[a]);""===b?b=c:b+="0000000".slice(0,7-c.length)+c}return b}function d(a,b,c){return 0===b?c:1===b%2?d(a,b-1,c*a):d(a*a,b/2,c)}function e(a){for(var b=0;a>=4096;)b+=12,a/=4096;for(;a>=2;)b+=1,a/=2;return b}var f,g,h;f=1e7,g=6,h=[0,0,0,0,0,0],Number.prototype.toFixed=function(f){var g,h,i,j,k,l,m,n;if(g=Number(f),g=g!==g?0:Math.floor(g),0>g||g>20)throw new RangeError("Number.toFixed called with invalid number of decimals");if(h=Number(this),h!==h)return"NaN";if(-1e21>=h||h>=1e21)return String(h);if(i="",0>h&&(i="-",h=-h),j="0",h>1e-21)if(k=e(h*d(2,69,1))-69,l=0>k?h*d(2,-k,1):h/d(2,k,1),l*=4503599627370496,k=52-k,k>0){for(a(0,l),m=g;m>=7;)a(1e7,0),m-=7;for(a(d(10,m,1),0),m=k-1;m>=23;)b(1<<23),m-=23;b(1<<m),a(1,1),b(2),j=c()}else a(0,l),a(1<<-k,0),j=c()+"0.00000000000000000000".slice(2,2+g);return g>0?(n=j.length,j=g>=n?i+"0.0000000000000000000".slice(0,g-n+2)+j:i+j.slice(0,n-g)+"."+j.slice(n-g)):j=i+j,j}}();var B=String.prototype.split;if(2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||0==="".split(/.?/).length||".".split(/()()/).length>1?!function(){var a=void 0===/()??/.exec("")[1];String.prototype.split=function(b,c){var d=this;if(void 0===b&&0===c)return[];if("[object RegExp]"!==Object.prototype.toString.call(b))return B.apply(this,arguments);var e,f,g,h,i=[],j=(b.ignoreCase?"i":"")+(b.multiline?"m":"")+(b.extended?"x":"")+(b.sticky?"y":""),k=0,b=new RegExp(b.source,j+"g");for(d+="",a||(e=new RegExp("^"+b.source+"$(?!\\s)",j)),c=void 0===c?-1>>>0:c>>>0;(f=b.exec(d))&&(g=f.index+f[0].length,!(g>k&&(i.push(d.slice(k,f.index)),!a&&f.length>1&&f[0].replace(e,function(){for(var a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(f[a]=void 0)}),f.length>1&&f.index<d.length&&Array.prototype.push.apply(i,f.slice(1)),h=f[0].length,k=g,i.length>=c)));)b.lastIndex===f.index&&b.lastIndex++;return k===d.length?(h||!b.test(""))&&i.push(""):i.push(d.slice(k)),i.length>c?i.slice(0,c):i}}():"0".split(void 0,0).length&&(String.prototype.split=function(a,b){return void 0===a&&0===b?[]:B.apply(this,arguments)}),"".substr&&"b"!=="0b".substr(-1)){var C=String.prototype.substr;String.prototype.substr=function(a,b){return C.call(this,0>a?(a=this.length+a)<0?0:a:a,b)}}var D=" \n \f\r   ᠎              \u2028\u2029";if(!String.prototype.trim||D.trim()){D="["+D+"]";var E=new RegExp("^"+D+D+"*"),F=new RegExp(D+D+"*$");String.prototype.trim=function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return String(this).replace(E,"").replace(F,"")}}var G=function(a){if(null==a)throw new TypeError("can't convert "+a+" to object");return Object(a)}}),function(a){var b=["equipment","information","rice","money","species","series","fish","sheep","moose","deer","news"],c=[[new RegExp("(m)en$","gi")],[new RegExp("(pe)ople$","gi")],[new RegExp("(child)ren$","gi")],[new RegExp("([ti])a$","gi")],[new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi")],[new RegExp("(hive)s$","gi")],[new RegExp("(tive)s$","gi")],[new RegExp("(curve)s$","gi")],[new RegExp("([lr])ves$","gi")],[new RegExp("([^fo])ves$","gi")],[new RegExp("([^aeiouy]|qu)ies$","gi")],[new RegExp("(s)eries$","gi")],[new RegExp("(m)ovies$","gi")],[new RegExp("(x|ch|ss|sh)es$","gi")],[new RegExp("([m|l])ice$","gi")],[new RegExp("(bus)es$","gi")],[new RegExp("(o)es$","gi")],[new RegExp("(shoe)s$","gi")],[new RegExp("(cris|ax|test)es$","gi")],[new RegExp("(octop|vir)i$","gi")],[new RegExp("(alias|status)es$","gi")],[new RegExp("^(ox)en","gi")],[new RegExp("(vert|ind)ices$","gi")],[new RegExp("(matr)ices$","gi")],[new RegExp("(quiz)zes$","gi")],[new RegExp("(m)an$","gi"),"$1en"],[new RegExp("(pe)rson$","gi"),"$1ople"],[new RegExp("(child)$","gi"),"$1ren"],[new RegExp("^(ox)$","gi"),"$1en"],[new RegExp("(ax|test)is$","gi"),"$1es"],[new RegExp("(octop|vir)us$","gi"),"$1i"],[new RegExp("(alias|status)$","gi"),"$1es"],[new RegExp("(bu)s$","gi"),"$1ses"],[new RegExp("(buffal|tomat|potat)o$","gi"),"$1oes"],[new RegExp("([ti])um$","gi"),"$1a"],[new RegExp("sis$","gi"),"ses"],[new RegExp("(?:([^f])fe|([lr])f)$","gi"),"$1$2ves"],[new RegExp("(hive)$","gi"),"$1s"],[new RegExp("([^aeiouy]|qu)y$","gi"),"$1ies"],[new RegExp("(x|ch|ss|sh)$","gi"),"$1es"],[new RegExp("(matr|vert|ind)ix|ex$","gi"),"$1ices"],[new RegExp("([m|l])ouse$","gi"),"$1ice"],[new RegExp("(quiz)$","gi"),"$1zes"],[new RegExp("s$","gi"),"s"],[new RegExp("$","gi"),"s"]],d=[[new RegExp("(m)an$","gi")],[new RegExp("(pe)rson$","gi")],[new RegExp("(child)$","gi")],[new RegExp("^(ox)$","gi")],[new RegExp("(ax|test)is$","gi")],[new RegExp("(octop|vir)us$","gi")],[new RegExp("(alias|status)$","gi")],[new RegExp("(bu)s$","gi")],[new RegExp("(buffal|tomat|potat)o$","gi")],[new RegExp("([ti])um$","gi")],[new RegExp("sis$","gi")],[new RegExp("(?:([^f])fe|([lr])f)$","gi")],[new RegExp("(hive)$","gi")],[new RegExp("([^aeiouy]|qu)y$","gi")],[new RegExp("(x|ch|ss|sh)$","gi")],[new RegExp("(matr|vert|ind)ix|ex$","gi")],[new RegExp("([m|l])ouse$","gi")],[new RegExp("(quiz)$","gi")],[new RegExp("(m)en$","gi"),"$1an"],[new RegExp("(pe)ople$","gi"),"$1rson"],[new RegExp("(child)ren$","gi"),"$1"],[new RegExp("([ti])a$","gi"),"$1um"],[new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi"),"$1$2sis"],[new RegExp("(hive)s$","gi"),"$1"],[new RegExp("(tive)s$","gi"),"$1"],[new RegExp("(curve)s$","gi"),"$1"],[new RegExp("([lr])ves$","gi"),"$1f"],[new RegExp("([^fo])ves$","gi"),"$1fe"],[new RegExp("([^aeiouy]|qu)ies$","gi"),"$1y"],[new RegExp("(s)eries$","gi"),"$1eries"],[new RegExp("(m)ovies$","gi"),"$1ovie"],[new RegExp("(x|ch|ss|sh)es$","gi"),"$1"],[new RegExp("([m|l])ice$","gi"),"$1ouse"],[new RegExp("(bus)es$","gi"),"$1"],[new RegExp("(o)es$","gi"),"$1"],[new RegExp("(shoe)s$","gi"),"$1"],[new RegExp("(cris|ax|test)es$","gi"),"$1is"],[new RegExp("(octop|vir)i$","gi"),"$1us"],[new RegExp("(alias|status)es$","gi"),"$1"],[new RegExp("^(ox)en","gi"),"$1"],[new RegExp("(vert|ind)ices$","gi"),"$1ex"],[new RegExp("(matr)ices$","gi"),"$1ix"],[new RegExp("(quiz)zes$","gi"),"$1"],[new RegExp("ss$","gi"),"ss"],[new RegExp("s$","gi"),""]],e=["and","or","nor","a","an","the","so","but","to","of","at","by","from","into","on","onto","off","out","in","over","with","for"],f=new RegExp("(_ids|_id)$","g"),g=new RegExp("_","g"),h=new RegExp("[ _]","g"),i=new RegExp("([A-Z])","g"),j=new RegExp("^_"),k={_apply_rules:function(a,b,c,d){if(d)a=d;else{var e=k.indexOf(c,a.toLowerCase())>-1;if(!e)for(var f=0,g=b.length;g>f;f++)if(a.match(b[f][0])){void 0!==b[f][1]&&(a=a.replace(b[f][0],b[f][1]));break}}return a},indexOf:function(a,b,c,d){c||(c=-1);for(var e=-1,f=c,g=a.length;g>f;f++)if(a[f]===b||d&&d(a[f],b)){e=f;break}return e},pluralize:function(a,d){return k._apply_rules(a,c,b,d)},singularize:function(a,c){return k._apply_rules(a,d,b,c)},camelize:function(a,b){for(var c=a.toLowerCase().split("/"),d=0,e=c.length;e>d;d++){for(var f=c[d].split("_"),g=b&&d+1===e?1:0,h=g,i=f.length;i>h;h++)f[h]=f[h].charAt(0).toUpperCase()+f[h].substring(1);c[d]=f.join("")}return c.join("::")},underscore:function(a,b){if(b&&a===a.toUpperCase())return a;for(var c=a.split("::"),d=0,e=c.length;e>d;d++)c[d]=c[d].replace(i,"_$1"),c[d]=c[d].replace(j,"");return c.join("/").toLowerCase()},humanize:function(a,b){return a=a.toLowerCase(),a=a.replace(f,""),a=a.replace(g," "),b||(a=k.capitalize(a)),a},capitalize:function(a){return a=a.toLowerCase(),a.substring(0,1).toUpperCase()+a.substring(1)},dasherize:function(a){return a.replace(h,"-")},titleize:function(a){a=a.toLowerCase().replace(g," ");for(var b=a.split(" "),c=0,d=b.length;d>c;c++){for(var f=b[c].split("-"),h=0,i=f.length;i>h;h++)k.indexOf(e,f[h].toLowerCase())<0&&(f[h]=k.capitalize(f[h]));b[c]=f.join("-")}return a=b.join(" "),a=a.substring(0,1).toUpperCase()+a.substring(1)},demodulize:function(a){var b=a.split("::");return b[b.length-1]},tableize:function(a){return a=k.underscore(a),a=k.pluralize(a)},classify:function(a){return a=k.camelize(a),a=k.singularize(a)},foreign_key:function(a,b){return a=k.demodulize(a),a=k.underscore(a)+(b?"":"_")+"id"},ordinalize:function(a){for(var b=a.split(" "),c=0,d=b.length;d>c;c++){var e=parseInt(b[c],10);if(!isNaN(e)){var f=b[c].substring(b[c].length-2),g=b[c].substring(b[c].length-1),h="th";"11"!=f&&"12"!=f&&"13"!=f&&("1"===g?h="st":"2"===g?h="nd":"3"===g&&(h="rd")),b[c]+=h}}return b.join(" ")}};return"undefined"==typeof exports?a.inflection=k:(k.version="1.2.5",module.exports=k,void 0)}(this),function(){this.Joosy={Modules:{},Resources:{},Templaters:{},Helpers:{},Events:{},debug:function(a){return null!=a?this.__debug=a:!!this.__debug},templater:function(a){if(null!=a)return this.__templater=a;if(!this.__templater)throw new Error("No templater registered");return this.__templater},namespace:function(a,b){var c,d,e,f,g,h,i;for(null==b&&(b=!1),a=a.split("."),f=window,g=0,h=a.length;h>g;g++)e=a[g],e.length>0&&(f=null!=f[e]?f[e]:f[e]={});b&&(b=b.apply(f)),i=[];for(c in f)d=f[c],f.hasOwnProperty(c)&&Joosy.Module.hasAncestor(d,Joosy.Module)?i.push(d.__namespace__=a):i.push(void 0);return i},helpers:function(a,b){var c;return(c=Joosy.Helpers)[a]||(c[a]={}),b.apply(Joosy.Helpers[a])},uid:function(){return this.__uid||(this.__uid=0),"__joosy"+this.__uid++},uuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b,c;return b=0|16*Math.random(),c="x"===a?b:8|3&b,c.toString(16)}).toUpperCase()},synchronize:function(){var a;return Joosy.Modules.Events?(a=Joosy.Modules.Events).synchronize.apply(a,arguments):console.error("Events module is required to use `Joosy.synchronize'!")},buildUrl:function(a,b){var c,d,e,f;e=[];for(d in b)f=b[d],e.push(""+d+"="+f);return c=a.match(/(\#.*)?$/)[0],a=a.replace(/\#.*$/,""),0!==e.length&&-1===a.indexOf("?")&&(a+="?"),e=e.join("&"),e.length>0&&"?"!==a[a.length-1]&&(e="&"+e),a+e+c}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy",function(){return Joosy})}.call(this),function(){Joosy.Module=function(){function a(){}return a.__namespace__=[],a.__className=function(a){return"function"!=typeof a&&(a=a.constructor),null!=a.name?a.name:a.toString().replace(/^function ([a-zA-Z]+)\([\s\S]+/,"$1")},a.hasAncestor=function(a,b){var c;if(null==a||null==b)return!1;for(a=a.prototype,b=b.prototype;a;){if(a===b)return!0;a=null!=(c=a.constructor)?c.__super__:void 0}return!1},a.aliasMethodChain=function(a,b,c){var d,e;return d=b.charAt(0).toUpperCase()+b.slice(1),e=""+a+"Without"+d,"function"!=typeof c&&(c=this.prototype[c]),this.prototype[e]=this.prototype[a],this.prototype[a]=c},a.aliasStaticMethodChain=function(a,b,c){var d,e;return d=b.charAt(0).toUpperCase()+b.slice(1),e=""+a+"Without"+d,c||(c=this[""+a+"With"+d]),this[e]=this[a],this[a]=c},a.merge=function(a,b,c,d){var e,f,g;null==c&&(c=!0),null==d&&(d=!1);for(e in b)f=b[e],b.hasOwnProperty(e)&&(c||!a.hasOwnProperty(e))&&(d&&f.constructor===Object?((null!=(g=a[e])?g.constructor:void 0)!==Object&&(a[e]={}),Joosy.Module.merge(a[e],f)):a[e]=f);return a},a.include=function(a){var b,c,d;if(!a)throw new Error("include(object) requires obj");for(b in a)c=a[b],"included"!==b&&"extended"!==b&&(this.prototype[b]=c);return null!=(d=a.included)&&d.apply(this),null},a.extend=function(a){var b;if(!a)throw new Error("extend(object) requires object");return this.merge(this,a),null!=(b=a.extended)&&b.apply(this),null},a}(),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/module",function(){return Joosy.Module})}.call(this),function(){var a,b,c=[].slice;b=function(){function a(){this.actions=[]}return a.prototype["do"]=function(a){return this.actions.push(a)},a.prototype.after=function(a){this.after=a},a}(),a=function(){function a(a){this.parent=a,this.bindings=[]}return a.prototype.bind=function(){var a,b;return a=1<=arguments.length?c.call(arguments,0):[],this.bindings.push((b=this.parent).bind.apply(b,a))},a.prototype.unbind=function(){var a,b,c,d;for(d=this.bindings,b=0,c=d.length;c>b;b++)a=d[b],this.parent.unbind(a);return this.bindings=[]},a}(),Joosy.Modules.Events={eventsNamespace:function(b){var c;return c=new a(this),null!=b&&"function"==typeof b.call&&b.call(c),c},wait:function(a,b,c){return this.hasOwnProperty("__oneShotEvents")||(this.__oneShotEvents={}),2===arguments.length&&(c=b,b=a,a=Object.keys(this.__oneShotEvents).length.toString()),b=this.__splitEvents(b),b.length>0?this.__oneShotEvents[a]=[b,c]:c(),a},unwait:function(a){return this.hasOwnProperty("__oneShotEvents")?delete this.__oneShotEvents[a]:void 0},bind:function(a,b,c){return this.hasOwnProperty("__boundEvents")||(this.__boundEvents={}),2===arguments.length&&(c=b,b=a,a=Object.keys(this.__boundEvents).length.toString()),b=this.__splitEvents(b),b.length>0?this.__boundEvents[a]=[b,c]:c(),a},unbind:function(a){return this.hasOwnProperty("__boundEvents")?delete this.__boundEvents[a]:void 0},trigger:function(){var a,b,d,e,f,g,h,i,j,k,l,m,n,o,p,q=this;if(d=arguments[0],b=2<=arguments.length?c.call(arguments,1):[],Joosy.Modules.Log.debugAs(this,"Event "+d+" triggered"),"string"==typeof d?i=!1:(i=d.remember,d=d.name),this.hasOwnProperty("__oneShotEvents")){f=[],m=this.__oneShotEvents;for(g in m){for(n=m[g],e=n[0],a=n[1];-1!==(h=e.indexOf(d));)e.splice(h,1);0===e.length&&f.push(g)}for(j=function(c){return a=q.__oneShotEvents[c][1],delete q.__oneShotEvents[c],a.apply(null,b)},k=0,l=f.length;l>k;k++)g=f[k],j(g)}if(this.hasOwnProperty("__boundEvents")){o=this.__boundEvents;for(g in o)p=o[g],e=p[0],a=p[1],-1!==e.indexOf(d)&&a.apply(null,b)}return i?(this.hasOwnProperty("__triggeredEvents")||(this.__triggeredEvents={}),this.__triggeredEvents[d]=!0):void 0},synchronize:function(a){var c,d,e,f,g,h,i,j=this;if(d=new b,e=0,a(d),0===d.actions.length)return d.after.call(this);for(h=d.actions,i=[],f=0,g=h.length;g>f;f++)c=h[f],i.push(function(a){return a.call(j,function(){return++e>=d.actions.length?d.after.call(this):void 0})}(c));return i},__splitEvents:function(a){var b=this;return"string"==typeof a&&(a=0===a.length?[]:a.trim().split(/\s+/)),this.hasOwnProperty("__triggeredEvents")&&(a=a.filter(function(a){return!b.__triggeredEvents[a]})),a}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/modules/events",function(){return Joosy.Modules.Events})}.call(this),function(){var a=[].slice;Joosy.Modules.Log={log:function(){var b;return b=1<=arguments.length?a.call(arguments,0):[],"undefined"!=typeof console&&null!==console?null!=console.log.apply?(b.unshift("Joosy>"),console.log.apply(console,b)):console.log(b.first()):void 0},debug:function(){var b;return b=1<=arguments.length?a.call(arguments,0):[],Joosy.debug()?this.log.apply(this,b):void 0},debugAs:function(){var b,c,d;return c=arguments[0],d=arguments[1],b=3<=arguments.length?a.call(arguments,2):[],Joosy.debug()?(c=Joosy.Module.__className(c)||"unknown context",this.debug.apply(this,[""+c+"> "+d].concat(a.call(b)))):void 0}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/modules/log",function(){return Joosy.Modules.Log})}.call(this),function(){Joosy.Modules.DOM={eventSplitter:/^(\S+)\s*(.*)$/,included:function(){return this.mapElements=function(a){return this.prototype.hasOwnProperty("__elements")||(this.prototype.__elements=Joosy.Module.merge({},this.__super__.__elements)),Joosy.Module.merge(this.prototype.__elements,a)},this.mapEvents=function(a){return this.prototype.hasOwnProperty("__events")||(this.prototype.__events=Joosy.Module.merge({},this.__super__.__events)),Joosy.Module.merge(this.prototype.__events,a)}},$:function(a,b){return $(a,b||this.$container)},__extractSelector:function(a){var b=this;return a=a.replace(/(\$[A-z0-9\.\$]+)/g,function(a){var c,d,e,f,g,h;for(a=a.split("."),c=a.pop(),e=b,f=0,g=a.length;g>f;f++)d=a[f],e=null!=e?e[d]:void 0;return null!=e?null!=(h=e[c])?h.selector:void 0:void 0}),a.trim()},__assignElements:function(a,b){var c,d,e,f=this;if(a||(a=this),b||(b=this.__elements),b){e=[];for(c in b)d=b[c],e.push(function(b,c){return"string"!=typeof c?f.__assignElements(a["$"+b]={},c):(c=f.__extractSelector(c),a["$"+b]=f.__wrapElement(c),a["$"+b].selector=c)}(c,d));return e}},__wrapElement:function(a){var b=this;return function(c){return c?b.$(a,c):b.$(a)}},__delegateEvents:function(){var a,b,c,d,e,f=this;if(d=this,a=this.__events){e=[];for(b in a)c=a[b],e.push(function(a,b){var c,e,g,h,i,j,k,l,m;for(l=a.split(","),m=[],j=0,k=l.length;k>j;j++)if(g=l[j],g=g.replace(/^\s+/,""),"function"!=typeof b&&(b=f[b]),c=function(a){return b.call(d,$(this),a)},h=g.match(f.eventSplitter),e=h[1],i=f.__extractSelector(h[2]),""===i)f.$container.bind(e,c),m.push(Joosy.Modules.Log.debugAs(f,""+e+" binded on container"));else{if(void 0===i)throw new Error("Unknown element "+h[2]+" in "+Joosy.Module.__className(f.constructor)+" (maybe typo?)");f.$container.on(e,i,c),m.push(Joosy.Modules.Log.debugAs(f,""+e+" binded on "+i))}return m}(b,c));return e}},__clearContainer:function(){return this.$container.unbind().off(),this.$container=$()}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/modules/dom",function(){return Joosy.Modules.DOM})}.call(this),function(a){var b=function(){},c=0,d=a.document,e=("undefined"==typeof ENV?{}:ENV).DISABLE_RANGE_API,f=!e&&d&&"createRange"in d&&"undefined"!=typeof Range&&Range.prototype.createContextualFragment,g=d&&function(){var a=d.createElement("div");return a.innerHTML="<div></div>",a.firstChild.innerHTML="<script></script>",""===a.firstChild.innerHTML}(),h=d&&function(){var a=d.createElement("div");return a.innerHTML="Test: <script type='text/x-placeholder'></script>Value","Test:"===a.childNodes[0].nodeValue&&" Value"===a.childNodes[2].nodeValue}(),i=function(a){var d;d=this instanceof i?this:new b,d.innerHTML=a;var e="metamorph-"+c++;return d.start=e+"-start",d.end=e+"-end",d};b.prototype=i.prototype;var j,k,l,m,n,o,p,q,r;if(m=function(){return this.startTag()+this.innerHTML+this.endTag()},q=function(){return"<script id='"+this.start+"' type='text/x-placeholder'></script>"},r=function(){return"<script id='"+this.end+"' type='text/x-placeholder'></script>"},f)j=function(a,b){var c=d.createRange(),e=d.getElementById(a.start),f=d.getElementById(a.end);return b?(c.setStartBefore(e),c.setEndAfter(f)):(c.setStartAfter(e),c.setEndBefore(f)),c},k=function(a,b){var c=j(this,b);c.deleteContents();var d=c.createContextualFragment(a);c.insertNode(d)},l=function(){var a=j(this,!0);a.deleteContents()},n=function(a){var b=d.createRange();b.setStart(a),b.collapse(!1);var c=b.createContextualFragment(this.outerHTML());a.appendChild(c)},o=function(a){var b=d.createRange(),c=d.getElementById(this.end);b.setStartAfter(c),b.setEndAfter(c);var e=b.createContextualFragment(a);b.insertNode(e)},p=function(a){var b=d.createRange(),c=d.getElementById(this.start);b.setStartAfter(c),b.setEndAfter(c);var e=b.createContextualFragment(a);b.insertNode(e)};else{var s={select:[1,"<select multiple='multiple'>","</select>"],fieldset:[1,"<fieldset>","</fieldset>"],table:[1,"<table>","</table>"],tbody:[2,"<table><tbody>","</tbody></table>"],tr:[3,"<table><tbody><tr>","</tr></tbody></table>"],colgroup:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],map:[1,"<map>","</map>"],_default:[0,"",""]},t=function(a,b){if(a.getAttribute("id")===b)return a;var c,d,e,f=a.childNodes.length;for(c=0;f>c;c++)if(d=a.childNodes[c],e=1===d.nodeType&&t(d,b))return e},u=function(a,b){var c=[];if(h&&(b=b.replace(/(\s+)(<script id='([^']+)')/g,function(a,b,d,e){return c.push([e,b]),d})),a.innerHTML=b,c.length>0){var e,f=c.length;for(e=0;f>e;e++){var g=t(a,c[e][0]),i=d.createTextNode(c[e][1]);g.parentNode.insertBefore(i,g)}}},v=function(a,b){var c=s[a.tagName.toLowerCase()]||s._default,e=c[0],f=c[1],h=c[2];g&&(b="&shy;"+b);var i=d.createElement("div");u(i,f+b+h);for(var j=0;e>=j;j++)i=i.firstChild;if(g){for(var k=i;1===k.nodeType&&!k.nodeName;)k=k.firstChild;3===k.nodeType&&"­"===k.nodeValue.charAt(0)&&(k.nodeValue=k.nodeValue.slice(1))}return i},w=function(a){for(;""===a.parentNode.tagName;)a=a.parentNode;return a},x=function(a,b){a.parentNode!==b.parentNode&&b.parentNode.insertBefore(a,b.parentNode.firstChild)};k=function(a,b){var c,e,f,g=w(d.getElementById(this.start)),h=d.getElementById(this.end),i=h.parentNode;for(x(g,h),c=g.nextSibling;c;){if(e=c.nextSibling,f=c===h){if(!b)break;h=c.nextSibling}if(c.parentNode.removeChild(c),f)break;c=e}for(c=v(g.parentNode,a);c;)e=c.nextSibling,i.insertBefore(c,h),c=e},l=function(){var a=w(d.getElementById(this.start)),b=d.getElementById(this.end);this.html(""),a.parentNode.removeChild(a),b.parentNode.removeChild(b)},n=function(a){for(var b,c=v(a,this.outerHTML());c;)b=c.nextSibling,a.appendChild(c),c=b},o=function(a){var b,c,e=d.getElementById(this.end),f=e.nextSibling,g=e.parentNode;for(c=v(g,a);c;)b=c.nextSibling,g.insertBefore(c,f),c=b},p=function(a){var b,c,e=d.getElementById(this.start),f=e.parentNode;c=v(f,a);for(var g=e.nextSibling;c;)b=c.nextSibling,f.insertBefore(c,g),c=b}}i.prototype.html=function(a){return this.checkRemoved(),void 0===a?this.innerHTML:(k.call(this,a),this.innerHTML=a,void 0)},i.prototype.replaceWith=function(a){this.checkRemoved(),k.call(this,a,!0)},i.prototype.remove=l,i.prototype.outerHTML=m,i.prototype.appendTo=n,i.prototype.after=o,i.prototype.prepend=p,i.prototype.startTag=q,i.prototype.endTag=r,i.prototype.isRemoved=function(){var a=d.getElementById(this.start),b=d.getElementById(this.end);return!a||!b},i.prototype.checkRemoved=function(){if(this.isRemoved())throw new Error("Cannot perform operations on a Metamorph that is not in the DOM.")},a.Metamorph=i}(this),function(){var a=[].slice;Joosy.Modules.Renderer={included:function(){return this.view=function(a,b){return null==b&&(b={}),this.prototype.__view=a,this.prototype.__renderDefault=function(c){return null==c&&(c={}),b.dynamic?this.renderDynamic(a,c):this.render(a,c)}},this.helper=function(){var b,c;return b=1<=arguments.length?a.call(arguments,0):[],this.prototype.hasOwnProperty("__helpers")||(this.prototype.__helpers=(null!=(c=this.__super__.__helpers)?c.slice():void 0)||[]),this.prototype.__helpers=this.prototype.__helpers.concat(b).filter(function(a,b,c){return c.indexOf(a)===b})}},render:function(a,b,c){return null==b&&(b={}),null==c&&(c=!1),this.__render(!1,a,b,c)},renderDynamic:function(a,b,c){return null==b&&(b={}),null==c&&(c=!1),this.__render(!0,a,b,c)},__assignHelpers:function(){var a,b,c,d,e,f,g=this;if(null!=this.__helpers){for(this.hasOwnProperty("__helpers")||(this.__helpers=this.__helpers.slice()),e=this.__helpers,f=[],b=c=0,d=e.length;d>c;b=++c)a=e[b],f.push(function(a,b){if(a.constructor!==Object){if(null==g[a])throw new Error("Cannot find method '"+a+"' to use as helper");return g.__helpers[b]={},g.__helpers[b][a]=function(){return g[a].apply(g,arguments)}}}(a,b));return f}},__instantiateHelpers:function(){var a,b,c,d;if(!this.__helpersInstance&&(this.__assignHelpers(),this.__helpersInstance={},this.__helpersInstance.__renderer=this,Joosy.Module.merge(this.__helpersInstance,Joosy.Helpers.Application),null!=Joosy.Helpers.Routes&&Joosy.Module.merge(this.__helpersInstance,Joosy.Helpers.Routes),this.__helpers))for(d=this.__helpers,b=0,c=d.length;c>b;b++)a=d[b],Joosy.Module.merge(this.__helpersInstance,a);
2
- return this.__helpersInstance},__instantiateRenderers:function(a){var b=this;return{render:function(c,d){return null==d&&(d={}),b.render(c,d,a)},renderDynamic:function(c,d){return null==d&&(d={}),b.renderDynamic(c,d,a)},renderInline:function(c,d){var e;return null==c&&(c={}),e=function(a){return d.apply(a)},b.renderDynamic(e,c,a)}}},__render:function(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o=this;if(null==c&&(c={}),null==d&&(d=!1),l=this.__renderingStackChildFor(d),l.template=b,l.locals=c,"string"==typeof b)null!=this.__renderSection&&(b=Joosy.templater().resolveTemplate(this.__renderSection(),b,this)),b=Joosy.templater().buildView(b);else if("function"!=typeof b)throw new Error(""+Joosy.Module.__className(this)+"> template (maybe @view) does not look like a string or lambda");if(c.constructor!==Object)throw new Error(""+Joosy.Module.__className(this)+"> locals (maybe @data?) is not a hash");if(f=function(){var a;return a={},Joosy.Module.merge(a,l.locals),Joosy.Module.merge(a,o.__instantiateHelpers(),!1),Joosy.Module.merge(a,o.__instantiateRenderers(l)),a},k=function(){return b(f())},a){i=Metamorph(k()),n=function(){var a,b,c,d,e,f,g,h,j,m,n;if(i.isRemoved()){for(h=i.__bindings,n=[],d=0,f=h.length;f>d;d++)j=h[d],c=j[0],a=j[1],n.push(c.unbind(a));return n}for(m=l.children,e=0,g=m.length;g>e;e++)b=m[e],o.__removeMetamorphs(b);return l.children=[],i.html(k())},m=null,g=function(){return clearTimeout(m),m=setTimeout(n,0)};for(h in c)j=c[h],c.hasOwnProperty(h)&&null!=(null!=j?j.bind:void 0)&&null!=(null!=j?j.unbind:void 0)&&(e=[j,j.bind("changed",g)],l.metamorphBindings.push(e));return i.__bindings=l.metamorphBindings,i.outerHTML()}return k()},__renderingStackElement:function(a){return null==a&&(a=null),{metamorphBindings:[],locals:null,template:null,children:[],parent:a}},__renderingStackChildFor:function(a){var b;return this.__renderingStack||(this.__renderingStack=[]),a?(b=this.__renderingStackElement(a),a.children.push(b),b):(b=this.__renderingStackElement(),this.__renderingStack.push(b),b)},__removeMetamorphs:function(a){var b,c,d,e,f,g=this;if(null==a&&(a=!1),b=function(a){var b,c,d,e,f,h,i,j,k,l;if(null!=a?a.children:void 0)for(j=a.children,e=0,h=j.length;h>e;e++)c=j[e],g.__removeMetamorphs(c);if(null!=a?a.metamorphBindings:void 0){for(k=a.metamorphBindings,f=0,i=k.length;i>f;f++)l=k[f],d=l[0],b=l[1],d.unbind(b);return a.metamorphBindings=[]}},a)return b(a);if(null!=this.__renderingStack){for(e=this.__renderingStack,f=[],c=0,d=e.length;d>c;c++)a=e[c],f.push(b(a));return f}}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/modules/renderer",function(){return Joosy.Modules.Renderer})}.call(this),function(){Joosy.Modules.TimeManager={setTimeout:function(a,b){var c;return this.__timeouts||(this.__timeouts=[]),c=window.setTimeout(function(){return b()},a),this.__timeouts.push(c),c},setInterval:function(a,b){var c;return this.__intervals||(this.__intervals=[]),c=window.setInterval(function(){return b()},a),this.__intervals.push(c),c},clearTimeout:function(a){return window.clearTimeout(a)},clearInterval:function(a){return window.clearInterval(a)},__clearTime:function(){var a,b,c,d,e,f,g,h;if(this.__intervals)for(f=this.__intervals,b=0,d=f.length;d>b;b++)a=f[b],window.clearInterval(a);if(this.__timeouts){for(g=this.__timeouts,h=[],c=0,e=g.length;e>c;c++)a=g[c],h.push(window.clearTimeout(a));return h}}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/modules/time_manager",function(){return Joosy.Modules.TimeManager})}.call(this),function(){var a=[].slice;Joosy.Modules.Filters={included:function(){return this.__registerFilterCollector=function(a){return this[a]=function(b){return this.prototype.hasOwnProperty("__"+a+"s")||(this.prototype["__"+a+"s"]=[].concat(this.__super__["__"+a+"s"]||[])),this.prototype["__"+a+"s"].push(b)},a.charAt(0).toUpperCase()+a.slice(1)},this.registerPlainFilters=function(){var b,c,d,e,f,g=this;for(c=1<=arguments.length?a.call(arguments,0):[],f=[],d=0,e=c.length;e>d;d++)b=c[d],f.push(function(b){var c;return c=g.__registerFilterCollector(b),g.prototype["__run"+c+"s"]=function(){var c,d,e,f,g,h;if(d=1<=arguments.length?a.call(arguments,0):[],this["__"+b+"s"]){for(g=this["__"+b+"s"],h=[],e=0,f=g.length;f>e;e++)c=g[e],"function"!=typeof c&&(c=this[c]),h.push(c.apply(this,d));return h}},g.prototype["__confirm"+c+"s"]=function(){var c,d=this;return c=1<=arguments.length?a.call(arguments,0):[],this["__"+b+"s"]?this["__"+b+"s"].reduce(function(a,b){return"function"!=typeof b&&(b=d[b]),a&&b.apply(d,c)!==!1},!0):!0},g.prototype["__apply"+c+"s"]=function(){var c,d,e,f,g,h;if(d=arguments[0],e=2<=arguments.length?a.call(arguments,1):[],!this["__"+b+"s"])return d;for(h=this["__"+b+"s"],f=0,g=h.length;g>f;f++)c=h[f],"function"!=typeof c&&(c=this[c]),d=c.apply(this,[d].concat(e));return d}}(b));return f},this.registerSequencedFilters=function(){var b,c,d,e,f,g=this;for(c=1<=arguments.length?a.call(arguments,0):[],f=[],d=0,e=c.length;e>d;d++)b=c[d],f.push(function(a){var b;return b=g.__registerFilterCollector(a),g.prototype["__run"+b+"s"]=function(b,c){var d,e;return this["__"+a+"s"]?(e=this["__"+a+"s"],d=this,1===e.length?e[0].apply(this,b.concat(c)):Joosy.synchronize(function(a){var f,g,h,i;for(g=function(c){return a["do"](function(a){return c.apply(d,b.concat(a))})},h=0,i=e.length;i>h;h++)f=e[h],g(f);return a.after(c)})):c()}}(b));return f}}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/modules/filters",function(){return Joosy.Modules.Filters})}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function d(){this.constructor=b}for(var e in c)a.call(c,e)&&(b[e]=c[e]);return d.prototype=c.prototype,b.prototype=new d,b.__super__=c.prototype,b};Joosy.Widget=function(a){function c(a,b){this.params=a,this.previous=b}return b(c,a),c.include(Joosy.Modules.Log),c.include(Joosy.Modules.Events),c.include(Joosy.Modules.DOM),c.include(Joosy.Modules.Renderer),c.include(Joosy.Modules.TimeManager),c.include(Joosy.Modules.Filters),c.mapWidgets=function(a){return this.prototype.hasOwnProperty("__widgets")||(this.prototype.__widgets=Joosy.Module.merge({},this.__super__.__widgets)),Joosy.Module.merge(this.prototype.__widgets,a)},c.independent=function(){return this.prototype.__independent=!0},c.registerPlainFilters("beforeLoad","afterLoad","afterUnload"),c.registerSequencedFilters("beforePaint","paint","erase","fetch"),c.prototype.registerWidget=function(a,b){return"string"==typeof a&&(a=this.__normalizeSelector(a)),b=this.__normalizeWidget(b),b.__bootstrapDefault(this,a),b},c.prototype.unregisterWidget=function(a){return a.__unload()},c.prototype.replaceWidget=function(a,b){return b=this.__normalizeWidget(b),b.previous=a,b.__bootstrapDefault(this,a.$container),b},c.prototype.navigate=function(){var a;return null!=(a=Joosy.Router)?a.navigate.apply(a,arguments):void 0},c.prototype.__renderSection=function(){return"widgets"},c.prototype.__nestingMap=function(){var a,b,c,d;a={},d=this.__widgets;for(b in d)c=d[b],c=this.__normalizeWidget(c),a[b]={instance:c,nested:c.__nestingMap()};return a},c.prototype.__bootstrapDefault=function(a,b){return this.__bootstrap(a,this.__nestingMap(),b)},c.prototype.__bootstrap=function(a,b,c,d){var e=this;return this.$container=c,null==d&&(d=!0),this.wait("section:fetched section:erased",function(){return e.__runPaints([],function(){return e.__paint(a,b,e.$container)})}),this.__erase(),d?this.__fetch(b):void 0},c.prototype.__fetch=function(a){var b=this;return this.data={},this.synchronize(function(c){var d,e,f;f=function(a,b){return b.instance.__fetch(b.nested),b.instance.__independent?void 0:c["do"](function(a){return b.instance.wait("section:fetched",a)})};for(e in a)d=a[e],f(e,d);return c["do"](function(a){return b.__runFetchs([],a)}),c.after(function(){return b.trigger({name:"section:fetched",remember:!0})})})},c.prototype.__erase=function(){var a=this;return null!=this.previous?this.previous.__runErases([],function(){return a.previous.__unload(),a.__runBeforePaints([],function(){return a.trigger({name:"section:erased",remember:!0})})}):this.__runBeforePaints([],function(){return a.trigger({name:"section:erased",remember:!0})})},c.prototype.__paint=function(a,b,c){var d,e,f,g=this;this.parent=a,this.$container=c,this.__nestedSections=[],this.$container.html("function"==typeof this.__renderDefault?this.__renderDefault(this.data||{}):void 0),this.__load(),f=[];for(e in b)d=b[e],f.push(function(a,b){var d;return c=g.__normalizeSelector(a),!b.instance.__independent||(null!=(d=b.instance.__triggeredEvents)?d["section:fetched"]:void 0)?b.instance.__paint(g,b.nested,c):b.instance.__bootstrap(g,b.nested,c,!1)}(e,d));return f},c.prototype.__load=function(){var a;return this.parent&&((a=this.parent).__nestedSections||(a.__nestedSections=[]),this.parent.__nestedSections.push(this)),this.__assignElements(),this.__delegateEvents(),this.__runAfterLoads()},c.prototype.__unload=function(a){var b,c,d,e;if(null==a&&(a=!0),this.__nestedSections){for(e=this.__nestedSections,c=0,d=e.length;d>c;c++)b=e[c],b.__unload(!1);delete this.__nestedSections}return this.__clearContainer(),this.__clearTime(),this.__removeMetamorphs(),this.__runAfterUnloads(),this.parent&&a&&this.parent.__nestedSections.splice(this.parent.__nestedSections.indexOf(this),1),delete this.previous,delete this.parent},c.prototype.__normalizeSelector=function(a){return"$container"===a?this.$container:$(this.__extractSelector(a),this.$container)},c.prototype.__normalizeWidget=function(a){return"function"!=typeof a||Joosy.Module.hasAncestor(a,Joosy.Widget)||(a=a.call(this)),Joosy.Module.hasAncestor(a,Joosy.Widget)&&(a=new a),a},c}(Joosy.Module),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/widget",function(){return Joosy.Widget})}.call(this),function(){Joosy.helpers("Application",function(){var a,b;return b=document.createTextNode("test"),a=document.createElement("span"),a.appendChild(b),this.escapeOnce=function(c){return b.nodeValue=c,a.innerHTML},this.tag=function(a,b,c,d){var e,f,g,h;null==b&&(b={}),null==c&&(c=!1),null==d&&(d=!0),e=document.createElement(a),g=document.createElement("div");for(a in b)h=b[a],d&&(h=this.escapeOnce(h)),e.setAttribute(a,h);return g.appendChild(e),f=g.innerHTML,c&&(f=f.replace("/>",">")),f},this.contentTag=function(a,b,c,d){var e,f,g,h,i;null==b&&(b=null),null==c&&(c=null),null==d&&(d=!0),"string"==typeof b?(c||(c={}),e=b):"function"==typeof b?(c={},e=b()):("function"==typeof c?(d=!0,e=c()):(d=c,e=d()),c=b),g=document.createElement(a),h=document.createElement("div");for(a in c)i=c[a],d&&(i=this.escapeOnce(i)),g.setAttribute(a,i);try{g.innerHTML=e}catch(j){if(f=j,e)throw f}return h.appendChild(g),h.innerHTML},this.renderWrapped=function(a,b){return this.render(a,Joosy.Module.merge(this,{yield:b()}))}})}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function d(){this.constructor=b}for(var e in c)a.call(c,e)&&(b[e]=c[e]);return d.prototype=c.prototype,b.prototype=new d,b.__super__=c.prototype,b};Joosy.Layout=function(a){function c(a,b){this.params=a,this.previous=b,this.uid=Joosy.uid()}return b(c,a),c.helper("page"),c.prototype.page=function(a,b){return null==b&&(b={}),b.id=this.uid,Joosy.Helpers.Application.tag(a,b)},c.prototype.content=function(){return $("#"+this.uid)},c.prototype.__renderSection=function(){return"layouts"},c.prototype.__nestingMap=function(a){var b;return b=c.__super__.__nestingMap.call(this),b["#"+this.uid]={instance:a,nested:a.__nestingMap()},b},c.prototype.__bootstrapDefault=function(a,b){return this.__bootstrap(null,this.__nestingMap(a),b)},c}(Joosy.Widget),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/layout",function(){return Joosy.Layout})}.call(this),function(){Joosy.Modules.Page={}}.call(this),function(){Joosy.Modules.Page.Scrolling={included:function(){return this.scroll=function(a,b){return null==b&&(b={}),this.prototype.__scrollElement=a,this.prototype.__scrollSpeed=b.speed||500,this.prototype.__scrollMargin=b.margin||0},this.paint(function(a){return this.__scrollElement&&0!==this.__scrollSpeed&&this.__fixHeight(),a()}),this.afterLoad(function(){return this.__scrollElement?this.__performScrolling():void 0})},__performScrolling:function(){var a,b,c=this;return a=(null!=(b=$(this.__extractSelector(this.__scrollElement)).offset())?b.top:void 0)+this.__scrollMargin,Joosy.Modules.Log.debugAs(this,"Scrolling to "+this.__extractSelector(this.__scrollElement)),$("html, body").animate({scrollTop:a},this.__scrollSpeed,function(){return 0!==c.__scrollSpeed?c.__releaseHeight():void 0})},__fixHeight:function(){return $("html").css("min-height",$(document).height())},__releaseHeight:function(){return $("html").css("min-height","")}}}.call(this),function(){Joosy.Modules.Page.Title={title:function(a,b){return null==b&&(b=" / "),this.afterLoad(function(){return"function"==typeof a&&(a=a.apply(this)),a instanceof Array&&(a=a.join(b)),this.__previousTitle=document.title,document.title=a}),this.afterUnload(function(){return document.title=this.__previousTitle})}}}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function d(){this.constructor=b}for(var e in c)a.call(c,e)&&(b[e]=c[e]);return d.prototype=c.prototype,b.prototype=new d,b.__super__=c.prototype,b};Joosy.Page=function(a){function c(a,b){var c;this.params=a,this.previous=b,this.layoutShouldChange=(null!=(c=this.previous)?c.__layoutClass:void 0)!==this.__layoutClass,this.halted=!this.__confirmBeforeLoads(),this.layout=function(){var b,c;switch(!1){case!(this.layoutShouldChange&&this.__layoutClass):return new this.__layoutClass(a,null!=(b=this.previous)?b.layout:void 0);case!!this.layoutShouldChange:return null!=(c=this.previous)?c.layout:void 0}}.call(this),this.layoutShouldChange&&!this.layout&&(this.previous=this.previous.layout)}return b(c,a),c.layout=function(a){return this.prototype.__layoutClass=a},c.include(Joosy.Modules.Page.Scrolling),c.extend(Joosy.Modules.Page.Title),c.prototype.__renderSection=function(){return"pages"},c.prototype.__bootstrapDefault=function(a){var b;return this.__bootstrap(this.layout,this.__nestingMap(),(null!=(b=this.layout)?b.content():void 0)||a)},c}(Joosy.Widget),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/page",function(){return Joosy.Page})}.call(this),function(){Joosy.helpers("Routes",function(){return this.linkTo=function(a,b,c){var d,e;return null==a&&(a=""),null==b&&(b=""),null==c&&(c={}),"function"==typeof c&&(d=c,e=[a,b],b=e[0],c=e[1],a=d()),Joosy.Helpers.Application.contentTag("a",a,Joosy.Module.merge(c,{"data-joosy":!0,href:b}))}})}.call(this),function(){var a,b={}.hasOwnProperty,c=function(a,c){function d(){this.constructor=a}for(var e in c)b.call(c,e)&&(a[e]=c[e]);return d.prototype=c.prototype,a.prototype=new d,a.__super__=c.prototype,a};Joosy.Router=function(b){function d(){return a=d.__super__.constructor.apply(this,arguments)}var e;return c(d,b),d.extend(Joosy.Modules.Events),$(window).bind("popstate",function(a){return null!=window.history.loaded?d.trigger("popstate",a):window.history.loaded=!0}),$(document).on("click","a[data-joosy]",function(a){return a.preventDefault(),Joosy.Router.navigate(this.getAttribute("href"))}),e=function(){function a(a,b){this.__namespace=a,this.__alias=b}return a.run=function(b,c,d){var e;return null==c&&(c=""),null==d&&(d=""),e=new a(c,d),b.call(e)},a.prototype.match=function(a,b){var c;return null==b&&(b={}),null!=b.as&&(c=this.__alias?this.__alias+b.as.charAt(0).toUpperCase()+b.as.slice(1):b.as),a=this.__namespace+a,Joosy.Router.compileRoute(a,b.to,c)},a.prototype.root=function(a){return null==a&&(a={}),this.match("/",{to:a.to,as:a.as||"root"})},a.prototype.notFound=function(a){return null==a&&(a={}),this.match(404,{to:a.to})},a.prototype.namespace=function(b,c,d){var e;return null==c&&(c={}),2===arguments.length&&(d=c,c={}),a.run(d,this.__namespace+b,null!=(e=c.as)?e.toString():void 0)},a}(),d.map=function(a,b){var c,d,e;e=[];for(c in a)d=a[c],null!=b&&(c=b+"/"+c),"function"==typeof d||d.prototype?e.push(this.compileRoute(c,d)):e.push(this.map(d,c));return e},d.draw=function(a){return e.run(a)},d.setup=function(a,b,c){var d,e=this;return this.config=a,this.responder=b,null==c&&(c=!0),history.pushState||(this.config.prefix=this.config.hashSuffix,this.config.html5=!1),this.config.html5||(this.config.prefix=this.config.hashSuffix),(d=this.config).prefix||(d.prefix=""),this.config.html5?(this.config.prefix=("/"+this.config.prefix+"/").replace(/\/{2,}/g,"/"),this.listener=this.bind("popstate pushstate",function(){return e.respond(e.canonizeLocation())})):(this.config.prefix=this.config.prefix.replace(/^\#?\/?/,"").replace(/\/?$/,""),$(window).bind("hashchange.JoosyRouter",function(){return e.respond(e.canonizeLocation())})),c?this.respond(this.canonizeLocation()):void 0},d.reset=function(){return this.unbind(this.listener),$(window).unbind(".JoosyRouter"),this.restriction=!1,this.routes={}},d.restrict=function(a){this.restriction=a},d.navigate=function(a,b){var c;null==b&&(b={}),c=a,this.config.html5?(this.config.prefix&&"/"===c[0]&&!c.match(RegExp("^"+this.config.prefix.replace(/\/$/,"")+"(/|$)"))&&(c=c.replace(/^\//,this.config.prefix)),history.pushState({},"",c),this.trigger("pushstate")):(this.config.prefix&&!c.match(RegExp("^#?/?"+this.config.prefix+"(/|$)"))&&(c=c.replace(/^\#?\/?/,""+this.config.prefix+"/")),location.hash=c)},d.canonizeLocation=function(){return this.config.html5?location.pathname.replace(RegExp("^("+this.config.prefix+"?)?/?"),"/")+location.search:location.hash.replace(RegExp("^#?/?("+this.config.prefix+"(/|$))?"),"/")},d.compileRoute=function(a,b,c){var d,e,f;return"404"===a.toString()?(this.wildcardAction=b,void 0):("/"===a[0]&&(a=a.substr(1)),d=a.replace(/\/{2,}/g,"/"),f={},d=d.replace(/\/:([^\/]+)/g,"/([^/]+)"),d=d.replace(/^\/?/,"^/?"),d=d.replace(/\/?$/,"/?$"),e=(a.match(/\/:[^\/]+/g)||[]).map(function(a){return a.substr(2)}),this.routes||(this.routes={}),this.routes[d]={to:b,capture:e,as:c},null!=c?this.defineHelpers(a,c):void 0)},d.respond=function(a){var b,c,d,e,f,g;if(Joosy.Modules.Log.debug("Router> Answering '"+a+"'"),this.restriction&&null===a.match(this.restriction))return this.trigger("restricted",a),void 0;f=a.split("?"),a=f[0],c=f[1],c=(null!=c?"function"==typeof c.split?c.split("&"):void 0:void 0)||[],g=this.routes;for(d in g)if(e=g[d],this.routes.hasOwnProperty(d)&&(b=a.match(new RegExp(d))))return this.responder(e.to,this.__grabParams(c,e,b)),this.trigger("responded",a),void 0;return null!=this.wildcardAction?(this.responder(this.wildcardAction,a),this.trigger("responded")):this.trigger("missed")},d.defineHelpers=function(a,b){var c;return c=function(b){var c,d,e,f,g;if(e=a,c=a.match(/\/:[^\/]+/g))for(f=0,g=c.length;g>f;f++)d=c[f],e=e.replace(d.substr(1),b[d.substr(2)]);return Joosy.Router.config.html5?""+Joosy.Router.config.prefix+e:"#"+Joosy.Router.config.prefix+e},Joosy.helpers("Routes",function(){return this[""+b+"Path"]=c,this[""+b+"Url"]=function(a){var b;return b=""+location.protocol+"//"+location.host,Joosy.Router.config.html5?""+b+c(a):""+b+location.pathname+c(a)}})},d.__grabParams=function(a,b,c){var d,e,f,g,h,i,j,k,l,m;if(null==b&&(b=null),null==c&&(c=[]),g={},c.shift(),d=null!=b?b.capture:void 0)for(i=0,k=d.length;k>i;i++)f=d[i],g[f]=decodeURIComponent(c.shift());for(j=0,l=a.length;l>j;j++)e=a[j],e.length>0&&(m=e.split("="),f=m[0],h=m[1],g[f]=h);return g},d}.call(this,Joosy.Module),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/router",function(){return Joosy.Router})}.call(this),function(){Joosy.Templaters.JST=function(){function a(a){this.config=null!=a?a:{},null!=this.config.prefix&&this.config.prefix.length>0&&(this.prefix=this.config.prefix)}return a.prototype.buildView=function(a){var b,c,d,e,f;for(d=!1,b=this.prefix?[""+this.prefix+"/templates/"+a+"-"+("undefined"!=typeof I18n&&null!==I18n?I18n.locale:void 0),""+this.prefix+"/templates/"+a]:["templates/"+a+"-"+("undefined"!=typeof I18n&&null!==I18n?I18n.locale:void 0),"templates/"+a],e=0,f=b.length;f>e;e++)if(c=b[e],window.JST[c])return window.JST[c];throw new Error("Template '"+a+"' not found. Checked at: '"+b.join(", ")+"'")},a.prototype.resolveTemplate=function(a,b,c){var d,e,f;return"/"===b[0]?b.substr(1):(d=null!=(e=c.constructor)?null!=(f=e.__namespace__)?f.map(function(a){return inflection.underscore(a)}):void 0:void 0,d||(d=[]),d.unshift(a),""+d.join("/")+"/"+b)},a}(),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/templaters/jst",function(){return Joosy.Templaters.JST})}.call(this),function(){Joosy.helpers("Application",function(){return this.widget=function(a,b,c){var d=this;return null==c&&(c=b,b={}),b.id=Joosy.uid(),this.__renderer.setTimeout(0,function(){return d.__renderer.registerWidget($("#"+b.id),c)}),this.tag(a,b)}})}.call(this),function(){}.call(this),function(){Joosy.Application=function(){function a(){}return a.Pages={},a.Layouts={},a.Controls={},a.initialized=!1,a.loading=!0,a.defaultConfig={test:!1,debug:!1,templater:{prefix:""},router:{html5:!1,base:"",prefix:""}},a.initialize=function(a,b){var c=this;if(this.selector=a,null==b&&(b={}),this.initialized)throw new Error("Attempted to initialize Application twice");return this.config={},Joosy.Module.merge(this.config,this.defaultConfig,!0,!0),null!=window.JoosyEnvironment&&Joosy.Module.merge(this.config,window.JoosyEnvironment,!0,!0),Joosy.Module.merge(this.config,b,!0,!0),this.config.test&&this.forceSandbox(),Joosy.templater(new Joosy.Templaters.JST(this.config.templater)),Joosy.debug(this.config.debug),Joosy.Router.setup(this.config.router,function(a,b){if(Joosy.Module.hasAncestor(a,Joosy.Page))return c.changePage(a,b);if("function"==typeof a)return a(b);throw new Error("Unknown kind of route action: "+a)}),this.initialized=!0},a.reset=function(){var a;return Joosy.Router.reset(),Joosy.templater(!1),Joosy.debug(!1),null!=(a=this.page)&&a.__unload(),delete this.page,this.loading=!0,this.initialized=!1},a.content=function(){return $(this.selector)},a.changePage=function(a,b){var c;return c=new a(b,this.page),c.halted?void 0:(c.layoutShouldChange&&c.layout?c.layout.__bootstrapDefault(c,this.content()):c.__bootstrapDefault(this.content()),this.page=c)},a.forceSandbox=function(){var a;return a=Joosy.uid(),this.selector="#"+a,$("body").append($("<div/>").attr("id",a).css({height:"0px",width:"0px",overflow:"hidden"}))},a}(),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/application",function(){return Joosy.Application})}.call(this),function(){}.call(this);
1
+ !function(a){"function"==typeof YUI?YUI.add("es5",a):a()}(function(){function a(){}function b(a){return a=+a,a!==a?a=0:0!==a&&a!==1/0&&a!==-(1/0)&&(a=(a>0||-1)*Math.floor(Math.abs(a))),a}function c(a){var b=typeof a;return null===a||"undefined"===b||"boolean"===b||"number"===b||"string"===b}function d(a){var b,d,e;if(c(a))return a;if(d=a.valueOf,"function"==typeof d&&(b=d.call(a),c(b)))return b;if(e=a.toString,"function"==typeof e&&(b=e.call(a),c(b)))return b;throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if("function"!=typeof c)throw new TypeError("Function.prototype.bind called on incompatible "+c);var d=m.call(arguments,1),e=function(){if(this instanceof e){var a=c.apply(this,d.concat(m.call(arguments)));return Object(a)===a?a:this}return c.apply(b,d.concat(m.call(arguments)))};return c.prototype&&(a.prototype=c.prototype,e.prototype=new a,a.prototype=null),e});var e,f,g,h,i,j=Function.prototype.call,k=Array.prototype,l=Object.prototype,m=k.slice,n=j.bind(l.toString),o=j.bind(l.hasOwnProperty);if((i=o(l,"__defineGetter__"))&&(e=j.bind(l.__defineGetter__),f=j.bind(l.__defineSetter__),g=j.bind(l.__lookupGetter__),h=j.bind(l.__lookupSetter__)),2!=[1,2].splice(0).length){var p=Array.prototype.splice;Array.prototype.splice=function(){function a(a){for(var b=[];a--;)b.unshift(a);return b}var b,c=[];return c.splice.bind(c,0,0).apply(null,a(20)),c.splice.bind(c,0,0).apply(null,a(26)),b=c.length,c.splice(5,0,"XXX"),b+1==c.length?!0:void 0}()?function(a,b){return arguments.length?p.apply(this,[void 0===a?0:a,void 0===b?this.length-a:b].concat(m.call(arguments,2))):[]}:function(a,b){var c,d=m.call(arguments,2),e=d.length;if(!arguments.length)return[];if(void 0===a&&(a=0),void 0===b&&(b=this.length-a),e>0){if(0>=b){if(a==this.length)return this.push.apply(this,d),[];if(0==a)return this.unshift.apply(this,d),[]}return c=m.call(this,a,a+b),d.push.apply(d,m.call(this,a+b,this.length)),d.unshift.apply(d,m.call(this,0,a)),d.unshift(0,this.length),p.apply(this,d),c}return p.call(this,a,b)}}if(1!=[].unshift(0)){var q=Array.prototype.unshift;Array.prototype.unshift=function(){return q.apply(this,arguments),this.length}}Array.isArray||(Array.isArray=function(a){return"[object Array]"==n(a)});var r=Object("a"),s="a"!=r[0]||!(0 in r);if(Array.prototype.forEach||(Array.prototype.forEach=function(a){var b=G(this),c=s&&"[object String]"==n(this)?this.split(""):b,d=arguments[1],e=-1,f=c.length>>>0;if("[object Function]"!=n(a))throw new TypeError;for(;++e<f;)e in c&&a.call(d,c[e],e,b)}),Array.prototype.map||(Array.prototype.map=function(a){var b=G(this),c=s&&"[object String]"==n(this)?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if("[object Function]"!=n(a))throw new TypeError(a+" is not a function");for(var g=0;d>g;g++)g in c&&(e[g]=a.call(f,c[g],g,b));return e}),Array.prototype.filter||(Array.prototype.filter=function(a){var b,c=G(this),d=s&&"[object String]"==n(this)?this.split(""):c,e=d.length>>>0,f=[],g=arguments[1];if("[object Function]"!=n(a))throw new TypeError(a+" is not a function");for(var h=0;e>h;h++)h in d&&(b=d[h],a.call(g,b,h,c)&&f.push(b));return f}),Array.prototype.every||(Array.prototype.every=function(a){var b=G(this),c=s&&"[object String]"==n(this)?this.split(""):b,d=c.length>>>0,e=arguments[1];if("[object Function]"!=n(a))throw new TypeError(a+" is not a function");for(var f=0;d>f;f++)if(f in c&&!a.call(e,c[f],f,b))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(a){var b=G(this),c=s&&"[object String]"==n(this)?this.split(""):b,d=c.length>>>0,e=arguments[1];if("[object Function]"!=n(a))throw new TypeError(a+" is not a function");for(var f=0;d>f;f++)if(f in c&&a.call(e,c[f],f,b))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(a){var b=G(this),c=s&&"[object String]"==n(this)?this.split(""):b,d=c.length>>>0;if("[object Function]"!=n(a))throw new TypeError(a+" is not a function");if(!d&&1==arguments.length)throw new TypeError("reduce of empty array with no initial value");var e,f=0;if(arguments.length>=2)e=arguments[1];else for(;;){if(f in c){e=c[f++];break}if(++f>=d)throw new TypeError("reduce of empty array with no initial value")}for(;d>f;f++)f in c&&(e=a.call(void 0,e,c[f],f,b));return e}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(a){var b=G(this),c=s&&"[object String]"==n(this)?this.split(""):b,d=c.length>>>0;if("[object Function]"!=n(a))throw new TypeError(a+" is not a function");if(!d&&1==arguments.length)throw new TypeError("reduceRight of empty array with no initial value");var e,f=d-1;if(arguments.length>=2)e=arguments[1];else for(;;){if(f in c){e=c[f--];break}if(--f<0)throw new TypeError("reduceRight of empty array with no initial value")}if(0>f)return e;do f in this&&(e=a.call(void 0,e,c[f],f,b));while(f--);return e}),Array.prototype.indexOf&&-1==[0,1].indexOf(1,2)||(Array.prototype.indexOf=function(a){var c=s&&"[object String]"==n(this)?this.split(""):G(this),d=c.length>>>0;if(!d)return-1;var e=0;for(arguments.length>1&&(e=b(arguments[1])),e=e>=0?e:Math.max(0,d+e);d>e;e++)if(e in c&&c[e]===a)return e;return-1}),Array.prototype.lastIndexOf&&-1==[0,1].lastIndexOf(0,-3)||(Array.prototype.lastIndexOf=function(a){var c=s&&"[object String]"==n(this)?this.split(""):G(this),d=c.length>>>0;if(!d)return-1;var e=d-1;for(arguments.length>1&&(e=Math.min(e,b(arguments[1]))),e=e>=0?e:d-Math.abs(e);e>=0;e--)if(e in c&&a===c[e])return e;return-1}),!Object.keys){var t=!0,u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],v=u.length;for(var w in{toString:null})t=!1;Object.keys=function H(a){if("object"!=typeof a&&"function"!=typeof a||null===a)throw new TypeError("Object.keys called on a non-object");var H=[];for(var b in a)o(a,b)&&H.push(b);if(t)for(var c=0,d=v;d>c;c++){var e=u[c];o(a,e)&&H.push(e)}return H}}var x=-621987552e5,y="-000001";Date.prototype.toISOString&&-1!==new Date(x).toISOString().indexOf(y)||(Date.prototype.toISOString=function(){var a,b,c,d,e;if(!isFinite(this))throw new RangeError("Date.prototype.toISOString called on non-finite value.");for(d=this.getUTCFullYear(),e=this.getUTCMonth(),d+=Math.floor(e/12),e=(e%12+12)%12,a=[e+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()],d=(0>d?"-":d>9999?"+":"")+("00000"+Math.abs(d)).slice(d>=0&&9999>=d?-4:-6),b=a.length;b--;)c=a[b],10>c&&(a[b]="0"+c);return d+"-"+a.slice(0,2).join("-")+"T"+a.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"});var z=!1;try{z=Date.prototype.toJSON&&null===new Date(0/0).toJSON()&&-1!==new Date(x).toJSON().indexOf(y)&&Date.prototype.toJSON.call({toISOString:function(){return!0}})}catch(A){}z||(Date.prototype.toJSON=function(){var a,b=Object(this),c=d(b);if("number"==typeof c&&!isFinite(c))return null;if(a=b.toISOString,"function"!=typeof a)throw new TypeError("toISOString property is not callable");return a.call(b)}),Date=function(a){function b(c,d,e,f,g,h,i){var j=arguments.length;if(this instanceof a){var k=1==j&&String(c)===c?new a(b.parse(c)):j>=7?new a(c,d,e,f,g,h,i):j>=6?new a(c,d,e,f,g,h):j>=5?new a(c,d,e,f,g):j>=4?new a(c,d,e,f):j>=3?new a(c,d,e):j>=2?new a(c,d):j>=1?new a(c):new a;return k.constructor=b,k}return a.apply(this,arguments)}function c(a,b){var c=b>1?1:0;return f[b]+Math.floor((a-1969+c)/4)-Math.floor((a-1901+c)/100)+Math.floor((a-1601+c)/400)+365*(a-1970)}function d(b){return Number(new a(1970,0,1,0,0,0,b))}var e=new RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:(\\.\\d{1,}))?)?(Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$"),f=[0,31,59,90,120,151,181,212,243,273,304,334,365];for(var g in a)b[g]=a[g];return b.now=a.now,b.UTC=a.UTC,b.prototype=a.prototype,b.prototype.constructor=b,b.parse=function(b){var f=e.exec(b);if(f){var g,h=Number(f[1]),i=Number(f[2]||1)-1,j=Number(f[3]||1)-1,k=Number(f[4]||0),l=Number(f[5]||0),m=Number(f[6]||0),n=Math.floor(1e3*Number(f[7]||0)),o=Boolean(f[4]&&!f[8]),p="-"===f[9]?1:-1,q=Number(f[10]||0),r=Number(f[11]||0);return(l>0||m>0||n>0?24:25)>k&&60>l&&60>m&&1e3>n&&i>-1&&12>i&&24>q&&60>r&&j>-1&&j<c(h,i+1)-c(h,i)&&(g=60*(24*(c(h,i)+j)+k+q*p),g=1e3*(60*(g+l+r*p)+m)+n,o&&(g=d(g)),g>=-864e13&&864e13>=g)?g:0/0}return a.parse.apply(this,arguments)},b}(Date),Date.now||(Date.now=function(){return(new Date).getTime()}),Number.prototype.toFixed&&"0.000"===8e-5.toFixed(3)&&"0"!==.9.toFixed(0)&&"1.25"===1.255.toFixed(2)&&"1000000000000000128"===0xde0b6b3a7640080.toFixed(0)||!function(){function a(a,b){for(var c=-1;++c<g;)b+=a*h[c],h[c]=b%f,b=Math.floor(b/f)}function b(a){for(var b=g,c=0;--b>=0;)c+=h[b],h[b]=Math.floor(c/a),c=c%a*f}function c(){for(var a=g,b="";--a>=0;)if(""!==b||0===a||0!==h[a]){var c=String(h[a]);""===b?b=c:b+="0000000".slice(0,7-c.length)+c}return b}function d(a,b,c){return 0===b?c:1===b%2?d(a,b-1,c*a):d(a*a,b/2,c)}function e(a){for(var b=0;a>=4096;)b+=12,a/=4096;for(;a>=2;)b+=1,a/=2;return b}var f,g,h;f=1e7,g=6,h=[0,0,0,0,0,0],Number.prototype.toFixed=function(f){var g,h,i,j,k,l,m,n;if(g=Number(f),g=g!==g?0:Math.floor(g),0>g||g>20)throw new RangeError("Number.toFixed called with invalid number of decimals");if(h=Number(this),h!==h)return"NaN";if(-1e21>=h||h>=1e21)return String(h);if(i="",0>h&&(i="-",h=-h),j="0",h>1e-21)if(k=e(h*d(2,69,1))-69,l=0>k?h*d(2,-k,1):h/d(2,k,1),l*=4503599627370496,k=52-k,k>0){for(a(0,l),m=g;m>=7;)a(1e7,0),m-=7;for(a(d(10,m,1),0),m=k-1;m>=23;)b(1<<23),m-=23;b(1<<m),a(1,1),b(2),j=c()}else a(0,l),a(1<<-k,0),j=c()+"0.00000000000000000000".slice(2,2+g);return g>0?(n=j.length,j=g>=n?i+"0.0000000000000000000".slice(0,g-n+2)+j:i+j.slice(0,n-g)+"."+j.slice(n-g)):j=i+j,j}}();var B=String.prototype.split;if(2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||0==="".split(/.?/).length||".".split(/()()/).length>1?!function(){var a=void 0===/()??/.exec("")[1];String.prototype.split=function(b,c){var d=this;if(void 0===b&&0===c)return[];if("[object RegExp]"!==Object.prototype.toString.call(b))return B.apply(this,arguments);var e,f,g,h,i=[],j=(b.ignoreCase?"i":"")+(b.multiline?"m":"")+(b.extended?"x":"")+(b.sticky?"y":""),k=0,b=new RegExp(b.source,j+"g");for(d+="",a||(e=new RegExp("^"+b.source+"$(?!\\s)",j)),c=void 0===c?-1>>>0:c>>>0;(f=b.exec(d))&&(g=f.index+f[0].length,!(g>k&&(i.push(d.slice(k,f.index)),!a&&f.length>1&&f[0].replace(e,function(){for(var a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(f[a]=void 0)}),f.length>1&&f.index<d.length&&Array.prototype.push.apply(i,f.slice(1)),h=f[0].length,k=g,i.length>=c)));)b.lastIndex===f.index&&b.lastIndex++;return k===d.length?(h||!b.test(""))&&i.push(""):i.push(d.slice(k)),i.length>c?i.slice(0,c):i}}():"0".split(void 0,0).length&&(String.prototype.split=function(a,b){return void 0===a&&0===b?[]:B.apply(this,arguments)}),"".substr&&"b"!=="0b".substr(-1)){var C=String.prototype.substr;String.prototype.substr=function(a,b){return C.call(this,0>a?(a=this.length+a)<0?0:a:a,b)}}var D=" \n \f\r   ᠎              \u2028\u2029";if(!String.prototype.trim||D.trim()){D="["+D+"]";var E=new RegExp("^"+D+D+"*"),F=new RegExp(D+D+"*$");String.prototype.trim=function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return String(this).replace(E,"").replace(F,"")}}var G=function(a){if(null==a)throw new TypeError("can't convert "+a+" to object");return Object(a)}}),function(a){var b=["equipment","information","rice","money","species","series","fish","sheep","moose","deer","news"],c=[[new RegExp("(m)en$","gi")],[new RegExp("(pe)ople$","gi")],[new RegExp("(child)ren$","gi")],[new RegExp("([ti])a$","gi")],[new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi")],[new RegExp("(hive)s$","gi")],[new RegExp("(tive)s$","gi")],[new RegExp("(curve)s$","gi")],[new RegExp("([lr])ves$","gi")],[new RegExp("([^fo])ves$","gi")],[new RegExp("([^aeiouy]|qu)ies$","gi")],[new RegExp("(s)eries$","gi")],[new RegExp("(m)ovies$","gi")],[new RegExp("(x|ch|ss|sh)es$","gi")],[new RegExp("([m|l])ice$","gi")],[new RegExp("(bus)es$","gi")],[new RegExp("(o)es$","gi")],[new RegExp("(shoe)s$","gi")],[new RegExp("(cris|ax|test)es$","gi")],[new RegExp("(octop|vir)i$","gi")],[new RegExp("(alias|status)es$","gi")],[new RegExp("^(ox)en","gi")],[new RegExp("(vert|ind)ices$","gi")],[new RegExp("(matr)ices$","gi")],[new RegExp("(quiz)zes$","gi")],[new RegExp("(m)an$","gi"),"$1en"],[new RegExp("(pe)rson$","gi"),"$1ople"],[new RegExp("(child)$","gi"),"$1ren"],[new RegExp("^(ox)$","gi"),"$1en"],[new RegExp("(ax|test)is$","gi"),"$1es"],[new RegExp("(octop|vir)us$","gi"),"$1i"],[new RegExp("(alias|status)$","gi"),"$1es"],[new RegExp("(bu)s$","gi"),"$1ses"],[new RegExp("(buffal|tomat|potat)o$","gi"),"$1oes"],[new RegExp("([ti])um$","gi"),"$1a"],[new RegExp("sis$","gi"),"ses"],[new RegExp("(?:([^f])fe|([lr])f)$","gi"),"$1$2ves"],[new RegExp("(hive)$","gi"),"$1s"],[new RegExp("([^aeiouy]|qu)y$","gi"),"$1ies"],[new RegExp("(x|ch|ss|sh)$","gi"),"$1es"],[new RegExp("(matr|vert|ind)ix|ex$","gi"),"$1ices"],[new RegExp("([m|l])ouse$","gi"),"$1ice"],[new RegExp("(quiz)$","gi"),"$1zes"],[new RegExp("s$","gi"),"s"],[new RegExp("$","gi"),"s"]],d=[[new RegExp("(m)an$","gi")],[new RegExp("(pe)rson$","gi")],[new RegExp("(child)$","gi")],[new RegExp("^(ox)$","gi")],[new RegExp("(ax|test)is$","gi")],[new RegExp("(octop|vir)us$","gi")],[new RegExp("(alias|status)$","gi")],[new RegExp("(bu)s$","gi")],[new RegExp("(buffal|tomat|potat)o$","gi")],[new RegExp("([ti])um$","gi")],[new RegExp("sis$","gi")],[new RegExp("(?:([^f])fe|([lr])f)$","gi")],[new RegExp("(hive)$","gi")],[new RegExp("([^aeiouy]|qu)y$","gi")],[new RegExp("(x|ch|ss|sh)$","gi")],[new RegExp("(matr|vert|ind)ix|ex$","gi")],[new RegExp("([m|l])ouse$","gi")],[new RegExp("(quiz)$","gi")],[new RegExp("(m)en$","gi"),"$1an"],[new RegExp("(pe)ople$","gi"),"$1rson"],[new RegExp("(child)ren$","gi"),"$1"],[new RegExp("([ti])a$","gi"),"$1um"],[new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi"),"$1$2sis"],[new RegExp("(hive)s$","gi"),"$1"],[new RegExp("(tive)s$","gi"),"$1"],[new RegExp("(curve)s$","gi"),"$1"],[new RegExp("([lr])ves$","gi"),"$1f"],[new RegExp("([^fo])ves$","gi"),"$1fe"],[new RegExp("([^aeiouy]|qu)ies$","gi"),"$1y"],[new RegExp("(s)eries$","gi"),"$1eries"],[new RegExp("(m)ovies$","gi"),"$1ovie"],[new RegExp("(x|ch|ss|sh)es$","gi"),"$1"],[new RegExp("([m|l])ice$","gi"),"$1ouse"],[new RegExp("(bus)es$","gi"),"$1"],[new RegExp("(o)es$","gi"),"$1"],[new RegExp("(shoe)s$","gi"),"$1"],[new RegExp("(cris|ax|test)es$","gi"),"$1is"],[new RegExp("(octop|vir)i$","gi"),"$1us"],[new RegExp("(alias|status)es$","gi"),"$1"],[new RegExp("^(ox)en","gi"),"$1"],[new RegExp("(vert|ind)ices$","gi"),"$1ex"],[new RegExp("(matr)ices$","gi"),"$1ix"],[new RegExp("(quiz)zes$","gi"),"$1"],[new RegExp("ss$","gi"),"ss"],[new RegExp("s$","gi"),""]],e=["and","or","nor","a","an","the","so","but","to","of","at","by","from","into","on","onto","off","out","in","over","with","for"],f=new RegExp("(_ids|_id)$","g"),g=new RegExp("_","g"),h=new RegExp("[ _]","g"),i=new RegExp("([A-Z])","g"),j=new RegExp("^_"),k={_apply_rules:function(a,b,c,d){if(d)a=d;else{var e=k.indexOf(c,a.toLowerCase())>-1;if(!e)for(var f=0,g=b.length;g>f;f++)if(a.match(b[f][0])){void 0!==b[f][1]&&(a=a.replace(b[f][0],b[f][1]));break}}return a},indexOf:function(a,b,c,d){c||(c=-1);for(var e=-1,f=c,g=a.length;g>f;f++)if(a[f]===b||d&&d(a[f],b)){e=f;break}return e},pluralize:function(a,d){return k._apply_rules(a,c,b,d)},singularize:function(a,c){return k._apply_rules(a,d,b,c)},camelize:function(a,b){for(var c=a.toLowerCase().split("/"),d=0,e=c.length;e>d;d++){for(var f=c[d].split("_"),g=b&&d+1===e?1:0,h=g,i=f.length;i>h;h++)f[h]=f[h].charAt(0).toUpperCase()+f[h].substring(1);c[d]=f.join("")}return c.join("::")},underscore:function(a,b){if(b&&a===a.toUpperCase())return a;for(var c=a.split("::"),d=0,e=c.length;e>d;d++)c[d]=c[d].replace(i,"_$1"),c[d]=c[d].replace(j,"");return c.join("/").toLowerCase()},humanize:function(a,b){return a=a.toLowerCase(),a=a.replace(f,""),a=a.replace(g," "),b||(a=k.capitalize(a)),a},capitalize:function(a){return a=a.toLowerCase(),a.substring(0,1).toUpperCase()+a.substring(1)},dasherize:function(a){return a.replace(h,"-")},titleize:function(a){a=a.toLowerCase().replace(g," ");for(var b=a.split(" "),c=0,d=b.length;d>c;c++){for(var f=b[c].split("-"),h=0,i=f.length;i>h;h++)k.indexOf(e,f[h].toLowerCase())<0&&(f[h]=k.capitalize(f[h]));b[c]=f.join("-")}return a=b.join(" "),a=a.substring(0,1).toUpperCase()+a.substring(1)},demodulize:function(a){var b=a.split("::");return b[b.length-1]},tableize:function(a){return a=k.underscore(a),a=k.pluralize(a)},classify:function(a){return a=k.camelize(a),a=k.singularize(a)},foreign_key:function(a,b){return a=k.demodulize(a),a=k.underscore(a)+(b?"":"_")+"id"},ordinalize:function(a){for(var b=a.split(" "),c=0,d=b.length;d>c;c++){var e=parseInt(b[c],10);if(!isNaN(e)){var f=b[c].substring(b[c].length-2),g=b[c].substring(b[c].length-1),h="th";"11"!=f&&"12"!=f&&"13"!=f&&("1"===g?h="st":"2"===g?h="nd":"3"===g&&(h="rd")),b[c]+=h}}return b.join(" ")}};return"undefined"==typeof exports?a.inflection=k:(k.version="1.2.5",module.exports=k,void 0)}(this),function(){this.Joosy={Modules:{},Resources:{},Templaters:{},Helpers:{},Events:{},debug:function(a){return null!=a?this.__debug=a:!!this.__debug},templater:function(a){if(null!=a)return this.__templater=a;if(!this.__templater)throw new Error("No templater registered");return this.__templater},namespace:function(a,b){var c,d,e,f,g,h,i;for(null==b&&(b=!1),a=a.split("."),f=window,g=0,h=a.length;h>g;g++)e=a[g],e.length>0&&(f=null!=f[e]?f[e]:f[e]={});b&&(b=b.apply(f)),i=[];for(c in f)d=f[c],f.hasOwnProperty(c)&&Joosy.Module.hasAncestor(d,Joosy.Module)?i.push(d.__namespace__=a):i.push(void 0);return i},helpers:function(a,b){var c;return(c=Joosy.Helpers)[a]||(c[a]={}),b.apply(Joosy.Helpers[a])},uid:function(){return this.__uid||(this.__uid=0),"__joosy"+this.__uid++},uuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b,c;return b=0|16*Math.random(),c="x"===a?b:8|3&b,c.toString(16)}).toUpperCase()},synchronize:function(){var a;return Joosy.Modules.Events?(a=Joosy.Modules.Events).synchronize.apply(a,arguments):console.error("Events module is required to use `Joosy.synchronize'!")},buildUrl:function(a,b){var c,d,e,f;e=[];for(d in b)f=b[d],e.push(""+d+"="+f);return c=a.match(/(\#.*)?$/)[0],a=a.replace(/\#.*$/,""),0!==e.length&&-1===a.indexOf("?")&&(a+="?"),e=e.join("&"),e.length>0&&"?"!==a[a.length-1]&&(e="&"+e),a+e+c}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy",function(){return Joosy})}.call(this),function(){Joosy.Module=function(){function a(){}return a.__namespace__=[],a.__className=function(a){return"function"!=typeof a&&(a=a.constructor),null!=a.name?a.name:a.toString().replace(/^function ([a-zA-Z]+)\([\s\S]+/,"$1")},a.hasAncestor=function(a,b){var c;if(null==a||null==b)return!1;for(a=a.prototype,b=b.prototype;a;){if(a===b)return!0;a=null!=(c=a.constructor)?c.__super__:void 0}return!1},a.aliasMethodChain=function(a,b,c){var d,e;return d=b.charAt(0).toUpperCase()+b.slice(1),e=""+a+"Without"+d,"function"!=typeof c&&(c=this.prototype[c]),this.prototype[e]=this.prototype[a],this.prototype[a]=c},a.aliasStaticMethodChain=function(a,b,c){var d,e;return d=b.charAt(0).toUpperCase()+b.slice(1),e=""+a+"Without"+d,c||(c=this[""+a+"With"+d]),this[e]=this[a],this[a]=c},a.merge=function(a,b,c,d){var e,f,g;null==c&&(c=!0),null==d&&(d=!1);for(e in b)f=b[e],b.hasOwnProperty(e)&&(c||!a.hasOwnProperty(e))&&(d&&f.constructor===Object?((null!=(g=a[e])?g.constructor:void 0)!==Object&&(a[e]={}),Joosy.Module.merge(a[e],f)):a[e]=f);return a},a.include=function(a){var b,c,d;if(!a)throw new Error("include(object) requires obj");for(b in a)c=a[b],"included"!==b&&"extended"!==b&&(this.prototype[b]=c);return null!=(d=a.included)&&d.apply(this),null},a.extend=function(a){var b;if(!a)throw new Error("extend(object) requires object");return this.merge(this,a),null!=(b=a.extended)&&b.apply(this),null},a.concern=function(a){var b,c;return null!=a.ClassMethods&&this.extend(a.ClassMethods),null!=a.InstanceMethods&&this.include(a.InstanceMethods),null!=(b=a.extended)&&b.apply(this),null!=(c=a.included)?c.apply(this):void 0},a}(),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/module",function(){return Joosy.Module})}.call(this),function(){var a,b,c=[].slice;b=function(){function a(){this.actions=[]}return a.prototype["do"]=function(a){return this.actions.push(a)},a.prototype.after=function(a){this.after=a},a}(),a=function(){function a(a){this.parent=a,this.bindings=[]}return a.prototype.bind=function(){var a,b;return a=1<=arguments.length?c.call(arguments,0):[],this.bindings.push((b=this.parent).bind.apply(b,a))},a.prototype.unbind=function(){var a,b,c,d;for(d=this.bindings,b=0,c=d.length;c>b;b++)a=d[b],this.parent.unbind(a);return this.bindings=[]},a}(),Joosy.Modules.Events={eventsNamespace:function(b){var c;return c=new a(this),null!=b&&"function"==typeof b.call&&b.call(c),c},wait:function(a,b,c){return this.hasOwnProperty("__oneShotEvents")||(this.__oneShotEvents={}),2===arguments.length&&(c=b,b=a,a=Object.keys(this.__oneShotEvents).length.toString()),b=this.__splitEvents(b),b.length>0?this.__oneShotEvents[a]=[b,c]:c(),a},unwait:function(a){return this.hasOwnProperty("__oneShotEvents")?delete this.__oneShotEvents[a]:void 0},bind:function(a,b,c){return this.hasOwnProperty("__boundEvents")||(this.__boundEvents={}),2===arguments.length&&(c=b,b=a,a=Object.keys(this.__boundEvents).length.toString()),b=this.__splitEvents(b),b.length>0?this.__boundEvents[a]=[b,c]:c(),a},unbind:function(a){return this.hasOwnProperty("__boundEvents")?delete this.__boundEvents[a]:void 0},trigger:function(){var a,b,d,e,f,g,h,i,j,k,l,m,n,o,p,q=this;if(d=arguments[0],b=2<=arguments.length?c.call(arguments,1):[],Joosy.Modules.Log.debugAs(this,"Event "+d+" triggered"),"string"==typeof d?i=!1:(i=d.remember,d=d.name),this.hasOwnProperty("__oneShotEvents")){f=[],m=this.__oneShotEvents;for(g in m){for(n=m[g],e=n[0],a=n[1];-1!==(h=e.indexOf(d));)e.splice(h,1);0===e.length&&f.push(g)}for(j=function(c){return a=q.__oneShotEvents[c][1],delete q.__oneShotEvents[c],a.apply(null,b)},k=0,l=f.length;l>k;k++)g=f[k],j(g)}if(this.hasOwnProperty("__boundEvents")){o=this.__boundEvents;for(g in o)p=o[g],e=p[0],a=p[1],-1!==e.indexOf(d)&&a.apply(null,b)}return i?(this.hasOwnProperty("__triggeredEvents")||(this.__triggeredEvents={}),this.__triggeredEvents[d]=!0):void 0},synchronize:function(a){var c,d,e,f,g,h,i,j=this;if(d=new b,e=0,a(d),0===d.actions.length)return d.after.call(this);for(h=d.actions,i=[],f=0,g=h.length;g>f;f++)c=h[f],i.push(function(a){return a.call(j,function(){return++e>=d.actions.length?d.after.call(this):void 0})}(c));return i},__splitEvents:function(a){var b=this;return"string"==typeof a&&(a=0===a.length?[]:a.trim().split(/\s+/)),this.hasOwnProperty("__triggeredEvents")&&(a=a.filter(function(a){return!b.__triggeredEvents[a]})),a}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/modules/events",function(){return Joosy.Modules.Events})}.call(this),function(){var a=[].slice;Joosy.Modules.Log={log:function(){var b;return b=1<=arguments.length?a.call(arguments,0):[],"undefined"!=typeof console&&null!==console?null!=console.log.apply?(b.unshift("Joosy>"),console.log.apply(console,b)):console.log(b.first()):void 0},debug:function(){var b;return b=1<=arguments.length?a.call(arguments,0):[],Joosy.debug()?this.log.apply(this,b):void 0},debugAs:function(){var b,c,d;return c=arguments[0],d=arguments[1],b=3<=arguments.length?a.call(arguments,2):[],Joosy.debug()?(c=Joosy.Module.__className(c)||"unknown context",this.debug.apply(this,[""+c+"> "+d].concat(a.call(b)))):void 0}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/modules/log",function(){return Joosy.Modules.Log})}.call(this),function(){Joosy.Modules.DOM={eventSplitter:/^(\S+)\s*(.*)$/,ClassMethods:{mapElements:function(a){return this.prototype.hasOwnProperty("__elements")||(this.prototype.__elements=Joosy.Module.merge({},this.__super__.__elements)),Joosy.Module.merge(this.prototype.__elements,a)},mapEvents:function(a){return this.prototype.hasOwnProperty("__events")||(this.prototype.__events=Joosy.Module.merge({},this.__super__.__events)),Joosy.Module.merge(this.prototype.__events,a)}},InstanceMethods:{$:function(a,b){return $(a,b||this.$container)},__extractSelector:function(a){var b=this;return a=a.replace(/(\$[A-z0-9\.\$]+)/g,function(a){var c,d,e,f,g,h;for(a=a.split("."),c=a.pop(),e=b,f=0,g=a.length;g>f;f++)d=a[f],e=null!=e?e[d]:void 0;return null!=e?null!=(h=e[c])?h.selector:void 0:void 0}),a.trim()},__assignElements:function(a,b){var c,d,e,f=this;if(a||(a=this),b||(b=this.__elements),b){e=[];for(c in b)d=b[c],e.push(function(b,c){return"string"!=typeof c?f.__assignElements(a["$"+b]={},c):(c=f.__extractSelector(c),a["$"+b]=f.__wrapElement(c),a["$"+b].selector=c)}(c,d));return e}},__wrapElement:function(a){var b=this;return function(c){return c?b.$(a,c):b.$(a)}},__delegateEvents:function(){var a,b,c,d,e,f=this;if(d=this,a=this.__events){e=[];for(b in a)c=a[b],e.push(function(a,b){var c,e,g,h,i,j,k,l,m;for(l=a.split(","),m=[],j=0,k=l.length;k>j;j++)if(g=l[j],g=g.replace(/^\s+/,""),"function"!=typeof b&&(b=f[b]),c=function(a){return b.call(d,$(this),a)},h=g.match(Joosy.Modules.DOM.eventSplitter),e=h[1],i=f.__extractSelector(h[2]),""===i)f.$container.bind(e,c),m.push(Joosy.Modules.Log.debugAs(f,""+e+" binded on container"));else{if(void 0===i)throw new Error("Unknown element "+h[2]+" in "+Joosy.Module.__className(f.constructor)+" (maybe typo?)");f.$container.on(e,i,c),m.push(Joosy.Modules.Log.debugAs(f,""+e+" binded on "+i))}return m}(b,c));return e}},__clearContainer:function(){return this.$container.unbind().off(),this.$container=$()}}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/modules/dom",function(){return Joosy.Modules.DOM})}.call(this),function(a){var b=function(){},c=0,d=a.document,e=("undefined"==typeof ENV?{}:ENV).DISABLE_RANGE_API,f=!e&&d&&"createRange"in d&&"undefined"!=typeof Range&&Range.prototype.createContextualFragment,g=d&&function(){var a=d.createElement("div");return a.innerHTML="<div></div>",a.firstChild.innerHTML="<script></script>",""===a.firstChild.innerHTML}(),h=d&&function(){var a=d.createElement("div");return a.innerHTML="Test: <script type='text/x-placeholder'></script>Value","Test:"===a.childNodes[0].nodeValue&&" Value"===a.childNodes[2].nodeValue}(),i=function(a){var d;d=this instanceof i?this:new b,d.innerHTML=a;var e="metamorph-"+c++;return d.start=e+"-start",d.end=e+"-end",d};b.prototype=i.prototype;var j,k,l,m,n,o,p,q,r;if(m=function(){return this.startTag()+this.innerHTML+this.endTag()},q=function(){return"<script id='"+this.start+"' type='text/x-placeholder'></script>"},r=function(){return"<script id='"+this.end+"' type='text/x-placeholder'></script>"},f)j=function(a,b){var c=d.createRange(),e=d.getElementById(a.start),f=d.getElementById(a.end);return b?(c.setStartBefore(e),c.setEndAfter(f)):(c.setStartAfter(e),c.setEndBefore(f)),c},k=function(a,b){var c=j(this,b);c.deleteContents();var d=c.createContextualFragment(a);c.insertNode(d)},l=function(){var a=j(this,!0);a.deleteContents()},n=function(a){var b=d.createRange();b.setStart(a),b.collapse(!1);var c=b.createContextualFragment(this.outerHTML());a.appendChild(c)},o=function(a){var b=d.createRange(),c=d.getElementById(this.end);b.setStartAfter(c),b.setEndAfter(c);var e=b.createContextualFragment(a);b.insertNode(e)},p=function(a){var b=d.createRange(),c=d.getElementById(this.start);b.setStartAfter(c),b.setEndAfter(c);var e=b.createContextualFragment(a);b.insertNode(e)};else{var s={select:[1,"<select multiple='multiple'>","</select>"],fieldset:[1,"<fieldset>","</fieldset>"],table:[1,"<table>","</table>"],tbody:[2,"<table><tbody>","</tbody></table>"],tr:[3,"<table><tbody><tr>","</tr></tbody></table>"],colgroup:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],map:[1,"<map>","</map>"],_default:[0,"",""]},t=function(a,b){if(a.getAttribute("id")===b)return a;var c,d,e,f=a.childNodes.length;for(c=0;f>c;c++)if(d=a.childNodes[c],e=1===d.nodeType&&t(d,b))return e},u=function(a,b){var c=[];if(h&&(b=b.replace(/(\s+)(<script id='([^']+)')/g,function(a,b,d,e){return c.push([e,b]),d})),a.innerHTML=b,c.length>0){var e,f=c.length;for(e=0;f>e;e++){var g=t(a,c[e][0]),i=d.createTextNode(c[e][1]);g.parentNode.insertBefore(i,g)}}},v=function(a,b){var c=s[a.tagName.toLowerCase()]||s._default,e=c[0],f=c[1],h=c[2];g&&(b="&shy;"+b);var i=d.createElement("div");u(i,f+b+h);for(var j=0;e>=j;j++)i=i.firstChild;if(g){for(var k=i;1===k.nodeType&&!k.nodeName;)k=k.firstChild;3===k.nodeType&&"­"===k.nodeValue.charAt(0)&&(k.nodeValue=k.nodeValue.slice(1))}return i},w=function(a){for(;""===a.parentNode.tagName;)a=a.parentNode;return a},x=function(a,b){a.parentNode!==b.parentNode&&b.parentNode.insertBefore(a,b.parentNode.firstChild)};k=function(a,b){var c,e,f,g=w(d.getElementById(this.start)),h=d.getElementById(this.end),i=h.parentNode;for(x(g,h),c=g.nextSibling;c;){if(e=c.nextSibling,f=c===h){if(!b)break;h=c.nextSibling}if(c.parentNode.removeChild(c),f)break;c=e}for(c=v(g.parentNode,a);c;)e=c.nextSibling,i.insertBefore(c,h),c=e},l=function(){var a=w(d.getElementById(this.start)),b=d.getElementById(this.end);this.html(""),a.parentNode.removeChild(a),b.parentNode.removeChild(b)},n=function(a){for(var b,c=v(a,this.outerHTML());c;)b=c.nextSibling,a.appendChild(c),c=b},o=function(a){var b,c,e=d.getElementById(this.end),f=e.nextSibling,g=e.parentNode;for(c=v(g,a);c;)b=c.nextSibling,g.insertBefore(c,f),c=b},p=function(a){var b,c,e=d.getElementById(this.start),f=e.parentNode;c=v(f,a);for(var g=e.nextSibling;c;)b=c.nextSibling,f.insertBefore(c,g),c=b}}i.prototype.html=function(a){return this.checkRemoved(),void 0===a?this.innerHTML:(k.call(this,a),this.innerHTML=a,void 0)},i.prototype.replaceWith=function(a){this.checkRemoved(),k.call(this,a,!0)},i.prototype.remove=l,i.prototype.outerHTML=m,i.prototype.appendTo=n,i.prototype.after=o,i.prototype.prepend=p,i.prototype.startTag=q,i.prototype.endTag=r,i.prototype.isRemoved=function(){var a=d.getElementById(this.start),b=d.getElementById(this.end);return!a||!b},i.prototype.checkRemoved=function(){if(this.isRemoved())throw new Error("Cannot perform operations on a Metamorph that is not in the DOM.")},a.Metamorph=i}(this),function(){var a=[].slice;Joosy.Modules.Renderer={ClassMethods:{view:function(a,b){return null==b&&(b={}),this.prototype.__view=a,this.prototype.__renderDefault=function(c){return null==c&&(c={}),b.dynamic?this.renderDynamic(a,c):this.render(a,c)}},helper:function(){var b,c;return b=1<=arguments.length?a.call(arguments,0):[],this.prototype.hasOwnProperty("__helpers")||(this.prototype.__helpers=(null!=(c=this.__super__.__helpers)?c.slice():void 0)||[]),this.prototype.__helpers=this.prototype.__helpers.concat(b).filter(function(a,b,c){return c.indexOf(a)===b})}},InstanceMethods:{render:function(a,b,c){return null==b&&(b={}),null==c&&(c=!1),this.__render(!1,a,b,c)},renderDynamic:function(a,b,c,d){return null==b&&(b={}),null==d&&(d=!1),this.__render(c||!0,a,b,d)},__assignHelpers:function(){var a,b,c,d,e,f,g=this;if(null!=this.__helpers){for(this.hasOwnProperty("__helpers")||(this.__helpers=this.__helpers.slice()),e=this.__helpers,f=[],b=c=0,d=e.length;d>c;b=++c)a=e[b],f.push(function(a,b){if(a.constructor!==Object){if(null==g[a])throw new Error("Cannot find method '"+a+"' to use as helper");return g.__helpers[b]={},g.__helpers[b][a]=function(){return g[a].apply(g,arguments)}}}(a,b));return f}},__instantiateHelpers:function(){var a,b,c,d;if(!this.__helpersInstance&&(this.__assignHelpers(),this.__helpersInstance={},this.__helpersInstance.__renderer=this,Joosy.Module.merge(this.__helpersInstance,Joosy.Helpers.Application),null!=Joosy.Helpers.Routes&&Joosy.Module.merge(this.__helpersInstance,Joosy.Helpers.Routes),this.__helpers))for(d=this.__helpers,b=0,c=d.length;c>b;b++)a=d[b],Joosy.Module.merge(this.__helpersInstance,a);
2
+ return this.__helpersInstance},__instantiateRenderers:function(a){var b=this;return{render:function(c,d){return null==d&&(d={}),b.render(c,d,a)},renderDynamic:function(c,d,e){return null==d&&(d={}),b.renderDynamic(c,d,e,a)},renderInline:function(c,d,e){var f;return null==c&&(c={}),arguments.length<3&&(e=d,d=void 0),f=function(a){return e.apply(a)},b.renderDynamic(f,c,d,a)}}},__render:function(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o=this;if(null==c&&(c={}),null==d&&(d=!1),l=this.__renderingStackChildFor(d),l.template=b,l.locals=c,"string"==typeof b)null!=this.__renderSection&&(b=Joosy.templater().resolveTemplate(this.__renderSection(),b,this)),b=Joosy.templater().buildView(b);else if("function"!=typeof b)throw new Error(""+Joosy.Module.__className(this)+"> template (maybe @view) does not look like a string or lambda");if(c.constructor!==Object)throw new Error(""+Joosy.Module.__className(this)+"> locals (maybe @data?) is not a hash");if(f=function(){var a;return a={},Joosy.Module.merge(a,l.locals),Joosy.Module.merge(a,o.__instantiateHelpers(),!1),Joosy.Module.merge(a,o.__instantiateRenderers(l)),a},k=function(){return b(f())},a){i=Metamorph(k()),n=function(){var b,c,d,e,f,g,h,j,m,n,p;if(i.isRemoved()){for(j=i.__bindings,p=[],e=0,g=j.length;g>e;e++)m=j[e],d=m[0],b=m[1],p.push(d.unbind(b));return p}for(n=l.children,f=0,h=n.length;h>f;f++)c=n[f],o.__removeMetamorphs(c);return l.children=[],i.html(k()),a instanceof Function?a():void 0},m=null,g=function(){return clearTimeout(m),m=setTimeout(n,0)};for(h in c)j=c[h],c.hasOwnProperty(h)&&null!=(null!=j?j.bind:void 0)&&null!=(null!=j?j.unbind:void 0)&&(e=[j,j.bind("changed",g)],l.metamorphBindings.push(e));return i.__bindings=l.metamorphBindings,i.outerHTML()}return k()},__renderingStackElement:function(a){return null==a&&(a=null),{metamorphBindings:[],locals:null,template:null,children:[],parent:a}},__renderingStackChildFor:function(a){var b;return this.__renderingStack||(this.__renderingStack=[]),a?(b=this.__renderingStackElement(a),a.children.push(b),b):(b=this.__renderingStackElement(),this.__renderingStack.push(b),b)},__removeMetamorphs:function(a){var b,c,d,e,f,g=this;if(null==a&&(a=!1),b=function(a){var b,c,d,e,f,h,i,j,k,l;if(null!=a?a.children:void 0)for(j=a.children,e=0,h=j.length;h>e;e++)c=j[e],g.__removeMetamorphs(c);if(null!=a?a.metamorphBindings:void 0){for(k=a.metamorphBindings,f=0,i=k.length;i>f;f++)l=k[f],d=l[0],b=l[1],d.unbind(b);return a.metamorphBindings=[]}},a)return b(a);if(null!=this.__renderingStack){for(e=this.__renderingStack,f=[],c=0,d=e.length;d>c;c++)a=e[c],f.push(b(a));return f}}}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/modules/renderer",function(){return Joosy.Modules.Renderer})}.call(this),function(){Joosy.Modules.TimeManager={setTimeout:function(a,b){var c;return this.__timeouts||(this.__timeouts=[]),c=window.setTimeout(function(){return b()},a),this.__timeouts.push(c),c},setInterval:function(a,b){var c;return this.__intervals||(this.__intervals=[]),c=window.setInterval(function(){return b()},a),this.__intervals.push(c),c},clearTimeout:function(a){return window.clearTimeout(a)},clearInterval:function(a){return window.clearInterval(a)},__clearTime:function(){var a,b,c,d,e,f,g,h;if(this.__intervals)for(f=this.__intervals,b=0,d=f.length;d>b;b++)a=f[b],window.clearInterval(a);if(this.__timeouts){for(g=this.__timeouts,h=[],c=0,e=g.length;e>c;c++)a=g[c],h.push(window.clearTimeout(a));return h}}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/modules/time_manager",function(){return Joosy.Modules.TimeManager})}.call(this),function(){var a=[].slice;Joosy.Modules.Filters={__registerFilterCollector:function(a){return this[a]=function(b){return this.prototype.hasOwnProperty("__"+a+"s")||(this.prototype["__"+a+"s"]=[].concat(this.__super__["__"+a+"s"]||[])),this.prototype["__"+a+"s"].push(b)},a.charAt(0).toUpperCase()+a.slice(1)},registerPlainFilters:function(){var b,c,d,e,f,g=this;for(c=1<=arguments.length?a.call(arguments,0):[],f=[],d=0,e=c.length;e>d;d++)b=c[d],f.push(function(b){var c;return c=g.__registerFilterCollector(b),g.prototype["__run"+c+"s"]=function(){var c,d,e,f,g,h;if(d=1<=arguments.length?a.call(arguments,0):[],this["__"+b+"s"]){for(g=this["__"+b+"s"],h=[],e=0,f=g.length;f>e;e++)c=g[e],"function"!=typeof c&&(c=this[c]),h.push(c.apply(this,d));return h}},g.prototype["__confirm"+c+"s"]=function(){var c,d=this;return c=1<=arguments.length?a.call(arguments,0):[],this["__"+b+"s"]?this["__"+b+"s"].reduce(function(a,b){return"function"!=typeof b&&(b=d[b]),a&&b.apply(d,c)!==!1},!0):!0},g.prototype["__apply"+c+"s"]=function(){var c,d,e,f,g,h;if(d=arguments[0],e=2<=arguments.length?a.call(arguments,1):[],!this["__"+b+"s"])return d;for(h=this["__"+b+"s"],f=0,g=h.length;g>f;f++)c=h[f],"function"!=typeof c&&(c=this[c]),d=c.apply(this,[d].concat(e));return d}}(b));return f},registerSequencedFilters:function(){var b,c,d,e,f,g=this;for(c=1<=arguments.length?a.call(arguments,0):[],f=[],d=0,e=c.length;e>d;d++)b=c[d],f.push(function(a){var b;return b=g.__registerFilterCollector(a),g.prototype["__run"+b+"s"]=function(b,c){var d,e;return this["__"+a+"s"]?(e=this["__"+a+"s"],d=this,1===e.length?e[0].apply(this,b.concat(c)):Joosy.synchronize(function(a){var f,g,h,i;for(g=function(c){return a["do"](function(a){return c.apply(d,b.concat(a))})},h=0,i=e.length;i>h;h++)f=e[h],g(f);return a.after(c)})):c()}}(b));return f}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/modules/filters",function(){return Joosy.Modules.Filters})}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function d(){this.constructor=b}for(var e in c)a.call(c,e)&&(b[e]=c[e]);return d.prototype=c.prototype,b.prototype=new d,b.__super__=c.prototype,b};Joosy.Widget=function(a){function c(a,b){this.params=a,this.previous=b}return b(c,a),c.include(Joosy.Modules.Log),c.include(Joosy.Modules.Events),c.concern(Joosy.Modules.DOM),c.concern(Joosy.Modules.Renderer),c.include(Joosy.Modules.TimeManager),c.extend(Joosy.Modules.Filters),c.mapWidgets=function(a){return this.prototype.hasOwnProperty("__widgets")||(this.prototype.__widgets=Joosy.Module.merge({},this.__super__.__widgets)),Joosy.Module.merge(this.prototype.__widgets,a)},c.independent=function(){return this.prototype.__independent=!0},c.registerPlainFilters("beforeLoad","beforeUnload","afterLoad","afterUnload"),c.registerSequencedFilters("beforePaint","paint","erase","fetch"),c.prototype.registerWidget=function(a,b){return"string"==typeof a&&(a=this.__normalizeSelector(a)),b=this.__normalizeWidget(b),b.__bootstrapDefault(this,a),b},c.prototype.unregisterWidget=function(a){return a.__unload()},c.prototype.replaceWidget=function(a,b){return b=this.__normalizeWidget(b),b.previous=a,b.__bootstrapDefault(this,a.$container),b},c.prototype.navigate=function(){var a;return null!=(a=Joosy.Router)?a.navigate.apply(a,arguments):void 0},c.prototype.__renderSection=function(){return"widgets"},c.prototype.__nestingMap=function(){var a,b,c,d;a={},d=this.__widgets;for(b in d)c=d[b],c=this.__normalizeWidget(c),a[b]={instance:c,nested:c.__nestingMap()};return a},c.prototype.__bootstrapDefault=function(a,b){return this.__bootstrap(a,this.__nestingMap(),b)},c.prototype.__bootstrap=function(a,b,c,d){var e=this;return this.$container=c,null==d&&(d=!0),this.wait("section:fetched section:erased",function(){return e.__runPaints([],function(){return e.__paint(a,b,e.$container)})}),this.__erase(),d?this.__fetch(b):void 0},c.prototype.__fetch=function(a){var b=this;return this.data={},this.synchronize(function(c){var d,e,f;f=function(a,b){return b.instance.__fetch(b.nested),b.instance.__independent?void 0:c["do"](function(a){return b.instance.wait("section:fetched",a)})};for(e in a)d=a[e],f(e,d);return c["do"](function(a){return b.__runFetchs([],a)}),c.after(function(){return b.trigger({name:"section:fetched",remember:!0})})})},c.prototype.__erase=function(){var a=this;return null!=this.previous?this.previous.__runErases([],function(){return a.previous.__unload(),a.__runBeforePaints([],function(){return a.trigger({name:"section:erased",remember:!0})})}):this.__runBeforePaints([],function(){return a.trigger({name:"section:erased",remember:!0})})},c.prototype.__paint=function(a,b,c){var d,e,f,g=this;this.parent=a,this.$container=c,this.__nestedSections=[],this.$container.html("function"==typeof this.__renderDefault?this.__renderDefault(this.data||{}):void 0),f=function(a,b){var d;return c=g.__normalizeSelector(a),!b.instance.__independent||(null!=(d=b.instance.__triggeredEvents)?d["section:fetched"]:void 0)?b.instance.__paint(g,b.nested,c):b.instance.__bootstrap(g,b.nested,c,!1)};for(e in b)d=b[e],f(e,d);return this.__load()},c.prototype.__load=function(){var a;return this.parent&&((a=this.parent).__nestedSections||(a.__nestedSections=[]),this.parent.__nestedSections.push(this)),this.__assignElements(),this.__delegateEvents(),this.__runAfterLoads()},c.prototype.__unload=function(a){var b,c,d,e;if(null==a&&(a=!0),this.__runBeforeUnloads(),this.__nestedSections){for(e=this.__nestedSections,c=0,d=e.length;d>c;c++)b=e[c],b.__unload(!1);delete this.__nestedSections}return this.__clearContainer(),this.__clearTime(),this.__removeMetamorphs(),this.__runAfterUnloads(),this.parent&&a&&this.parent.__nestedSections.splice(this.parent.__nestedSections.indexOf(this),1),delete this.previous,delete this.parent},c.prototype.__normalizeSelector=function(a){return"$container"===a?this.$container:$(this.__extractSelector(a),this.$container)},c.prototype.__normalizeWidget=function(a){return"function"!=typeof a||Joosy.Module.hasAncestor(a,Joosy.Widget)||(a=a.call(this)),Joosy.Module.hasAncestor(a,Joosy.Widget)&&(a=new a),a},c}(Joosy.Module),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/widget",function(){return Joosy.Widget})}.call(this),function(){Joosy.helpers("Application",function(){var a,b;return b=document.createTextNode("test"),a=document.createElement("span"),a.appendChild(b),this.escapeOnce=function(c){return b.nodeValue=c,a.innerHTML},this.tag=function(a,b,c,d){var e,f,g,h;null==b&&(b={}),null==c&&(c=!1),null==d&&(d=!0),e=document.createElement(a),g=document.createElement("div");for(a in b)h=b[a],d&&(h=this.escapeOnce(h)),e.setAttribute(a,h);return g.appendChild(e),f=g.innerHTML,c&&(f=f.replace("/>",">")),f},this.contentTag=function(a,b,c,d){var e,f,g,h,i;null==b&&(b=null),null==c&&(c=null),null==d&&(d=!0),"string"==typeof b?(c||(c={}),e=b):"function"==typeof b?(c={},e=b()):null!=b?("function"==typeof c?(d=!0,e=c()):"function"==typeof d&&(e=d(),d=c),c=b):e="",g=document.createElement(a),h=document.createElement("div");for(a in c)i=c[a],d&&(i=this.escapeOnce(i)),g.setAttribute(a,i);try{g.innerHTML=e}catch(j){if(f=j,e)throw f}return h.appendChild(g),h.innerHTML},this.renderWrapped=function(a,b){return this.render(a,Joosy.Module.merge(this,{yield:b()}))},this.linkTo=function(a,b,c){var d,e;return null==a&&(a=""),null==b&&(b=""),null==c&&(c={}),"function"==typeof c&&(d=c,e=[a,b],b=e[0],c=e[1],a=d()),Joosy.Helpers.Application.contentTag("a",a,Joosy.Module.merge(c,{"data-joosy":!0,href:b}))}})}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function d(){this.constructor=b}for(var e in c)a.call(c,e)&&(b[e]=c[e]);return d.prototype=c.prototype,b.prototype=new d,b.__super__=c.prototype,b};Joosy.Layout=function(a){function c(a,b){this.params=a,this.previous=b,this.uid=Joosy.uid()}return b(c,a),c.helper("page"),c.prototype.page=function(a,b){return null==b&&(b={}),b.id=this.uid,Joosy.Helpers.Application.tag(a,b)},c.prototype.content=function(){return $("#"+this.uid)},c.prototype.__renderSection=function(){return"layouts"},c.prototype.__nestingMap=function(a){var b;return b=c.__super__.__nestingMap.call(this),b["#"+this.uid]={instance:a,nested:a.__nestingMap()},b},c.prototype.__bootstrapDefault=function(a,b){return this.__bootstrap(null,this.__nestingMap(a),b)},c}(Joosy.Widget),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/layout",function(){return Joosy.Layout})}.call(this),function(){Joosy.Modules.Page={}}.call(this),function(){Joosy.Modules.Page.Scrolling={included:function(){return this.afterLoad(function(){return this.__scrollElement?this.__performScrolling():void 0}),this.paint(function(a){return this.__scrollElement&&0!==this.__scrollSpeed&&this.__fixHeight(),a()})},ClassMethods:{scroll:function(a,b){return null==b&&(b={}),this.prototype.__scrollElement=a,this.prototype.__scrollSpeed=b.speed||500,this.prototype.__scrollMargin=b.margin||0}},InstanceMethods:{__performScrolling:function(){var a,b,c=this;return a=(null!=(b=$(this.__extractSelector(this.__scrollElement)).offset())?b.top:void 0)+this.__scrollMargin,Joosy.Modules.Log.debugAs(this,"Scrolling to "+this.__extractSelector(this.__scrollElement)),$("html, body").animate({scrollTop:a},this.__scrollSpeed,function(){return 0!==c.__scrollSpeed?c.__releaseHeight():void 0})},__fixHeight:function(){return $("html").css("min-height",$(document).height())},__releaseHeight:function(){return $("html").css("min-height","")}}}}.call(this),function(){Joosy.Modules.Page.Title={title:function(a,b){return null==b&&(b=" / "),this.afterLoad(function(){return"function"==typeof a&&(a=a.apply(this)),a instanceof Array&&(a=a.join(b)),this.__previousTitle=document.title,document.title=a}),this.afterUnload(function(){return document.title=this.__previousTitle})}}}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function d(){this.constructor=b}for(var e in c)a.call(c,e)&&(b[e]=c[e]);return d.prototype=c.prototype,b.prototype=new d,b.__super__=c.prototype,b};Joosy.Page=function(a){function c(a,b){var c;this.params=a,this.previous=b,this.layoutShouldChange=(null!=(c=this.previous)?c.__layoutClass:void 0)!==this.__layoutClass,this.halted=!this.__confirmBeforeLoads(),this.layout=function(){var b,c;switch(!1){case!(this.layoutShouldChange&&this.__layoutClass):return new this.__layoutClass(a,null!=(b=this.previous)?b.layout:void 0);case!!this.layoutShouldChange:return null!=(c=this.previous)?c.layout:void 0}}.call(this),this.layoutShouldChange&&!this.layout&&(this.previous=this.previous.layout)}return b(c,a),c.layout=function(a){return this.prototype.__layoutClass=a},c.concern(Joosy.Modules.Page.Scrolling),c.extend(Joosy.Modules.Page.Title),c.prototype.__renderSection=function(){return"pages"},c.prototype.__bootstrapDefault=function(a){var b;return this.__bootstrap(this.layout,this.__nestingMap(),(null!=(b=this.layout)?b.content():void 0)||a)},c}(Joosy.Widget),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/page",function(){return Joosy.Page})}.call(this),function(){var a,b={}.hasOwnProperty,c=function(a,c){function d(){this.constructor=a}for(var e in c)b.call(c,e)&&(a[e]=c[e]);return d.prototype=c.prototype,a.prototype=new d,a.__super__=c.prototype,a};Joosy.Router=function(b){function d(){return a=d.__super__.constructor.apply(this,arguments)}var e;return c(d,b),d.extend(Joosy.Modules.Events),$(window).bind("popstate",function(a){return d.trigger("popstate",a)}),$(document).on("click","a[data-joosy]",function(a){return a.preventDefault(),Joosy.Router.navigate(this.getAttribute("href"))}),e=function(){function a(a,b){this.__namespace=a,this.__alias=b}return a.run=function(b,c,d){var e;return null==c&&(c=""),null==d&&(d=""),e=new a(c,d),b.call(e)},a.prototype.match=function(a,b){var c;return null==b&&(b={}),null!=b.as&&(c=this.__alias?this.__alias+b.as.charAt(0).toUpperCase()+b.as.slice(1):b.as),a=this.__namespace+a,Joosy.Router.compileRoute(a,b.to,c)},a.prototype.root=function(a){return null==a&&(a={}),this.match("/",{to:a.to,as:a.as||"root"})},a.prototype.notFound=function(a){return null==a&&(a={}),this.match(404,{to:a.to})},a.prototype.namespace=function(b,c,d){var e;return null==c&&(c={}),2===arguments.length&&(d=c,c={}),e=c.as?this.__alias?this.__alias+c.as.charAt(0).toUpperCase()+c.as.slice(1):c.as:this.__alias,a.run(d,this.__namespace+b,e)},a}(),d.map=function(a,b){var c,d,e;e=[];for(c in a)d=a[c],null!=b&&(c=b+"/"+c),"function"==typeof d||d.prototype?e.push(this.compileRoute(c,d)):e.push(this.map(d,c));return e},d.draw=function(a){return e.run(a)},d.setup=function(a,b,c){var d,e=this;return this.config=a,this.responder=b,null==c&&(c=!0),history.pushState||(this.config.prefix=this.config.hashSuffix,this.config.html5=!1),this.config.html5||(this.config.prefix=this.config.hashSuffix),(d=this.config).prefix||(d.prefix=""),this.config.html5?(this.config.prefix=("/"+this.config.prefix+"/").replace(/\/{2,}/g,"/"),this.suppressPopstate=!0,this.initialPath=location.pathname,this.popstateListener=this.bind("popstate",function(){var a;return a=e.suppressPopstate&&location.pathname===e.initialPath,e.suppressPopstate=!1,a?Joosy.Modules.Log.debug("Router> Suppressed initial popstate"):e.respond(e.canonizeLocation())}),this.pushstateListener=this.bind("pushstate",function(){return e.suppressPopstate=!1,e.respond(e.canonizeLocation())})):(this.config.prefix=this.config.prefix.replace(/^\#?\/?/,"").replace(/\/?$/,""),$(window).bind("hashchange.JoosyRouter",function(){return null!=e.__skipHashChange&&e.__skipHashChange>0?e.__skipHashChange-=1:e.respond(e.canonizeLocation())})),c?this.respond(this.canonizeLocation()):void 0},d.reset=function(){var a,b,c;if(null!=Joosy.Helpers.Routes){c=Joosy.Helpers.Routes;for(a in c)b=c[a],delete Joosy.Widget.prototype[a];Joosy.Helpers.Routes={}}return this.unbind(this.popstateListener),this.unbind(this.pushstateListener),$(window).unbind(".JoosyRouter"),this.restriction=!1,this.routes={}},d.restrict=function(a){this.restriction=a},d.navigate=function(a,b){var c,d,e;null==b&&(b={}),c=b.replace?"replaceState":"pushState",d=null!=(e=b.respond)?e:!0,this.config.html5?(this.config.prefix&&"/"===a[0]&&!a.match(RegExp("^"+this.config.prefix.replace(/\/$/,"")+"(/|$)"))&&(a=a.replace(/^\//,this.config.prefix)),history[c]({},"",a),d&&this.trigger("pushstate")):(this.config.prefix&&!a.match(RegExp("^#?/?"+this.config.prefix+"(/|$)"))&&(a=a.replace(/^\#?\/?/,""+this.config.prefix+"/")),d||(null==this.__skipHashChange&&(this.__skipHashChange=0),this.__skipHashChange+=1),location.hash=a)},d.canonizeLocation=function(){return this.config.html5?location.pathname.replace(RegExp("^("+this.config.prefix+"?)?/?"),"/")+location.search:location.hash.replace(RegExp("^#?/?("+this.config.prefix+"(/|$))?"),"/")},d.compileRoute=function(a,b,c){var d,e,f;return"404"===a.toString()?(this.wildcardAction=b,void 0):("/"===a[0]&&(a=a.substr(1)),d=a.replace(/\/{2,}/g,"/"),f={},d=d.replace(/\/?:([^\/]+)/g,"/([^/]+)"),d=d.replace(/^\/?/,"^/?"),d=d.replace(/\/?$/,"/?$"),e=(a.match(/\/?:[^\/]+/g)||[]).map(function(a){return"/"===a[0]&&(a=a.substr(1)),a.substr(1)}),this.routes||(this.routes={}),this.routes[d]={to:b,capture:e,as:c},null!=c?this.defineHelpers(a,c):void 0)},d.respond=function(a){var b,c,d,e,f,g;if(Joosy.Modules.Log.debug("Router> Answering '"+a+"'"),this.restriction&&null===a.match(this.restriction))return this.trigger("restricted",a),void 0;f=a.split("?"),a=f[0],c=f[1],c=(null!=c?"function"==typeof c.split?c.split("&"):void 0:void 0)||[],g=this.routes;for(d in g)if(e=g[d],this.routes.hasOwnProperty(d)&&(b=a.match(new RegExp(d))))return this.responder(e.to,this.__grabParams(c,e,b)),this.trigger("responded",a),void 0;return null!=this.wildcardAction?(this.responder(this.wildcardAction,a),this.trigger("responded")):this.trigger("missed")},d.defineHelpers=function(a,b){var c;return c=function(b){var c,d,e,f,g;if(e=a,c=a.match(/\/:[^\/]+/g))for(f=0,g=c.length;g>f;f++)d=c[f],e=e.replace(d.substr(1),b[d.substr(2)]);return Joosy.Router.config.html5?""+Joosy.Router.config.prefix+e:"#"+Joosy.Router.config.prefix+e},Joosy.helpers("Routes",function(){return this[""+b+"Path"]=c,this[""+b+"Url"]=function(a){var b;return b=""+location.protocol+"//"+location.host,Joosy.Router.config.html5?""+b+c(a):""+b+location.pathname+c(a)},Joosy.Widget.prototype[""+b+"Path"]=this[""+b+"Path"],Joosy.Widget.prototype[""+b+"Url"]=this[""+b+"Url"]})},d.__grabParams=function(a,b,c){var d,e,f,g,h,i,j,k,l,m;if(null==b&&(b=null),null==c&&(c=[]),g={},c.shift(),d=null!=b?b.capture:void 0)for(i=0,k=d.length;k>i;i++)f=d[i],g[f]=decodeURIComponent(c.shift());for(j=0,l=a.length;l>j;j++)e=a[j],e.length>0&&(m=e.split("="),f=m[0],h=m[1],g[f]=h);return g},d}.call(this,Joosy.Module),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/router",function(){return Joosy.Router})}.call(this),function(){Joosy.Templaters.JST=function(){function a(a){this.config=null!=a?a:{},null!=this.config.prefix&&this.config.prefix.length>0&&(this.prefix=this.config.prefix)}return a.prototype.buildView=function(a){var b,c,d,e,f;for(d=!1,b=this.prefix?[""+this.prefix+"/templates/"+a+"-"+("undefined"!=typeof I18n&&null!==I18n?I18n.locale:void 0),""+this.prefix+"/templates/"+a]:["templates/"+a+"-"+("undefined"!=typeof I18n&&null!==I18n?I18n.locale:void 0),"templates/"+a],e=0,f=b.length;f>e;e++)if(c=b[e],window.JST[c])return window.JST[c];throw new Error("Template '"+a+"' not found. Checked at: '"+b.join(", ")+"'")},a.prototype.resolveTemplate=function(a,b,c){var d,e,f;return"/"===b[0]?b.substr(1):(d=null!=(e=c.constructor)?null!=(f=e.__namespace__)?f.map(function(a){return inflection.underscore(a)}):void 0:void 0,d||(d=[]),d.unshift(a),""+d.join("/")+"/"+b)},a}(),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/templaters/jst",function(){return Joosy.Templaters.JST})}.call(this),function(){Joosy.helpers("Application",function(){return this.widget=function(a,b,c){var d=this;return null==c&&(c=b,b={}),b.id=Joosy.uid(),this.__renderer.setTimeout(0,function(){return d.__renderer.registerWidget($("#"+b.id),c)}),this.tag(a,b)}})}.call(this),function(){}.call(this),function(){Joosy.Application=function(){function a(){}return a.Pages={},a.Layouts={},a.Controls={},a.initialized=!1,a.loading=!0,a.defaultConfig={test:!1,debug:!1,templater:{prefix:""},router:{html5:!1,base:"",prefix:""}},a.initialize=function(a,b){var c=this;if(this.selector=a,null==b&&(b={}),this.initialized)throw new Error("Attempted to initialize Application twice");return this.config={},Joosy.Module.merge(this.config,this.defaultConfig,!0,!0),null!=window.JoosyEnvironment&&Joosy.Module.merge(this.config,window.JoosyEnvironment,!0,!0),Joosy.Module.merge(this.config,b,!0,!0),this.config.test&&this.forceSandbox(),Joosy.templater(new Joosy.Templaters.JST(this.config.templater)),Joosy.debug(this.config.debug),Joosy.Router.setup(this.config.router,function(a,b){if(Joosy.Module.hasAncestor(a,Joosy.Page))return c.changePage(a,b);if("function"==typeof a)return a(b);throw new Error("Unknown kind of route action: "+a)}),this.initialized=!0},a.reset=function(){var a;return Joosy.Router.reset(),Joosy.templater(!1),Joosy.debug(!1),null!=(a=this.page)&&a.__unload(),delete this.page,this.loading=!0,this.initialized=!1},a.content=function(){return $(this.selector)},a.changePage=function(a,b){var c;return c=new a(b,this.page),c.halted?void 0:(c.layoutShouldChange&&c.layout?c.layout.__bootstrapDefault(c,this.content()):c.__bootstrapDefault(this.content()),this.page=c)},a.forceSandbox=function(){var a;return a=Joosy.uid(),this.selector="#"+a,$("body").append($("<div/>").attr("id",a).css({height:"0px",width:"0px",overflow:"hidden"}))},a}(),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/application",function(){return Joosy.Application})}.call(this),function(){}.call(this);
@@ -1 +1 @@
1
- (function(){var a={}.hasOwnProperty,b=function(b,c){function d(){this.constructor=b}for(var e in c)a.call(c,e)&&(b[e]=c[e]);return d.prototype=c.prototype,b.prototype=new d,b.__super__=c.prototype,b};Joosy.Form=function(a){function c(a,b){var c,d,e,f,g=this;if(null==b&&(b={}),"function"==typeof b)this.success=b;else for(c in b)e=b[c],this[c]=e;this.$container=$(a),0!==this.$container.length&&(this.__assignElements(),this.__delegateEvents(),d=null!=(f=this.$container.get(0).getAttribute("method"))?f.toLowerCase():void 0,d&&-1!==!["get","post"].indexOf(d)&&(this.__markMethod(d),this.$container.attr("method","POST")),this.$container.ajaxForm({dataType:"json",beforeSend:function(){return g.__debounce.apply(g,arguments)?!1:(g.__before.apply(g,arguments),g.__pending_request=!0,g.debugAs(g,"beforeSend: pending_request = true"),!0)},success:function(){return g.__pending_request=!1,g.debugAs(g,"success: pending_request = false"),g.__success.apply(g,arguments)},error:function(){return g.__pending_request=!1,g.debugAs(g,"error: pending_request = false"),g.__error.apply(g,arguments)},xhr:function(){var a;return a=$.ajaxSettings.xhr(),null!=a.upload&&g.progress&&(a.upload.onprogress=function(a){return a.lengthComputable?g.progress((100*(a.position/a.total)).round(2)):void 0}),a}}),null!=this.resource&&(this.fill(this.resource,b),delete this.resource),null!=this.action&&(this.$container.attr("action",this.action),this.$container.attr("method","POST")),null!=this.method&&this.__markMethod(this.method))}return b(c,a),c.include(Joosy.Modules.DOM),c.include(Joosy.Modules.Log),c.include(Joosy.Modules.Events),c.prototype.invalidationClass="field_with_errors",c.prototype.substitutions={},c.mapElements({fields:"input,select,textarea"}),c.submit=function(a,b){return null==b&&(b={}),a=new this(a,b),a.$container.submit(),a.unbind(),null},c.attach=function(){return function(a,b,c){c.prototype=a.prototype;var d=new c,e=a.apply(d,b);return Object(e)===e?e:d}(Joosy.Form,arguments,function(){})},c.prototype.unbind=function(){return this.$container.unbind("submit").find("input:submit,input:image,button:submit").unbind("click")},c.prototype.fill=function(a,b){var c,d,e,f=this;return"function"==typeof a.build&&(a=a.build()),this.__resource=a,c=null!=(null!=b?b.decorator:void 0)?b.decorator(a.data):a.data,d=function(a,b){var c,e,g;if(!a.__joosy_form_filler_lock){a.__joosy_form_filler_lock=!0,g=function(a,c){var e,g,h,i,j,k,l;if(i=f.concatFieldName(b,a),h=f.$fields().filter("[name='"+i+"']:not(:file),[name='"+inflection.underscore(i)+"']:not(:file),[name='"+inflection.camelize(i,!0)+"']:not(:file)"),h.length>0&&(h.is(":checkbox")?c?h.attr("checked","checked"):h.removeAttr("checked"):h.is(":radio")?h.filter("[value='"+c+"']").attr("checked","checked"):h.val(c)),c instanceof Joosy.Resources.Array){for(l=[],g=j=0,k=c.length;k>j;g=++j)e=c[g],l.push(d(e.data,f.concatFieldName(b,"["+a+"_attributes]["+g+"]")));return l}return c instanceof Joosy.Resources.REST?d(c.data,f.concatFieldName(b,"["+a+"_attributes]")):(null!=c?c.constructor:void 0)===Object||c instanceof Array?d(c,i):void 0};for(c in a)e=a[c],g(c,e);return delete a.__joosy_form_filler_lock}},d(c,a.__entityName||b.resourceName),$("input[name=_method]",this.$container).remove(),a.id()&&this.__markMethod((null!=b?b.method:void 0)||"PUT"),e=(null!=b?b.action:void 0)||(null!=a.id()?a.memberPath():a.collectionPath()),this.$container.attr("action",e),this.$container.attr("method","POST")},c.prototype.submit=function(){return this.$container.submit()},c.prototype.serialize=function(a){var b;return null==a&&(a=!0),b=this.$container.serialize(),a&&(b=b.replace(/\&?\_method\=put/i,"")),b},c.prototype.__success=function(a,b,c){var d;return c?"function"==typeof this.success?this.success(a):void 0:200<=(d=a.status)&&300>d?this.success(a.json):this.__error(a.json)},c.prototype.__before=function(){return null==this.before||this.before.apply(this,arguments)===!0?this.$fields().removeClass(this.invalidationClass):void 0},c.prototype.__error=function(a){var b,c,d,e,f,g=this;if(c=function(){if(!a.responseText)return a;try{return a=jQuery.parseJSON(a.responseText)}catch(c){return b=c,{}}}(),null==this.error||this.error(c)===!0){c=this.__stringifyErrors(c),f=function(a,b){var c;return c=g.findField(a).addClass(g.invalidationClass),"function"==typeof g.notification?g.notification(c,b):void 0};for(d in c)e=c[d],f(d,e);return c}return!1},c.prototype.__debounce=function(a){return this.debugAs(this,"debounce: pending_request == "+this.__pending_request),this.__pending_request&&this.debounce!==!1&&(this.debounce||Joosy.Form.debounceForms)?(a.abort(),this.debugAs(this,"debounce: xhr aborted"),!0):!1},c.prototype.findField=function(a){return this.$fields().filter("[name='"+a+"']")},c.prototype.__markMethod=function(a){return null==a&&(a="PUT"),a=$("<input/>",{type:"hidden",name:"_method",value:a}),this.$container.append(a)},c.prototype.__stringifyErrors=function(a){var b,c,d,e,f,g=this;d={},(null!=a?null!=(f=a.errors)?f.constructor:void 0:void 0)===Object&&(a=a.errors),e=function(a,b){var c,e,f,h,i,j,k,l,m;if(null!=g.substitutions[a]&&(a=g.substitutions[a]),b.constructor===Object||g.isArrayOfObjects(b)){l=g.__foldInlineEntities(b),m=[];for(e in l)i=l[e],m.push(d[a+e]=i);return m}if(-1!==a.indexOf("."))for(h=a.split("."),a=h.shift(),(g.resourceName||g.__resource)&&(f=g.resourceName||g.__resource.__entityName,a=f+("["+a+"]")),j=0,k=h.length;k>j;j++)c=h[j],a+="["+c+"]";else(g.resourceName||g.__resource)&&(f=g.resourceName||g.__resource.__entityName,a=f+("["+a+"]"));return d[a]=b};for(b in a)c=a[b],e(b,c);return d},c.prototype.__foldInlineEntities=function(a,b,c){var d,e;null==b&&(b=""),null==c&&(c={});for(d in a)e=a[d],(null!=e?e.constructor:void 0)===Object||this.isArrayOfObjects(e)?this.__foldInlineEntities(e,""+b+"["+d+"]",c):c[""+b+"["+d+"]"]=e;return c},c.prototype.concatFieldName=function(a,b){var c;return c=this.splitFieldName(a).concat(this.splitFieldName(b)),""+c[0]+"["+c.slice(1).join("][")+"]"},c.prototype.splitFieldName=function(a){var b,c;return c=a.split("]["),b=c[0].split("["),2===b.length&&(0===b[0].length?c.splice(0,1,b[1]):c.splice(0,1,b[0],b[1]),c[c.length-1]=c[c.length-1].split("]")[0]),c},c.prototype.isArrayOfObjects=function(a){return a instanceof Array&&0===a.filter(function(a){return(null!=a?a.constructor:void 0)!==Object}).length},c}(Joosy.Module),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/form",function(){return Joosy.Form})}).call(this);
1
+ (function(){var a={}.hasOwnProperty,b=function(b,c){function d(){this.constructor=b}for(var e in c)a.call(c,e)&&(b[e]=c[e]);return d.prototype=c.prototype,b.prototype=new d,b.__super__=c.prototype,b};Joosy.Form=function(a){function c(a,b){var c,d,e,f,g=this;if(null==b&&(b={}),"function"==typeof b)this.success=b;else for(c in b)e=b[c],this[c]=e;this.$container=$(a),0!==this.$container.length&&(this.__assignElements(),this.__delegateEvents(),d=null!=(f=this.$container.get(0).getAttribute("method"))?f.toLowerCase():void 0,d&&-1===["get","post"].indexOf(d)&&(this.__markMethod(d),this.$container.attr("method","POST")),this.$container.ajaxForm({dataType:"json",beforeSend:function(){return g.__debounce.apply(g,arguments)?!1:(g.__before.apply(g,arguments),g.__pending_request=!0,g.debugAs(g,"beforeSend: pending_request = true"),!0)},success:function(){return g.__pending_request=!1,g.debugAs(g,"success: pending_request = false"),g.__success.apply(g,arguments)},error:function(){return g.__pending_request=!1,g.debugAs(g,"error: pending_request = false"),g.__error.apply(g,arguments)},xhr:function(){var a;return a=$.ajaxSettings.xhr(),null!=a.upload&&g.progress&&(a.upload.onprogress=function(a){return a.lengthComputable?g.progress((100*(a.position/a.total)).round(2)):void 0}),a}}),null!=this.resource&&(this.fill(this.resource,b),delete this.resource),null!=this.action&&(this.$container.attr("action",this.action),this.$container.attr("method","POST")),null!=this.method&&this.__markMethod(this.method))}return b(c,a),c.concern(Joosy.Modules.DOM),c.include(Joosy.Modules.Log),c.include(Joosy.Modules.Events),c.prototype.invalidationClass="field_with_errors",c.prototype.substitutions={},c.mapElements({fields:"input,select,textarea"}),c.submit=function(a,b){return null==b&&(b={}),a=new this(a,b),a.$container.submit(),a.unbind(),null},c.attach=function(){return function(a,b,c){c.prototype=a.prototype;var d=new c,e=a.apply(d,b);return Object(e)===e?e:d}(Joosy.Form,arguments,function(){})},c.prototype.unbind=function(){return this.$container.unbind("submit").find("input:submit,input:image,button:submit").unbind("click")},c.prototype.fill=function(a,b){var c,d,e,f=this;return"function"==typeof a.build&&(a=a.build()),this.__resource=a,c=null!=(null!=b?b.decorator:void 0)?b.decorator(a.data):a.data,d=function(a,b){var c,e,g;if(!a.__joosy_form_filler_lock){a.__joosy_form_filler_lock=!0,g=function(a,c){var e,g,h,i,j,k,l;if(i=f.concatFieldName(b,a),h=f.$fields().filter("[name='"+i+"']:not(:file),[name='"+inflection.underscore(i)+"']:not(:file),[name='"+inflection.camelize(i,!0)+"']:not(:file)"),h.length>0&&(h.is(":checkbox")?c?h.attr("checked","checked"):h.removeAttr("checked"):h.is(":radio")?h.filter("[value='"+c+"']").attr("checked","checked"):h.val(c)),c instanceof Joosy.Resources.Array){for(l=[],g=j=0,k=c.length;k>j;g=++j)e=c[g],l.push(d(e.data,f.concatFieldName(b,"["+a+"_attributes]["+g+"]")));return l}return c instanceof Joosy.Resources.REST?d(c.data,f.concatFieldName(b,"["+a+"_attributes]")):(null!=c?c.constructor:void 0)===Object||c instanceof Array?d(c,i):void 0};for(c in a)e=a[c],g(c,e);return delete a.__joosy_form_filler_lock}},d(c,a.__entityName||b.resourceName),$("input[name=_method]",this.$container).remove(),a.id()&&this.__markMethod((null!=b?b.method:void 0)||"PUT"),e=(null!=b?b.action:void 0)||(null!=a.id()?a.memberPath():a.collectionPath()),this.$container.attr("action",e),this.$container.attr("method","POST")},c.prototype.submit=function(){return this.$container.submit()},c.prototype.serialize=function(a){var b;return null==a&&(a=!0),b=this.$container.serialize(),a&&(b=b.replace(/\&?\_method\=put/i,"")),b},c.prototype.__success=function(a,b,c){var d;return c?"function"==typeof this.success?this.success(a):void 0:200<=(d=a.status)&&300>d?this.success(a.json):this.__error(a.json)},c.prototype.__before=function(){return null==this.before||this.before.apply(this,arguments)===!0?this.$fields().removeClass(this.invalidationClass):void 0},c.prototype.__error=function(a){var b,c,d,e,f,g=this;if(c=function(){if(!a.responseText)return a;try{return a=jQuery.parseJSON(a.responseText)}catch(c){return b=c,{}}}(),null==this.error||this.error(c)===!0){c=this.__stringifyErrors(c),f=function(a,b){var c;return c=g.findField(a).addClass(g.invalidationClass),"function"==typeof g.notification?g.notification(c,b):void 0};for(d in c)e=c[d],f(d,e);return c}return!1},c.prototype.__debounce=function(a){return this.debugAs(this,"debounce: pending_request == "+this.__pending_request),this.__pending_request&&this.debounce!==!1&&(this.debounce||Joosy.Form.debounceForms)?(a.abort(),this.debugAs(this,"debounce: xhr aborted"),!0):!1},c.prototype.findField=function(a){return this.$fields().filter("[name='"+a+"']")},c.prototype.__markMethod=function(a){return null==a&&(a="PUT"),a=$("<input/>",{type:"hidden",name:"_method",value:a}),this.$container.append(a)},c.prototype.__stringifyErrors=function(a){var b,c,d,e,f,g=this;d={},(null!=a?null!=(f=a.errors)?f.constructor:void 0:void 0)===Object&&(a=a.errors),e=function(a,b){var c,e,f,h,i,j,k,l,m;if(null!=g.substitutions[a]&&(a=g.substitutions[a]),b.constructor===Object||g.isArrayOfObjects(b)){l=g.__foldInlineEntities(b),m=[];for(e in l)i=l[e],m.push(d[a+e]=i);return m}if(-1!==a.indexOf("."))for(h=a.split("."),a=h.shift(),(g.resourceName||g.__resource)&&(f=g.resourceName||g.__resource.__entityName,a=f+("["+a+"]")),j=0,k=h.length;k>j;j++)c=h[j],a+="["+c+"]";else(g.resourceName||g.__resource)&&(f=g.resourceName||g.__resource.__entityName,a=f+("["+a+"]"));return d[a]=b};for(b in a)c=a[b],e(b,c);return d},c.prototype.__foldInlineEntities=function(a,b,c){var d,e;null==b&&(b=""),null==c&&(c={});for(d in a)e=a[d],(null!=e?e.constructor:void 0)===Object||this.isArrayOfObjects(e)?this.__foldInlineEntities(e,""+b+"["+d+"]",c):c[""+b+"["+d+"]"]=e;return c},c.prototype.concatFieldName=function(a,b){var c;return c=this.splitFieldName(a).concat(this.splitFieldName(b)),""+c[0]+"["+c.slice(1).join("][")+"]"},c.prototype.splitFieldName=function(a){var b,c;return c=a.split("]["),b=c[0].split("["),2===b.length&&(0===b[0].length?c.splice(0,1,b[1]):c.splice(0,1,b[0],b[1]),c[c.length-1]=c[c.length-1].split("]")[0]),c},c.prototype.isArrayOfObjects=function(a){return a instanceof Array&&0===a.filter(function(a){return(null!=a?a.constructor:void 0)!==Object}).length},c}(Joosy.Module),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/form",function(){return Joosy.Form})}).call(this);
@@ -1 +1 @@
1
- (function(){var a={}.hasOwnProperty,b=function(b,c){function d(){this.constructor=b}for(var e in c)a.call(c,e)&&(b[e]=c[e]);return d.prototype=c.prototype,b.prototype=new d,b.__super__=c.prototype,b};Joosy.Resources.Array=function(a){function c(){this.__fillData(arguments,!1)}return b(c,a),Joosy.Module.merge(c,Joosy.Module),c.include(Joosy.Modules.Events),c.include(Joosy.Modules.Filters),c.registerPlainFilters("beforeLoad"),c.build=function(){return function(a,b,c){c.prototype=a.prototype;var d=new c,e=a.apply(d,b);return Object(e)===e?e:d}(this,arguments,function(){})},c.prototype.load=function(){return this.__fillData(arguments)},c.prototype.get=function(a){return this[a]},c.prototype.set=function(a,b){return this[a]=b,this.trigger("changed"),b},c.prototype.push=function(){var a;return a=c.__super__.push.apply(this,arguments),this.trigger("changed"),a},c.prototype.pop=function(){var a;return a=c.__super__.pop.apply(this,arguments),this.trigger("changed"),a},c.prototype.shift=function(){var a;return a=c.__super__.shift.apply(this,arguments),this.trigger("changed"),a},c.prototype.unshift=function(){var a;return a=c.__super__.unshift.apply(this,arguments),this.trigger("changed"),a},c.prototype.splice=function(){var a;return a=c.__super__.splice.apply(this,arguments),this.trigger("changed"),a},c.prototype.__fillData=function(a,b){var c,d,e,f;for(null==b&&(b=!0),a=this.slice.call(a,0),this.length>0&&this.splice(0,this.length),f=this.__applyBeforeLoads(a),d=0,e=f.length;e>d;d++)c=f[d],this.push(c);return b&&this.trigger("changed"),null},c}(Array),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/resources/array",function(){return Joosy.Resources.Array})}).call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function d(){this.constructor=b}for(var e in c)a.call(c,e)&&(b[e]=c[e]);return d.prototype=c.prototype,b.prototype=new d,b.__super__=c.prototype,b};Joosy.Resources.Hash=function(a){function c(a){null==a&&(a={}),this.__fillData(a,!1)}return b(c,a),c.include(Joosy.Modules.Events),c.include(Joosy.Modules.Filters),c.registerPlainFilters("beforeLoad"),c.build=function(){return function(a,b,c){c.prototype=a.prototype;var d=new c,e=a.apply(d,b);return Object(e)===e?e:d}(this,arguments,function(){})},c.prototype.__call=function(a,b){return arguments.length>1?this.set(a,b):this.get(a)},c.prototype.load=function(a){return this.__fillData(a),this},c.prototype.get=function(a){var b,c,d;return d=this.__callTarget(a,!0),b=d[0],c=d[1],b?b.get?b.get(c):b[c]:void 0},c.prototype.set=function(a,b){var c,d,e;return e=this.__callTarget(a),c=e[0],d=e[1],null!=c.set?c.set(d,b):c[d]=b,this.trigger("changed"),b},c.prototype.__callTarget=function(a,b){var c,d,e,f,g;if(null==b&&(b=!1),-1!==a.indexOf(".")&&null==this.data[a]){for(a=a.split("."),c=a.pop(),e=this.data,f=0,g=a.length;g>f;f++){if(d=a[f],b&&null==e[d])return!1;null==e[d]&&(e[d]={}),e=e.__get?e.__get(d):e[d]}return[e,c]}return[this.data,a]},c.prototype.__fillData=function(a,b){return null==b&&(b=!0),this.data=this.__applyBeforeLoads(a),b&&this.trigger("changed"),null},c.prototype.toString=function(){return"Hash: "+JSON.stringify(this.data)},c}(Joosy.Module),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/resources/hash",function(){return Joosy.Resources.Hash})}.call(this),function(){Joosy.Modules.Resources={}}.call(this),function(){Joosy.Modules.Resources.Model={included:function(){return this.primaryKey=function(a){return this.prototype.__primaryKey=a},this.collection=function(a){return this.prototype.__collection=a},this.entity=function(a){return this.prototype.__entityName=a},this.map=function(a,b){if(null==b&&(b=!1),b||(b=window[inflection.camelize(inflection.singularize(a))]),!b)throw new Error(""+Joosy.Module.__className(this)+"> class can not be detected for '"+a+"' mapping");return this.beforeLoad(function(c){var d;return null==b.build&&(b=b()),c[a]instanceof Array?(d=c[a].map(function(a){return b.build(a)}),c[a]=function(a,b,c){c.prototype=a.prototype;var d=new c,e=a.apply(d,b);return Object(e)===e?e:d}(b.prototype.__collection,d,function(){})):c[a]&&(c[a]=b.build(c[a])),c})},this.grab=function(a){return this.build({}).grab(a)},this.attrAccessor=function(){var a,b,c,d,e=this;for(d=[],b=0,c=arguments.length;c>b;b++)a=arguments[b],d.push(function(a){return e.prototype[a]=function(b){return null!=b?this.set(a,b):this.get(a)}}(a));return d}},__primaryKey:"id",__collection:Joosy.Resources.Array,id:function(){var a;return null!=(a=this.data)?a[this.__primaryKey]:void 0},knownAttributes:function(){return Object.keys(this.data)},load:function(a,b){return null==b&&(b=!1),b&&(this.data={}),this.__fillData(a),this},__fillData:function(a,b){return null==b&&(b=!0),this.raw=a,this.hasOwnProperty("data")||(this.data={}),Joosy.Module.merge(this.data,this.__applyBeforeLoads(a)),b&&this.trigger("changed"),null},grab:function(a){var b,c,d,e,f;for(b={},f=$(a).serializeArray(),d=0,e=f.length;e>d;d++)c=f[d],b[c.name]?(b[c.name]instanceof Array||(b[c.name]=[b[c.name]]),b[c.name].push(c.value)):b[c.name]=c.value;return this.load(b)},toString:function(){return"<Resource "+this.__entityName+"> "+JSON.stringify(this.data)}}}.call(this),function(){var a,b={}.hasOwnProperty,c=function(a,c){function d(){this.constructor=a}for(var e in c)b.call(c,e)&&(a[e]=c[e]);return d.prototype=c.prototype,a.prototype=new d,a.__super__=c.prototype,a},d=[].slice;Joosy.Resources.REST=function(b){function e(){return a=e.__super__.constructor.apply(this,arguments)}return c(e,b),e.include(Joosy.Modules.Resources.Model),e.registerPlainFilters("beforeSave"),e.beforeLoad(function(a){var b;return a.constructor===Object&&1===Object.keys(a).length&&this.__entityName&&(b=inflection.camelize(this.__entityName,!0),a[b]&&(a=a[b])),a}),e.requestOptions=function(a){return this.prototype.__requestOptions=a},e.source=function(a){return this.__source=a},e.__atWrapper=function(){var a,b,c=this;return b=arguments[0],a=2<=arguments.length?d.call(arguments,1):[],1===a.length&&a[0]instanceof Array?this.__atWrapper.apply(this,[b].concat(d.call(a[0]))):b(function(b){return b.__source=a.reduce(function(a,b){return a+=Joosy.Module.hasAncestor(b.constructor,Joosy.Resources.REST)?b.memberPath():b.replace(/^\/?/,"/")},""),b.__source+="/"+inflection.pluralize(c.prototype.__entityName)})},e.at=function(){var a=this;return this.__atWrapper.apply(this,[function(b){var d,e;return d=function(a){function d(){return e=d.__super__.constructor.apply(this,arguments)}return c(d,a),b(d),d}(a)}].concat(d.call(arguments)))},e.prototype.at=function(){var a,b;return a=1<=arguments.length?d.call(arguments,0):[],new((b=this.constructor).at.apply(b,a))(this.data)},e.prototype.__interpolatePath=function(a,b){return b instanceof Array||(b=[b]),b.reduce(function(a,b){return b instanceof Joosy.Resources.REST&&(b=b.id()),a.replace(/:[^\/]+/,b)},a)},e.collectionPath=function(){var a,b;return a=1<=arguments.length?d.call(arguments,0):[],(b=this.prototype).collectionPath.apply(b,a)},e.prototype.collectionPath=function(a,b){var c,d,e;return null==a&&(a=[]),null==b&&(b={}),a.constructor===Object&&(b=a,a=[]),b.url?b.url:(e=this.__source||this.constructor.__source,e?d=this.__interpolatePath(e,a):(d="/",this.constructor.__namespace__.length>0&&(c=this.constructor.__namespace__.map(function(a){return inflection.underscore(a)}),d+=c.join("/")+"/"),d+=inflection.pluralize(this.__entityName)),b.action&&(d+="/"+b.action),d)},e.memberPath=function(){var a,b;return a=1<=arguments.length?d.call(arguments,0):[],(b=this.prototype).memberPath.apply(b,a)},e.prototype.memberPath=function(a,b){var c,d,e;return null==a&&(a=[]),null==b&&(b={}),a.constructor===Object&&(b=a,a=[]),b.url?b.url:(a instanceof Array||(a=[a]),d=this.id()||a.pop(),c=b.action,a.push(this.id()),e=this.collectionPath(a,Joosy.Module.merge(b,{action:void 0}))+("/"+d),null!=c&&(e+="/"+c),e)},e.send=function(a,b,c){var d;return d=this.prototype.__extractOptionsAndCallback(b,c),b=d[0],c=d[1],this.__query(this.collectionPath(b),a.toUpperCase(),b.params,c)},e.prototype.send=function(a,b,c){var d;return d=this.__extractOptionsAndCallback(b,c),b=d[0],c=d[1],this.constructor.__query(this.memberPath(b),a.toUpperCase(),b.params,c)},e.prototype.reload=function(a,b){var c,d=this;return null==a&&(a={}),null==b&&(b=!1),c=this.__extractOptionsAndCallback(a,b),a=c[0],b=c[1],this.constructor.__query(this.memberPath(a),"GET",a.params,function(a,c,e){return null!=c&&d.load(c),"function"==typeof b?b(a,d,c,e):void 0})},e.find=function(a,b,c){var d,e;return null==b&&(b={}),null==c&&(c=!1),e=this.prototype.__extractOptionsAndCallback(b,c),b=e[0],c=e[1],d={},d[this.prototype.__primaryKey]=a instanceof Array?a[a.length-1]:a,d=this.build(d),a instanceof Array&&a.length>1&&(d.__source=this.collectionPath(a)),this.__query(this.memberPath(a,b),"GET",b.params,function(a,b,e){return null!=b&&d.load(b),"function"==typeof c?c(a,d,b,e):void 0}),d},e.all=function(a,b,c){var d,e,f,g=this;return null==b&&(b={}),null==c&&(c=!1),"function"==typeof a||a.constructor===Object?(e=this.prototype.__extractOptionsAndCallback(a,b),b=e[0],c=e[1],a=[]):(f=this.prototype.__extractOptionsAndCallback(b,c),b=f[0],c=f[1]),d=new this.prototype.__collection,this.__query(this.collectionPath(a,b),"GET",b.params,function(b,e,f){var h;if(null!=(h=e)){if(h.constructor===Object&&!(h=h[inflection.pluralize(g.prototype.__entityName)]))throw new Error("Invalid data for `all` received: "+JSON.stringify(h));h=h.map(function(b){var c;return c=g.build(b),a.length>1&&(c.__source=g.collectionPath(a)),c}),d.load.apply(d,h)}return"function"==typeof c?c(b,d,e,f):void 0}),d},e.prototype.update=function(a){var b=this;return this.send("put",{params:this.__applyBeforeSaves(this.data)},function(c,d){return c||b.load(d),"function"==typeof a?a(c,b):void 0})},e.prototype.create=function(a){var b=this;return this.constructor.send("post",{params:this.__applyBeforeSaves(this.data)},function(c,d){return c||b.load(d),"function"==typeof a?a(c,b):void 0})},e.prototype.save=function(a){return this.id()?this.update(a):this.create(a)},e.__query=function(a,b,c,d){var e;return e={url:a,data:c,type:b,cache:!1,dataType:"json"},"function"==typeof d?(e.success=function(a,b,c){return d(!1,a,c)},e.error=function(a){return d(a)}):Joosy.Module.merge(e,d),this.prototype.__requestOptions instanceof Function?this.prototype.__requestOptions(e):this.prototype.__requestOptions&&Joosy.Module.merge(e,this.prototype.__requestOptions),$.ajax(e)},e.prototype.__extractOptionsAndCallback=function(a,b){return"function"==typeof a&&(b=a,a={}),[a,b]},e}(Joosy.Resources.Hash),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/resources/rest",function(){return Joosy.Resources.REST})}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function d(){this.constructor=b}for(var e in c)a.call(c,e)&&(b[e]=c[e]);return d.prototype=c.prototype,b.prototype=new d,b.__super__=c.prototype,b};Joosy.Resources.Scalar=function(a){function c(a){this.load(a)}return b(c,a),c.include(Joosy.Modules.Events),c.include(Joosy.Modules.Filters),c.registerPlainFilters("beforeLoad"),c.build=function(){return function(a,b,c){c.prototype=a.prototype;var d=new c,e=a.apply(d,b);return Object(e)===e?e:d}(this,arguments,function(){})},c.prototype.__call=function(){return arguments.length>0?this.set(arguments[0]):this.get()},c.prototype.load=function(a){return this.value=this.__applyBeforeLoads(a),this.trigger("changed"),this.value},c.prototype.get=function(){return this.value},c.prototype.set=function(a){return this.value=a,this.trigger("changed")},c.prototype.valueOf=function(){return this.value.valueOf()},c.prototype.toString=function(){return this.value.toString()},c}(Joosy.Module),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/resources/scalar",function(){return Joosy.Resources.Scalar})}.call(this),function(){var a=[].slice;Joosy.Modules.Resources.Cacher={included:function(){return this.cache=function(a){return this.prototype.__cacheKey=a},this.fetcher=function(a){return this.prototype.__fetcher=a},this.cached=function(a,b,c){var d,e=this;return null==b&&(b=!1),null==c&&(c=!1),"function"==typeof b&&(c=b,b=void 0),b||(b=this.prototype.__cacheKey),c||(c=this.prototype.__fetcher),b&&localStorage&&localStorage[b]?(d=this.build.apply(this,JSON.parse(localStorage[b])),"function"==typeof a&&a(d),d.refresh()):this.fetch(function(b){return d=e.build.apply(e,b),"function"==typeof a?a(d):void 0})},this.fetch=function(b){var c=this;return this.prototype.__fetcher(function(){var d;return d=1<=arguments.length?a.call(arguments,0):[],c.prototype.__cacheKey&&localStorage&&(localStorage[c.prototype.__cacheKey]=JSON.stringify(d)),b(d)})}},refresh:function(a){var b=this;return this.constructor.fetch(function(c){return b.load.apply(b,c),"function"==typeof a?a(b):void 0})}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/modules/resources/cacher",function(){return Joosy.Modules.Resources.Cacher})}.call(this),function(){Joosy.Modules.Resources.Function={extended:function(){return this.build?this.aliasStaticMethodChain("build","function"):(this.build=this.buildWithFunction,this.buildWithoutFunction=function(){return function(a,b,c){c.prototype=a.prototype;var d=new c,e=a.apply(d,b);return Object(e)===e?e:d}(this,arguments,function(){})})},buildWithFunction:function(){var a,b,c,d;if(c=function(){return c.__call.apply(c,arguments)},b=this.buildWithoutFunction.apply(this,arguments),c.__proto__)c.__proto__=b;else for(a in b)d=b[a],c[a]=d;return c.constructor=b.constructor,c}}}.call(this),function(){Joosy.Modules.Resources.IdentityMap={extended:function(){return this.prototype.__identityHolder=this,this.aliasStaticMethodChain("build","identityMap")},identityReset:function(){return this.prototype.__identityHolder.identity={}},identityPath:function(a){return[this.prototype.__entityName,"s"+(this.__source||""),a[this.prototype.__primaryKey]]},buildWithIdentityMap:function(a){var b,c,d,e,f,g,h,i;if(null==a&&(a={}),d=this.identityPath(a),0===d.filter(function(a){return null==a}).length){for(e=null!=(g=this.prototype.__identityHolder).identity?(g=this.prototype.__identityHolder).identity:g.identity={},b=d.pop(),h=0,i=d.length;i>h;h++)c=d[h],e=null!=e[c]?e[c]:e[c]={};return f={},f[this.prototype.__primaryKey]=a[this.prototype.__primaryKey],null==e[b]&&(e[b]=this.buildWithoutIdentityMap(f)),e[b].load(a)}return this.buildWithoutIdentityMap(a)}}}.call(this),function(){}.call(this);
1
+ (function(){var a={}.hasOwnProperty,b=function(b,c){function d(){this.constructor=b}for(var e in c)a.call(c,e)&&(b[e]=c[e]);return d.prototype=c.prototype,b.prototype=new d,b.__super__=c.prototype,b};Joosy.Resources.Array=function(a){function c(){this.__fillData(arguments,!1)}return b(c,a),Joosy.Module.merge(c,Joosy.Module),c.include(Joosy.Modules.Events),c.extend(Joosy.Modules.Filters),c.registerPlainFilters("beforeLoad"),c.build=function(){return function(a,b,c){c.prototype=a.prototype;var d=new c,e=a.apply(d,b);return Object(e)===e?e:d}(this,arguments,function(){})},c.prototype.load=function(){return this.__fillData(arguments)},c.prototype.get=function(a){return this[a]},c.prototype.set=function(a,b){return this[a]=b,this.trigger("changed"),b},c.prototype.push=function(){var a;return a=c.__super__.push.apply(this,arguments),this.trigger("changed"),a},c.prototype.pop=function(){var a;return a=c.__super__.pop.apply(this,arguments),this.trigger("changed"),a},c.prototype.shift=function(){var a;return a=c.__super__.shift.apply(this,arguments),this.trigger("changed"),a},c.prototype.unshift=function(){var a;return a=c.__super__.unshift.apply(this,arguments),this.trigger("changed"),a},c.prototype.splice=function(){var a;return a=c.__super__.splice.apply(this,arguments),this.trigger("changed"),a},c.prototype.__fillData=function(a,b){var c,d,e,f;for(null==b&&(b=!0),a=this.slice.call(a,0),this.length>0&&this.splice(0,this.length),f=this.__applyBeforeLoads(a),d=0,e=f.length;e>d;d++)c=f[d],this.push(c);return b&&this.trigger("changed"),null},c}(Array),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/resources/array",function(){return Joosy.Resources.Array})}).call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function d(){this.constructor=b}for(var e in c)a.call(c,e)&&(b[e]=c[e]);return d.prototype=c.prototype,b.prototype=new d,b.__super__=c.prototype,b};Joosy.Resources.Hash=function(a){function c(a){null==a&&(a={}),this.__fillData(a,!1)}return b(c,a),c.include(Joosy.Modules.Events),c.extend(Joosy.Modules.Filters),c.registerPlainFilters("beforeLoad"),c.build=function(){return function(a,b,c){c.prototype=a.prototype;var d=new c,e=a.apply(d,b);return Object(e)===e?e:d}(this,arguments,function(){})},c.prototype.__call=function(a,b){return arguments.length>1?this.set(a,b):this.get(a)},c.prototype.load=function(a){return this.__fillData(a),this},c.prototype.get=function(a){var b,c,d;return d=this.__callTarget(a,!0),b=d[0],c=d[1],b?b.get?b.get(c):b[c]:void 0},c.prototype.set=function(a,b){var c,d,e;return e=this.__callTarget(a),c=e[0],d=e[1],null!=c.set?c.set(d,b):c[d]=b,this.trigger("changed"),b},c.prototype.__callTarget=function(a,b){var c,d,e,f,g;if(null==b&&(b=!1),-1!==a.indexOf(".")&&null==this.data[a]){for(a=a.split("."),c=a.pop(),e=this.data,f=0,g=a.length;g>f;f++){if(d=a[f],b&&null==e[d])return!1;null==e[d]&&(e[d]={}),e=e.__get?e.__get(d):e[d]}return[e,c]}return[this.data,a]},c.prototype.__fillData=function(a,b){return null==b&&(b=!0),this.data=this.__applyBeforeLoads(a),b&&this.trigger("changed"),null},c.prototype.toString=function(){return"Hash: "+JSON.stringify(this.data)},c}(Joosy.Module),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/resources/hash",function(){return Joosy.Resources.Hash})}.call(this),function(){Joosy.Modules.Resources={}}.call(this),function(){Joosy.Modules.Resources.Model={ClassMethods:{primaryKey:function(a){return this.prototype.__primaryKey=a},collection:function(a){return this.prototype.__collection=a},entity:function(a){return this.prototype.__entityName=a},map:function(a,b){if(null==b&&(b=!1),b||(b=window[inflection.camelize(inflection.singularize(a))]),!b)throw new Error(""+Joosy.Module.__className(this)+"> class can not be detected for '"+a+"' mapping");return this.beforeLoad(function(c){var d;return null==b.build&&(b=b()),c[a]instanceof Array?(d=c[a].map(function(a){return b.build(a)}),c[a]=function(a,b,c){c.prototype=a.prototype;var d=new c,e=a.apply(d,b);return Object(e)===e?e:d}(b.prototype.__collection,d,function(){})):c[a]&&(c[a]=b.build(c[a])),c})},grab:function(a){return this.build({}).grab(a)},attrAccessor:function(){var a,b,c,d,e=this;for(d=[],b=0,c=arguments.length;c>b;b++)a=arguments[b],d.push(function(a){return e.prototype[a]=function(b){return null!=b?this.set(a,b):this.get(a)}}(a));return d}},InstanceMethods:{__primaryKey:"id",__collection:Joosy.Resources.Array,id:function(){var a;return null!=(a=this.data)?a[this.__primaryKey]:void 0},knownAttributes:function(){return Object.keys(this.data)},load:function(a,b){return null==b&&(b=!1),b&&(this.data={}),this.__fillData(a),this},__fillData:function(a,b){return null==b&&(b=!0),this.raw=a,this.hasOwnProperty("data")||(this.data={}),Joosy.Module.merge(this.data,this.__applyBeforeLoads(a)),b&&this.trigger("changed"),null},grab:function(a){var b,c,d,e,f;for(b={},f=$(a).serializeArray(),d=0,e=f.length;e>d;d++)c=f[d],b[c.name]?(b[c.name]instanceof Array||(b[c.name]=[b[c.name]]),b[c.name].push(c.value)):b[c.name]=c.value;return this.load(b)},toString:function(){return"<Resource "+this.__entityName+"> "+JSON.stringify(this.data)}}}}.call(this),function(){var a,b={}.hasOwnProperty,c=function(a,c){function d(){this.constructor=a}for(var e in c)b.call(c,e)&&(a[e]=c[e]);return d.prototype=c.prototype,a.prototype=new d,a.__super__=c.prototype,a},d=[].slice;Joosy.Resources.REST=function(b){function e(){return a=e.__super__.constructor.apply(this,arguments)}return c(e,b),e.concern(Joosy.Modules.Resources.Model),e.registerPlainFilters("beforeSave"),e.beforeLoad(function(a){var b;return a.constructor===Object&&1===Object.keys(a).length&&this.__entityName&&(b=inflection.camelize(this.__entityName,!0),a[b]&&(a=a[b])),a}),e.requestOptions=function(a){return this.prototype.__requestOptions=a},e.source=function(a){return this.__source=a},e.__atWrapper=function(){var a,b,c=this;return b=arguments[0],a=2<=arguments.length?d.call(arguments,1):[],1===a.length&&a[0]instanceof Array?this.__atWrapper.apply(this,[b].concat(d.call(a[0]))):b(function(b){return b.__source=a.reduce(function(a,b){return a+=Joosy.Module.hasAncestor(b.constructor,Joosy.Resources.REST)?b.memberPath():b.replace(/^\/?/,"/")},""),b.__source+="/"+inflection.pluralize(c.prototype.__entityName)})},e.at=function(){var a=this;return this.__atWrapper.apply(this,[function(b){var d,e;return d=function(a){function d(){return e=d.__super__.constructor.apply(this,arguments)}return c(d,a),b(d),d}(a)}].concat(d.call(arguments)))},e.prototype.at=function(){var a,b;return a=1<=arguments.length?d.call(arguments,0):[],new((b=this.constructor).at.apply(b,a))(this.data)},e.prototype.__interpolatePath=function(a,b){return b instanceof Array||(b=[b]),b.reduce(function(a,b){return b instanceof Joosy.Resources.REST&&(b=b.id()),a.replace(/:[^\/]+/,b)},a)},e.collectionPath=function(){var a,b;return a=1<=arguments.length?d.call(arguments,0):[],(b=this.prototype).collectionPath.apply(b,a)},e.prototype.collectionPath=function(a,b){var c,d,e;return null==a&&(a=[]),null==b&&(b={}),a.constructor===Object&&(b=a,a=[]),b.url?b.url:(e=this.__source||this.constructor.__source,e?d=this.__interpolatePath(e,a):(d="/",this.constructor.__namespace__.length>0&&(c=this.constructor.__namespace__.map(function(a){return inflection.underscore(a)}),d+=c.join("/")+"/"),d+=inflection.pluralize(this.__entityName)),b.action&&(d+="/"+b.action),d)},e.memberPath=function(){var a,b;return a=1<=arguments.length?d.call(arguments,0):[],(b=this.prototype).memberPath.apply(b,a)},e.prototype.memberPath=function(a,b){var c,d,e;return null==a&&(a=[]),null==b&&(b={}),a.constructor===Object&&(b=a,a=[]),b.url?b.url:(a instanceof Array||(a=[a]),d=this.id()||a.pop(),c=b.action,a.push(this.id()),e=this.collectionPath(a,Joosy.Module.merge(b,{action:void 0}))+("/"+d),null!=c&&(e+="/"+c),e)},e.send=function(a,b,c){var d;return d=this.prototype.__extractOptionsAndCallback(b,c),b=d[0],c=d[1],this.__query(this.collectionPath(b),a.toUpperCase(),b.params,c)},e.prototype.send=function(a,b,c){var d;return d=this.__extractOptionsAndCallback(b,c),b=d[0],c=d[1],this.constructor.__query(this.memberPath(b),a.toUpperCase(),b.params,c)},e.prototype.reload=function(a,b){var c,d=this;return null==a&&(a={}),null==b&&(b=!1),c=this.__extractOptionsAndCallback(a,b),a=c[0],b=c[1],this.constructor.__query(this.memberPath(a),"GET",a.params,function(a,c,e){return null!=c&&d.load(c),"function"==typeof b?b(a,d,c,e):void 0})},e.find=function(a,b,c){var d,e;return null==b&&(b={}),null==c&&(c=!1),e=this.prototype.__extractOptionsAndCallback(b,c),b=e[0],c=e[1],d={},d[this.prototype.__primaryKey]=a instanceof Array?a[a.length-1]:a,d=this.build(d),a instanceof Array&&a.length>1&&(d.__source=this.collectionPath(a)),this.__query(this.memberPath(a,b),"GET",b.params,function(a,b,e){return null!=b&&d.load(b),"function"==typeof c?c(a,d,b,e):void 0}),d},e.all=function(a,b,c){var d,e,f,g=this;return null==b&&(b={}),null==c&&(c=!1),"function"==typeof a||a.constructor===Object?(e=this.prototype.__extractOptionsAndCallback(a,b),b=e[0],c=e[1],a=[]):(f=this.prototype.__extractOptionsAndCallback(b,c),b=f[0],c=f[1]),d=new this.prototype.__collection,this.__query(this.collectionPath(a,b),"GET",b.params,function(b,e,f){var h;if(null!=(h=e)){if(h.constructor===Object&&!(h=h[inflection.pluralize(g.prototype.__entityName)]))throw new Error("Invalid data for `all` received: "+JSON.stringify(h));h=h.map(function(b){var c;return c=g.build(b),a.length>1&&(c.__source=g.collectionPath(a)),c}),d.load.apply(d,h)}return"function"==typeof c?c(b,d,e,f):void 0}),d},e.prototype.update=function(a){var b=this;return this.send("put",{params:this.__applyBeforeSaves(this.data)},function(c,d){return c||b.load(d),"function"==typeof a?a(c,b):void 0})},e.prototype.create=function(a){var b=this;return this.constructor.send("post",{params:this.__applyBeforeSaves(this.data)},function(c,d){return c||b.load(d),"function"==typeof a?a(c,b):void 0})},e.prototype.save=function(a){return this.id()?this.update(a):this.create(a)},e.__query=function(a,b,c,d){var e;return e={url:a,data:c,type:b,cache:!1,dataType:"json"},"function"==typeof d?(e.success=function(a,b,c){return d(!1,a,c)},e.error=function(a){return d(a)}):Joosy.Module.merge(e,d),this.prototype.__requestOptions instanceof Function?this.prototype.__requestOptions(e):this.prototype.__requestOptions&&Joosy.Module.merge(e,this.prototype.__requestOptions),$.ajax(e)},e.prototype.__extractOptionsAndCallback=function(a,b){return"function"==typeof a&&(b=a,a={}),[a,b]},e}(Joosy.Resources.Hash),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/resources/rest",function(){return Joosy.Resources.REST})}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function d(){this.constructor=b}for(var e in c)a.call(c,e)&&(b[e]=c[e]);return d.prototype=c.prototype,b.prototype=new d,b.__super__=c.prototype,b};Joosy.Resources.Scalar=function(a){function c(a){this.load(a)}return b(c,a),c.include(Joosy.Modules.Events),c.extend(Joosy.Modules.Filters),c.registerPlainFilters("beforeLoad"),c.build=function(){return function(a,b,c){c.prototype=a.prototype;var d=new c,e=a.apply(d,b);return Object(e)===e?e:d}(this,arguments,function(){})},c.prototype.__call=function(){return arguments.length>0?this.set(arguments[0]):this.get()},c.prototype.load=function(a){return this.value=this.__applyBeforeLoads(a),this.trigger("changed"),this.value},c.prototype.get=function(){return this.value},c.prototype.set=function(a){return this.value=a,this.trigger("changed")},c.prototype.valueOf=function(){return this.value.valueOf()},c.prototype.toString=function(){return this.value.toString()},c}(Joosy.Module),null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/resources/scalar",function(){return Joosy.Resources.Scalar})}.call(this),function(){var a=[].slice;Joosy.Modules.Resources.Cacher={ClassMethods:{cache:function(a){return this.prototype.__cacheKey=a},fetcher:function(a){return this.prototype.__fetcher=a},cached:function(a,b,c){var d,e=this;return null==b&&(b=!1),null==c&&(c=!1),"function"==typeof b&&(c=b,b=void 0),b||(b=this.prototype.__cacheKey),c||(c=this.prototype.__fetcher),b&&localStorage&&localStorage[b]?(d=this.build.apply(this,JSON.parse(localStorage[b])),"function"==typeof a&&a(d),d.refresh()):this.fetch(function(b){return d=e.build.apply(e,b),"function"==typeof a?a(d):void 0})},fetch:function(b){var c=this;return this.prototype.__fetcher(function(){var d;return d=1<=arguments.length?a.call(arguments,0):[],c.prototype.__cacheKey&&localStorage&&(localStorage[c.prototype.__cacheKey]=JSON.stringify(d)),b(d)})}},InstanceMethods:{refresh:function(a){var b=this;return this.constructor.fetch(function(c){return b.load.apply(b,c),"function"==typeof a?a(b):void 0})}}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)&&define("joosy/modules/resources/cacher",function(){return Joosy.Modules.Resources.Cacher})}.call(this),function(){Joosy.Modules.Resources.Function={ClassMethods:{extended:function(){return this.build?this.aliasStaticMethodChain("build","function"):(this.build=this.buildWithFunction,this.buildWithoutFunction=function(){return function(a,b,c){c.prototype=a.prototype;var d=new c,e=a.apply(d,b);return Object(e)===e?e:d}(this,arguments,function(){})})},buildWithFunction:function(){var a,b,c,d;if(c=function(){return c.__call.apply(c,arguments)},b=this.buildWithoutFunction.apply(this,arguments),c.__proto__)c.__proto__=b;else for(a in b)d=b[a],c[a]=d;return c.constructor=b.constructor,c}}}}.call(this),function(){Joosy.Modules.Resources.IdentityMap={ClassMethods:{extended:function(){return this.prototype.__identityHolder=this,this.aliasStaticMethodChain("build","identityMap")},identityReset:function(){return this.prototype.__identityHolder.identity={}},identityPath:function(a){return[this.prototype.__entityName,"s"+(this.__source||""),a[this.prototype.__primaryKey]]},buildWithIdentityMap:function(a){var b,c,d,e,f,g,h,i;if(null==a&&(a={}),d=this.identityPath(a),0===d.filter(function(a){return null==a}).length){for(e=null!=(g=this.prototype.__identityHolder).identity?(g=this.prototype.__identityHolder).identity:g.identity={},b=d.pop(),h=0,i=d.length;i>h;h++)c=d[h],e=null!=e[c]?e[c]:e[c]={};return f={},f[this.prototype.__primaryKey]=a[this.prototype.__primaryKey],null==e[b]&&(e[b]=this.buildWithoutIdentityMap(f)),e[b].load(a)}return this.buildWithoutIdentityMap(a)}}}}.call(this),function(){}.call(this);
@@ -4,7 +4,7 @@
4
4
  "keywords": [
5
5
  "joosy"
6
6
  ],
7
- "version": "1.2.0-beta.4",
7
+ "version": "1.2.0-rc.1",
8
8
  "author": "Boris Staal <boris@staal.io>",
9
9
  "homepage": "http://joosy.ws/",
10
10
  "repository": {
@@ -22,7 +22,7 @@
22
22
  "semver": "~2.1.0",
23
23
  "grunt-coffeelint": "0.0.6",
24
24
  "grunt-release": "~0.3.5",
25
- "grunt-contrib-testem": ">=0.5.3",
25
+ "grunt-contrib-testem": "=0.5.13",
26
26
  "grunt-gh-pages": "git+https://github.com/inossidabile/grunt-gh-pages.git",
27
27
  "moment": "~2.1.0",
28
28
  "grunt-contrib-uglify": "~0.2.4"
@@ -7,8 +7,8 @@
7
7
  # Joosy Application container
8
8
  #
9
9
  class Joosy.Application
10
- @Pages: {}
11
- @Layouts: {}
10
+ @Pages: {}
11
+ @Layouts: {}
12
12
  @Controls: {}
13
13
 
14
14
  @initialized: false
@@ -17,10 +17,10 @@
17
17
  #
18
18
  # @include Joosy.Modules.Log
19
19
  # @include Joosy.Modules.Events
20
- # @include Joosy.Modules.DOM
20
+ # @concern Joosy.Modules.DOM
21
21
  #
22
22
  class Joosy.Form extends Joosy.Module
23
- @include Joosy.Modules.DOM
23
+ @concern Joosy.Modules.DOM
24
24
  @include Joosy.Modules.Log
25
25
  @include Joosy.Modules.Events
26
26
 
@@ -107,7 +107,7 @@ class Joosy.Form extends Joosy.Module
107
107
  @__delegateEvents()
108
108
 
109
109
  method = @$container.get(0).getAttribute('method')?.toLowerCase()
110
- if method && !['get', 'post'].indexOf(method) != -1
110
+ if method && ['get', 'post'].indexOf(method) == -1
111
111
  @__markMethod method
112
112
  @$container.attr 'method', 'POST'
113
113
 
@@ -298,7 +298,7 @@ class Joosy.Form extends Joosy.Module
298
298
 
299
299
  #
300
300
  # Simulates REST methods by adding hidden _method input with real method
301
- # while setting POST as the transport method
301
+ # while setting POST as the transport method.
302
302
  #
303
303
  # @param [String] method Real method to simulate
304
304
  #
@@ -1,5 +1,7 @@
1
1
  #
2
- # @private
2
+ # Form is an internally-used instance of `formFor` block.
3
+ #
4
+ # @nodoc
3
5
  #
4
6
  class Form
5
7
  constructor: (@context, @resource, @options) ->
@@ -38,6 +40,13 @@ class Form
38
40
  #
39
41
  Joosy.helpers 'Application', ->
40
42
 
43
+ #
44
+ # Internally-used helper allowing to split hash into two by a list of keys
45
+ #
46
+ # @param [Hash] options Original hash
47
+ # @param [Array<String>] Keys to separate
48
+ # @return [Array<Hash>]
49
+ #
41
50
  separateOptions = (options, keys) ->
42
51
  attributes = {}
43
52
  parameters = {}
@@ -118,11 +127,11 @@ Joosy.helpers 'Application', ->
118
127
  block = options
119
128
  options = {}
120
129
 
121
- attributes = Joosy.Module.merge(options.html || {}, id: uuid)
122
130
  uuid = Joosy.uuid()
131
+ attributes = Joosy.Module.merge(options.html || {}, id: uuid)
123
132
  form = new Form @, resource, options
124
133
 
125
- @tag 'form', attributes, block?.call(@, form)
134
+ @contentTag 'form', block?.call(@, form), attributes
126
135
 
127
136
  #
128
137
  # Generates `label` tag
@@ -1,3 +1,2 @@
1
- #= require ./routes
2
1
  #= require ./view
3
2
  #= require ./widgets
@@ -58,6 +58,7 @@ Joosy.helpers 'Application', ->
58
58
  # 2. @contentTag 'name', ->
59
59
  # 3. @contentTag 'name', {}, ->
60
60
  # 4. @contentTag 'name', {}, false, ->
61
+ # 5. @contentTag 'name', null, {}
61
62
  #
62
63
  # Example
63
64
  # != @contentTag 'div', {class: 'foo'}, =>
@@ -72,14 +73,16 @@ Joosy.helpers 'Application', ->
72
73
  else if typeof(contentOrOptions) == 'function'
73
74
  options = {}
74
75
  content = contentOrOptions()
75
- else
76
+ else if contentOrOptions?
76
77
  if typeof(options) == 'function'
77
78
  escape = true
78
79
  content = options()
79
- else
80
- escape = options
80
+ else if typeof(escape) == 'function'
81
81
  content = escape()
82
+ escape = options
82
83
  options = contentOrOptions
84
+ else
85
+ content = ''
83
86
 
84
87
  element = document.createElement name
85
88
  temp = document.createElement 'div'
@@ -113,3 +116,13 @@ Joosy.helpers 'Application', ->
113
116
  #
114
117
  @renderWrapped = (template, lambda) ->
115
118
  @render template, Joosy.Module.merge(this, yield: lambda())
119
+
120
+ @linkTo = (name='', url='', tagOptions={}) ->
121
+
122
+ # (url, tagOptions, block) ->
123
+ if typeof(tagOptions) == 'function'
124
+ block = tagOptions
125
+ [url, tagOptions] = [name, url]
126
+ name = block()
127
+
128
+ Joosy.Helpers.Application.contentTag 'a', name, Joosy.Module.merge(tagOptions, 'data-joosy': true, href: url)
@@ -37,10 +37,6 @@ class Joosy.Layout extends Joosy.Widget
37
37
  content: ->
38
38
  $("##{@uid}")
39
39
 
40
- ######
41
- ###### Widget extensions
42
- ######
43
-
44
40
  #
45
41
  # This is required by {Joosy.Modules.Renderer}
46
42
  # Sets the base template dir to app_name/templates/layouts
@@ -7,6 +7,8 @@ class Joosy.Module
7
7
  # Sets the default namespace for all Joosy descendants.
8
8
  # This is used in {Joosy.namespace} magic.
9
9
  #
10
+ # @nodoc
11
+ #
10
12
  @__namespace__: []
11
13
 
12
14
  #
@@ -134,9 +136,22 @@ class Joosy.Module
134
136
 
135
137
  @merge this, object
136
138
 
137
- object.extended?.apply this
139
+ object.extended?.apply @
138
140
  null
139
141
 
142
+ #
143
+ # Mixes given object as a concern
144
+ #
145
+ # Concern is a Module containing two submodules named ClassMethods and InstanceMethods
146
+ # that should be correspondingly extended and included
147
+ #
148
+ @concern: (object) ->
149
+ @extend object.ClassMethods if object.ClassMethods?
150
+ @include object.InstanceMethods if object.InstanceMethods?
151
+
152
+ object.extended?.apply @
153
+ object.included?.apply @
154
+
140
155
  # AMD wrapper
141
156
  if define?.amd?
142
157
  define 'joosy/module', -> Joosy.Module
@@ -3,14 +3,13 @@
3
3
  #
4
4
  # DOM container handling, DOM elements and DOM events bindings
5
5
  #
6
- # @note Requires implementor to contain DOM node at @$container propert
7
- #
6
+ # @note Requires implementor to contain DOM node at @$container property
8
7
  # @mixin
9
8
  #
10
9
  Joosy.Modules.DOM =
11
10
  eventSplitter: /^(\S+)\s*(.*)$/
12
11
 
13
- included: ->
12
+ ClassMethods:
14
13
  #
15
14
  # Extends elements mapping scheme
16
15
  #
@@ -21,7 +20,7 @@ Joosy.Modules.DOM =
21
20
  # 'category':
22
21
  # 'name3': '.selector'
23
22
  #
24
- @mapElements = (map) ->
23
+ mapElements: (map) ->
25
24
  unless @::hasOwnProperty "__elements"
26
25
  @::__elements = Joosy.Module.merge {}, @.__super__.__elements
27
26
  Joosy.Module.merge @::__elements, map
@@ -35,109 +34,115 @@ Joosy.Modules.DOM =
35
34
  # 'click .selector': ($element, event) -> #fires on .selector
36
35
  # 'click $name': ($element, event) -> #fires on selector assigned to 'name' element
37
36
  #
38
- @mapEvents = (map) ->
37
+ mapEvents: (map) ->
39
38
  unless @::hasOwnProperty "__events"
40
39
  @::__events = Joosy.Module.merge {}, @.__super__.__events
41
40
  Joosy.Module.merge @::__events, map
42
41
 
43
- $: (selector, context) ->
44
- $(selector, context || @$container)
45
-
46
- #
47
- # Converts '$...' notation to selector from 'elements'
48
- #
49
- # @param [String] selector Selector to convert
50
- # @private
51
- #
52
- __extractSelector: (selector) ->
53
- selector = selector.replace /(\$[A-z0-9\.\$]+)/g, (path) =>
54
- path = path.split('.')
55
- keyword = path.pop()
56
-
57
- target = @
58
- target = target?[part] for part in path
59
-
60
- target?[keyword]?.selector
61
-
62
- selector.trim()
63
-
64
- #
65
- # Assigns elements defined in 'elements'
66
- #
67
- # @private
68
- # @example Sample elements
69
- # @mapElements
70
- # foo: '.foo'
71
- # bar: '.bar'
72
- #
73
- __assignElements: (root, entries) ->
74
- root ||= @
75
- entries ||= @__elements
76
-
77
- return unless entries
78
-
79
- for key,value of entries
80
- do (key, value) =>
81
- if typeof(value) != 'string'
82
- @__assignElements root['$'+key]={}, value
83
- else
84
- value = @__extractSelector value
85
- root['$'+key] = @__wrapElement(value)
86
- root['$'+key].selector = value
87
-
88
- #
89
- # Wraps actual element closures. Required to clear context to avoid circular reference
90
- #
91
- # @private
92
- #
93
- __wrapElement: (value) ->
94
- (context) =>
95
- return @$(value) unless context
96
- return @$(value, context)
97
-
98
- #
99
- # Binds events defined in 'events' to container
100
- #
101
- # @private
102
- # @example Sample events
103
- # @mapEvents
104
- # 'click': -> # this will raise on container click
105
- # 'click .foo': -> # this will raise on .foo click
106
- # 'click $foo': -> #this will search for selector of foo element
107
- #
108
- __delegateEvents: ->
109
- module = @
110
- events = @__events
111
-
112
- return unless events
113
-
114
- for keys, method of events
115
- do (keys, method) =>
116
- for key in keys.split(',')
117
- key = key.replace(/^\s+/, '')
118
-
119
- unless typeof(method) == 'function'
120
- method = @[method]
121
- callback = (event) ->
122
- method.call module, $(this), event
123
-
124
- match = key.match @eventSplitter
125
- eventName = match[1]
126
- selector = @__extractSelector match[2]
127
-
128
- if selector == ""
129
- @$container.bind eventName, callback
130
- Joosy.Modules.Log.debugAs @, "#{eventName} binded on container"
131
- else if selector == undefined
132
- throw new Error "Unknown element #{match[2]} in #{Joosy.Module.__className @constructor} (maybe typo?)"
42
+ InstanceMethods:
43
+ #
44
+ # jQuery accessor limited to the container of current object
45
+ #
46
+ # @param [String] selector jQuery selector
47
+ # @param [jQuery] context The override for the context
48
+ # @return [jQuery]
49
+ #
50
+ $: (selector, context) ->
51
+ $(selector, context || @$container)
52
+
53
+ #
54
+ # Converts '$...' notation to selector from 'elements'
55
+ #
56
+ # @param [String] selector Selector to convert
57
+ # @private
58
+ #
59
+ __extractSelector: (selector) ->
60
+ selector = selector.replace /(\$[A-z0-9\.\$]+)/g, (path) =>
61
+ path = path.split('.')
62
+ keyword = path.pop()
63
+
64
+ target = @
65
+ target = target?[part] for part in path
66
+
67
+ target?[keyword]?.selector
68
+
69
+ selector.trim()
70
+
71
+ #
72
+ # Assigns elements defined in 'elements'
73
+ #
74
+ # @private
75
+ # @see Joosy.Modules.DOM.mapElements
76
+ #
77
+ __assignElements: (root, entries) ->
78
+ root ||= @
79
+ entries ||= @__elements
80
+
81
+ return unless entries
82
+
83
+ for key,value of entries
84
+ do (key, value) =>
85
+ if typeof(value) != 'string'
86
+ @__assignElements root['$'+key]={}, value
133
87
  else
134
- @$container.on eventName, selector, callback
135
- Joosy.Modules.Log.debugAs @, "#{eventName} binded on #{selector}"
88
+ value = @__extractSelector value
89
+ root['$'+key] = @__wrapElement(value)
90
+ root['$'+key].selector = value
91
+
92
+ #
93
+ # Wraps actual element closures. Required to clear context to avoid circular reference
94
+ #
95
+ # @private
96
+ # @see Joosy.Modules.DOM.mapElements
97
+ #
98
+ __wrapElement: (value) ->
99
+ (context) =>
100
+ return @$(value) unless context
101
+ return @$(value, context)
136
102
 
137
- # @private
138
- __clearContainer: ->
139
- @$container.unbind().off()
140
- @$container = $()
103
+ #
104
+ # Binds events defined in 'events' to container
105
+ #
106
+ # @private
107
+ # @see Joosy.Modules.DOM.mapEvents
108
+ #
109
+ __delegateEvents: ->
110
+ module = @
111
+ events = @__events
112
+
113
+ return unless events
114
+
115
+ for keys, method of events
116
+ do (keys, method) =>
117
+ for key in keys.split(',')
118
+ key = key.replace(/^\s+/, '')
119
+
120
+ unless typeof(method) == 'function'
121
+ method = @[method]
122
+ callback = (event) ->
123
+ method.call module, $(this), event
124
+
125
+ match = key.match Joosy.Modules.DOM.eventSplitter
126
+ eventName = match[1]
127
+ selector = @__extractSelector match[2]
128
+
129
+ if selector == ""
130
+ @$container.bind eventName, callback
131
+ Joosy.Modules.Log.debugAs @, "#{eventName} binded on container"
132
+ else if selector == undefined
133
+ throw new Error "Unknown element #{match[2]} in #{Joosy.Module.__className @constructor} (maybe typo?)"
134
+ else
135
+ @$container.on eventName, selector, callback
136
+ Joosy.Modules.Log.debugAs @, "#{eventName} binded on #{selector}"
137
+
138
+ #
139
+ # Clears the container from everything
140
+ #
141
+ # @private
142
+ #
143
+ __clearContainer: ->
144
+ @$container.unbind().off()
145
+ @$container = $()
141
146
 
142
147
 
143
148
  # AMD wrapper