';S.bb='Sorry, you do not have permission for this!
';S.prototype={bind:J(),Qb:function(a){this.H.push(a);this.H.length==1&&
-this.za("/user_session/new.mini?database="+encodeURIComponent(this.ja)+"&return_url="+encodeURIComponent(this.Wa()))},Rb:function(a){this.H.push(a);this.H.length==1&&this.za("/user_session/do_destroy.mini")},Wa:function(){return this.ib.location.href.split("#")[0]},za:function(a){var b=this,c=(new Date).getTime(),d=this.Wa()+"#$iframe_notify="+c,e=k('');this.eb.append(e);e.dialog({height:363,
-width:500,resizable:false,modal:true,title:'Authentication: <angular/>'});N["_iframe_notify_"+c]=function(){e.dialog("destroy");e.remove();o(b.H,function(f){f()});b.H=[]}},dc:function(){if(!this.Ba){this.Ba=k(S.bb);this.Ba.Ic({Cc:true,height:70,Mc:true})}}};Z.cb=B(J(),{all:function(){return[]},query:function(){return[]},load:function(){return{}},title:undefined});Z.prototype={S:function(a){if(!a.k===this)throw"Parameter must be an instance of Entity! "+
-v(a);var b=a.$entity+"/"+a.$id,c=this.fa[b];if(c)G.ia(a,c);else c=this.fa[b]=a;return c},load:function(a,b,c,d){if(b&&b!=="*"){var e=this;this.D(["GET",a.$entity+"/"+b],function(f){a.$loadFrom(f);a.$migrate();f=a.$$entity(a);e.S(f);(c||n)(a)},d)}return a},la:function(a,b,c){var d=this,e=[],f=0;o(b,function(g){e.push(d.load(a(),g,function(){f++;if(f==b.length)(c||n)(e)}))});return e},Ia:function(a,b,c){return this.load(a,b,c,function(d){if(d.$status_code==404){a.$id=b;(c||n)(a)}else throw d;})},Ha:function(a,
-b){var c=this,d=[];d.$$accept=function(e){return e.$entity==a.title};this.K.push(d);this.D(["GET",a.title],function(e){for(var f=0;ff.title?1:-1});(a||n)(b)});return b},yb:function(){var a={};this.post([["GET","$users"]],function(b,c){B(a,c[0])});return a},sc:function(a){var b={};this.post([["GET","$users/"+a]],function(c,d){B(b,d[0])});return b},G:function(a,b){if(!a)return Z.cb;var c=this,d=B(function(e){return new G(d,e)},{title:a,$$factory:true,k:this,defaults:b||{},load:function(e,f){return c.load(d(),e,f)},loadMany:function(e,f){return c.la(d,e,f)},loadOrCreate:function(e,
-f){return c.Ia(d(),e,f)},all:function(e){return c.Ha(d,e)},query:function(e,f,g){return c.Ra(d,e,f,g)},properties:function(e){c.D(["GET",a+"/$properties"],e)}});return d},join:function(a){function b(){throw"Joined entities can not be instantiated into a document.";}var c=_(a).Dc().map(function(d,e){return e}).sortBy(function(d){var e=[];do{if(_(e).include(d))throw"Infinite loop in join: "+e.join(" -> ");e.push(d);if(!a[d])throw _("Named entity '<%=name%>' is undefined.").template({name:d});d=a[d].Z?
-a[d].Z.substring(0,a[d].Z.indexOf(".")):undefined}while(d);return e.length}).value();if(_(c).select(function(d){return a[d].Z}).length!=c.length-1)throw"Exactly one entity needs to be primary.";b.query=function(d,e){var f=[],g=d?d.substring(0,d.indexOf(".")):undefined;if(g!=c[0])throw _("Named entity '<%=name%>' is not a primary entity.").template({name:g});var h=1;a[g].join.query(d.substring(d.indexOf(".")+1),e,function(i){var j=c[h++],l=a[j],q=l.Z,O={};_(i).each(function(r){var A={};f.push(A);A[g]=
-r;r=u.O(A,q);O[r]=r});l.join.la(_.toArray(O),function(r){var A={};_(r).each(function(y){A[y.Za]=y});_(f).each(function(y){var I=u.O(y,q);y[j]=A[I]})})});return f};return b}};s.g=function(a){if(a)for(var b in a)this[b]=a[b]};s.g.get=function(a,b){b=b||"text";switch(typeof a){case "string":return b=="text"?a:undefined;case "object":if(a&&typeof a[b]!=="undefined")return a[b];return;default:return a}};var t;o({currency:function(a){k(this.element).toggleClass("ng-format-negative",a<0);return"$"+s.number.apply(this,
-[a,2])},number:function(a,b){if(isNaN(a)||!isFinite(a))return"";b=typeof b=="undefined"?2:b;var c=a<0;a=Math.abs(a);var d=Math.pow(10,b);a=""+Math.round(a*d);var e=a.substring(0,a.length-b);e=e||"0";d=a.substring(a.length-b);a=c?"-":"";for(c=0;c0){for(c=d.length;c'+g+"",Oc:b});_.breakLoop()}});e&&_.breakLoop()});return e?e:b?c||new s.g({text:b+" is not recognized"}):null}}(),link:function(a,b){b=b||s.g.get(a);var c=s.g.get(a,"url")||s.g.get(a);if(c){if(m.Q.Jc(c)===null)c="mailto:"+c;a=''+b+"";return new s.g({text:b,url:c,html:a})}return a},bytes:function(){var a=
+this.Aa("/user_session/new.mini?database="+encodeURIComponent(this.ka)+"&return_url="+encodeURIComponent(this.Wa()))},Rb:function(a){this.H.push(a);this.H.length==1&&this.Aa("/user_session/do_destroy.mini")},Wa:function(){return this.ib.location.href.split("#")[0]},Aa:function(a){var b=this,c=(new Date).getTime(),d=this.Wa()+"#$iframe_notify="+c,e=l('');this.eb.append(e);e.dialog({height:363,
+width:500,resizable:false,modal:true,title:'Authentication: <angular/>'});N["_iframe_notify_"+c]=function(){e.dialog("destroy");e.remove();o(b.H,function(f){f()});b.H=[]}},dc:function(){if(!this.Da){this.Da=l(S.bb);this.Da.Ic({Cc:true,height:70,Mc:true})}}};Z.cb=B(J(),{all:function(){return[]},query:function(){return[]},load:function(){return{}},title:undefined});Z.prototype={S:function(a){if(!a.l===this)throw"Parameter must be an instance of Entity! "+
+v(a);var b=a.$entity+"/"+a.$id,c=this.ha[b];if(c)G.ja(a,c);else c=this.ha[b]=a;return c},load:function(a,b,c,d){if(b&&b!=="*"){var e=this;this.D(["GET",a.$entity+"/"+b],function(f){a.$loadFrom(f);a.$migrate();f=a.$$entity(a);e.S(f);(c||n)(a)},d)}return a},ma:function(a,b,c){var d=this,e=[],f=0;o(b,function(h){e.push(d.load(a(),h,function(){f++;if(f==b.length)(c||n)(e)}))});return e},Ka:function(a,b,c){return this.load(a,b,c,function(d){if(d.$status_code==404){a.$id=b;(c||n)(a)}else throw d;})},Ja:function(a,
+b){var c=this,d=[];d.$$accept=function(e){return e.$entity==a.title};this.K.push(d);this.D(["GET",a.title],function(e){for(var f=0;ff.title?1:-1});(a||n)(b)});return b},zb:function(){var a={};this.post([["GET","$users"]],function(b,c){B(a,c[0])});return a},sc:function(a){var b={};this.post([["GET","$users/"+a]],function(c,d){B(b,d[0])});return b},G:function(a,b){if(!a)return Z.cb;var c=this,d=B(function(e){return new G(d,e)},{title:a,$$factory:true,l:this,defaults:b||{},load:function(e,f){return c.load(d(),e,f)},loadMany:function(e,f){return c.ma(d,e,f)},loadOrCreate:function(e,
+f){return c.Ka(d(),e,f)},all:function(e){return c.Ja(d,e)},query:function(e,f,h){return c.Sa(d,e,f,h)},properties:function(e){c.D(["GET",a+"/$properties"],e)}});return d},join:function(a){function b(){throw"Joined entities can not be instantiated into a document.";}var c=_(a).Dc().map(function(d,e){return e}).sortBy(function(d){var e=[];do{if(_(e).include(d))throw"Infinite loop in join: "+e.join(" -> ");e.push(d);if(!a[d])throw _("Named entity '<%=name%>' is undefined.").template({name:d});d=a[d].Z?
+a[d].Z.substring(0,a[d].Z.indexOf(".")):undefined}while(d);return e.length}).value();if(_(c).select(function(d){return a[d].Z}).length!=c.length-1)throw"Exactly one entity needs to be primary.";b.query=function(d,e){var f=[],h=d?d.substring(0,d.indexOf(".")):undefined;if(h!=c[0])throw _("Named entity '<%=name%>' is not a primary entity.").template({name:h});var g=1;a[h].join.query(d.substring(d.indexOf(".")+1),e,function(i){var j=c[g++],k=a[j],q=k.Z,O={};_(i).each(function(r){var A={};f.push(A);A[h]=
+r;r=u.O(A,q);O[r]=r});k.join.ma(_.toArray(O),function(r){var A={};_(r).each(function(y){A[y.Za]=y});_(f).each(function(y){var I=u.O(y,q);y[j]=A[I]})})});return f};return b}};s.g=function(a){if(a)for(var b in a)this[b]=a[b]};s.g.get=function(a,b){b=b||"text";switch(typeof a){case "string":return b=="text"?a:undefined;case "object":if(a&&typeof a[b]!=="undefined")return a[b];return;default:return a}};var t;o({currency:function(a){l(this.ga).toggleClass("ng-format-negative",a<0);return"$"+s.number.apply(this,
+[a,2])},number:function(a,b){if(isNaN(a)||!isFinite(a))return"";b=typeof b=="undefined"?2:b;var c=a<0;a=Math.abs(a);var d=Math.pow(10,b);a=""+Math.round(a*d);var e=a.substring(0,a.length-b);e=e||"0";d=a.substring(a.length-b);a=c?"-":"";for(c=0;c0){for(c=d.length;c'+h+"",Oc:b});_.breakLoop()}});e&&_.breakLoop()});return e?e:b?c||new s.g({text:b+" is not recognized"}):null}}(),link:function(a,b){b=b||s.g.get(a);var c=s.g.get(a,"url")||s.g.get(a);if(c){if(m.Q.Jc(c)===null)c="mailto:"+c;a=''+b+"";return new s.g({text:b,url:c,html:a})}return a},bytes:function(){var a=
["bytes","KB","MB","GB","TB","PB"];return function(b){if(b===null)return"";for(var c=0;b>1E3;){b/=1024;c++}b=""+b;var d=b.indexOf(".");if(d>-1&&d+2"})}return null},lowercase:function(a){return(a=s.g.get(a))?(""+a).toLowerCase():a},uppercase:function(a){return(a=s.g.get(a))?
(""+a).toUpperCase():a},linecount:function(a){a=s.g.get(a);if(a===""||!a)return 1;return a.split(/\n|\f/).length},"if":function(a,b){return b?a:undefined},unless:function(a,b){return b?undefined:a},googleChartApi:B(function(a,b,c,d){b=b||{};a={cht:a,chco:t.collect(b,"color"),chtt:t.title(b),chdl:t.collect(b,"label"),chd:t.values(b),chf:"bg,s,FFFFFF00"};if(_.isArray(b.xLabels)){a.chxt="x";a.chxl="0:|"+b.Qc.join("|")}return t.encode(a,c,d)},{values:function(a){var b=[];o(a.series||[],function(c){var d=
-[];o(c.values||[],function(e){d.push(e)});b.push(d.join(","))});a=b.join("|");return a===""?null:"t:"+a},title:function(a){var b=[];a=a.title||[];o(_.isArray(a)?a:[a],function(c){b.push(encodeURIComponent(c))});return b.join("|")},collect:function(a,b){var c=[],d=0;o(a.series||[],function(e){var f=[];e=e[b]||[];o(_.isArray(e)?e:[e],function(g){f.push(encodeURIComponent(g));d++});c.push(f.join("|"))});return d?c.join(","):null},encode:function(a,b,c){b=b||200;c=c||b;var d="http://chart.apis.google.com/chart?",
-e=[];a.chs=b+"x"+c;o(a,function(f,g){f&&e.push(g+"="+f)});e.sort();d+=e.join("&");return new s.g({url:d,html:'
'})}}),qrcode:function(a,b,c){return t.encode({cht:"qr",chl:encodeURIComponent(a)},b,c)},chart:{pie:function(a,b,c){return t("p",a,b,c)},pie3d:function(a,b,c){return t("p3",a,b,c)},pieConcentric:function(a,b,c){return t("pc",a,b,c)},barHorizontalStacked:function(a,b,c){return t("bhs",a,b,c)},barHorizontalGrouped:function(a,b,c){return t("bhg",
+[];o(c.values||[],function(e){d.push(e)});b.push(d.join(","))});a=b.join("|");return a===""?null:"t:"+a},title:function(a){var b=[];a=a.title||[];o(_.isArray(a)?a:[a],function(c){b.push(encodeURIComponent(c))});return b.join("|")},collect:function(a,b){var c=[],d=0;o(a.series||[],function(e){var f=[];e=e[b]||[];o(_.isArray(e)?e:[e],function(h){f.push(encodeURIComponent(h));d++});c.push(f.join("|"))});return d?c.join(","):null},encode:function(a,b,c){b=b||200;c=c||b;var d="http://chart.apis.google.com/chart?",
+e=[];a.chs=b+"x"+c;o(a,function(f,h){f&&e.push(h+"="+f)});e.sort();d+=e.join("&");return new s.g({url:d,html:'
'})}}),qrcode:function(a,b,c){return t.encode({cht:"qr",chl:encodeURIComponent(a)},b,c)},chart:{pie:function(a,b,c){return t("p",a,b,c)},pie3d:function(a,b,c){return t("p3",a,b,c)},pieConcentric:function(a,b,c){return t("pc",a,b,c)},barHorizontalStacked:function(a,b,c){return t("bhs",a,b,c)},barHorizontalGrouped:function(a,b,c){return t("bhg",
a,b,c)},barVerticalStacked:function(a,b,c){return t("bvs",a,b,c)},barVerticalGrouped:function(a,b,c){return t("bvg",a,b,c)},line:function(a,b,c){return t("lc",a,b,c)},sparkline:function(a,b,c){return t("ls",a,b,c)},scatter:function(a,b,c){return t("s",a,b,c)}},html:function(a){return new s.g({html:a})},linky:function(a){if(!a)return a;for(var b=/(ftp|http|https|mailto):\/\/([^\(\)|\s]+)/,c,d=a,e=[];c=d.match(b);){c=c[0].replace(/[\.\;\,\(\)\{\}\<\>]$/,"");var f=d.indexOf(c);e.push(C(d.substr(0,f)));
-e.push('');e.push(c);e.push("");d=d.substring(f+c.length)}e.push(C(d));return new s.g({text:a,html:e.join("")})}},function(a,b){s[b]=a});t=s.googleChartApi;B(ga,{noop:T(Fa,Fa),"boolean":T(qa,W),number:T(qa,function(a){return 1*a}),list:T(function(a){return a?a.join(", "):a},function(a){return a?_(_(a.split(",")).map(k.trim)).select(_.identity):[]}),trim:T(function(a){return a?$.trim(""+a):""})});array=[].constructor;m.toJson=v;m.fromJson=L;G.ia=function(a,b){if(!(a===b||!a||!b)){var c=
-function(e,f,g){return g.substring(0,2)!=="$$"&&typeof e[g]!=="function"&&typeof f[g]!=="function"};for(var d in b)c(a,b,d)&&delete b[d];for(d in a)if(c(a,b,d))b[d]=a[d]}};B(G.prototype,{$migrate:function(){X(this.$$entity.defaults,this);return this},$merge:function(a){X(a,this);return this},$save:function(a){this.$$entity.k.save(this,a===true?undefined:a);a===true&&this.$$entity.k.V();return this},$delete:function(a){this.$$entity.k.remove(this,a===true?undefined:a);a===true&&this.$$entity.k.V();
-return this},$loadById:function(a,b){this.$$entity.k.load(this,a,b);return this},$loadFrom:function(a){G.ia(a,this);return this},$saveTo:function(a){G.ia(this,a);return this}});E.ta={"null":P(null),"true":P(true),"false":P(false),"+":function(a,b,c){return(b||0)+(c||0)},"-":function(a,b,c){return(b||0)-(c||0)},"*":function(a,b,c){return b*c},"/":function(a,b,c){return b/c},"%":function(a,b,c){return b%c},"^":function(a,b,c){return b^c},"=":function(a,b,c){return a.scope.i(b,c)},"==":function(a,b,
+e.push('');e.push(c);e.push("");d=d.substring(f+c.length)}e.push(C(d));return new s.g({text:a,html:e.join("")})}},function(a,b){s[b]=a});t=s.googleChartApi;B(ga,{noop:T(Fa,Fa),"boolean":T(qa,W),number:T(qa,function(a){return 1*a}),list:T(function(a){return a?a.join(", "):a},function(a){return a?_(_(a.split(",")).map(l.trim)).select(_.identity):[]}),trim:T(function(a){return a?$.trim(""+a):""})});array=[].constructor;m.toJson=v;m.fromJson=L;G.ja=function(a,b){if(!(a===b||!a||!b)){var c=
+function(e,f,h){return h.substring(0,2)!=="$$"&&typeof e[h]!=="function"&&typeof f[h]!=="function"};for(var d in b)c(a,b,d)&&delete b[d];for(d in a)if(c(a,b,d))b[d]=a[d]}};B(G.prototype,{$migrate:function(){X(this.$$entity.defaults,this);return this},$merge:function(a){X(a,this);return this},$save:function(a){this.$$entity.l.save(this,a===true?undefined:a);a===true&&this.$$entity.l.V();return this},$delete:function(a){this.$$entity.l.remove(this,a===true?undefined:a);a===true&&this.$$entity.l.V();
+return this},$loadById:function(a,b){this.$$entity.l.load(this,a,b);return this},$loadFrom:function(a){G.ja(a,this);return this},$saveTo:function(a){G.ja(this,a);return this}});E.ua={"null":P(null),"true":P(true),"false":P(false),"+":function(a,b,c){return(b||0)+(c||0)},"-":function(a,b,c){return(b||0)-(c||0)},"*":function(a,b,c){return b*c},"/":function(a,b,c){return b/c},"%":function(a,b,c){return b%c},"^":function(a,b,c){return b^c},"=":function(a,b,c){return a.scope.i(b,c)},"==":function(a,b,
c){return b==c},"!=":function(a,b,c){return b!=c},"<":function(a,b,c){return b":function(a,b,c){return b>c},"<=":function(a,b,c){return b<=c},">=":function(a,b,c){return b>=c},"&&":function(a,b,c){return b&&c},"||":function(a,b,c){return b||c},"&":function(a,b,c){return b&c},"|":function(a,b,c){return c(a,b)},"!":function(a,b){return!b}};E.ab={n:"\n",f:"\u000c",r:"\r",t:"\t",v:"\u000b","'":"'",'"':'"'};E.prototype={I:function(){return this.index+10){e=e[0];var f=e.text;if(f==a||f==b||f==c||f==d||!a&&!b&&!c&&!d)return e}return false},a:function(a,b,c,d){if(a=this.I(a,b,c,d)){this.h.shift();return this.Ec=a}return false},j:function(a){if(!this.a(a)){var b=this.I();throw"Expecting '"+a+"' at column '"+(b.index+1)+"' in '"+this.text+"' got '"+this.text.substring(b.index)+"'.";}},fb:function(a,b){return function(c){return a(c,b(c))}},z:function(a,b,c){return function(d){return b(d,
-a(d),c(d))}},Ca:function(){return this.h.length>0},L:function(){if(this.h.length!==0)throw"Did not understand '"+this.text.substring(this.h[0].index)+"' while evaluating '"+this.text+"'.";},qa:function(){for(var a=[];;){this.h.length>0&&!this.I("}",")",";","]")&&a.push(this.Aa());if(!this.a(";"))return function(b){for(var c,d=0;d","<=",">="))a=this.z(a,b.b,this.wa());else return a},wa:function(){for(var a=this.na(),b;b=this.a("+","-");)a=this.z(a,b.b,this.na());return a},na:function(){for(var a=this.Va(),b;b=this.a("*","/","%");)a=this.z(a,b.b,this.Va());return a},Va:function(){var a;return this.a("+")?this.ca():(a=this.a("-"))?this.z(D.db,a.b,this.na()):this.ca()},Ib:function(a){var b=this.a(),c=b.text.split(".");a=a;for(var d,e=0;e1;d++){var e=a.shift(),f=c[e];if(!f){f={};c[e]=f}c=f}return c[a.shift()]=b},o:function(a,b){this.eval(a+"="+v(b))},eval:function(a,b){var c=
-u.U[a];if(!c){var d=new D(a);c=d.qa();d.L();u.U[a]=c}b=b||{};b.scope=this;return c(b)},l:function(a,b,c,d,e){try{var f=this.eval(b,c);if(a.C){a.C=false;k(a.view).removeClass("ng-exception").removeAttr("ng-error")}d&&d.apply(a,[f]);return true}catch(g){ba("Eval Widget Error:",g);b=v(g,true);a.C=true;k(a.view).addClass("ng-exception").attr("ng-error",b);e&&e.apply(a,[g,b]);return false}},uc:function(a,b){var c=u.U[a];if(!c){c=(new D(a)).Q();u.U[a]=c}a={scope:this};return c(a)(a,b)},G:function(a,b){return(new D(a)).Cb()({scope:this,
-k:b})},rb:function(){for(var a=this.q.$invalidWidgets;a.length>0;)a.pop()},Sb:function(a){this.q.$invalidWidgets.push(a)},watch:function(a){var b=this;(new D(a)).watch()({scope:this,jb:function(c,d){b.kb(c,function(e,f){try{return d({scope:b},e,f)}catch(g){alert(g)}})}})},kb:function(a,b){var c=this.sa[a];if(!c){c={Ga:[],s:a};this.sa[a]=c}c.Ga.push(b)},Gb:function(){var a=this,b=false;o(this.sa,function(c){var d=a.eval(c.s);if(d!==c.c){o(c.Ga,function(e){e(d,c.c);b=true});c.c=d}});return b}};na.prototype=
-{ob:function(a){return fa.zb(a)},P:function(a,b,c,d){var e=this.tc+this.Tb++;a=this.ob(v({u:b,m:a,p:c}));b=Math.ceil(a.length/this.ma);c=this.url+"/$/"+e+"/"+b+"/";N[e]=function(h){delete N[e];d(200,h)};for(var f=0;fc)return"Value can not be greater than "+c+".";return null}else return"Value is not a number."},integer:function(a,b,c){if(b=Ga.number(a,b,c))return b;if(!(""+a).match(/^\s*[\d+]*\s*$/)||a!=Math.round(a))return"Value is not a whole number.";return null},date:function(a){if(a.match(/^\d\d?\/\d\d?\/\d\d\d\d$/))return null;return"Value is not a date. (Expecting format: 12/31/2009)."},ssn:function(a){if(a.match(/^\d\d\d-\d\d-\d\d\d\d$/))return null;
-return"SSN needs to be in 999-99-9999 format."},email:function(a){if(a.match(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/))return null;return"Email needs to be in username@host.com format."},phone:function(a){if(a.match(/^1\(\d\d\d\)\d\d\d-\d\d\d\d$/))return null;if(a.match(/^\+\d{2,3} (\(\d{1,5}\))?[\d ]+\d$/))return null;return"Phone number needs to be in 1(987)654-3210 format in North America or +999 (123) 45678 906 internationaly."},url:function(a){if(a.match(/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/))return null;
-return"URL needs to be in http://server[:port]/path format."},json:function(a){try{L(a);return null}catch(b){return b.toString()}}},function(a,b){Ga[b]=a});ma.prototype={tb:function(a,b){var c,d=a.attr("type").toLowerCase(),e=a.attr("name");if(e)e=e.split(":").pop();var f="change",g=true,h=ga[a.attr("ng-format")]||ga.noop;if(d=="button"||d=="submit"||d=="reset"||d=="image"){c=new Ra(a[0],e,h);f="click";g=false}else if(d=="text"||d=="textarea"||d=="hidden"||d=="password"){c=new ra(a[0],e,h);f="keyup change"}else if(d==
-"checkbox"){c=new sa(a[0],e,h);f="click"}else if(d=="radio"){c=new va(a[0],e,h);f="click"}else if(d=="select-one")c=new ta(a[0],e,h);else if(d=="select-multiple")c=new ua(a[0],e,h);else if(d=="file")c=this.ub(a,e,h);else throw"Unknown type: "+d;a.data("controller",c);var i=b.get("$updateView");k(c.view,":input").bind(f,function(){if(c.e(b)){var j=k(c.view).attr("ng-action")||"";b.l(c,j)&&i(b)}return g});return c},ub:function(a){var b="__uploadWidget_"+this.Ub++,c=U.template(b);a.after(c);b=this.vb({data:this.ea+
-"/admin/ServerAPI.swf",width:"95",height:"20",align:"top",wmode:"transparent"},{flashvars:"uploadWidgetId="+b,allowScriptAccess:"always"},b);a.remove();a=new U(c,a[0].name,b,this.ea+"/data/"+this.ja);k(b).data("controller",a);return a}};N.flashEvent=function(a,b,c){a=x.getElementById(a);a=k(a);var d=a.data("controller");U.prototype[b].apply(d,c);_.defer(a.scope().get("$updateView"))};U.template=function(a){return k('')};B(U.prototype,{cancel:n,complete:n,httpStatus:function(a){alert("httpStatus:"+this.J+" status:"+a)},ioError:function(){alert("ioError:"+this.J)},open:function(){alert("open:"+this.J)},progress:n,securityError:function(){alert("securityError:"+this.J)},uploadCompleteData:function(a){a=L(a);a.url=this.xa+"/"+a.id+"/"+a.text;this.view.find("input").attr("checked",true);var b=this.view.scope();this.value=a;this.e(b);this.value=null},select:function(a,b){this.name=a;this.view.find("a").text(a).attr("href",
-a);this.view.find("span").text(m.filter.bytes(b));this.upload()},e:function(a){var b=this.view.find("input").attr("checked")?this.value:null;if(this.c===b)return false;else{a.i(this.J,b);return true}},d:function(a){if((a=a.get(this.J))&&this.value!==a){this.value=a;this.view.find("a").attr("href",this.value.url).text(this.value.text);this.view.find("span").text(m.filter.bytes(this.value.size))}this.view.find("input").attr("checked",!!a)},upload:function(){this.name&&this.rc.uploadFile(this.xa)}});
-R.prototype={e:P(true),d:n};R.Kb=new R;var Ra=R;ra.prototype={e:function(a){var b=this.A.parse(this.view.value);if(this.c===b)return false;else{a.o(this.exp,b);this.c=b;return true}},d:function(a){var b=this.view,c=a.get(this.exp);if(typeof c==="undefined"){c=this.w;a.o(this.exp,c)}c=c?c:"";if(!_(this.c).isEqual(c)){b.value=this.A.format(c);this.c=c}var d=false;b.removeAttribute("ng-error");if(this.lc)d=!(c&&$.trim(""+c).length>0);var e=d?"Required Value":null;if(!d&&this.Q&&c){e=a.uc(this.Q,c);d=
-!!e}if(this.Ea!==e){this.Ea=d;if(e&&Ha(b)){b.setAttribute("ng-error",e);a.Sb(this)}k(b).toggleClass("ng-validation-error",d)}}};sa.prototype={e:function(a){var b=this.view;b=b.checked?b.value:"";b=this.A.parse(b);b=this.A.format(b);if(this.c===b)return false;else{a.o(this.exp,this.A.parse(b));this.c=b;return true}},d:function(a){var b=this.view,c=a.eval(this.exp);if(typeof c==="undefined"){c=this.w;a.o(this.exp,c)}b.checked=this.A.parse(b.value)==c}};ta.prototype={e:function(a){if(this.view.selectedIndex<
-0)a.o(this.exp,null);else{var b=this.view.value;if(this.c===b)return false;else{a.o(this.exp,b);this.c=b;return true}}},d:function(a){var b=this.view,c=a.get(this.exp);if(typeof c==="undefined"){c=this.w;a.o(this.exp,c)}if(c!==this.c){b.value=c?c:"";this.c=c}}};ua.prototype={selected:function(){for(var a=[],b=this.view.options,c=0;cd;--b)this.children.pop().element.remove();if(h&&h.element[0].nodeName==="OPTION")if(d=k(h.element[0].parentNode).data("controller")){d.c=undefined;d.d(a)}})}};z.ua="mouseleave mouseout click dblclick keypress keyup";z.fc=function(){z.oa();var a=k(this);a.bind(z.ua,z.oa);var b=a.position(),c=x.documentElement,d=(self.innerWidth||c&&c.clientWidth||
-x.body.clientWidth)-b.left;c=a.hasClass("ng-exception")?"EXCEPTION:":"Validation error...";a=a.attr("ng-error");d=d>375?"left":"right";c=k("");k("body").append(c);if(d==="left")a=b.left+this.offsetWidth+11;else{a=b.left-315;c.find(".ng-arrow-right").css({left:301})}c.css({left:a+"px",top:b.top-3+"px"});return true};z.oa=function(){k("#ng-callout").unbind(z.ua,
-z.oa).remove();return true};z.prototype={bind:function(){this.F.find(".ng-validation-error,.ng-exception").live("mouseover",z.fc)}};Y.$a='loading....
';Y.prototype={pb:function(){if(this.da===0)(this.Ja=this.Ja||this.body.append(Y.$a).find("#ng-loading")).show();this.da++},Ab:function(){this.da--;this.da===0&&this.Ja.hide("fold")}}})(window,document);
+a(d),c(d))}},Ea:function(){return this.h.length>0},L:function(){if(this.h.length!==0)throw"Did not understand '"+this.text.substring(this.h[0].index)+"' while evaluating '"+this.text+"'.";},ra:function(){for(var a=[];;){this.h.length>0&&!this.I("}",")",";","]")&&a.push(this.Ca());if(!this.a(";"))return function(b){for(var c,d=0;d","<=",">="))a=this.z(a,b.b,this.Ua());return a},mb:function(){for(var a=this.Na(),b;b=this.a("+","-");)a=this.z(a,b.b,this.Na());return a},Na:function(){for(var a=this.fa(),b;b=this.a("*","/","%");)a=this.z(a,b.b,this.fa());return a},fa:function(){var a;return this.a("+")?this.ca():(a=this.a("-"))?this.z(D.db,a.b,this.fa()):(a=this.a("!"))?this.fb(a.b,this.fa()):this.ca()},Ib:function(a){var b=this.a(),c=b.text.split(".");a=a;for(var d,e=0;e1;d++){var e=a.shift(),f=c[e];if(!f){f={};c[e]=f}c=f}return c[a.shift()]=b},q:function(a,b){this.eval(a+
+"="+v(b))},eval:function(a,b){var c=u.U[a];if(!c){var d=new D(a);c=d.ra();d.L();u.U[a]=c}b=b||{};b.scope=this;return c(b)},o:function(a,b,c,d,e){try{var f=this.eval(b,c);if(a.C){a.C=false;l(a.view).removeClass("ng-exception").removeAttr("ng-error")}d&&d.apply(a,[f]);return true}catch(h){ba("Eval Widget Error:",h);b=v(h,true);a.C=true;l(a.view).addClass("ng-exception").attr("ng-error",b);e&&e.apply(a,[h,b]);return false}},uc:function(a,b,c){var d=u.U[a];if(!d){d=(new D(a)).Q();u.U[a]=d}a={scope:this,
+self:this.k,$element:c};return d(a)(a,b)},G:function(a,b){return(new D(a)).Db()({scope:this,l:b})},sb:function(){for(var a=this.k.$invalidWidgets;a.length>0;)a.pop()},Sb:function(a){this.k.$invalidWidgets.push(a)},watch:function(a){var b=this;(new D(a)).watch()({scope:this,jb:function(c,d){b.kb(c,function(e,f){try{return d({scope:b},e,f)}catch(h){alert(h)}})}})},kb:function(a,b){var c=this.ta[a];if(!c){c={Ia:[],s:a};this.ta[a]=c}c.Ia.push(b)},Gb:function(){var a=this,b=false;o(this.ta,function(c){var d=
+a.eval(c.s);if(d!==c.c){o(c.Ia,function(e){e(d,c.c);b=true});c.c=d}});return b}};na.prototype={pb:function(a){return fa.Ab(a)},P:function(a,b,c,d){var e=this.tc+this.Tb++;a=this.pb(v({u:b,m:a,p:c}));b=Math.ceil(a.length/this.oa);c=this.url+"/$/"+e+"/"+b+"/";N[e]=function(g){delete N[e];d(200,g)};for(var f=0;fc)return"Value can not be greater than "+c+".";return null}else return"Value is not a number."},integer:function(a,b,c){if(b=Ga.number(a,b,c))return b;if(!(""+a).match(/^\s*[\d+]*\s*$/)||a!=Math.round(a))return"Value is not a whole number.";return null},date:function(a){if(a.match(/^\d\d?\/\d\d?\/\d\d\d\d$/))return null;return"Value is not a date. (Expecting format: 12/31/2009)."},
+ssn:function(a){if(a.match(/^\d\d\d-\d\d-\d\d\d\d$/))return null;return"SSN needs to be in 999-99-9999 format."},email:function(a){if(a.match(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/))return null;return"Email needs to be in username@host.com format."},phone:function(a){if(a.match(/^1\(\d\d\d\)\d\d\d-\d\d\d\d$/))return null;if(a.match(/^\+\d{2,3} (\(\d{1,5}\))?[\d ]+\d$/))return null;return"Phone number needs to be in 1(987)654-3210 format in North America or +999 (123) 45678 906 internationaly."},
+url:function(a){if(a.match(/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/))return null;return"URL needs to be in http://server[:port]/path format."},json:function(a){try{L(a);return null}catch(b){return b.toString()}}},function(a,b){Ga[b]=a});ma.prototype={ub:function(a,b){var c,d=a.attr("type").toLowerCase(),e=a.attr("name");if(e)e=e.split(":").pop();var f="change",h=true,g=ga[a.attr("ng-format")]||ga.noop;if(d=="button"||d=="submit"||d=="reset"||d=="image"){c=
+new Ra(a[0],e,g);f="click";h=false}else if(d=="text"||d=="textarea"||d=="hidden"||d=="password"){c=new ra(a[0],e,g);f="keyup change"}else if(d=="checkbox"){c=new sa(a[0],e,g);f="click"}else if(d=="radio"){c=new va(a[0],e,g);f="click"}else if(d=="select-one")c=new ta(a[0],e,g);else if(d=="select-multiple")c=new ua(a[0],e,g);else if(d=="file")c=this.vb(a,e,g);else throw"Unknown type: "+d;a.data("controller",c);var i=b.get("$updateView");l(c.view,":input").bind(f,function(){if(c.e(b)){var j=l(c.view).attr("ng-action")||
+"";b.o(c,j)&&i(b)}return h});return c},vb:function(a){var b="__uploadWidget_"+this.Ub++,c=U.template(b);a.after(c);b=this.wb({data:this.ea+"/admin/ServerAPI.swf",width:"95",height:"20",align:"top",wmode:"transparent"},{flashvars:"uploadWidgetId="+b,allowScriptAccess:"always"},b);a.remove();a=new U(c,a[0].name,b,this.ea+"/data/"+this.ka);l(b).data("controller",a);return a}};N.flashEvent=function(a,b,c){a=x.getElementById(a);a=l(a);var d=a.data("controller");U.prototype[b].apply(d,c);_.defer(a.scope().get("$updateView"))};
+U.template=function(a){return l('')};B(U.prototype,{cancel:n,complete:n,httpStatus:function(a){alert("httpStatus:"+this.J+" status:"+a)},ioError:function(){alert("ioError:"+this.J)},open:function(){alert("open:"+this.J)},progress:n,securityError:function(){alert("securityError:"+this.J)},uploadCompleteData:function(a){a=L(a);a.url=this.ya+"/"+a.id+"/"+a.text;this.view.find("input").attr("checked",
+true);var b=this.view.scope();this.value=a;this.e(b);this.value=null},select:function(a,b){this.name=a;this.view.find("a").text(a).attr("href",a);this.view.find("span").text(m.filter.bytes(b));this.upload()},e:function(a){var b=this.view.find("input").attr("checked")?this.value:null;if(this.c===b)return false;else{a.i(this.J,b);return true}},d:function(a){if((a=a.get(this.J))&&this.value!==a){this.value=a;this.view.find("a").attr("href",this.value.url).text(this.value.text);this.view.find("span").text(m.filter.bytes(this.value.size))}this.view.find("input").attr("checked",
+!!a)},upload:function(){this.name&&this.rc.uploadFile(this.ya)}});R.prototype={e:P(true),d:n};R.Kb=new R;var Ra=R;ra.prototype={e:function(a){var b=this.A.parse(this.view.value);if(this.c===b)return false;else{a.q(this.exp,b);this.c=b;return true}},d:function(a){var b=this.view,c=a.get(this.exp);if(typeof c==="undefined"){c=this.w;a.q(this.exp,c)}c=c?c:"";if(!_(this.c).isEqual(c)){b.value=this.A.format(c);this.c=c}var d=false;b.removeAttribute("ng-error");if(this.lc)d=!(c&&$.trim(""+c).length>0);
+var e=d?"Required Value":null;if(!d&&this.Q&&c){e=a.uc(this.Q,c,b);d=!!e}if(this.Ga!==e){this.Ga=d;if(e&&Ha(b)){b.setAttribute("ng-error",e);a.Sb(this)}l(b).toggleClass("ng-validation-error",d)}}};sa.prototype={e:function(a){var b=this.view;b=b.checked?b.value:"";b=this.A.parse(b);b=this.A.format(b);if(this.c===b)return false;else{a.q(this.exp,this.A.parse(b));this.c=b;return true}},d:function(a){var b=this.view,c=a.eval(this.exp);if(typeof c==="undefined"){c=this.w;a.q(this.exp,c)}b.checked=this.A.parse(b.value)==
+c}};ta.prototype={e:function(a){if(this.view.selectedIndex<0)a.q(this.exp,null);else{var b=this.view.value;if(this.c===b)return false;else{a.q(this.exp,b);this.c=b;return true}}},d:function(a){var b=this.view,c=a.get(this.exp);if(typeof c==="undefined"){c=this.w;a.q(this.exp,c)}if(c!==this.c){b.value=c?c:"";this.c=c}}};ua.prototype={selected:function(){for(var a=[],b=this.view.options,c=0;cd;--b)this.children.pop().element.remove();if(g&&g.element[0].nodeName==="OPTION")if(d=l(g.element[0].parentNode).data("controller")){d.c=undefined;d.d(a)}})}};z.va="mouseleave mouseout click dblclick keypress keyup";z.fc=function(){z.pa();var a=l(this);
+a.bind(z.va,z.pa);var b=a.position(),c=x.documentElement,d=(self.innerWidth||c&&c.clientWidth||x.body.clientWidth)-b.left;c=a.hasClass("ng-exception")?"EXCEPTION:":"Validation error...";a=a.attr("ng-error");d=d>375?"left":"right";c=l("");l("body").append(c);if(d==="left")a=b.left+this.offsetWidth+11;else{a=b.left-315;c.find(".ng-arrow-right").css({left:301})}c.css({left:a+
+"px",top:b.top-3+"px"});return true};z.pa=function(){l("#ng-callout").unbind(z.va,z.pa).remove();return true};z.prototype={bind:function(){this.F.find(".ng-validation-error,.ng-exception").live("mouseover",z.fc)}};Y.$a='loading....
';Y.prototype={qb:function(){if(this.da===0)(this.La=this.La||this.body.append(Y.$a).find("#ng-loading")).show();this.da++},Bb:function(){this.da--;this.da===0&&this.La.hide("fold")}}})(window,document);
diff --git a/angular.js b/angular.js
index 0ff24a74..6ff1fbb8 100644
--- a/angular.js
+++ b/angular.js
@@ -1635,7 +1635,7 @@ var angularFilterGoogleChartApi;
foreach({
'currency': function(amount){
- jQuery(this.element).toggleClass('ng-format-negative', amount < 0);
+ jQuery(this.$element).toggleClass('ng-format-negative', amount < 0);
return '$' + angularFilter['number'].apply(this, [amount, 2]);
},
@@ -1671,7 +1671,7 @@ foreach({
},
'json': function(object) {
- jQuery(this.element).addClass("ng-monospace");
+ jQuery(this.$element).addClass("ng-monospace");
return toJson(object, true);
},
@@ -2488,7 +2488,16 @@ Parser.prototype = {
for ( var i = 0; i < argsFn.length; i++) {
args.push(argsFn[i](self));
}
- return fn.apply(self, args);
+ var pipeThis = function(){
+ var _this = this;
+ foreach(self, function(v, k) {
+ if (k.charAt(0) == '$') {
+ _this[k] = v;
+ }
+ });
+ };
+ pipeThis.prototype = self.self;
+ return fn.apply(new pipeThis(), args);
};
return function(){
return fnInvoke;
@@ -2541,48 +2550,30 @@ Parser.prototype = {
},
logicalAND: function(){
- var left = this.negated();
+ var left = this.equality();
var token;
- while(true) {
- if ((token = this.expect('&&'))) {
- left = this._binary(left, token.fn, this.negated());
- } else {
- return left;
- }
- }
- },
-
- negated: function(){
- var token;
- if (token = this.expect('!')) {
- return this._unary(token.fn, this.assignment());
- } else {
- return this.equality();
+ if ((token = this.expect('&&'))) {
+ left = this._binary(left, token.fn, this.logicalAND());
}
+ return left;
},
equality: function(){
var left = this.relational();
var token;
- while(true) {
- if ((token = this.expect('==','!='))) {
- left = this._binary(left, token.fn, this.relational());
- } else {
- return left;
- }
+ if ((token = this.expect('==','!='))) {
+ left = this._binary(left, token.fn, this.equality());
}
+ return left;
},
relational: function(){
var left = this.additive();
var token;
- while(true) {
- if ((token = this.expect('<', '>', '<=', '>='))) {
- left = this._binary(left, token.fn, this.additive());
- } else {
- return left;
- }
+ if (token = this.expect('<', '>', '<=', '>=')) {
+ left = this._binary(left, token.fn, this.relational());
}
+ return left;
},
additive: function(){
@@ -2608,7 +2599,9 @@ Parser.prototype = {
if (this.expect('+')) {
return this.primary();
} else if (token = this.expect('-')) {
- return this._binary(Parser.ZERO, token.fn, this.multiplicative());
+ return this._binary(Parser.ZERO, token.fn, this.unary());
+ } else if (token = this.expect('!')) {
+ return this._unary(token.fn, this.unary());
} else {
return this.primary();
}
@@ -3001,13 +2994,13 @@ Scope.prototype = {
}
},
- validate: function(expressionText, value) {
+ validate: function(expressionText, value, element) {
var expression = Scope.expressionCache[expressionText];
if (!expression) {
expression = new Parser(expressionText).validator();
Scope.expressionCache[expressionText] = expression;
}
- var self = {scope:this};
+ var self = {scope:this, self:this.state, '$element':element};
return expression(self)(self, value);
},
@@ -3485,7 +3478,7 @@ TextController.prototype = {
}
var errorText = isValidationError ? "Required Value" : null;
if (!isValidationError && this.validator && value) {
- errorText = scope.validate(this.validator, value);
+ errorText = scope.validate(this.validator, value, view);
isValidationError = !!errorText;
}
if (this.lastErrorText !== errorText) {
@@ -3731,7 +3724,7 @@ BindUpdater.prototype = {
var part = parts[i];
var binding = Binder.binding(part);
if (binding) {
- scope.evalWidget(this, binding, {element:this.view}, function(value){
+ scope.evalWidget(this, binding, {$element:this.view}, function(value){
html.push(BindUpdater.toText(value));
}, function(e, text){
setHtml(this.view, text);
@@ -3771,7 +3764,7 @@ BindAttrUpdater.prototype = {
var binding = Binder.binding(attributeTemplate[i]);
if (binding) {
try {
- var value = scope.eval(binding, {element:jNode[0], attrName:attrName});
+ var value = scope.eval(binding, {$element:jNode[0], attrName:attrName});
if (value && (value.constructor !== array || value.length !== 0))
attrValues.push(value);
} catch (e) {
diff --git a/src/Filters.js b/src/Filters.js
index 77fa5ec7..60d53fb9 100644
--- a/src/Filters.js
+++ b/src/Filters.js
@@ -24,7 +24,7 @@ var angularFilterGoogleChartApi;
foreach({
'currency': function(amount){
- jQuery(this.element).toggleClass('ng-format-negative', amount < 0);
+ jQuery(this.$element).toggleClass('ng-format-negative', amount < 0);
return '$' + angularFilter['number'].apply(this, [amount, 2]);
},
@@ -60,7 +60,7 @@ foreach({
},
'json': function(object) {
- jQuery(this.element).addClass("ng-monospace");
+ jQuery(this.$element).addClass("ng-monospace");
return toJson(object, true);
},
diff --git a/src/Parser.js b/src/Parser.js
index fe9671af..3aa644ac 100644
--- a/src/Parser.js
+++ b/src/Parser.js
@@ -369,7 +369,16 @@ Parser.prototype = {
for ( var i = 0; i < argsFn.length; i++) {
args.push(argsFn[i](self));
}
- return fn.apply(self, args);
+ var pipeThis = function(){
+ var _this = this;
+ foreach(self, function(v, k) {
+ if (k.charAt(0) == '$') {
+ _this[k] = v;
+ }
+ });
+ };
+ pipeThis.prototype = self.self;
+ return fn.apply(new pipeThis(), args);
};
return function(){
return fnInvoke;
@@ -422,48 +431,30 @@ Parser.prototype = {
},
logicalAND: function(){
- var left = this.negated();
+ var left = this.equality();
var token;
- while(true) {
- if ((token = this.expect('&&'))) {
- left = this._binary(left, token.fn, this.negated());
- } else {
- return left;
- }
- }
- },
-
- negated: function(){
- var token;
- if (token = this.expect('!')) {
- return this._unary(token.fn, this.assignment());
- } else {
- return this.equality();
+ if ((token = this.expect('&&'))) {
+ left = this._binary(left, token.fn, this.logicalAND());
}
+ return left;
},
equality: function(){
var left = this.relational();
var token;
- while(true) {
- if ((token = this.expect('==','!='))) {
- left = this._binary(left, token.fn, this.relational());
- } else {
- return left;
- }
+ if ((token = this.expect('==','!='))) {
+ left = this._binary(left, token.fn, this.equality());
}
+ return left;
},
relational: function(){
var left = this.additive();
var token;
- while(true) {
- if ((token = this.expect('<', '>', '<=', '>='))) {
- left = this._binary(left, token.fn, this.additive());
- } else {
- return left;
- }
+ if (token = this.expect('<', '>', '<=', '>=')) {
+ left = this._binary(left, token.fn, this.relational());
}
+ return left;
},
additive: function(){
@@ -489,7 +480,9 @@ Parser.prototype = {
if (this.expect('+')) {
return this.primary();
} else if (token = this.expect('-')) {
- return this._binary(Parser.ZERO, token.fn, this.multiplicative());
+ return this._binary(Parser.ZERO, token.fn, this.unary());
+ } else if (token = this.expect('!')) {
+ return this._unary(token.fn, this.unary());
} else {
return this.primary();
}
diff --git a/src/Scope.js b/src/Scope.js
index cedb0542..c0998168 100644
--- a/src/Scope.js
+++ b/src/Scope.js
@@ -138,13 +138,13 @@ Scope.prototype = {
}
},
- validate: function(expressionText, value) {
+ validate: function(expressionText, value, element) {
var expression = Scope.expressionCache[expressionText];
if (!expression) {
expression = new Parser(expressionText).validator();
Scope.expressionCache[expressionText] = expression;
}
- var self = {scope:this};
+ var self = {scope:this, self:this.state, '$element':element};
return expression(self)(self, value);
},
diff --git a/src/Widgets.js b/src/Widgets.js
index 4f359e91..71fcd110 100644
--- a/src/Widgets.js
+++ b/src/Widgets.js
@@ -234,7 +234,7 @@ TextController.prototype = {
}
var errorText = isValidationError ? "Required Value" : null;
if (!isValidationError && this.validator && value) {
- errorText = scope.validate(this.validator, value);
+ errorText = scope.validate(this.validator, value, view);
isValidationError = !!errorText;
}
if (this.lastErrorText !== errorText) {
@@ -480,7 +480,7 @@ BindUpdater.prototype = {
var part = parts[i];
var binding = Binder.binding(part);
if (binding) {
- scope.evalWidget(this, binding, {element:this.view}, function(value){
+ scope.evalWidget(this, binding, {$element:this.view}, function(value){
html.push(BindUpdater.toText(value));
}, function(e, text){
setHtml(this.view, text);
@@ -520,7 +520,7 @@ BindAttrUpdater.prototype = {
var binding = Binder.binding(attributeTemplate[i]);
if (binding) {
try {
- var value = scope.eval(binding, {element:jNode[0], attrName:attrName});
+ var value = scope.eval(binding, {$element:jNode[0], attrName:attrName});
if (value && (value.constructor !== array || value.length !== 0))
attrValues.push(value);
} catch (e) {
diff --git a/test/FiltersTest.js b/test/FiltersTest.js
index 5ca63ca7..e6e8b662 100644
--- a/test/FiltersTest.js
+++ b/test/FiltersTest.js
@@ -2,7 +2,7 @@ FiltersTest = TestCase('FiltersTest');
FiltersTest.prototype.testCurrency = function(){
var html = $('');
- var context = {element:html[0]};
+ var context = {$element:html[0]};
var currency = bind(context, angular.filter.currency);
assertEquals(currency(0), '$0.00');
@@ -17,10 +17,10 @@ FiltersTest.prototype.testFilterThisIsContext = function(){
expectAsserts(2);
var scope = new Scope();
Scope.expressionCache = {};
- var context = {element:123};
+ var context = {$element:123, self:{name:'misko'}};
angular.filter.testFn = function () {
- assertEquals('Context not equal', this, context);
- assertEquals('scope not equal', this.scope, scope);
+ assertEquals('Context not equal', 123, this.$element);
+ assertEquals('scope not equal', 'misko', this.name);
};
scope.eval("0|testFn", context);
delete angular.filter['testFn'];
diff --git a/test/ParserTest.js b/test/ParserTest.js
index 2fcbc7fe..09c3b8de 100644
--- a/test/ParserTest.js
+++ b/test/ParserTest.js
@@ -160,6 +160,9 @@ ParserTest.prototype.testComparison = function(){
assertEquals(scope.eval("1<=1"), true);
assertEquals(scope.eval("1>2"), 1>2);
assertEquals(scope.eval("2>=1"), 2>=1);
+
+ assertEquals(true==2<3, scope.eval("true==2<3"));
+
};
ParserTest.prototype.testLogical = function(){
@@ -467,3 +470,10 @@ ParserTest.prototype.testDoubleNegationBug = function (){
assertEquals('a', scope.eval('{true:"a", false:"b"}[!!true]'));
};
+ParserTest.prototype.testNegationBug = function () {
+ var scope = new Scope();
+ assertEquals(!false || true, scope.eval("!false || true"));
+ assertEquals(!11 == 10, scope.eval("!11 == 10"));
+ assertEquals(12/6/2, scope.eval("12/6/2"));
+};
+
diff --git a/test/ScopeTest.js b/test/ScopeTest.js
index b066f0cb..24febf19 100644
--- a/test/ScopeTest.js
+++ b/test/ScopeTest.js
@@ -83,8 +83,9 @@ ScopeTest.prototype.testGlobalFunctionAccess =function(){
ScopeTest.prototype.testValidationEval = function(){
expectAsserts(4);
var scope = new Scope();
+ scope.set("name", "misko");
angular.validator.testValidator = function(value, expect){
- assertEquals(scope, this.scope);
+ assertEquals("misko", this.name);
return value == expect ? null : "Error text";
};
diff --git a/test/ValidatorsTest.js b/test/ValidatorsTest.js
index f06e0b3a..a4e603fa 100644
--- a/test/ValidatorsTest.js
+++ b/test/ValidatorsTest.js
@@ -1,5 +1,22 @@
ValidatorTest = TestCase('ValidatorTest');
+ValidatorTest.prototype.testItShouldHaveThisSet = function() {
+ expectAsserts(5);
+ var self;
+ angular.validator.myValidator = function(first, last){
+ assertEquals('misko', first);
+ assertEquals('hevery', last);
+ self = this;
+ };
+ var c = compile('');
+ c.scope.set('name', 'misko');
+ c.scope.set('state', 'abc');
+ c.binder.updateView();
+ assertEquals('abc', self.state);
+ assertEquals('misko', self.name);
+ assertEquals('name', self.$element.name);
+};
+
ValidatorTest.prototype.testRegexp = function() {
assertEquals(angular.validator.regexp("abc", /x/, "E1"), "E1");
assertEquals(angular.validator.regexp("abc", '/x/'),
@@ -64,4 +81,3 @@ ValidatorTest.prototype.testJson = function() {
assertNotNull(angular.validator.json("''X"));
assertNull(angular.validator.json("{}"));
};
-
--
cgit v1.2.3