luca 0.9.65 → 0.9.76
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +30 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +27 -0
- data/lib/luca/rails/version.rb +1 -1
- data/spec/components/controller_spec.coffee +58 -0
- data/spec/components/form_view_spec.coffee +4 -0
- data/spec/concerns/dom_helpers_spec.coffee +16 -0
- data/spec/{modules → concerns}/filterable_spec.coffee +0 -0
- data/spec/concerns/model_presenter_spec.coffee +31 -0
- data/spec/{modules → concerns}/paginatable_spec.coffee +0 -0
- data/spec/{modules → concerns}/state_model_spec.coffee +0 -0
- data/spec/concerns_spec.coffee +88 -0
- data/spec/core/container_spec.coffee +103 -6
- data/spec/core/field_spec.coffee +4 -0
- data/spec/core/model_spec.coffee +6 -1
- data/spec/define_spec.coffee +104 -7
- data/spec/framework_spec.coffee +30 -1
- data/spec/util_spec.coffee +24 -0
- data/src/components/application.coffee +62 -25
- data/src/components/base_toolbar.coffee +6 -4
- data/src/components/collection_loader_view.coffee +3 -1
- data/src/components/collection_view.coffee +36 -73
- data/src/components/controller.coffee +73 -35
- data/src/components/fields/button_field.coffee +20 -12
- data/src/components/fields/checkbox_array.coffee +8 -2
- data/src/components/fields/checkbox_field.coffee +18 -9
- data/src/components/fields/file_upload_field.coffee +5 -1
- data/src/components/fields/hidden_field.coffee +3 -1
- data/src/components/fields/label_field.coffee +4 -3
- data/src/components/fields/select_field.coffee +7 -8
- data/src/components/fields/text_area_field.coffee +3 -2
- data/src/components/fields/text_field.coffee +5 -4
- data/src/components/fields/type_ahead_field.coffee +4 -2
- data/src/components/form_button_toolbar.coffee +4 -1
- data/src/components/form_view.coffee +26 -24
- data/src/components/grid_view.coffee +3 -3
- data/src/components/multi_collection_view.coffee +6 -35
- data/src/components/pagination_control.coffee +1 -3
- data/src/components/router.coffee +2 -0
- data/src/components/table_view.coffee +7 -0
- data/src/concerns.coffee +70 -0
- data/src/{modules → concerns}/application_event_bindings.coffee +1 -1
- data/src/{modules → concerns}/collection_event_bindings.coffee +1 -1
- data/src/{modules → concerns}/deferrable.coffee +1 -1
- data/src/{modules → concerns}/dom_helpers.coffee +11 -2
- data/src/{modules → concerns}/enhanced_properties.coffee +1 -1
- data/src/{modules → concerns}/filterable.coffee +11 -11
- data/src/{modules → concerns}/grid_layout.coffee +1 -1
- data/src/{modules → concerns}/loadmaskable.coffee +1 -1
- data/src/{modules → concerns}/local_storage.coffee +0 -0
- data/src/{modules → concerns}/modal_view.coffee +1 -1
- data/src/concerns/model_presenter.coffee +23 -0
- data/src/{modules → concerns}/paginatable.coffee +9 -3
- data/src/concerns/query_collection_bindings.coffee +44 -0
- data/src/{modules → concerns}/state_model.coffee +1 -1
- data/src/{modules → concerns}/templating.coffee +1 -1
- data/src/containers/card_view.coffee +16 -9
- data/src/containers/tab_view.coffee +8 -11
- data/src/containers/viewport.coffee +3 -3
- data/src/core/collection.coffee +39 -28
- data/src/core/container.coffee +37 -15
- data/src/core/field.coffee +40 -39
- data/src/core/meta_data.coffee +93 -0
- data/src/core/model.coffee +18 -1
- data/src/core/registry.coffee +4 -3
- data/src/core/view.coffee +24 -30
- data/src/define.coffee +165 -79
- data/src/framework.coffee +97 -21
- data/src/index.coffee +4 -2
- data/src/managers/collection_manager.coffee +7 -3
- data/src/stylesheets/components/checkbox_array.scss +1 -1
- data/src/stylesheets/components/form_view.scss +5 -5
- data/src/stylesheets/components/viewport.scss +2 -1
- data/src/stylesheets/containers/container.scss +0 -5
- data/src/stylesheets/containers/tab_view.scss +5 -5
- data/src/templates/fields/text_area_field.jst.ejs +1 -1
- data/src/templates/fields/text_field.jst.ejs +1 -1
- data/src/util.coffee +47 -0
- data/vendor/assets/javascripts/luca-ui-full.js +1279 -494
- data/vendor/assets/javascripts/luca-ui-full.min.js +5 -5
- data/vendor/assets/javascripts/luca-ui-templates.js +2 -2
- data/vendor/assets/javascripts/luca-ui.js +1279 -494
- data/vendor/assets/javascripts/luca-ui.min.js +5 -4
- data/vendor/assets/stylesheets/luca-ui.css +15 -15
- metadata +27 -20
- data/spec/mixin_spec.coffee +0 -49
@@ -2,8 +2,8 @@
|
|
2
2
|
]||"").split(".").sort(),r=K.event.special[l]||{},l=(f?r.delegateType:r.bindType)||l,r=K.event.special[l]||{},n=K.extend({type:l,origType:k[1],data:e,handler:d,guid:d.guid,selector:f,quick:fb(f),namespace:m.join(".")},o),q=i[l];if(!q){q=i[l]=[],q.delegateCount=0;if(!r.setup||r.setup.call(a,e,m,h)===!1)a.addEventListener?a.addEventListener(l,h,!1):a.attachEvent&&a.attachEvent("on"+l,h)}r.add&&(r.add.call(a,n),n.handler.guid||(n.handler.guid=d.guid)),f?q.splice(q.delegateCount++,0,n):q.push(n),K.event.global[l]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var f=K.hasData(a)&&K._data(a),g,h,i,j,k,l,m,n,o,p,q,r;if(!!f&&!!(n=f.events)){b=K.trim(hb(b||"")).split(" ");for(g=0;g<b.length;g++){h=_.exec(b[g])||[],i=j=h[1],k=h[2];if(!i){for(i in n)K.event.remove(a,i+b[g],c,d,!0);continue}o=K.event.special[i]||{},i=(d?o.delegateType:o.bindType)||i,q=n[i]||[],l=q.length,k=k?new RegExp("(^|\\.)"+k.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(m=0;m<q.length;m++)r=q[m],(e||j===r.origType)&&(!c||c.guid===r.guid)&&(!k||k.test(r.namespace))&&(!d||d===r.selector||d==="**"&&r.selector)&&(q.splice(m--,1),r.selector&&q.delegateCount--,o.remove&&o.remove.call(a,r));q.length===0&&l!==q.length&&((!o.teardown||o.teardown.call(a,k)===!1)&&K.removeEvent(a,i,f.handle),delete n[i])}K.isEmptyObject(n)&&(p=f.handle,p&&(p.elem=null),K.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,f){if(!e||e.nodeType!==3&&e.nodeType!==8){var g=c.type||c,h=[],i,j,k,l,m,n,o,p,q,r;if(db.test(g+K.event.triggered))return;g.indexOf("!")>=0&&(g=g.slice(0,-1),j=!0),g.indexOf(".")>=0&&(h=g.split("."),g=h.shift(),h.sort());if((!e||K.event.customEvent[g])&&!K.event.global[g])return;c=typeof c=="object"?c[K.expando]?c:new K.Event(g,c):new K.Event(g),c.type=g,c.isTrigger=!0,c.exclusive=j,c.namespace=h.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,n=g.indexOf(":")<0?"on"+g:"";if(!e){i=K.cache;for(k in i)i[k].events&&i[k].events[g]&&K.event.trigger(c,d,i[k].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?K.makeArray(d):[],d.unshift(c),o=K.event.special[g]||{};if(o.trigger&&o.trigger.apply(e,d)===!1)return;q=[[e,o.bindType||g]];if(!f&&!o.noBubble&&!K.isWindow(e)){r=o.delegateType||g,l=db.test(r+g)?e:e.parentNode,m=null;for(;l;l=l.parentNode)q.push([l,r]),m=l;m&&m===e.ownerDocument&&q.push([m.defaultView||m.parentWindow||a,r])}for(k=0;k<q.length&&!c.isPropagationStopped();k++)l=q[k][0],c.type=q[k][1],p=(K._data(l,"events")||{})[c.type]&&K._data(l,"handle"),p&&p.apply(l,d),p=n&&l[n],p&&K.acceptData(l)&&p.apply(l,d)===!1&&c.preventDefault();return c.type=g,!f&&!c.isDefaultPrevented()&&(!o._default||o._default.apply(e.ownerDocument,d)===!1)&&(g!=="click"||!K.nodeName(e,"a"))&&K.acceptData(e)&&n&&e[g]&&(g!=="focus"&&g!=="blur"||c.target.offsetWidth!==0)&&!K.isWindow(e)&&(m=e[n],m&&(e[n]=null),K.event.triggered=g,e[g](),K.event.triggered=b,m&&(e[n]=m)),c.result}},dispatch:function(c){c=K.event.fix(c||a.event);var d=(K._data(this,"events")||{})[c.type]||[],e=d.delegateCount,f=[].slice.call(arguments,0),g=!c.exclusive&&!c.namespace,h=[],i,j,k,l,m,n,o,p,q,r,s;f[0]=c,c.delegateTarget=this;if(e&&!c.target.disabled&&(!c.button||c.type!=="click")){l=K(this),l.context=this.ownerDocument||this;for(k=c.target;k!=this;k=k.parentNode||this){n={},p=[],l[0]=k;for(i=0;i<e;i++)q=d[i],r=q.selector,n[r]===b&&(n[r]=q.quick?gb(k,q.quick):l.is(r)),n[r]&&p.push(q);p.length&&h.push({elem:k,matches:p})}}d.length>e&&h.push({elem:this,matches:d.slice(e)});for(i=0;i<h.length&&!c.isPropagationStopped();i++){o=h[i],c.currentTarget=o.elem;for(j=0;j<o.matches.length&&!c.isImmediatePropagationStopped();j++){q=o.matches[j];if(g||!c.namespace&&!q.namespace||c.namespace_re&&c.namespace_re.test(q.namespace))c.data=q.data,c.handleObj=q,m=((K.event.special[q.origType]||{}).handle||q.handler).apply(o.elem,f),m!==b&&(c.result=m,m===!1&&(c.preventDefault(),c.stopPropagation()))}}return c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,c){var d,e,f,g=c.button,h=c.fromElement;return a.pageX==null&&c.clientX!=null&&(d=a.target.ownerDocument||H,e=d.documentElement,f=d.body,a.pageX=c.clientX+(e&&e.scrollLeft||f&&f.scrollLeft||0)-(e&&e.clientLeft||f&&f.clientLeft||0),a.pageY=c.clientY+(e&&e.scrollTop||f&&f.scrollTop||0)-(e&&e.clientTop||f&&f.clientTop||0)),!a.relatedTarget&&h&&(a.relatedTarget=h===a.target?c.toElement:h),!a.which&&g!==b&&(a.which=g&1?1:g&2?3:g&4?2:0),a}},fix:function(a){if(a[K.expando])return a;var c,d,e=a,f=K.event.fixHooks[a.type]||{},g=f.props?this.props.concat(f.props):this.props;a=K.Event(e);for(c=g.length;c;)d=g[--c],a[d]=e[d];return a.target||(a.target=e.srcElement||H),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey),f.filter?f.filter(a,e):a},special:{ready:{setup:K.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){K.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=K.extend(new K.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?K.event.trigger(e,null,b):K.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},K.event.handle=K.event.dispatch,K.removeEvent=H.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},K.Event=function(a,b){if(!(this instanceof K.Event))return new K.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?B:C):this.type=a,b&&K.extend(this,b),this.timeStamp=a&&a.timeStamp||K.now(),this[K.expando]=!0},K.Event.prototype={preventDefault:function(){this.isDefaultPrevented=B;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=B;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=B,this.stopPropagation()},isDefaultPrevented:C,isPropagationStopped:C,isImmediatePropagationStopped:C},K.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){K.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,f=e.selector,g;if(!d||d!==c&&!K.contains(c,d))a.type=e.origType,g=e.handler.apply(this,arguments),a.type=b;return g}}}),K.support.submitBubbles||(K.event.special.submit={setup:function(){if(K.nodeName(this,"form"))return!1;K.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=K.nodeName(c,"input")||K.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(K.event.add(d,"submit._submit",function(a){this.parentNode&&!a.isTrigger&&K.event.simulate("submit",this.parentNode,a,!0)}),d._submit_attached=!0)})},teardown:function(){if(K.nodeName(this,"form"))return!1;K.event.remove(this,"._submit")}}),K.support.changeBubbles||(K.event.special.change={setup:function(){if($.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")K.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),K.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,K.event.simulate("change",this,a,!0))});return!1}K.event.add(this,"beforeactivate._change",function(a){var b=a.target;$.test(b.nodeName)&&!b._change_attached&&(K.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&K.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){return K.event.remove(this,"._change"),$.test(this.nodeName)}}),K.support.focusinBubbles||K.each({focus:"focusin",blur:"focusout"},function(a,b){var c=0,d=function(a){K.event.simulate(b,a.target,K.event.fix(a),!0)};K.event.special[b]={setup:function(){c++===0&&H.addEventListener(a,d,!0)},teardown:function(){--c===0&&H.removeEventListener(a,d,!0)}}}),K.fn.extend({on:function(a,c,d,e,f){var g,h;if(typeof a=="object"){typeof c!="string"&&(d=c,c=b);for(h in a)this.on(h,c,d,a[h],f);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=C;else if(!e)return this;return f===1&&(g=e,e=function(a){return K().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=K.guid++)),this.each(function(){K.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on.call(this,a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;return K(a.delegateTarget).off(e.namespace?e.type+"."+e.namespace:e.type,e.selector,e.handler),this}if(typeof a=="object"){for(var f in a)this.off(f,c,a[f]);return this}if(c===!1||typeof c=="function")d=c,c=b;return d===!1&&(d=C),this.each(function(){K.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){return K(this.context).on(a,this.selector,b,c),this},die:function(a,b){return K(this.context).off(a,this.selector||"**",b),this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){K.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return K.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||K.guid++,d=0,e=function(c){var e=(K._data(this,"lastToggle"+a.guid)||0)%d;return K._data(this,"lastToggle"+a.guid,e+1),c.preventDefault(),b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),K.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){K.fn[b]=function(a,c){return c==null&&(c=a,a=null),arguments.length>0?this.on(b,null,a,c):this.trigger(b)},K.attrFn&&(K.attrFn[b]=!0),bb.test(b)&&(K.event.fixHooks[b]=K.event.keyHooks),cb.test(b)&&(K.event.fixHooks[b]=K.event.mouseHooks)}),function(){function a(a,b,c,d,f,g){for(var h=0,i=d.length;h<i;h++){var j=d[h];if(j){var k=!1;j=j[a];while(j){if(j[e]===c){k=d[j.sizset];break}if(j.nodeType===1){g||(j[e]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}d[h]=k}}}function c(a,b,c,d,f,g){for(var h=0,i=d.length;h<i;h++){var j=d[h];if(j){var k=!1;j=j[a];while(j){if(j[e]===c){k=d[j.sizset];break}j.nodeType===1&&!g&&(j[e]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}d[h]=k}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e="sizcache"+(Math.random()+"").replace(".",""),f=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){return i=!1,0});var m=function(a,b,c,e){c=c||[],b=b||H;var f=b;if(b.nodeType!==1&&b.nodeType!==9)return[];if(!a||typeof a!="string")return c;var h,i,j,k,l,n,q,r,t=!0,u=m.isXML(b),v=[],x=a;do{d.exec(""),h=d.exec(x);if(h){x=h[3],v.push(h[1]);if(h[2]){k=h[3];break}}}while(h);if(v.length>1&&p.exec(a))if(v.length===2&&o.relative[v[0]])i=w(v[0]+v[1],b,e);else{i=o.relative[v[0]]?[b]:m(v.shift(),b);while(v.length)a=v.shift(),o.relative[a]&&(a+=v.shift()),i=w(a,i,e)}else{!e&&v.length>1&&b.nodeType===9&&!u&&o.match.ID.test(v[0])&&!o.match.ID.test(v[v.length-1])&&(l=m.find(v.shift(),b,u),b=l.expr?m.filter(l.expr,l.set)[0]:l.set[0]);if(b){l=e?{expr:v.pop(),set:s(e)}:m.find(v.pop(),v.length!==1||v[0]!=="~"&&v[0]!=="+"||!b.parentNode?b:b.parentNode,u),i=l.expr?m.filter(l.expr,l.set):l.set,v.length>0?j=s(i):t=!1;while(v.length)n=v.pop(),q=n,o.relative[n]?q=v.pop():n="",q==null&&(q=b),o.relative[n](j,q,u)}else j=v=[]}j||(j=i),j||m.error(n||a);if(g.call(j)==="[object Array]")if(!t)c.push.apply(c,j);else if(b&&b.nodeType===1)for(r=0;j[r]!=null;r++)j[r]&&(j[r]===!0||j[r].nodeType===1&&m.contains(b,j[r]))&&c.push(i[r]);else for(r=0;j[r]!=null;r++)j[r]&&j[r].nodeType===1&&c.push(i[r]);else s(j,c);return k&&(m(k,f,c,e),m.uniqueSort(c)),c};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}return d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]),{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q){if(g!=null)break;m.error(a)}q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(b,d,e){var g,h=f++,i=a;typeof d=="string"&&!l.test(d)&&(d=d.toLowerCase(),g=d,i=c),i("parentNode",d,h,b,g,e)},"~":function(b,d,e){var g,h=f++,i=a;typeof d=="string"&&!l.test(d)&&(d=d.toLowerCase(),g=d,i=c),i("previousSibling",d,h,b,g,e)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);return a[0]=f++,a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");return!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" "),a},PSEUDO:function(a,b,c,e,f){if(a[1]==="not"){if(!((d.exec(a[3])||"").length>1||/^\w/.test(a[3]))){var g=m.filter(a[3],b,c,!0^f);return c||e.push.apply(e,g),!1}a[3]=m(a[3],null,null,b)}else if(o.match.POS.test(a[0])||o.match.CHILD.test(a[0]))return!0;return a},POS:function(a){return a.unshift(!0),a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,d,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],d=b[3];if(c===1&&d===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[e]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[e]=f}return j=a.nodeIndex-d,c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){return a=Array.prototype.slice.call(a,0),b?(b.push.apply(b,a),b):a};try{Array.prototype.slice.call(H.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;H.documentElement.compareDocumentPosition?u=function(a,b){return a===b?(h=!0,0):!a.compareDocumentPosition||!b.compareDocumentPosition?a.compareDocumentPosition?-1:1:a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b)return h=!0,0;if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=H.createElement("div"),c="script"+(new Date).getTime(),d=H.documentElement;a.innerHTML="<a name='"+c+"'/>",d.insertBefore(a,d.firstChild),H.getElementById(c)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),d.removeChild(a),d=a=null}(),function(){var a=H.createElement("div");a.appendChild(H.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),H.querySelectorAll&&function(){var a=m,b=H.createElement("div"),c="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,d,e,f){d=d||H;if(!f&&!m.isXML(d)){var g=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(g&&(d.nodeType===1||d.nodeType===9)){if(g[1])return s(d.getElementsByTagName(b),e);if(g[2]&&o.find.CLASS&&d.getElementsByClassName)return s(d.getElementsByClassName(g[2]),e)}if(d.nodeType===9){if(b==="body"&&d.body)return s([d.body],e);if(g&&g[3]){var h=d.getElementById(g[3]);if(!h||!h.parentNode)return s([],e);if(h.id===g[3])return s([h],e)}try{return s(d.querySelectorAll(b),e)}catch(i){}}else if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){var j=d,k=d.getAttribute("id"),l=k||c,n=d.parentNode,p=/^\s*[+~]/.test(b);k?l=l.replace(/'/g,"\\$&"):d.setAttribute("id",l),p&&n&&(d=d.parentNode);try{if(!p||n)return s(d.querySelectorAll("[id='"+l+"'] "+b),e)}catch(q){}finally{k||j.removeAttribute("id")}}}return a(b,d,e,f)};for(var d in a)m[d]=a[d];b=null}}(),function(){var a=H.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var c=!b.call(H.createElement("div"),"div"),d=!1;try{b.call(H.documentElement,"[test!='']:sizzle")}catch(e){d=!0}m.matchesSelector=function(a,e){e=e.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(d||!o.match.PSEUDO.test(e)&&!/!=/.test(e)){var f=b.call(a,e);if(f||!c||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(e,null,null,[a]).length>0}}}(),function(){var a=H.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),H.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:H.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var w=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=K.attr,m.selectors.attrMap={},K.find=m,K.expr=m.selectors,K.expr[":"]=K.expr.filters,K.unique=m.uniqueSort,K.text=m.getText,K.isXMLDoc=m.isXML,K.contains=m.contains}();var ib=/Until$/,jb=/^(?:parents|prevUntil|prevAll)/,kb=/,/,lb=/^.[^:#\[\.,]*$/,mb=Array.prototype.slice,nb=K.expr.match.POS,ob={children:!0,contents:!0,next:!0,prev:!0};K.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return K(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(K.contains(b[c],this))return!0});var e=this.pushStack("","find",a),f,g,h;for(c=0,d=this.length;c<d;c++){f=e.length,K.find(a,this[c],e);if(c>0)for(g=f;g<e.length;g++)for(h=0;h<f;h++)if(e[h]===e[g]){e.splice(g--,1);break}}return e},has:function(a){var b=K(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(K.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(z(this,a,!1),"not",a)},filter:function(a){return this.pushStack(z(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?nb.test(a)?K(a,this.context).index(this[0])>=0:K.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,f=this[0];if(K.isArray(a)){var g=1;while(f&&f.ownerDocument&&f!==b){for(d=0;d<a.length;d++)K(f).is(a[d])&&c.push({selector:a[d],elem:f,level:g});f=f.parentNode,g++}return c}var h=nb.test(a)||typeof a!="string"?K(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){f=this[d];while(f){if(h?h.index(f)>-1:K.find.matchesSelector(f,a)){c.push(f);break}f=f.parentNode;if(!f||!f.ownerDocument||f===b||f.nodeType===11)break}}return c=c.length>1?K.unique(c):c,this.pushStack(c,"closest",a)},index:function(a){return a?typeof a=="string"?K.inArray(this[0],K(a)):K.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?K(a,b):K.makeArray(a&&a.nodeType?[a]:a),d=K.merge(this.get(),c);return this.pushStack(A(c[0])||A(d[0])?d:K.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),K.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return K.dir(a,"parentNode")},parentsUntil:function(a,b,c){return K.dir(a,"parentNode",c)},next:function(a){return K.nth(a,2,"nextSibling")},prev:function(a){return K.nth(a,2,"previousSibling")},nextAll:function(a){return K.dir(a,"nextSibling")},prevAll:function(a){return K.dir(a,"previousSibling")},nextUntil:function(a,b,c){return K.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return K.dir(a,"previousSibling",c)},siblings:function(a){return K.sibling(a.parentNode.firstChild,a)},children:function(a){return K.sibling(a.firstChild)},contents:function(a){return K.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:K.makeArray(a.childNodes)}},function(a,b){K.fn[a]=function(c,d){var e=K.map(this,b,c);return ib.test(a)||(d=c),d&&typeof d=="string"&&(e=K.filter(d,e)),e=this.length>1&&!ob[a]?K.unique(e):e,(this.length>1||kb.test(d))&&jb.test(a)&&(e=e.reverse()),this.pushStack(e,a,mb.call(arguments).join(","))}}),K.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?K.find.matchesSelector(b[0],a)?[b[0]]:[]:K.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!K(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var pb="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",qb=/ jQuery\d+="(?:\d+|null)"/g,rb=/^\s+/,sb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,tb=/<([\w:]+)/,ub=/<tbody/i,vb=/<|&#?\w+;/,wb=/<(?:script|style)/i,xb=/<(?:script|object|embed|option|style)/i,yb=new RegExp("<(?:"+pb+")","i"),zb=/checked\s*(?:[^=]|=\s*.checked.)/i,Ab=/\/(java|ecma)script/i,Bb=/^\s*<!(?:\[CDATA\[|\-\-)/,Cb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},Db=y(H);Cb.optgroup=Cb.option,Cb.tbody=Cb.tfoot=Cb.colgroup=Cb.caption=Cb.thead,Cb.th=Cb.td,K.support.htmlSerialize||(Cb._default=[1,"div<div>","</div>"]),K.fn.extend({text:function(a){return K.isFunction(a)?this.each(function(b){var c=K(this);c.text(a.call(this,b,c.text()))}):typeof a!="object"&&a!==b?this.empty().append((this[0]&&this[0].ownerDocument||H).createTextNode(a)):K.text(this)},wrapAll:function(a){if(K.isFunction(a))return this.each(function(b){K(this).wrapAll(a.call(this,b))});if(this[0]){var b=K(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return K.isFunction(a)?this.each(function(b){K(this).wrapInner(a.call(this,b))}):this.each(function(){var b=K(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=K.isFunction(a);return this.each(function(c){K(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){K.nodeName(this,"body")||K(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=K.clean(arguments);return a.push.apply(a,this.toArray()),this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);return a.push.apply(a,K.clean(arguments)),a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||K.filter(a,[d]).length)!b&&d.nodeType===1&&(K.cleanData(d.getElementsByTagName("*")),K.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&K.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return K.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(qb,""):null;if(typeof a=="string"&&!wb.test(a)&&(K.support.leadingWhitespace||!rb.test(a))&&!Cb[(tb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(sb,"<$1></$2>"
|
3
3
|
);try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(K.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else K.isFunction(a)?this.each(function(b){var c=K(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){return this[0]&&this[0].parentNode?K.isFunction(a)?this.each(function(b){var c=K(this),d=c.html();c.replaceWith(a.call(this,b,d))}):(typeof a!="string"&&(a=K(a).detach()),this.each(function(){var b=this.nextSibling,c=this.parentNode;K(this).remove(),b?K(b).before(a):K(c).append(a)})):this.length?this.pushStack(K(K.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,f,g,h,i=a[0],j=[];if(!K.support.checkClone&&arguments.length===3&&typeof i=="string"&&zb.test(i))return this.each(function(){K(this).domManip(a,c,d,!0)});if(K.isFunction(i))return this.each(function(e){var f=K(this);a[0]=i.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){h=i&&i.parentNode,K.support.parentNode&&h&&h.nodeType===11&&h.childNodes.length===this.length?e={fragment:h}:e=K.buildFragment(a,this,j),g=e.fragment,g.childNodes.length===1?f=g=g.firstChild:f=g.firstChild;if(f){c=c&&K.nodeName(f,"tr");for(var k=0,l=this.length,m=l-1;k<l;k++)d.call(c?x(this[k],f):this[k],e.cacheable||l>1&&k<m?K.clone(g,!0,!0):g)}j.length&&K.each(j,q)}return this}}),K.buildFragment=function(a,b,c){var d,e,f,g,h=a[0];return b&&b[0]&&(g=b[0].ownerDocument||b[0]),g.createDocumentFragment||(g=H),a.length===1&&typeof h=="string"&&h.length<512&&g===H&&h.charAt(0)==="<"&&!xb.test(h)&&(K.support.checkClone||!zb.test(h))&&(K.support.html5Clone||!yb.test(h))&&(e=!0,f=K.fragments[h],f&&f!==1&&(d=f)),d||(d=g.createDocumentFragment(),K.clean(a,g,d,c)),e&&(K.fragments[h]=f?d:1),{fragment:d,cacheable:e}},K.fragments={},K.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){K.fn[a]=function(c){var d=[],e=K(c),f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&e.length===1)return e[b](this[0]),this;for(var g=0,h=e.length;g<h;g++){var i=(g>0?this.clone(!0):this).get();K(e[g])[b](i),d=d.concat(i)}return this.pushStack(d,a,e.selector)}}),K.extend({clone:function(a,b,c){var d,e,f,g=K.support.html5Clone||!yb.test("<"+a.nodeName)?a.cloneNode(!0):r(a);if((!K.support.noCloneEvent||!K.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!K.isXMLDoc(a)){v(a,g),d=u(a),e=u(g);for(f=0;d[f];++f)e[f]&&v(d[f],e[f])}if(b){w(a,g);if(c){d=u(a),e=u(g);for(f=0;d[f];++f)w(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var e;b=b||H,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||H);var f=[],g;for(var h=0,i;(i=a[h])!=null;h++){typeof i=="number"&&(i+="");if(!i)continue;if(typeof i=="string")if(!vb.test(i))i=b.createTextNode(i);else{i=i.replace(sb,"<$1></$2>");var j=(tb.exec(i)||["",""])[1].toLowerCase(),k=Cb[j]||Cb._default,l=k[0],m=b.createElement("div");b===H?Db.appendChild(m):y(b).appendChild(m),m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!K.support.tbody){var n=ub.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]==="<table>"&&!n?m.childNodes:[];for(g=o.length-1;g>=0;--g)K.nodeName(o[g],"tbody")&&!o[g].childNodes.length&&o[g].parentNode.removeChild(o[g])}!K.support.leadingWhitespace&&rb.test(i)&&m.insertBefore(b.createTextNode(rb.exec(i)[0]),m.firstChild),i=m.childNodes}var p;if(!K.support.appendChecked)if(i[0]&&typeof (p=i.length)=="number")for(g=0;g<p;g++)s(i[g]);else s(i);i.nodeType?f.push(i):f=K.merge(f,i)}if(c){e=function(a){return!a.type||Ab.test(a.type)};for(h=0;f[h];h++)if(d&&K.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))d.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{if(f[h].nodeType===1){var q=K.grep(f[h].getElementsByTagName("script"),e);f.splice.apply(f,[h+1,0].concat(q))}c.appendChild(f[h])}}return f},cleanData:function(a){var b,c,d=K.cache,e=K.event.special,f=K.support.deleteExpando;for(var g=0,h;(h=a[g])!=null;g++){if(h.nodeName&&K.noData[h.nodeName.toLowerCase()])continue;c=h[K.expando];if(c){b=d[c];if(b&&b.events){for(var i in b.events)e[i]?K.event.remove(h,i):K.removeEvent(h,i,b.handle);b.handle&&(b.handle.elem=null)}f?delete h[K.expando]:h.removeAttribute&&h.removeAttribute(K.expando),delete d[c]}}}});var Eb=/alpha\([^)]*\)/i,Fb=/opacity=([^)]*)/,Gb=/([A-Z]|^ms)/g,Hb=/^-?\d+(?:px)?$/i,Ib=/^-?\d/,Jb=/^([\-+])=([\-+.\de]+)/,Kb={position:"absolute",visibility:"hidden",display:"block"},Lb=["Left","Right"],Mb=["Top","Bottom"],Nb,Ob,Pb;K.fn.css=function(a,c){return arguments.length===2&&c===b?this:K.access(this,a,c,!0,function(a,c,d){return d!==b?K.style(a,c,d):K.css(a,c)})},K.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Nb(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":K.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var f,g,h=K.camelCase(c),i=a.style,j=K.cssHooks[h];c=K.cssProps[h]||h;if(d===b)return j&&"get"in j&&(f=j.get(a,!1,e))!==b?f:i[c];g=typeof d,g==="string"&&(f=Jb.exec(d))&&(d=+(f[1]+1)*+f[2]+parseFloat(K.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!K.cssNumber[h]&&(d+="px");if(!j||!("set"in j)||(d=j.set(a,d))!==b)try{i[c]=d}catch(k){}}},css:function(a,c,d){var e,f;c=K.camelCase(c),f=K.cssHooks[c],c=K.cssProps[c]||c,c==="cssFloat"&&(c="float");if(f&&"get"in f&&(e=f.get(a,!0,d))!==b)return e;if(Nb)return Nb(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),K.curCSS=K.css,K.each(["height","width"],function(a,b){K.cssHooks[b]={get:function(a,c,d){var e;if(c)return a.offsetWidth!==0?p(a,b,d):(K.swap(a,Kb,function(){e=p(a,b,d)}),e)},set:function(a,b){if(!Hb.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),K.support.opacity||(K.cssHooks.opacity={get:function(a,b){return Fb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=K.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&K.trim(f.replace(Eb,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=Eb.test(f)?f.replace(Eb,e):f+" "+e}}),K(function(){K.support.reliableMarginRight||(K.cssHooks.marginRight={get:function(a,b){var c;return K.swap(a,{display:"inline-block"},function(){b?c=Nb(a,"margin-right","marginRight"):c=a.style.marginRight}),c}})}),H.defaultView&&H.defaultView.getComputedStyle&&(Ob=function(a,b){var c,d,e;return b=b.replace(Gb,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!K.contains(a.ownerDocument.documentElement,a)&&(c=K.style(a,b))),c}),H.documentElement.currentStyle&&(Pb=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;return f===null&&g&&(e=g[b])&&(f=e),!Hb.test(f)&&Ib.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d)),f===""?"auto":f}),Nb=Ob||Pb,K.expr&&K.expr.filters&&(K.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!K.support.reliableHiddenOffsets&&(a.style&&a.style.display||K.css(a,"display"))==="none"},K.expr.filters.visible=function(a){return!K.expr.filters.hidden(a)});var Qb=/%20/g,Rb=/\[\]$/,Sb=/\r?\n/g,Tb=/#.*$/,Ub=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,Vb=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,Wb=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,Xb=/^(?:GET|HEAD)$/,Yb=/^\/\//,Zb=/\?/,$b=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,_b=/^(?:select|textarea)/i,ac=/\s+/,bc=/([?&])_=[^&]*/,cc=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,dc=K.fn.load,ec={},fc={},gc,hc,ic=["*/"]+["*"];try{gc=J.href}catch(jc){gc=H.createElement("a"),gc.href="",gc=gc.href}hc=cc.exec(gc.toLowerCase())||[],K.fn.extend({load:function(a,c,d){if(typeof a!="string"&&dc)return dc.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}var g="GET";c&&(K.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=K.param(c,K.ajaxSettings.traditional),g="POST"));var h=this;return K.ajax({url:a,type:g,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),h.html(f?K("<div>").append(c.replace($b,"")).find(f):c)),d&&h.each(d,[c,b,a])}}),this},serialize:function(){return K.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?K.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||_b.test(this.nodeName)||Vb.test(this.type))}).map(function(a,b){var c=K(this).val();return c==null?null:K.isArray(c)?K.map(c,function(a,c){return{name:b.name,value:a.replace(Sb,"\r\n")}}):{name:b.name,value:c.replace(Sb,"\r\n")}}).get()}}),K.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){K.fn[b]=function(a){return this.on(b,a)}}),K.each(["get","post"],function(a,c){K[c]=function(a,d,e,f){return K.isFunction(d)&&(f=f||e,e=d,d=b),K.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),K.extend({getScript:function(a,c){return K.get(a,b,c,"script")},getJSON:function(a,b,c){return K.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?m(a,K.ajaxSettings):(b=a,a=K.ajaxSettings),m(a,b),a},ajaxSettings:{url:gc,isLocal:Wb.test(hc[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":ic},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":K.parseJSON,"text xml":K.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:o(ec),ajaxTransport:o(fc),ajax:function(a,c){function d(a,c,d,n){if(v!==2){v=2,t&&clearTimeout(t),s=b,q=n||"",y.readyState=a>0?4:0;var o,p,r,u=c,x=d?k(e,y,d):b,z,A;if(a>=200&&a<300||a===304){if(e.ifModified){if(z=y.getResponseHeader("Last-Modified"))K.lastModified[m]=z;if(A=y.getResponseHeader("Etag"))K.etag[m]=A}if(a===304)u="notmodified",o=!0;else try{p=j(e,x),u="success",o=!0}catch(B){u="parsererror",r=B}}else{r=u;if(!u||a)u="error",a<0&&(a=0)}y.status=a,y.statusText=""+(c||u),o?h.resolveWith(f,[p,u,y]):h.rejectWith(f,[y,u,r]),y.statusCode(l),l=b,w&&g.trigger("ajax"+(o?"Success":"Error"),[y,e,o?p:r]),i.fireWith(f,[y,u]),w&&(g.trigger("ajaxComplete",[y,e]),--K.active||K.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var e=K.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof K)?K(f):K.event,h=K.Deferred(),i=K.Callbacks("once memory"),l=e.statusCode||{},m,o={},p={},q,r,s,t,u,v=0,w,x,y={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=p[c]=p[c]||a,o[a]=b}return this},getAllResponseHeaders:function(){return v===2?q:null},getResponseHeader:function(a){var c;if(v===2){if(!r){r={};while(c=Ub.exec(q))r[c[1].toLowerCase()]=c[2]}c=r[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(e.mimeType=a),this},abort:function(a){return a=a||"abort",s&&s.abort(a),d(0,a),this}};h.promise(y),y.success=y.done,y.error=y.fail,y.complete=i.add,y.statusCode=function(a){if(a){var b;if(v<2)for(b in a)l[b]=[l[b],a[b]];else b=a[y.status],y.then(b,b)}return this},e.url=((a||e.url)+"").replace(Tb,"").replace(Yb,hc[1]+"//"),e.dataTypes=K.trim(e.dataType||"*").toLowerCase().split(ac),e.crossDomain==null&&(u=cc.exec(e.url.toLowerCase()),e.crossDomain=!(!u||u[1]==hc[1]&&u[2]==hc[2]&&(u[3]||(u[1]==="http:"?80:443))==(hc[3]||(hc[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!="string"&&(e.data=K.param(e.data,e.traditional)),n(ec,e,c,y);if(v===2)return!1;w=e.global,e.type=e.type.toUpperCase(),e.hasContent=!Xb.test(e.type),w&&K.active++===0&&K.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(Zb.test(e.url)?"&":"?")+e.data,delete e.data),m=e.url;if(e.cache===!1){var z=K.now(),A=e.url.replace(bc,"$1_="+z);e.url=A+(A===e.url?(Zb.test(e.url)?"&":"?")+"_="+z:"")}}(e.data&&e.hasContent&&e.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",e.contentType),e.ifModified&&(m=m||e.url,K.lastModified[m]&&y.setRequestHeader("If-Modified-Since",K.lastModified[m]),K.etag[m]&&y.setRequestHeader("If-None-Match",K.etag[m])),y.setRequestHeader("Accept",e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", "+ic+"; q=0.01":""):e.accepts["*"]);for(x in e.headers)y.setRequestHeader(x,e.headers[x]);if(!e.beforeSend||e.beforeSend.call(f,y,e)!==!1&&v!==2){for(x in{success:1,error:1,complete:1})y[x](e[x]);s=n(fc,e,c,y);if(!s)d(-1,"No Transport");else{y.readyState=1,w&&g.trigger("ajaxSend",[y,e]),e.async&&e.timeout>0&&(t=setTimeout(function(){y.abort("timeout")},e.timeout));try{v=1,s.send(o,d)}catch(B){if(!(v<2))throw B;d(-1,B)}}return y}return y.abort(),!1},param:function(a,c){var d=[],e=function(a,b){b=K.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=K.ajaxSettings.traditional);if(K.isArray(a)||a.jquery&&!K.isPlainObject(a))K.each(a,function(){e(this.name,this.value)});else for(var f in a)l(f,a[f],c,e);return d.join("&").replace(Qb,"+")}}),K.extend({active:0,lastModified:{},etag:{}});var kc=K.now(),lc=/(\=)\?(&|$)|\?\?/i;K.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return K.expando+"_"+kc++}}),K.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(lc.test(b.url)||e&&lc.test(b.data))){var f,g=b.jsonpCallback=K.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h=a[g],i=b.url,j=b.data,k="$1"+g+"$2";return b.jsonp!==!1&&(i=i.replace(lc,k),b.url===i&&(e&&(j=j.replace(lc,k)),b.data===j&&(i+=(/\?/.test(i)?"&":"?")+b.jsonp+"="+g))),b.url=i,b.data=j,a[g]=function(a){f=[a]},d.always(function(){a[g]=h,f&&K.isFunction(h)&&a[g](f[0])}),b.converters["script json"]=function(){return f||K.error(g+" was not called"),f[0]},b.dataTypes[0]="json","script"}}),K.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return K.globalEval(a),a}}}),K.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),K.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=H.head||H.getElementsByTagName("head")[0]||H.documentElement;return{send:function(e,f){c=H.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||f(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var mc=a.ActiveXObject?function(){for(var a in oc)oc[a](0,1)}:!1,nc=0,oc;K.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&i()||h()}:i,function(a){K.extend(K.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(K.ajaxSettings.xhr()),K.support.ajax&&K.ajaxTransport(function(c){if(!c.crossDomain||K.support.cors){var d;return{send:function(e,f){var g=c.xhr(),h,i;c.username?g.open(c.type,c.url,c.async,c.username,c.password):g.open(c.type,c.url,c.async);if(c.xhrFields)for(i in c.xhrFields)g[i]=c.xhrFields[i];c.mimeType&&g.overrideMimeType&&g.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e)g.setRequestHeader(i,e[i])}catch(j){}g.send(c.hasContent&&c.data||null),d=function(a,e){var i,j,k,l,m;try{if(d&&(e||g.readyState===4)){d=b,h&&(g.onreadystatechange=K.noop,mc&&delete oc[h]);if(e)g.readyState!==4&&g.abort();else{i=g.status,k=g.getAllResponseHeaders(),l={},m=g.responseXML,m&&m.documentElement&&(l.xml=m),l.text=g.responseText;try{j=g.statusText}catch(n){j=""}!i&&c.isLocal&&!c.crossDomain?i=l.text?200:404:i===1223&&(i=204)}}}catch(o){e||f(-1,o)}l&&f(i,j,l,k)},!c.async||g.readyState===4?d():(h=++nc,mc&&(oc||(oc={},K(a).unload(mc)),oc[h]=d),g.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var pc={},qc,rc,sc=/^(?:toggle|show|hide)$/,tc=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,uc,vc=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],wc;K.fn.extend({show:function(a,b,c){var f,g;if(a||a===0)return this.animate(e("show",3),a,b,c);for(var h=0,i=this.length;h<i;h++)f=this[h],f.style&&(g=f.style.display,!K._data(f,"olddisplay")&&g==="none"&&(g=f.style.display=""),g===""&&K.css(f,"display")==="none"&&K._data(f,"olddisplay",d(f.nodeName)));for(h=0;h<i;h++){f=this[h];if(f.style){g=f.style.display;if(g===""||g==="none")f.style.display=K._data(f,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(e("hide",3),a,b,c);var d,f,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(f=K.css(d,"display"),f!=="none"&&!K._data(d,"olddisplay")&&K._data(d,"olddisplay",f));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:K.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";return K.isFunction(a)&&K.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:K(this).is(":hidden");K(this)[b?"show":"hide"]()}):this.animate(e("toggle",3),a,b,c),this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,e){function f(){g.queue===!1&&K._mark(this);var b=K.extend({},g),c=this.nodeType===1,e=c&&K(this).is(":hidden"),f,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){f=K.camelCase(i),i!==f&&(a[f]=a[i],delete a[i]),h=a[f],K.isArray(h)?(b.animatedProperties[f]=h[1],h=a[f]=h[0]):b.animatedProperties[f]=b.specialEasing&&b.specialEasing[f]||b.easing||"swing";if(h==="hide"&&e||h==="show"&&!e)return b.complete.call(this);c&&(f==="height"||f==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],K.css(this,"display")==="inline"&&K.css(this,"float")==="none"&&(!K.support.inlineBlockNeedsLayout||d(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new K.fx(this,b,i),h=a[i],sc.test(h)?(o=K._data(this,"toggle"+i)||(h==="toggle"?e?"show":"hide":0),o?(K._data(this,"toggle"+i,o==="show"?"hide":"show"),j[o]()):j[h]()):(k=tc.exec(h),l=j.cur(),k?(m=parseFloat(k[2]),n=k[3]||(K.cssNumber[i]?"":"px"),n!=="px"&&(K.style(this,i,(m||1)+n),l=(m||1)/j.cur()*l,K.style(this,i,l+n)),k[1]&&(m=(k[1]==="-="?-1:1)*m+l),j.custom(l,m,n)):j.custom(l,h,""));return!0}var g=K.speed(b,c,e);return K.isEmptyObject(a)?this.each(g.complete,[!1]):(a=K.extend({},a),g.queue===!1?this.each(f):this.queue(g.queue,f))},stop:function(a,c,d){return typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){function b(a,b,c){var e=b[c];K.removeData(a,c,!0),e.stop(d)}var c,e=!1,f=K.timers,g=K._data(this);d||K._unmark(!0,this);if(a==null)for(c in g)g[c]&&g[c].stop&&c.indexOf(".run")===c.length-4&&b(this,g,c);else g[c=a+".run"]&&g[c].stop&&b(this,g,c);for(c=f.length;c--;)f[c].elem===this&&(a==null||f[c].queue===a)&&(d?f[c](!0):f[c].saveState(),e=!0,f.splice(c,1));(!d||!e)&&K.dequeue(this,a)})}}),K.each({slideDown:e("show",1),slideUp:e("hide",1),slideToggle:e("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){K.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),K.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?K.extend({},a):{complete:c||!c&&b||K.isFunction(a)&&a,duration:a,easing:c&&b||b&&!K.isFunction(b)&&b};d.duration=K.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in K.fx.speeds?K.fx.speeds[d.duration]:K.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";return d.old=d.complete,d.complete=function(a){K.isFunction(d.old)&&d.old.call(this),d.queue?K.dequeue(this,d.queue):a!==!1&&K._unmark(this)},d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),K.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(K.fx.step[this.prop]||K.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]==null||!!this.elem.style&&this.elem.style[this.prop]!=null){var a,b=K.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a}return this.elem[this.prop]},custom:function(a,c,d){function e(a){return f.step(a)}var f=this,h=K.fx;this.startTime=wc||g(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(K.cssNumber[this.prop]?"":"px"),e.queue=this.options.queue,e.elem=this.elem,e.saveState=function(){f.options.hide&&K._data(f.elem,"fxshow"+f.prop)===b&&K._data(f.elem,"fxshow"+f.prop,f.start)},e()&&K.timers.push(e)&&!uc&&(uc=setInterval(h.tick,h.interval))},show:function(){var a=K._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||K.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),K(this.elem).show()},hide:function(){this.options.orig[this.prop]=K._data(this.elem,"fxshow"+this.prop)||K.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=wc||g(),f=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(f=!1);if(f){i.overflow!=null&&!K.support.shrinkWrapBlocks&&K.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&K(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)K.style(h,b,i.orig[b]),K.removeData(h,"fxshow"+b,!0),K.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}return i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=K.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update(),!0}},K.extend(K.fx,{tick:function(){var a,b=K.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||K.fx.stop()},interval:13,stop:function(){clearInterval(uc),uc=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){K.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),K.each(["width","height"],function(a,b){K.fx.step[b]=function(a){K.style(a.elem,b,Math.max(0,a.now)+a.unit)}}),K.expr&&K.expr.filters&&(K.expr.filters.animated=function(a){return K.grep(K.timers,function(b){return a===b.elem}).length});var xc=/^t(?:able|d|h)$/i,yc=/^(?:body|html)$/i;"getBoundingClientRect"in H.documentElement?K.fn.offset=function(a){var b=this[0],d;if(a)return this.each(function(b){K.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return K.offset.bodyOffset(b);try{d=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,g=f.documentElement;if(!d||!K.contains(g,b))return d?{top:d.top,left:d.left}:{top:0,left:0};var h=f.body,i=c(f),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||K.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||K.support.boxModel&&g.scrollLeft||h.scrollLeft,n=d.top+l-j,o=d.left+m-k;return{top:n,left:o}}:K.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){K.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return K.offset.bodyOffset(b);var c,d=b.offsetParent,e=b,f=b.ownerDocument,g=f.documentElement,h=f.body,i=f.defaultView,j=i?i.getComputedStyle(b,null):b.currentStyle,k=b.offsetTop,l=b.offsetLeft;while((b=b.parentNode)&&b!==h&&b!==g){if(K.support.fixedPosition&&j.position==="fixed")break;c=i?i.getComputedStyle(b,null):b.currentStyle,k-=b.scrollTop,l-=b.scrollLeft,b===d&&(k+=b.offsetTop,l+=b.offsetLeft,K.support.doesNotAddBorder&&(!K.support.doesAddBorderForTableAndCells||!xc.test(b.nodeName))&&(k+=parseFloat(c.borderTopWidth)||0,l+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),K.support.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(k+=parseFloat(c.borderTopWidth)||0,l+=parseFloat(c.borderLeftWidth)||0),j=c}if(j.position==="relative"||j.position==="static")k+=h.offsetTop,l+=h.offsetLeft;return K.support.fixedPosition&&j.position==="fixed"&&(k+=Math.max(g.scrollTop,h.scrollTop),l+=Math.max(g.scrollLeft,h.scrollLeft)),{top:k,left:l}},K.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;return K.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(K.css(a,"marginTop"))||0,c+=parseFloat(K.css(a,"marginLeft"))||0),{top:b,left:c}},setOffset:function(a,b,c){var d=K.css(a,"position");d==="static"&&(a.style.position="relative");var e=K(a),f=e.offset(),g=K.css(a,"top"),h=K.css(a,"left"),i=(d==="absolute"||d==="fixed")&&K.inArray("auto",[g,h])>-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),K.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},K.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=yc.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(K.css(a,"marginTop"))||0,c.left-=parseFloat(K.css(a,"marginLeft"))||0,d.top+=parseFloat(K.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(K.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||H.body;while(a&&!yc.test(a.nodeName)&&K.css(a,"position")==="static")a=a.offsetParent;return a})}}),K.each(["Left","Top"],function(a,d){var e="scroll"+d;K.fn[e]=function(d){var f,g;return d===b?(f=this[0],f?(g=c(f),g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:K.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]):null):this.each(function(){g=c(this),g?g.scrollTo(a?K(g).scrollLeft():d,a?d:K(g).scrollTop()):this[e]=d})}}),K.each(["Height","Width"],function(a,c){var d=c.toLowerCase();K.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(K.css(a,d,"padding")):this[d]():null},K.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(K.css(b,d,a?"margin":"border")):this[d]():null},K.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(K.isFunction(a))return this.each(function(b){var c=K(this);c[d](a.call(this,b,c[d]()))});if(K.isWindow(e)){var f=e.document.documentElement["client"+c],g=e.document.body;return e.document.compatMode==="CSS1Compat"&&f||g&&g["client"+c]||f}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=K.css(e,d),i=parseFloat(h);return K.isNumeric(i)?i:h}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=K,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return K})})(window),function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=Function.prototype,g=d.push,h=d.slice,i=d.concat,j=d.unshift,k=e.toString,l=e.hasOwnProperty,m=d.forEach,n=d.map,o=d.reduce,p=d.reduceRight,q=d.filter,r=d.every,s=d.some,t=d.indexOf,u=d.lastIndexOf,v=Array.isArray,w=Object.keys,x=f.bind,y=function(a){if(a instanceof y)return a;if(!(this instanceof y))return new y(a);this._wrapped=a};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=y),exports._=y):a._=y,y.VERSION="1.4.2";var z=y.each=y.forEach=function(a,b,d){if(a==null)return;if(m&&a.forEach===m)a.forEach(b,d);else if(a.length===+a.length){for(var e=0,f=a.length;e<f;e++)if(b.call(d,a[e],e,a)===c)return}else for(var g in a)if(y.has(a,g)&&b.call(d,a[g],g,a)===c)return};y.map=y.collect=function(a,b,c){var d=[];return a==null?d:n&&a.map===n?a.map(b,c):(z(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)}),d)},y.reduce=y.foldl=y.inject=function(a,b,c,d){var e=arguments.length>2;a==null&&(a=[]);if(o&&a.reduce===o)return d&&(b=y.bind(b,d)),e?a.reduce(b,c):a.reduce(b);z(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},y.reduceRight=y.foldr=function(a,b,c,d){var e=arguments.length>2;a==null&&(a=[]);if(p&&a.reduceRight===p)return d&&(b=y.bind(b,d)),arguments.length>2?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=y.keys(a);f=g.length}z(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},y.find=y.detect=function(a,b,c){var d;return A(a,function(a,e,f){if(b.call(c,a,e,f))return d=a,!0}),d},y.filter=y.select=function(a,b,c){var d=[];return a==null?d:q&&a.filter===q?a.filter(b,c):(z(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)}),d)},y.reject=function(a,b,c){var d=[];return a==null?d:(z(a,function(a,e,f){b.call(c,a,e,f)||(d[d.length]=a)}),d)},y.every=y.all=function(a,b,d){b||(b=y.identity);var e=!0;return a==null?e:r&&a.every===r?a.every(b,d):(z(a,function(a,f,g){if(!(e=e&&b.call(d,a,f,g)))return c}),!!e)};var A=y.some=y.any=function(a,b,d){b||(b=y.identity);var e=!1;return a==null?e:s&&a.some===s?a.some(b,d):(z(a,function(a,f,g){if(e||(e=b.call(d,a,f,g)))return c}),!!e)};y.contains=y.include=function(a,b){var c=!1;return a==null?c:t&&a.indexOf===t?a.indexOf(b)!=-1:(c=A(a,function(a){return a===b}),c)},y.invoke=function(a,b){var c=h.call(arguments,2);return y.map(a,function(a){return(y.isFunction(b)?b:a[b]).apply(a,c)})},y.pluck=function(a,b){return y.map(a,function(a){return a[b]})},y.where=function(a,b){return y.isEmpty(b)?[]:y.filter(a,function(a){for(var c in b)if(b[c]!==a[c])return!1;return!0})},y.max=function(a,b,c){if(!b&&y.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);if(!b&&y.isEmpty(a))return-Infinity;var d={computed:-Infinity};return z(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})}),d.value},y.min=function(a,b,c){if(!b&&y.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);if(!b&&y.isEmpty(a))return Infinity;var d={computed:Infinity};return z(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})}),d.value},y.shuffle=function(a){var b,c=0,d=[];return z(a,function(a){b=y.random(c++),d[c-1]=d[b],d[b]=a}),d};var B=function(a){return y.isFunction(a)?a:function(b){return b[a]}};y.sortBy=function(a,b,c){var d=B(b);return y.pluck(y.map(a,function(a,b,e){return{value:a,index:b,criteria:d.call(c,a,b,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||c===void 0)return 1;if(c<d||d===void 0)return-1}return a.index<b.index?-1:1}),"value")};var C=function(a,b,c,d){var e={},f=B(b);return z(a,function(b,g){var h=f.call(c,b,g,a);d(e,h,b)}),e};y.groupBy=function(a,b,c){return C(a,b,c,function(a,b,c){(y.has(a,b)?a[b]:a[b]=[]).push(c)})},y.countBy=function(a,b,c){return C(a,b,c,function(a,b,c){y.has(a,b)||(a[b]=0),a[b]++})},y.sortedIndex=function(a,b,c,d){c=c==null?y.identity:B(c);var e=c.call(d,b),f=0,g=a.length;while(f<g){var h=f+g>>>1;c.call(d,a[h])<e?f=h+1:g=h}return f},y.toArray=function(a){return a?a.length===+a.length?h.call(a):y.values(a):[]},y.size=function(a){return a.length===+a.length?a.length:y.keys(a).length},y.first=y.head=y.take=function(a,b,c){return b!=null&&!c?h.call(a,0,b):a[0]},y.initial=function(a,b,c){return h.call(a,0,a.length-(b==null||c?1:b))},y.last=function(a,b,c){return b!=null&&!c?h.call(a,Math.max(a.length-b,0)):a[a.length-1]},y.rest=y.tail=y.drop=function(a,b,c){return h.call(a,b==null||c?1:b)},y.compact=function(a){return y.filter(a,function(a){return!!a})};var D=function(a,b,c){return z(
|
4
4
|
a,function(a){y.isArray(a)?b?g.apply(c,a):D(a,b,c):c.push(a)}),c};y.flatten=function(a,b){return D(a,b,[])},y.without=function(a){return y.difference(a,h.call(arguments,1))},y.uniq=y.unique=function(a,b,c,d){var e=c?y.map(a,c,d):a,f=[],g=[];return z(e,function(c,d){if(b?!d||g[g.length-1]!==c:!y.contains(g,c))g.push(c),f.push(a[d])}),f},y.union=function(){return y.uniq(i.apply(d,arguments))},y.intersection=function(a){var b=h.call(arguments,1);return y.filter(y.uniq(a),function(a){return y.every(b,function(b){return y.indexOf(b,a)>=0})})},y.difference=function(a){var b=i.apply(d,h.call(arguments,1));return y.filter(a,function(a){return!y.contains(b,a)})},y.zip=function(){var a=h.call(arguments),b=y.max(y.pluck(a,"length")),c=new Array(b);for(var d=0;d<b;d++)c[d]=y.pluck(a,""+d);return c},y.object=function(a,b){var c={};for(var d=0,e=a.length;d<e;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},y.indexOf=function(a,b,c){if(a==null)return-1;var d=0,e=a.length;if(c){if(typeof c!="number")return d=y.sortedIndex(a,b),a[d]===b?d:-1;d=c<0?Math.max(0,e+c):c}if(t&&a.indexOf===t)return a.indexOf(b,c);for(;d<e;d++)if(a[d]===b)return d;return-1},y.lastIndexOf=function(a,b,c){if(a==null)return-1;var d=c!=null;if(u&&a.lastIndexOf===u)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);var e=d?c:a.length;while(e--)if(a[e]===b)return e;return-1},y.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);while(e<d)f[e++]=a,a+=c;return f};var E=function(){};y.bind=function(a,b){var c,d;if(a.bind===x&&x)return x.apply(a,h.call(arguments,1));if(!y.isFunction(a))throw new TypeError;return d=h.call(arguments,2),c=function(){if(this instanceof c){E.prototype=a.prototype;var e=new E,f=a.apply(e,d.concat(h.call(arguments)));return Object(f)===f?f:e}return a.apply(b,d.concat(h.call(arguments)))}},y.bindAll=function(a){var b=h.call(arguments,1);return b.length==0&&(b=y.functions(a)),z(b,function(b){a[b]=y.bind(a[b],a)}),a},y.memoize=function(a,b){var c={};return b||(b=y.identity),function(){var d=b.apply(this,arguments);return y.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},y.delay=function(a,b){var c=h.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},y.defer=function(a){return y.delay.apply(y,[a,1].concat(h.call(arguments,1)))},y.throttle=function(a,b){var c,d,e,f,g,h,i=y.debounce(function(){g=f=!1},b);return function(){c=this,d=arguments;var j=function(){e=null,g&&(h=a.apply(c,d)),i()};return e||(e=setTimeout(j,b)),f?g=!0:(f=!0,h=a.apply(c,d)),i(),h}},y.debounce=function(a,b,c){var d,e;return function(){var f=this,g=arguments,h=function(){d=null,c||(e=a.apply(f,g))},i=c&&!d;return clearTimeout(d),d=setTimeout(h,b),i&&(e=a.apply(f,g)),e}},y.once=function(a){var b=!1,c;return function(){return b?c:(b=!0,c=a.apply(this,arguments),a=null,c)}},y.wrap=function(a,b){return function(){var c=[a];return g.apply(c,arguments),b.apply(this,c)}},y.compose=function(){var a=arguments;return function(){var b=arguments;for(var c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},y.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}},y.keys=w||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[];for(var c in a)y.has(a,c)&&(b[b.length]=c);return b},y.values=function(a){var b=[];for(var c in a)y.has(a,c)&&b.push(a[c]);return b},y.pairs=function(a){var b=[];for(var c in a)y.has(a,c)&&b.push([c,a[c]]);return b},y.invert=function(a){var b={};for(var c in a)y.has(a,c)&&(b[a[c]]=c);return b},y.functions=y.methods=function(a){var b=[];for(var c in a)y.isFunction(a[c])&&b.push(c);return b.sort()},y.extend=function(a){return z(h.call(arguments,1),function(b){for(var c in b)a[c]=b[c]}),a},y.pick=function(a){var b={},c=i.apply(d,h.call(arguments,1));return z(c,function(c){c in a&&(b[c]=a[c])}),b},y.omit=function(a){var b={},c=i.apply(d,h.call(arguments,1));for(var e in a)y.contains(c,e)||(b[e]=a[e]);return b},y.defaults=function(a){return z(h.call(arguments,1),function(b){for(var c in b)a[c]==null&&(a[c]=b[c])}),a},y.clone=function(a){return y.isObject(a)?y.isArray(a)?a.slice():y.extend({},a):a},y.tap=function(a,b){return b(a),a};var F=function(a,b,c,d){if(a===b)return a!==0||1/a==1/b;if(a==null||b==null)return a===b;a instanceof y&&(a=a._wrapped),b instanceof y&&(b=b._wrapped);var e=k.call(a);if(e!=k.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:a==0?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if(typeof a!="object"||typeof b!="object")return!1;var f=c.length;while(f--)if(c[f]==a)return d[f]==b;c.push(a),d.push(b);var g=0,h=!0;if(e=="[object Array]"){g=a.length,h=g==b.length;if(h)while(g--)if(!(h=F(a[g],b[g],c,d)))break}else{var i=a.constructor,j=b.constructor;if(i!==j&&!(y.isFunction(i)&&i instanceof i&&y.isFunction(j)&&j instanceof j))return!1;for(var l in a)if(y.has(a,l)){g++;if(!(h=y.has(b,l)&&F(a[l],b[l],c,d)))break}if(h){for(l in b)if(y.has(b,l)&&!(g--))break;h=!g}}return c.pop(),d.pop(),h};y.isEqual=function(a,b){return F(a,b,[],[])},y.isEmpty=function(a){if(a==null)return!0;if(y.isArray(a)||y.isString(a))return a.length===0;for(var b in a)if(y.has(a,b))return!1;return!0},y.isElement=function(a){return!!a&&a.nodeType===1},y.isArray=v||function(a){return k.call(a)=="[object Array]"},y.isObject=function(a){return a===Object(a)},z(["Arguments","Function","String","Number","Date","RegExp"],function(a){y["is"+a]=function(b){return k.call(b)=="[object "+a+"]"}}),y.isArguments(arguments)||(y.isArguments=function(a){return!!a&&!!y.has(a,"callee")}),typeof /./!="function"&&(y.isFunction=function(a){return typeof a=="function"}),y.isFinite=function(a){return y.isNumber(a)&&isFinite(a)},y.isNaN=function(a){return y.isNumber(a)&&a!=+a},y.isBoolean=function(a){return a===!0||a===!1||k.call(a)=="[object Boolean]"},y.isNull=function(a){return a===null},y.isUndefined=function(a){return a===void 0},y.has=function(a,b){return l.call(a,b)},y.noConflict=function(){return a._=b,this},y.identity=function(a){return a},y.times=function(a,b,c){for(var d=0;d<a;d++)b.call(c,d)},y.random=function(a,b){return b==null&&(b=a,a=0),a+(0|Math.random()*(b-a+1))};var G={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};G.unescape=y.invert(G.escape);var H={escape:new RegExp("["+y.keys(G.escape).join("")+"]","g"),unescape:new RegExp("("+y.keys(G.unescape).join("|")+")","g")};y.each(["escape","unescape"],function(a){y[a]=function(b){return b==null?"":(""+b).replace(H[a],function(b){return G[a][b]})}}),y.result=function(a,b){if(a==null)return null;var c=a[b];return y.isFunction(c)?c.call(a):c},y.mixin=function(a){z(y.functions(a),function(b){var c=y[b]=a[b];y.prototype[b]=function(){var a=[this._wrapped];return g.apply(a,arguments),M.call(this,c.apply(y,a))}})};var I=0;y.uniqueId=function(a){var b=I++;return a?a+b:b},y.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var J=/(.)^/,K={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},L=/\\|'|\r|\n|\t|\u2028|\u2029/g;y.template=function(a,b,c){c=y.defaults({},c,y.templateSettings);var d=new RegExp([(c.escape||J).source,(c.interpolate||J).source,(c.evaluate||J).source].join("|")+"|$","g"),e=0,f="__p+='";a.replace(d,function(b,c,d,g,h){f+=a.slice(e,h).replace(L,function(a){return"\\"+K[a]}),f+=c?"'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'":d?"'+\n((__t=("+d+"))==null?'':__t)+\n'":g?"';\n"+g+"\n__p+='":"",e=h+b.length}),f+="';\n",c.variable||(f="with(obj||{}){\n"+f+"}\n"),f="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+f+"return __p;\n";try{var g=new Function(c.variable||"obj","_",f)}catch(h){throw h.source=f,h}if(b)return g(b,y);var i=function(a){return g.call(this,a,y)};return i.source="function("+(c.variable||"obj")+"){\n"+f+"}",i},y.chain=function(a){return y(a).chain()};var M=function(a){return this._chain?y(a).chain():a};y.mixin(y),z(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];y.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),(a=="shift"||a=="splice")&&c.length===0&&delete c[0],M.call(this,c)}}),z(["concat","join","slice"],function(a){var b=d[a];y.prototype[a]=function(){return M.call(this,b.apply(this._wrapped,arguments))}}),y.extend(y.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),function(a){var b=String.prototype.trim,c=function(a,b){for(var c=[];b>0;c[--b]=a);return c.join("")},d=function(a){return function(){for(var b=Array.prototype.slice.call(arguments),c=0;c<b.length;c++)b[c]=b[c]==null?"":""+b[c];return a.apply(null,b)}},e=function(){function a(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}var b=function(){return b.cache.hasOwnProperty(arguments[0])||(b.cache[arguments[0]]=b.parse(arguments[0])),b.format.call(null,b.cache[arguments[0]],arguments)};return b.format=function(b,d){var f=1,g=b.length,h="",i=[],j,k,n,o;for(j=0;j<g;j++)if(h=a(b[j]),h==="string")i.push(b[j]);else if(h==="array"){n=b[j];if(n[2]){h=d[f];for(k=0;k<n[2].length;k++){if(!h.hasOwnProperty(n[2][k]))throw e('[_.sprintf] property "%s" does not exist',n[2][k]);h=h[n[2][k]]}}else h=n[1]?d[n[1]]:d[f++];if(/[^s]/.test(n[8])&&a(h)!="number")throw e("[_.sprintf] expecting number but found %s",a(h));switch(n[8]){case"b":h=h.toString(2);break;case"c":h=String.fromCharCode(h);break;case"d":h=parseInt(h,10);break;case"e":h=n[7]?h.toExponential(n[7]):h.toExponential();break;case"f":h=n[7]?parseFloat(h).toFixed(n[7]):parseFloat(h);break;case"o":h=h.toString(8);break;case"s":h=(h=String(h))&&n[7]?h.substring(0,n[7]):h;break;case"u":h=Math.abs(h);break;case"x":h=h.toString(16);break;case"X":h=h.toString(16).toUpperCase()}h=/[def]/.test(n[8])&&n[3]&&h>=0?"+"+h:h,k=n[4]?n[4]=="0"?"0":n[4].charAt(1):" ",o=n[6]-String(h).length,k=n[6]?c(k,o):"",i.push(n[5]?h+k:k+h)}return i.join("")},b.cache={},b.parse=function(a){for(var b=[],c=[],d=0;a;){if((b=/^[^\x25]+/.exec(a))!==null)c.push(b[0]);else if((b=/^\x25{2}/.exec(a))!==null)c.push("%");else{if((b=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(a))===null)throw"[_.sprintf] huh?";if(b[2]){d|=1;var e=[],f=b[2],g=[];if((g=/^([a-z_][a-z_\d]*)/i.exec(f))===null)throw"[_.sprintf] huh?";for(e.push(g[1]);(f=f.substring(g[0].length))!=="";)if((g=/^\.([a-z_][a-z_\d]*)/i.exec(f))!==null)e.push(g[1]);else{if((g=/^\[(\d+)\]/.exec(f))===null)throw"[_.sprintf] huh?";e.push(g[1])}b[2]=e}else d|=2;if(d===3)throw"[_.sprintf] mixing positional and named placeholders is not (yet) supported";c.push(b)}a=a.substring(b[0].length)}return c},b}(),f={VERSION:"1.2.0",isBlank:d(function(a){return/^\s*$/.test(a)}),stripTags:d(function(a){return a.replace(/<\/?[^>]+>/ig,"")}),capitalize:d(function(a){return a.charAt(0).toUpperCase()+a.substring(1).toLowerCase()}),chop:d(function(a,b){for(var b=b*1||0||a.length,c=[],d=0;d<a.length;)c.push(a.slice(d,d+b)),d+=b;return c}),clean:d(function(a){return f.strip(a.replace(/\s+/g," "))}),count:d(function(a,b){for(var c=0,d,e=0;e<a.length;)d=a.indexOf(b,e),d>=0&&c++,e=e+(d>=0?d:0)+b.length;return c}),chars:d(function(a){return a.split("")}),escapeHTML:d(function(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}),unescapeHTML:d(function(a){return a.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}),escapeRegExp:d(function(a){return a.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1")}),insert:d(function(a,b,c){return a=a.split(""),a.splice(b*1||0,0,c),a.join("")}),include:d(function(a,b){return a.indexOf(b)!==-1}),join:d(function(a){var b=Array.prototype.slice.call(arguments);return b.join(b.shift())}),lines:d(function(a){return a.split("\n")}),reverse:d(function(a){return Array.prototype.reverse.apply(String(a).split("")).join("")}),splice:d(function(a,b,c,d){return a=a.split(""),a.splice(b*1||0,c*1||0,d),a.join("")}),startsWith:d(function(a,b){return a.length>=b.length&&a.substring(0,b.length)===b}),endsWith:d(function(a,b){return a.length>=b.length&&a.substring(a.length-b.length)===b}),succ:d(function(a){var b=a.split("");return b.splice(a.length-1,1,String.fromCharCode(a.charCodeAt(a.length-1)+1)),b.join("")}),titleize:d(function(a){for(var a=a.split(" "),b,c=0;c<a.length;c++)b=a[c].split(""),typeof b[0]!="undefined"&&(b[0]=b[0].toUpperCase()),c+1===a.length?a[c]=b.join(""):a[c]=b.join("")+" ";return a.join("")}),camelize:d(function(a){return f.trim(a).replace(/(\-|_|\s)+(.)?/g,function(a,b,c){return c?c.toUpperCase():""})}),underscored:function(a){return f.trim(a).replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/\-|\s+/g,"_").toLowerCase()},dasherize:function(a){return f.trim(a).replace(/([a-z\d])([A-Z]+)/g,"$1-$2").replace(/^([A-Z]+)/,"-$1").replace(/\_|\s+/g,"-").toLowerCase()},humanize:function(a){return f.capitalize(this.underscored(a).replace(/_id$/,"").replace(/_/g," "))},trim:d(function(a,c){return!c&&b?b.call(a):(c=c?f.escapeRegExp(c):"\\s",a.replace(RegExp("^["+c+"]+|["+c+"]+$","g"),""))}),ltrim:d(function(a,b){return b=b?f.escapeRegExp(b):"\\s",a.replace(RegExp("^["+b+"]+","g"),"")}),rtrim:d(function(a,b){return b=b?f.escapeRegExp(b):"\\s",a.replace(RegExp("["+b+"]+$","g"),"")}),truncate:d(function(a,b,c){return b=b*1||0,a.length>b?a.slice(0,b)+(c||"..."):a}),prune:d(function(a,b,c){var c=c||"...",b=b*1||0,d="",d=a.substring(b-1,b+1).search(/^\w\w$/)===0?f.rtrim(a.slice(0,b).replace(/([\W][\w]*)$/,"")):f.rtrim(a.slice(0,b)),d=d.replace(/\W+$/,"");return d.length+c.length>a.length?a:d+c}),words:function(a,b){return String(a).split(b||" ")},pad:d(function(a,b,d,e){var f="",f=0,b=b*1||0;d?d.length>1&&(d=d.charAt(0)):d=" ";switch(e){case"right":f=b-a.length,f=c(d,f),a+=f;break;case"both":f=b-a.length,f={left:c(d,Math.ceil(f/2)),right:c(d,Math.floor(f/2))},a=f.left+a+f.right;break;default:f=b-a.length,f=c(d,f),a=f+a}return a}),lpad:function(a,b,c){return f.pad(a,b,c)},rpad:function(a,b,c){return f.pad(a,b,c,"right")},lrpad:function(a,b,c){return f.pad(a,b,c,"both")},sprintf:e,vsprintf:function(a,b){return b.unshift(a),e.apply(null,b)},toNumber:function(a,b){var c;return c=(a*1||0).toFixed(b*1||0)*1||0,c!==0||a==="0"||a===0?c:Number.NaN},strRight:d(function(a,b){var c=b?a.indexOf(b):-1;return c!=-1?a.slice(c+b.length,a.length):a}),strRightBack:d(function(a,b){var c=b?a.lastIndexOf(b):-1;return c!=-1?a.slice(c+b.length,a.length):a}),strLeft:d(function(a,b){var c=b?a.indexOf(b):-1;return c!=-1?a.slice(0,c):a}),strLeftBack:d(function(a,b){var c=a.lastIndexOf(b);return c!=-1?a.slice(0,c):a}),exports:function(){var a={},b;for(b in this)this.hasOwnProperty(b)&&b!="include"&&b!="contains"&&b!="reverse"&&(a[b]=this[b]);return a}};f.strip=f.trim,f.lstrip=f.ltrim,f.rstrip=f.rtrim,f.center=f.lrpad,f.ljust=f.lpad,f.rjust=f.rpad,f.contains=f.include,typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(module.exports=f),exports._s=f):typeof a._!="undefined"?(a._.string=f,a._.str=a._.string):a._={string:f,str:f}}(this||window),function(){var a=this,b=a.Backbone,c=Array.prototype.slice,d=Array.prototype.splice,e;e="undefined"!=typeof exports?exports:a.Backbone={},e.VERSION="0.9.1";var f=a._;!f&&"undefined"!=typeof require&&(f=require("underscore"));var g=a.jQuery||a.Zepto||a.ender;e.setDomLibrary=function(a){g=a},e.noConflict=function(){return a.Backbone=b,this},e.emulateHTTP=!1,e.emulateJSON=!1,e.Events={on:function(a,b,c){for(var d,a=a.split(/\s+/),e=this._callbacks||(this._callbacks={});d=a.shift();){d=e[d]||(e[d]={});var f=d.tail||(d.tail=d.next={});f.callback=b,f.context=c,d.tail=f.next={}}return this},off:function(a,b,c){var d,e,f;if(a){if(e=this._callbacks)for(a=a.split(/\s+/);d=a.shift();)if(f=e[d],delete e[d],b&&f)for(;(f=f.next)&&f.next;)(f.callback!==b||!!c&&f.context!==c)&&this.on(d,f.callback,f.context)}else delete this._callbacks;return this},trigger:function(a){var b,d,e,f;if(!(e=this._callbacks))return this;f=e.all;for((a=a.split(/\s+/)).push(null);b=a.shift();)f&&a.push({next:f.next,tail:f.tail,event:b}),(d=e[b])&&a.push({next:d.next,tail:d.tail});for(f=c.call(arguments,1);d=a.pop();){b=d.tail;for(e=d.event?[d.event].concat(f):f;(d=d.next)!==b;)d.callback.apply(d.context||this,e)}return this}},e.Events.bind=e.Events.on,e.Events.unbind=e.Events.off,e.Model=function(a,b){var c;a||(a={}),b&&b.parse&&(a=this.parse(a));if(c=s(this,"defaults"))a=f.extend({},c,a);b&&b.collection&&(this.collection=b.collection),this.attributes={},this._escapedAttributes={},this.cid=f.uniqueId("c");if(!this.set(a,{silent:!0}))throw Error("Can't create an invalid model");delete this._changed,this._previousAttributes=f.clone(this.attributes),this.initialize.apply(this,arguments)},f.extend(e.Model.prototype,e.Events,{idAttribute:"id",initialize:function(){},toJSON:function(){return f.clone(this.attributes)},get:function(a){return this.attributes[a]},escape:function(a){var b;return(b=this._escapedAttributes[a])?b:(b=this.attributes[a],this._escapedAttributes[a]=f.escape(null==b?"":""+b))},has:function(a){return null!=this.attributes[a]},set:function(a,b,c){var d,g;f.isObject(a)||null==a?(d=a,c=b):(d={},d[a]=b),c||(c={});if(!d)return this;d instanceof e.Model&&(d=d.attributes);if(c.unset)for(g in d)d[g]=void 0;if(!this._validate(d,c))return!1;this.idAttribute in d&&(this.id=d[this.idAttribute]);var b=this.attributes,h=this._escapedAttributes,i=this._previousAttributes||{},j=this._setting;this._changed||(this._changed={}),this._setting=!0;for(g in d)if(a=d[g],f.isEqual(b[g],a)||delete h[g],c.unset?delete b[g]:b[g]=a,this._changing&&!f.isEqual(this._changed[g],a)&&(this.trigger("change:"+g,this,a,c),this._moreChanges=!0),delete this._changed[g],!f.isEqual(i[g],a)||f.has(b,g)!=f.has(i,g))this._changed[g]=a;return j||(!c.silent&&this.hasChanged()&&this.change(c),this._setting=!1),this},unset:function(a,b){return(b||(b={})).unset=!0,this.set(a,null,b)},clear:function(a){return(a||(a={})).unset=!0,this.set(f.clone(this.attributes),a)},fetch:function(a){var a=a?f.clone(a):{},b=this,c=a.success;return a.success=function(d,e,f){if(!b.set(b.parse(d,f),a))return!1;c&&c(b,d)},a.error=e.wrapError(a.error,b,a),(this.sync||e.sync).call(this,"read",this,a)},save:function(a,b,c){var d,g;f.isObject(a)||null==a?(d=a,c=b):(d={},d[a]=b),c=c?f.clone(c):{},c.wait&&(g=f.clone(this.attributes)),a=f.extend({},c,{silent:!0});if(d&&!this.set(d,c.wait?a:c))return!1;var h=this,i=c.success;return c.success=function(a,b,e){b=h.parse(a,e),c.wait&&(b=f.extend(d||{},b));if(!h.set(b,c))return!1;i?i(h,a):h.trigger("sync",h,a,c)},c.error=e.wrapError(c.error,h,c),b=this.isNew()?"create":"update",b=(this.sync||e.sync).call(this,b,this,c),c.wait&&this.set(g,a),b},destroy:function(a){var a=a?f.clone(a):{},b=this,c=a.success,d=function(){b.trigger("destroy",b,b.collection,a)};if(this.isNew())return d();a.success=function(e){a.wait&&d(),c?c(b,e):b.trigger("sync",b,e,a)},a.error=e.wrapError(a.error,b,a);var g=(this.sync||e.sync).call(this,"delete",this,a);return a.wait||d(),g},url:function(){var a=s(this.collection,"url")||s(this,"urlRoot")||t();return this.isNew()?a:a+("/"==a.charAt(a.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(a){return a},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},change:function(a){if(this._changing||!this.hasChanged())return this;this._moreChanges=this._changing=!0;for(var b in this._changed)this.trigger("change:"+b,this,this._changed[b],a);for(;this._moreChanges;)this._moreChanges=!1,this.trigger("change",this,a);return this._previousAttributes=f.clone(this.attributes),delete this._changed,this._changing=!1,this},hasChanged:function(a){return arguments.length?this._changed&&f.has(this._changed,a):!f.isEmpty(this._changed)},changedAttributes:function(a){if(!a)return this.hasChanged()?f.clone(this._changed):!1;var b,c=!1,d=this._previousAttributes,e;for(e in a)f.isEqual(d[e],b=a[e])||((c||(c={}))[e]=b);return c},previous:function(a){return!arguments.length||!this._previousAttributes?null:this._previousAttributes[a]},previousAttributes:function(){return f.clone(this._previousAttributes)},isValid:function(){return!this.validate(this.attributes)},_validate:function(a,b){if(b.silent||!this.validate)return!0;var a=f.extend({},this.attributes,a),c=this.validate(a,b);return c?(b&&b.error?b.error(this,c,b):this.trigger("error",this,c,b),!1):!0}}),e.Collection=function(a,b){b||(b={}),b.comparator&&(this.comparator=b.comparator),this._reset(),this.initialize.apply(this,arguments),a&&this.reset(a,{silent:!0,parse:b.parse})},f.extend(e.Collection.prototype,e.Events,{model:e.Model,initialize:function(){},toJSON:function(){return this.map(function(a){return a.toJSON()})},add:function(a,b){var c,e,g,h,i,j={},k={};b||(b={}),a=f.isArray(a)?a.slice():[a];for(c=0,e=a.length;c<e;c++){if(!(g=a[c]=this._prepareModel(a[c],b)))throw Error("Can't add an invalid model to a collection");if(j[h=g.cid]||this._byCid[h]||null!=(i=g.id)&&(k[i]||this._byId[i]))throw Error("Can't add the same model to a collection twice");j[h]=k[i]=g}for(c=0;c<e;c++)(g=a[c]).on("all",this._onModelEvent,this),this._byCid[g.cid]=g,null!=g.id&&(this._byId[g.id]=g);this.length+=e,d.apply(this.models,[null!=b.at?b.at:this.models.length,0].concat(a)),this.comparator&&this.sort({silent:!0});if(b.silent)return this;for(c=0,e=this.models.length;c<e;c++)j[(g=this.models[c]).cid]&&(b.index=c,g.trigger("add",g,this,b));return this},remove:function(a,b){var c,d,e,g;b||(b={}),a=f.isArray(a)?a.slice():[a];for(c=0,d=a.length;c<d;c++)if(g=this.getByCid(a[c])||this.get(a[c]))delete this._byId[g.id],delete this._byCid[g.cid],e=this.indexOf(g),this.models.splice(e,1),this.length--,b.silent||(b.index=e,g.trigger("remove",g,this,b)),this._removeReference(g);return this},get:function(a){return null==a?null:this._byId[null!=a.id?a.id:a]},getByCid:function(a){return a&&this._byCid[a.cid||a]},at:function(a){return this.models[a]},sort:function(a){a||(a={});if(!this.comparator)throw Error("Cannot sort a set without a comparator");var b=f.bind(this.comparator,this);return 1==this.comparator.length?this.models=this.sortBy(b):this.models.sort(b),a.silent||this.trigger("reset",this,a),this},pluck:function(a){return f.map(this.models,function(b){return b.get(a)})},reset:function(a,b){a||(a=[]),b||(b={});for(var c=0,d=this.models.length;c<d;c++)this._removeReference(this.models[c]);return this._reset(),this.add(a,{silent:!0,parse:b.parse}),b.silent||this.trigger("reset",this,b),this},fetch:function(a){a=a?f.clone(a):{},void 0===a.parse&&(a.parse=!0);var b=this,c=a.success;return a.success=function(d,e,f){b[a.add?"add":"reset"](b.parse(d,f),a),c&&c(b,d)},a.error=e.wrapError(a.error,b,a),(this.sync||e.sync).call(this,"read",this,a)},create:function(a,b){var c=this,b=b?f.clone(b):{},a=this._prepareModel(a,b);if(!a)return!1;b.wait||c.add(a,b);var d=b.success;return b.success=function(e,f){b.wait&&c.add(e,b),d?d(e,f):e.trigger("sync",a,f,b)},a.save(null,b),a},parse:function(a){return a},chain:function(){return f(this.models).chain()},_reset:function(){this.length=0,this.models=[],this._byId={},this._byCid={}},_prepareModel:function(a,b){return a instanceof e.Model?a.collection||(a.collection=this):(b.collection=this,a=new this.model(a,b),a._validate(a.attributes,b)||(a=!1)),a},_removeReference:function(a){this==a.collection&&delete a.collection,a.off("all",this._onModelEvent,this)},_onModelEvent:function(a,b,c,d){("add"==a||"remove"==a)&&c!=this||("destroy"==a&&this.remove(b,d),b&&a==="change:"+b.idAttribute&&(delete this._byId[b.previous(b.idAttribute)],this._byId[b.id]=b),this.trigger.apply(this,arguments))}}),f.each("forEach,each,map,reduce,reduceRight,find,detect,filter,select,reject,every,all,some,any,include,contains,invoke,max,min,sortBy,sortedIndex,toArray,size,first,initial,rest,last,without,indexOf,shuffle,lastIndexOf,isEmpty,groupBy".split(","),function(a){e.Collection.prototype[a]=function(){return f[a].apply(f,[this.models].concat(f.toArray(arguments)))}}),e.Router=function(a){a||(a={}),a.routes&&(this.routes=a.routes),this._bindRoutes(),this.initialize.apply(this,arguments)};var h=/:\w+/g,i=/\*\w+/g,j=/[-[\]{}()+?.,\\^$|#\s]/g;f.extend(e.Router.prototype,e.Events,{initialize:function(){},route:function(a,b,c){return e.history||(e.history=new e.History),f.isRegExp(a)||(a=this._routeToRegExp(a)),c||(c=this[b]),e.history.route(a,f.bind(function(d){d=this._extractParameters(a,d),c&&c.apply(this,d),this.trigger.apply(this,["route:"+b].concat(d)),e.history.trigger("route",this,b,d)},this)),this},navigate:function(a,b){e.history.navigate(a,b)},_bindRoutes:function(){if(this.routes){var a=[],b;for(b in this.routes)a.unshift([b,this.routes[b]]);b=0;for(var c=a.length;b<c;b++)this.route(a[b][0],a[b][1],this[a[b][1]])}},_routeToRegExp:function(a){return a=a.replace(j,"\\$&").replace(h,"([^/]+)").replace(i,"(.*?)"),RegExp("^"+a+"$")},_extractParameters:function(a,b){return a.exec(b).slice(1)}}),e.History=function(){this.handlers=[],f.bindAll(this,"checkUrl")};var k=/^[#\/]/,l=/msie [\w.]+/,m=!1;f.extend(e.History.prototype,e.Events,{interval:50,getFragment:function(a,b){if(null==a)if(this._hasPushState||b){var a=window.location.pathname,c=window.location.search;c&&(a+=c)}else a=window.location.hash;return a=decodeURIComponent(a),a.indexOf(this.options.root)||(a=a.substr(this.options.root.length)),a.replace(k,"")},start:function(a){if(m)throw Error("Backbone.history has already been started");this.options=f.extend({},{root:"/"},this.options,a),this._wantsHashChange=!1!==this.options.hashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.options.pushState||!window.history||!window.history.pushState);var a=this.getFragment(),b=document.documentMode;if(b=l.exec(navigator.userAgent.toLowerCase())&&(!b||7>=b))this.iframe=g('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(a);this._hasPushState?g(window).bind("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!b?g(window).bind("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=a,m=!0,a=window.location,b=a.pathname==this.options.root;if(this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!b)return this.fragment=this.getFragment(null,!0),window.location.replace(this.options.root+"#"+this.fragment),!0;this._wantsPushState&&this._hasPushState&&b&&a.hash&&(this.fragment=a.hash.replace(k,""),window.history.replaceState({},document.title,a.protocol+"//"+a.host+this.options.root+this.fragment));if(!this.options.silent)return this.loadUrl()},stop:function(){g(window).unbind("popstate",this.checkUrl).unbind("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),m=!1},route:function(a,b){this.handlers.unshift({route:a,callback:b})},checkUrl:function(){var a=this.getFragment();a==this.fragment&&this.iframe&&(a=this.getFragment(this.iframe.location.hash));if(a==this.fragment||a==decodeURIComponent(this.fragment))return!1;this.iframe&&this.navigate(a),this.loadUrl()||this.loadUrl(window.location.hash)},loadUrl:function(a){var b=this.fragment=this.getFragment(a);return f.any(this.handlers,function(a){if(a.route.test(b))return a.callback(b),!0})},navigate:function(a,b){if(!m)return!1;if(!b||!0===b)b={trigger:b};var c=(a||"").replace(k,"");this.fragment==c||this.fragment==decodeURIComponent(c)||(this._hasPushState?(0!=c.indexOf(this.options.root)&&(c=this.options.root+c),this.fragment=c,window.history[b.replace?"replaceState":"pushState"]({},document.title,c)):this._wantsHashChange?(this.fragment=c,this._updateHash(window.location,c,b.replace),this.iframe&&c!=this.getFragment(this.iframe.location.hash)&&(b.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,c,b.replace))):window.location.assign(this.options.root+a),b.trigger&&this.loadUrl(a))},_updateHash:function(a,b,c){c?a.replace(a.toString().replace(/(javascript:|#).*$/,"")+"#"+b):a.hash=b}}),e.View=function(a){this.cid=f.uniqueId("view"),this._configure(a||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()};var n=/^(\S+)\s*(.*)$/,o="model,collection,el,id,attributes,className,tagName".split(",");f.extend(e.View.prototype,e.Events,{tagName:"div",$:function(a){return this.$el.find(a)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this},make:function(a,b,c){return a=document.createElement(a),b&&g(a).attr(b),c&&g(a).html(c),a},setElement:function(a,b){return this.$el=g(a),this.el=this.$el[0],!1!==b&&this.delegateEvents(),this},delegateEvents:function(a){if(a||(a=s(this,"events"))){this.undelegateEvents();for(var b in a){var c=a[b];f.isFunction(c)||(c=this[a[b]]);if(!c)throw Error('Event "'+a[b]+'" does not exist');var d=b.match(n),e=d[1],d=d[2],c=f.bind(c,this),e=e+(".delegateEvents"+this.cid);""===d?this.$el.bind(e,c):this.$el.delegate(d,e,c)}}},undelegateEvents:function(){this.$el.unbind(".delegateEvents"+this.cid)},_configure:function(a){this.options&&(a=f.extend({},this.options,a));for(var b=0,c=o.length;b<c;b++){var d=o[b];a[d]&&(this[d]=a[d])}this.options=a},_ensureElement:function(){if(this.el)this.setElement(this.el,!1);else{var a=s(this,"attributes")||{};this.id&&(a.id=this.id),this.className&&(a["class"]=this.className),this.setElement(this.make(this.tagName,a),!1)}}}),e.Model.extend=e.Collection.extend=e.Router.extend=e.View.extend=function(a,b){var c=r(this,a,b);return c.extend=this.extend,c};var p={create:"POST",update:"PUT","delete":"DELETE",read:"GET"};e.sync=function(a,b,c){var d=p[a],h={type:d,dataType:"json"};return c.url||(h.url=s(b,"url")||t()),!c.data&&b&&("create"==a||"update"==a)&&(h.contentType="application/json",h.data=JSON.stringify(b.toJSON())),e.emulateJSON&&(h.contentType="application/x-www-form-urlencoded",h.data=h.data?{model:h.data}:{}),e.emulateHTTP&&("PUT"===d||"DELETE"===d)&&(e.emulateJSON&&(h.data._method=d),h.type="POST",h.beforeSend=function(a){a.setRequestHeader("X-HTTP-Method-Override",d)}),"GET"!==h.type&&!e.emulateJSON&&(h.processData=!1),g.ajax(f.extend(h,c))},e.wrapError=function(a,b,c){return function(d,e){e=d===b?e:d,a?a(b,e,c):b.trigger("error",b,e,c)}};var q=function(){},r=function(a,b,c){var d;return d=b&&b.hasOwnProperty("constructor")?b.constructor:function(){a.apply(this,arguments)},f.extend(d,a),q.prototype=a.prototype,d.prototype=new q,b&&f.extend(d.prototype,b),c&&f.extend(d,c),d.prototype.constructor=d,d.__super__=a.prototype,d},s=function(a,b){return!a||!a[b]?null:f.isFunction(a[b])?a[b]():a[b]},t=function(){throw Error('A "url" property or function must be specified')}}.call(this),function(){var a,b,c,d,e,f,g,h,i,j,k,l=Array.prototype.indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(this[b]===a)return b;return-1};f=function(a){var b,c,d,e,f,g;g=[];for(b in a){d=a[b],c={key:b};if(_.isRegExp(d))c.type="$regex",c.value=d;else if(_(d).isObject())for(e in d)f=d[e],k(e,f)&&(c.type=e,c.value=f);else c.type="$equal",c.value=d;g.push(c)}return g},k=function(a,b){switch(a){case"$in":case"$nin":case"$all":case"$any":return _(b).isArray();case"$size":return _(b).isNumber();case"$regex":return _(b).isRegExp();case"$like":case"$likeI":return _(b).isString();case"$between":return _(b).isArray()&&b.length===2;case"$cb":return _(b).isFunction();default:return!0}},j=function(a,b){switch(a){case"$like":case"$likeI":case"$regex":return _(b).isString();case"$contains":case"$all":case"$any":return _(b).isArray();case"$size":return _(b).isArray()||_(b).isString();case"$in":case"$nin":return b!=null;default:return!0}},g=function(a,b,c,d){switch(a){case"$equal":return c===b;case"$contains":return l.call(c,b)>=0;case"$ne":return c!==b;case"$lt":return c<b;case"$gt":return c>b;case"$lte":return c<=b;case"$gte":return c>=b;case"$between":return b[0]<c&&c<b[1];case"$in":return l.call(b,c)>=0;case"$nin":return l.call(b,c)<0;case"$all":return _(c).all(function(a){return l.call(b,a)>=0});case"$any":return _(c).any(function(a){return l.call(b,a)>=0});case"$size":return c.length===b;case"$exists":case"$has":return c!=null===b;case"$like":return c.indexOf(b)!==-1;case"$likeI":return c.toLowerCase().indexOf(b.toLowerCase())!==-1;case"$regex":return b.test(c);case"$cb":return b.call(d,c);default:return!1}},d=function(a,b,c,d){var e;return e=f(b),_[d](a,function(a){var b,d,f,h,i;for(h=0,i=e.length;h<i;h++){d=e[h],b=a.get(d.key)
|
5
|
-
,f=j(d.type,b),f&&(f=g(d.type,d.value,b,a));if(c===f)return c}return!c})},h={$and:function(a,b){return d(a,b,!1,"filter")},$or:function(a,b){return d(a,b,!0,"filter")},$nor:function(a,b){return d(a,b,!0,"reject")},$not:function(a,b){return d(a,b,!1,"reject")}},a=function(a,b,d){var e,f,g,h;return g=JSON.stringify(b),e=(h=a._query_cache)!=null?h:a._query_cache={},f=e[g],f||(f=c(a,b,d),e[g]=f),f},b=function(a,b){var c,d,e;return c=_.intersection(["$and","$not","$or","$nor"],_(b).keys()),d=a.models,c.length===0?h.$and(d,b):(e=function(a,c){return h[c](a,b[c])},_.reduce(c,e,d))},c=function(a,c,d){var e;return e=b(a,c),d.sortBy&&(e=i(e,d)),e},i=function(a,b){return _(b.sortBy).isString()?a=_(a).sortBy(function(a){return a.get(b.sortBy)}):_(b.sortBy).isFunction()&&(a=_(a).sortBy(b.sortBy)),b.order==="desc"&&(a=a.reverse()),a},e=function(a,b){var c,d,e,f;return b.offset?e=b.offset:b.page?e=(b.page-1)*b.limit:e=0,c=e+b.limit,d=a.slice(e,c),b.pager&&_.isFunction(b.pager)&&(f=Math.ceil(a.length/b.limit),b.pager(f,d)),d};if(typeof require!="undefined"){if(typeof _=="undefined"||_===null)_=require("underscore");if(typeof Backbone=="undefined"||Backbone===null)Backbone=require("backbone")}Backbone.QueryCollection=Backbone.Collection.extend({query:function(b,d){var f;return d==null&&(d={}),d.cache?f=a(this,b,d):f=c(this,b,d),d.limit&&(f=e(f,d)),f},where:function(a,b){return b==null&&(b={}),new this.constructor(this.query(a,b))},reset_query_cache:function(){return this._query_cache={}}}),typeof exports!="undefined"&&(exports.QueryCollection=Backbone.QueryCollection)}.call(this),function(){}.call(this),!function(a){a(function(){a.support.transition=function(){var a=function(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd",transition:"transitionend"},c;for(c in b)if(a.style[c]!==undefined)return b[c]}();return a&&{end:a}}()})}(window.jQuery),!function(a){function b(){var b=this,d=setTimeout(function(){b.$element.off(a.support.transition.end),c.call(b)},500);this.$element.one(a.support.transition.end,function(){clearTimeout(d),c.call(b)})}function c(a){this.$element.hide().trigger("hidden"),d.call(this)}function d(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(a.proxy(this.hide,this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),f?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,a.proxy(e,this)):e.call(this)):b&&b()}function e(){this.$backdrop.remove(),this.$backdrop=null}function f(){var b=this;this.isShown&&this.options.keyboard?a(document).on("keyup.dismiss.modal",function(a){a.which==27&&b.hide()}):this.isShown||a(document).off("keyup.dismiss.modal")}var g=function(b,c){this.options=c,this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this))};g.prototype={constructor:g,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this,c=a.Event("show");this.$element.trigger(c);if(this.isShown||c.isDefaultPrevented())return;a("body").addClass("modal-open"),this.isShown=!0,f.call(this),d.call(this,function(){var c=a.support.transition&&b.$element.hasClass("fade");b.$element.parent().length||b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in"),c?b.$element.one(a.support.transition.end,function(){b.$element.trigger("shown")}):b.$element.trigger("shown")})},hide:function(d){d&&d.preventDefault();var e=this;d=a.Event("hide"),this.$element.trigger(d);if(!this.isShown||d.isDefaultPrevented())return;this.isShown=!1,a("body").removeClass("modal-open"),f.call(this),this.$element.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?b.call(this):c.call(this)}},a.fn.modal=function(b){return this.each(function(){var c=a(this),d=c.data("modal"),e=a.extend({},a.fn.modal.defaults,c.data(),typeof b=="object"&&b);d||c.data("modal",d=new g(this,e)),typeof b=="string"?d[b]():e.show&&d.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},a.fn.modal.Constructor=g,a(function(){a("body").on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({},e.data(),c.data());b.preventDefault(),e.modal(f)})})}(window.jQuery),!function(a){function b(){a(c).parent().removeClass("open")}var c='[data-toggle="dropdown"]',d=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};d.prototype={constructor:d,toggle:function(c){var d=a(this),e,f,g;if(d.is(".disabled, :disabled"))return;return f=d.attr("data-target"),f||(f=d.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,"")),e=a(f),e.length||(e=d.parent()),g=e.hasClass("open"),b(),g||e.toggleClass("open"),!1}},a.fn.dropdown=function(b){return this.each(function(){var c=a(this),e=c.data("dropdown");e||c.data("dropdown",e=new d(this)),typeof b=="string"&&e[b].call(c)})},a.fn.dropdown.Constructor=d,a(function(){a("html").on("click.dropdown.data-api",b),a("body").on("click.dropdown",".dropdown form",function(a){a.stopPropagation()}).on("click.dropdown.data-api",c,d.prototype.toggle)})}(window.jQuery),!function(a){var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,this.options.trigger!="manual"&&(e=this.options.trigger=="hover"?"mouseenter":"focus",f=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(e,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.show)return c.show();clearTimeout(this.timeout),c.hoverState="in",this.timeout=setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show)},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.hide)return c.hide();clearTimeout(this.timeout),c.hoverState="out",this.timeout=setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide)},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f=typeof this.options.placement=="function"?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.remove().css({top:0,left:0,display:"block"}).appendTo(b?this.$element:document.body),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight;switch(b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.css(g).addClass(f).addClass("in")}},isHTML:function(a){return typeof a!="string"||a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3||/^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(a)},setContent:function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.isHTML(b)?"html":"text"](b),a.removeClass("fade in top bottom left right")},hide:function(){function b(){var b=setTimeout(function(){d.off(a.support.transition.end).remove()},500);d.one(a.support.transition.end,function(){clearTimeout(b),d.remove()})}var c=this,d=this.tip();d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?b():d.remove()},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(b){return a.extend({},b?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a},tip:function(){return this.$tip=this.$tip||a(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()}},a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("tooltip"),f=typeof c=="object"&&c;e||d.data("tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover",title:"",delay:0}}(window.jQuery),!function(a){var b=function(a,b){this.init("popover",a,b)};b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype,{constructor:b,setContent:function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.isHTML(b)?"html":"text"](b),a.find(".popover-content > *")[this.isHTML(c)?"html":"text"](c),a.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-content")||(typeof c.content=="function"?c.content.call(b[0]):c.content),a},tip:function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip}}),a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("popover"),f=typeof c=="object"&&c;e||d.data("popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.defaults=a.extend({},a.fn.tooltip.defaults,{placement:"right",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'})}(window.jQuery),!function(a){var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed").remove()}var d=a(this),e=d.attr("data-target"),f;e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,"")),f=a(e),b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close"));if(b.isDefaultPrevented())return;f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.on(a.support.transition.end,c):c()},a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("alert");e||d.data("alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a(function(){a("body").on("click.alert.data-api",b,c.prototype.close)})}(window.jQuery),!function(a){var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.parent('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")},a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("button"),f=typeof c=="object"&&c;e||d.data("button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a(function(){a("body").on("click.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle")})})}(window.jQuery),!function(a){var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b,c,d,e;if(this.transitioning)return;b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find("> .accordion-group > .in");if(d&&d.length){e=d.data("collapse");if(e&&e.transitioning)return;d.collapse("hide"),e||d.data("collapse",null)}this.$element[b](0),this.transition("addClass",a.Event("show"),"shown"),this.$element[b](this.$element[0][c])},hide:function(){var b;if(this.transitioning)return;b=this.dimension(),this.reset(this.$element[b]()),this.transition("removeClass",a.Event("hide"),"hidden"),this.$element[b](0)},reset:function(a){var b=this.dimension();return this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element[a!==null?"addClass":"removeClass"]("collapse"),this},transition:function(b,c,d){var e=this,f=function(){c.type=="show"&&e.reset(),e.transitioning=0,e.$element.trigger(d)};this.$element.trigger(c);if(c.isDefaultPrevented())return;this.transitioning=1,this.$element[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("collapse"),f=typeof c=="object"&&c;e||d.data("collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a(function(){a("body").on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":c.data();a(e).collapse(f)})})}(window.jQuery),!function(a){var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.typeahead.defaults,c),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.$menu=a(this.options.menu).appendTo("body"),this.source=this.options.source,this.shown=!1,this.listen()};b.prototype={constructor:b,select:function(){var a=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(a)).change(),this.hide()},updater:function(a){return a},show:function(){var b=a.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:b.top+b.height,left:b.left}),this.$menu.show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(b){var c=this,d,e;return this.query=this.$element.val(),this.query?(d=a.grep(this.source,function(a){return c.matcher(a)}),d=this.sorter(d),d.length?this.render(d.slice(0,this.options.items)).show():this.shown?this.hide():this):this.shown?this.hide():this},matcher:function(a){return~a.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(a){var b=[],c=[],d=[],e;while(e=a.shift())e.toLowerCase().indexOf(this.query.toLowerCase())?~e.indexOf(this.query)?c.push(e):d.push(e):b.push(e);return b.concat(c,d)},highlighter:function(a){var b=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return a.replace(new RegExp("("+b+")","ig"),function(a,b){return"<strong>"+b+"</strong>"})},render:function(b){var c=this;return b=a(b).map(function(b,d){return b=a(c.options.item).attr("data-value",d),b.find("a").html(c.highlighter(d)),b[0]}),b.first().addClass("active"),this.$menu.html(b),this},next:function(b){var c=this.$menu.find(".active").removeClass("active"),d=c.next();d.length||(d=a(this.$menu.find("li")[0])),d.addClass("active")},prev:function(a){var b=this.$menu.find(".active").removeClass("active"),c=b.prev();c.length||(c=this.$menu.find("li").last()),c.addClass("active")},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),(a.browser.webkit||a.browser.msie)&&this.$element.on("keydown",a.proxy(this.keypress,this)),this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this))},keyup:function(a){switch(a.keyCode){case 40:case 38:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}a.stopPropagation(),a.preventDefault()},keypress:function(a){if(!this.shown)return;switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:if(a.type!="keydown")break;a.preventDefault(),this.prev();break;case 40:if(a.type!="keydown")break;a.preventDefault(),this.next()}a.stopPropagation()},blur:function(a){var b=this;setTimeout(function(){b.hide()},150)},click:function(a){a.stopPropagation(),a.preventDefault(),this.select()},mouseenter:function(b){this.$menu.find(".active").removeClass("active"),a(b.currentTarget).addClass("active")}},a.fn.typeahead=function(c){return this.each(function(){var d=a(this),e=d.data("typeahead"),f=typeof c=="object"&&c;e||d.data("typeahead",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>'},a.fn.typeahead.Constructor=b,a(function(){a("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(b){var c=a(this);if(c.data("typeahead"))return;b.preventDefault(),c.typeahead(c.data())})})}(window.jQuery),function(){var a,b=Array.prototype.slice;(window||global).Luca=function(){var a,c,d,e,f,g;f=arguments[0],a=2<=arguments.length?b.call(arguments,1):[];if(_.isString(f)&&(g=Luca.cache(f)))return g;if(_.isString(f)&&(g=Luca.find(f)))return g;if(_.isObject(f)&&f.ctype!=null)return Luca.util.lazyComponent(f);_.isObject(f)&&f.defines&&f["extends"]&&(c=f.defines,e=f["extends"]);if(_.isFunction(d=_(a).last()))return d()},_.extend(Luca,{VERSION:"0.9.65",core:{},containers:{},components:{},modules:{},util:{},fields:{},registry:{},options:{},config:{}}),_.extend(Luca,Backbone.Events),Luca.autoRegister=Luca.config.autoRegister=!0,Luca.developmentMode=Luca.config.developmentMode=!1,Luca.enableGlobalObserver=Luca.config.enableGlobalObserver=!1,Luca.enableBootstrap=Luca.config.enableBootstrap=!0,Luca.config.enhancedViewProperties=!0,Luca.keys={ENTER:13,ESCAPE:27,KEYLEFT:37,KEYUP:38,KEYRIGHT:39,KEYDOWN:40,SPACEBAR:32,FORWARDSLASH:191},Luca.keyMap=_(Luca.keys).inject(function(a,b,c){return a[b]=c.toLowerCase(),a},{}),Luca.find=function(a){return Luca($(a).data("luca-id"))},Luca.supportsEvents=Luca.supportsBackboneEvents=function(a){return Luca.isComponent(a)||_.isFunction(a!=null?a.trigger:void 0)||_.isFunction(a!=null?a.bind:void 0)},Luca.isComponent=function(a){return Luca.isBackboneModel(a)||Luca.isBackboneView(a)||Luca.isBackboneCollection(a)},Luca.isComponentPrototype=function(a){return Luca.isViewPrototype(a)||Luca.isModelPrototype(a)||Luca.isCollectionPrototype(a)},Luca.isBackboneModel=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),_.isFunction(a!=null?a.set:void 0)&&_.isFunction(a!=null?a.get:void 0)&&_.isObject(a!=null?a.attributes:void 0)},Luca.isBackboneView=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),_.isFunction(a!=null?a.render:void 0)&&!_.isUndefined(a!=null?a.el:void 0)},Luca.isBackboneCollection=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),_.isFunction(a!=null?a.fetch:void 0)&&_.isFunction(a!=null?a.reset:void 0)},Luca.isViewPrototype=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),a!=null&&a.prototype!=null&&a.prototype.make!=null&&a.prototype.$!=null&&a.prototype.render!=null},Luca.isModelPrototype=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),a!=null&&(typeof a.prototype=="function"?a.prototype(a.prototype.save!=null&&a.prototype.changedAttributes!=null):void 0)},Luca.isCollectionPrototype=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),a!=null&&a.prototype!=null&&!Luca.isModelPrototype(a)&&a.prototype.reset!=null&&a.prototype.select!=null&&a.prototype.reject!=null},Luca.inheritanceChain=function(a){return _(Luca.parentClasses(a)).map(function(a){return Luca.util.resolve(a)})},Luca.parentClasses=function(a){var b,c,d;return c=[],_.isString(a)&&(a=Luca.util.resolve(a)),c.push(a.displayName||((d=a.prototype)!=null?d.displayName:void 0)||Luca.parentClass(a)),b=function(){var b;b=[];while(Luca.parentClass(a)!=null)b.push(a=Luca.parentClass(a));return b}(),c=c.concat(b),_.uniq(c)},Luca.parentClass=function(a){var b,c,d;b=[],_.isString(a)&&(a=Luca.util.resolve(a));if(Luca.isComponent(a))return a.displayName;if(Luca.isComponentPrototype(a))return typeof (c=a.prototype)._superClass=="function"?(d=c._superClass())!=null?d.displayName:void 0:void 0},Luca.template=function(a,b){var c,d,e,f,g;window.JST||(window.JST={});if(_.isFunction(a))return a(b);d=(g=Luca.templates)!=null?g[a]:void 0,c=typeof JST!="undefined"&&JST!==null?JST[a]:void 0,d==null&&c==null&&(e=new RegExp(""+a+"$"),d=_(Luca.templates).detect(function(a,b){return e.exec(b)}),c=_(JST).detect(function(a,b){return e.exec(b)}));if(!d&&!c)throw"Could not find template named "+a;return f=d||c,b!=null?f(b):f},Luca.available_templates=function(a){var b;return a==null&&(a=""),b=_(Luca.templates).keys(),a.length>0?_(b).select(function(b){return b.match(a)}):b},a={module:function(a,b){_.extend(a,b);if(a.included&&_(a.included).isFunction())return a.included.apply(a)},"delete":function(a,b){var c;return c=a[b],delete a[b],c},idle:function(a,b){var c;return b==null&&(b=1e3),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}},idleShort:function(a,b){var c;return b==null&&(b=100),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}},idleMedium:function(a,b){var c;return b==null&&(b=2e3),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}},idleLong:function(a,b){var c;return b==null&&(b=5e3),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}}},_.mixin(a)}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/bootstrap_form_controls"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="btn-group form-actions">\n <a class="btn btn-primary submit-button">\n <i class="icon icon-ok icon-white"></i>\n Save Changes\n </a>\n <a class="btn reset-button cancel-button">\n <i class="icon icon-remove"></i>\n Cancel\n </a>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/collection_loader_view"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div id="progress-modal" class="modal" style="display: none">\n <div class="progress progress-info progress-striped active">\n <div class="bar" style="width:0%;"></div>\n </div>\n <div class="message">Initializing...</div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/form_alert"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="',className,'">\n <a class="close" href="#" data-dismiss="alert">x</a>\n ',message,"\n</div>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/grid_view"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="luca-ui-g-view-wrapper">\n <div class="g-view-header"></div>\n <div class="luca-ui-g-view-body">\n <table class="luca-ui-g-view scrollable-table" width="100%" cellpadding=0 cellspacing=0>\n <thead class="fixed"></thead>\n <tbody class="scrollable"></tbody>\n <tfoot></tfoot>\n </table>\n </div>\n <div class="luca-ui-g-view-header"></div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/grid_view_empty_text"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="empty-text empty-text-wrapper">\n <p>',text,"</p>\n</div>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/load_mask"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="load-mask">\n <div class="progress progress-striped active">\n <div class="bar" style="width:0%"></div>\n </div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/nav_bar"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="navbar-inner">\n <div class="luca-ui-navbar-body container">\n </div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/pagination"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="pagination">\n <a class="btn previous">\n <i class="icon icon-chevron-left"></i>\n </a>\n <div class="pagination-group">\n </div>\n <a class="btn next">\n <i class="icon icon-chevron-right"></i>\n </a>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/containers/basic"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div id="',id,'" class="',classes,'" style="',style,'"></div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/containers/tab_selector_container"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div id="',cid,'-tab-selector" class="tab-selector-container">\n <ul id="',cid,'-tabs-nav" class="nav nav-tabs">\n ');for(var i=0;i<components.length;i++){__p.push("\n ");var component=components[i];__p.push('\n <li class="tab-selector" data-target="',i,'">\n <a data-target="',i,'">\n ',component.title,"\n </a>\n </li>\n ")}__p.push("\n </ul>\n</div>\n")}return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/containers/tab_view"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<ul id="',cid,'-tabs-selector" class="nav ',navClass,'"></ul>\n<div id="',cid,'-tab-view-content" class="tab-content"></div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/containers/toolbar_wrapper"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="luca-ui-toolbar-wrapper" id="',id,'"></div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/button_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label> </label>\n<input style="',inputStyles,'" class="btn ',input_class,'" value="',input_value,'" type="',input_type,'" id="<%= input_id" />\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/button_field_link"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<a class="btn ',input_class,'">\n '),icon_class.length&&__p.push('\n <i class="',icon_class,'"></i>\n ',input_value,"\n "),__p.push("\n</a>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/checkbox_array"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="control-group">\n <label for="',input_id,'"><%= label =>\n <div class="controls"><div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/checkbox_array_item"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n <input id="',input_id,'" type="checkbox" name="',input_name,'" value="',value,'" />\n</label>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/checkbox_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n ',label,'\n <input type="checkbox" name="',input_name,'" value="',input_value,'" style="',inputStyles,'" />\n</label>\n\n'),helperText&&__p.push('\n<p class="helper-text help-block">\n ',helperText,"\n</p>\n"),__p.push("\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/file_upload_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n ',label,'\n <input type="file" name="',input_name,'" value="',input_value,'" style="',inputStyles,'" />\n</label>\n\n'),helperText&&__p.push('\n<p class="helper-text help-block">\n ',helperText,"\n</p>\n"),__p.push("\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/hidden_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push(' <input type="hidden" name="',input_name,'" value="',input_value,'" style="',inputStyles,'" />\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/select_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n ',label,'\n</label>\n<div class="controls">\n <select name="',input_name,'" value="',input_value,'" style="',inputStyles,'" ></select>\n '),helperText&&__p.push('\n <p class="helper-text help-block">\n ',helperText,"\n </p>\n "),__p.push("\n</div>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/text_area_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n ',label,'\n</label>\n<div class="controls">\n <textarea name="',input_name,'" style="',inputStyles,'" >',input_value,"</textarea>\n "),helperText&&__p.push('\n <p class="helper-text help-block">\n ',helperText,"\n </p>\n "),__p.push("\n</div>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/text_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push(""),(typeof label!="undefined"&&typeof hideLabel!="undefined"&&!hideLabel||typeof hideLabel=="undefined")&&__p.push('\n<label class="control-label" for="',input_id,'">',label,"</label>\n"),__p.push('\n\n<div class="controls">\n'),typeof addOn!="undefined"&&__p.push('\n <span class="add-on">',addOn,"</span>\n"),__p.push('\n<input type="text" name="',input_name,'" style="',inputStyles,'" value="',input_value,'" />\n'),helperText&&__p.push('\n<p class="helper-text help-block">\n ',helperText,"\n</p>\n"),__p.push("\n\n</div>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/table_view"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<thead></thead>\n<tbody class="table-body"></tbody>\n<tfoot></tfoot>\n<caption></caption>\n');return __p.join("")}}.call(this),function(){var currentNamespace,__slice=Array.prototype.slice;Luca.util.resolve=function(a,b){var c;try{b||(b=window||global),c=_(a.split(/\./)).inject(function(a,b){return a=a!=null?a[b]:void 0},b)}catch(d)
|
6
|
-
{throw console.log("Error resolving",a,b),d}return c},Luca.util.nestedValue=Luca.util.resolve,Luca.util.argumentsLogger=function(a){return function(){return console.log(a,arguments)}},Luca.util.read=function(){var a,b;return b=arguments[0],a=2<=arguments.length?__slice.call(arguments,1):[],_.isFunction(b)?b.apply(this,a):b},Luca.util.classify=function(a){return a==null&&(a=""),_.string.camelize(_.string.capitalize(a))},Luca.util.hook=function(a){var b,c,d;return a==null&&(a=""),c=a.split(":"),d=c.shift(),c=_(c).map(function(a){return _.string.capitalize(a)}),b=d+c.join("")},Luca.util.isIE=function(){try{return Object.defineProperty({},"",{}),!1}catch(a){return!0}},currentNamespace=window||global,Luca.util.namespace=function(namespace){return namespace==null?currentNamespace:(currentNamespace=_.isString(namespace)?Luca.util.resolve(namespace,window||global):namespace,currentNamespace!=null?currentNamespace:currentNamespace=eval("(window||global)."+namespace+" = {}"))},Luca.util.lazyComponent=function(config){var componentClass,constructor,ctype;_.isObject(config)&&(ctype=config.ctype||config.type),_.isString(config)&&(ctype=config),componentClass=Luca.registry.lookup(ctype);if(!componentClass)throw"Invalid Component Type: "+ctype+". Did you forget to register it?";return constructor=eval(componentClass),new constructor(config)},Luca.util.selectProperties=function(a,b,c){var d;return d=_(b).values(),_(d).select(a)},Luca.util.loadScript=function(a,b){var c;return c=document.createElement("script"),c.type="text/javascript",c.readyState&&(c.onreadystatechange=function(){return c.readyState==="loaded"||c.readyState==="complete"?(c.onreadystatechange=null,b()):c.onload=function(){return b()}}),c.src=a,document.body.appendChild(c)},Luca.util.make=Backbone.View.prototype.make,Luca.util.list=function(a,b,c){var d,e,f,g;b==null&&(b={}),d=c?"ol":"ul",d=Luca.util.make(d,b);if(_.isArray(a))for(f=0,g=a.length;f<g;f++)e=a[f],$(d).append(Luca.util.make("li",{},e));return d.outerHTML},Luca.util.label=function(a,b,c){var d;return a==null&&(a=""),c==null&&(c="label"),d=c,b!=null&&(d+=" "+c+"-"+b),Luca.util.make("span",{"class":d},a)},Luca.util.badge=function(a,b,c){var d;return a==null&&(a=""),c==null&&(c="badge"),d=c,b!=null&&(d+=" "+c+"-"+b),Luca.util.make("span",{"class":d},a)}}.call(this),function(){Luca.DevelopmentToolHelpers={refreshCode:function(){var a;return a=this,_(this.eventHandlerProperties()).each(function(b){return a[b]=a.definitionClass()[b]}),this.autoBindEventHandlers===!0&&this.bindAllEventHandlers(),this.delegateEvents()},eventHandlerProperties:function(){var a;return a=_(this.events).values(),_(a).select(function(a){return _.isString(a)})},eventHandlerFunctions:function(){var a,b=this;return a=_(this.events).values(),_(a).map(function(a){return _.isFunction(a)?a:b[a]})}}}.call(this),function(){var a,b=Array.prototype.slice;a=function(){function a(a,b,c){var d;this.object=a,c==null&&(c=!0),_.isFunction(b)?d=b:_.isString(b)&&_.isFunction(this.object[b])&&(d=this.object[b]);if(!_.isFunction(d))throw"Must pass a function or a string representing one";c===!0?this.fn=_.bind(function(){return _.defer(d)},this.object):this.fn=_.bind(d,this.object),this}return a.prototype.until=function(a,b){return a!=null&&b==null&&(b=a,a=this.object),a.once(b,this.fn),this.object},a}(),Luca.Events={defer:function(b,c){return c==null&&(c=!0),new a(this,b,c)},once:function(a,b,c){var d;return c||(c=this),d=function(){return b.apply(c,arguments),this.unbind(a,d)},this.bind(a,d)}},Luca.EventsExt={waitUntil:function(a,b){return this.waitFor.call(this,a,b)},waitFor:function(a,c){var d,e;return e=this,d={on:function(b){return b.waitFor.call(b,a,c)},and:function(){var d,f,g,h,i;f=1<=arguments.length?b.call(arguments,0):[],i=[];for(g=0,h=f.length;g<h;g++)d=f[g],d=_.isFunction(d)?d:e[d],i.push(e.once(a,d,c));return i},andThen:function(){return e.and.apply(e,arguments)}}},relayEvent:function(a){var c=this;return{on:function(){var d;return d=1<=arguments.length?b.call(arguments,0):[],{to:function(){var e,f,g,h,i,j;g=1<=arguments.length?b.call(arguments,0):[],j=[];for(h=0,i=g.length;h<i;h++)f=g[h],j.push(function(){var c,g,h,i=this;h=[];for(c=0,g=d.length;c<g;c++)e=d[c],h.push(e.on(a,function(){var c;return c=1<=arguments.length?b.call(arguments,0):[],c.unshift(a),f.trigger.apply(f,c)}));return h}.call(c));return j}}}}}}}.call(this),function(){var DefineProxy,__slice=Array.prototype.slice;_.mixin({def:Luca.component=Luca.define=Luca.register=function(a){return new DefineProxy(a)}}),DefineProxy=function(){function DefineProxy(a){var b;this.namespace=Luca.util.namespace(),this.componentId=this.componentName=a,this.superClassName="Luca.View",a.match(/\./)&&(this.namespaced=!0,b=a.split("."),this.componentId=b.pop(),this.namespace=b.join("."),Luca.registry.addNamespace(b.join(".")))}return DefineProxy.prototype["in"]=function(a){return this.namespace=a,this},DefineProxy.prototype.from=function(a){return this.superClassName=a,this},DefineProxy.prototype["extends"]=function(a){return this.superClassName=a,this},DefineProxy.prototype.extend=function(a){return this.superClassName=a,this},DefineProxy.prototype.triggers=function(){var a,b,c,d;b=1<=arguments.length?__slice.call(arguments,0):[],_.defaults(this.properties||(this.properties={}),{hooks:[]});for(c=0,d=b.length;c<d;c++)a=b[c],this.properties.hooks.push(a);return this.properties.hooks=_.uniq(this.properties.hooks),this},DefineProxy.prototype.includes=function(){var a,b,c,d;b=1<=arguments.length?__slice.call(arguments,0):[],_.defaults(this.properties||(this.properties={}),{include:[]});for(c=0,d=b.length;c<d;c++)a=b[c],this.properties.include.push(a);return this.properties.include=_.uniq(this.properties.include),this},DefineProxy.prototype.mixesIn=function(){var a,b,c,d;b=1<=arguments.length?__slice.call(arguments,0):[],_.defaults(this.properties||(this.properties={}),{mixins:[]});for(c=0,d=b.length;c<d;c++)a=b[c],this.properties.mixins.push(a);return this.properties.mixins=_.uniq(this.properties.mixins),this},DefineProxy.prototype.defaultProperties=function(properties){var at,componentType,_base;return properties==null&&(properties={}),_.defaults(this.properties||(this.properties={}),properties),at=this.namespaced?Luca.util.resolve(this.namespace,window||global):window||global,this.namespaced&&at==null&&(eval("(window||global)."+this.namespace+" = {}"),at=Luca.util.resolve(this.namespace,window||global)),at[this.componentId]=Luca.extend(this.superClassName,this.componentName,this.properties),Luca.autoRegister===!0&&(Luca.isViewPrototype(at[this.componentId])&&(componentType="view"),Luca.isCollectionPrototype(at[this.componentId])&&((_base=Luca.Collection).namespaces||(_base.namespaces=[]),Luca.Collection.namespaces.push(this.namespace),componentType="collection"),Luca.isModelPrototype(at[this.componentId])&&(componentType="model"),Luca.registerComponent(_.string.underscored(this.componentId),this.componentName,componentType)),at[this.componentId]},DefineProxy}(),DefineProxy.prototype.behavesAs=DefineProxy.prototype.uses=DefineProxy.prototype.mixesIn,DefineProxy.prototype.defines=DefineProxy.prototype.defaults=DefineProxy.prototype.exports=DefineProxy.prototype.defaultProperties,DefineProxy.prototype.defaultsTo=DefineProxy.prototype.enhance=DefineProxy.prototype["with"]=DefineProxy.prototype.defaultProperties,Luca.extend=function(a,b,c){var d,e,f,g,h,i;c==null&&(c={}),f=Luca.util.resolve(a,window||global),f.__initializers||(f.__initializers=[]);if(!_.isFunction(f!=null?f.extend:void 0))throw"Error defining "+b+". "+a+" is not a valid component to extend from";c.displayName=b,c._superClass=function(){return f.displayName||(f.displayName=a),f},c._super=function(a,b,c){var d;return b==null&&(b=this),c==null&&(c=[]),(d=this._superClass().prototype[a])!=null?d.apply(b,c):void 0},d=f.extend(c);if(_.isArray(c!=null?c.include:void 0)){i=c.include;for(g=0,h=i.length;g<h;g++)e=i[g],_.isString(e)&&(e=Luca.util.resolve(e)),_.extend(d.prototype,e)}return d},Luca.mixin=function(a){var b,c;return b=_(Luca.mixin.namespaces).detect(function(b){var c;return((c=Luca.util.resolve(b))!=null?c[a]:void 0)!=null}),b||(b="Luca.modules"),c=Luca.util.resolve(b)[a],c==null&&console.log("Could not find "+a+" in ",Luca.mixin.namespaces),c},Luca.mixin.namespaces=["Luca.modules"],Luca.mixin.namespace=function(a){return Luca.mixin.namespaces.push(a),Luca.mixin.namespaces=_(Luca.mixin.namespaces).uniq()},Luca.decorate=function(a){return _.isString(a)&&(a=Luca.util.resolve(a).prototype),{"with":function(b){var c,d,e,f,g;return c=Luca.mixin(b),d=_(c).chain().keys().select(function(a){return(""+a).match(/^__/)}),e=_(c).omit(d.value()),_.extend(a,e),c!=null&&(g=c.__included)!=null&&g.call(c,b),f=a._superClass().prototype.mixins,a.mixins||(a.mixins=[]),a.mixins.push(b),a.mixins=a.mixins.concat(f),a.mixins=_(a.mixins).chain().uniq().compact().value(),a}}}}.call(this),function(){Luca.modules.ApplicationEventBindings={__initializer:function(){var a,b,c,d,e,f,g;if(_.isEmpty(this.applicationEvents))return;a=this.app;if(_.isString(a)||_.isUndefined(a))a=(e=Luca.Application)!=null?typeof e.get=="function"?e.get(a):void 0:void 0;if(!Luca.supportsEvents(a))throw"Error binding to the application object on "+(this.name||this.cid);f=this.applicationEvents,g=[];for(c=0,d=f.length;c<d;c++){b=f[c],_.isString(c)&&(c=this[c]);if(!_.isFunction(c))throw"Error registering application event "+b+" on "+(this.name||this.cid);g.push(a.on(b,c))}return g}}}.call(this),function(){Luca.modules.CollectionEventBindings={__initializer:function(){var a,b,c,d,e,f,g,h,i;if(_.isEmpty(this.collectionEvents))return;e=this.collectionManager||Luca.CollectionManager.get(),g=this.collectionEvents,i=[];for(f in g){c=g[f],h=f.split(" "),d=h[0],b=h[1],a=e.getOrCreate(d);if(!a)throw"Could not find collection specified by "+d;_.isString(c)&&(c=this[c]);if(!_.isFunction(c))throw"invalid collectionEvents configuration";try{i.push(a.on(b,c,a))}catch(j){throw console.log("Error Binding To Collection in registerCollectionEvents",this),j}}return i}}}.call(this),function(){Luca.modules.Deferrable={configure_collection:function(a){var b,c,d;a==null&&(a=!0);if(!this.collection)return;_.isString(this.collection)&&(b=(c=Luca.CollectionManager)!=null?c.get():void 0)&&(this.collection=b.getOrCreate(this.collection)),this.collection&&_.isFunction(this.collection.fetch)&&_.isFunction(this.collection.reset)||(this.collection=new Luca.Collection(this.collection.initial_set,this.collection));if((d=this.collection)!=null?d.deferrable_trigger:void 0)this.deferrable_trigger=this.collection.deferrable_trigger;if(a)return this.deferrable=this.collection}}}.call(this),function(){Luca.modules.DomHelpers={__initializer:function(){var a,b,c,d,e;b=_(this.additionalClassNames||[]).clone(),this.wrapperClass!=null&&this.$wrap(this.wrapperClass),_.isString(b)&&(b=b.split(" ")),this.gridSpan&&b.push("span"+this.gridSpan),this.gridOffset&&b.push("offset"+this.gridOffset),this.gridRowFluid&&b.push("row-fluid"),this.gridRow&&b.push("row");if(b==null)return;e=[];for(c=0,d=b.length;c<d;c++)a=b[c],e.push(this.$el.addClass(a));return e},$wrap:function(a){return _.isString(a)&&!a.match(/[<>]/)&&(a=this.make("div",{"class":a})),this.$el.wrap(a)},$template:function(a,b){return b==null&&(b={}),this.$el.html(Luca.template(a,b))},$html:function(a){return this.$el.html(a)},$append:function(a){return this.$el.append(a)},$attach:function(){return this.$container().append(this.el)},$bodyEl:function(){return this.$el},$container:function(){return $(this.container)}}}.call(this),function(){Luca.modules.EnhancedProperties={__initializer:function(){if(Luca.config.enhancedViewProperties!==!0)return;_.isString(this.collection)&&Luca.CollectionManager.get()&&(this.collection=Luca.CollectionManager.get().getOrCreate(this.collection)),this.template!=null&&this.$template(this.template,this);if(_.isString(this.collectionManager))return this.collectionManager=Luca.CollectionManager.get(this.collectionManager)}}}.call(this),function(){var a,b=Object.prototype.hasOwnProperty,c=function(a,c){function e(){this.constructor=a}for(var d in c)b.call(c,d)&&(a[d]=c[d]);return e.prototype=c.prototype,a.prototype=new e,a.__super__=c.prototype,a};Luca.modules.Filterable={__included:function(a,b){return _.extend(Luca.Collection.prototype,{__filters:{}})},__initializer:function(a,b){var c,d,e,f=this;if(this.filterable===!1)return;Luca.isBackboneCollection(this.collection)||(this.collection=typeof (d=Luca.CollectionManager).get=="function"?(e=d.get())!=null?e.getOrCreate(this.collection):void 0:void 0);if(!Luca.isBackboneCollection(this.collection)){this.debug("Skipping Filterable due to no collection being present on "+(this.name||this.cid)),this.debug("Collection",this.collection);return}return this.getCollection||(this.getCollection=function(){return this.collection}),c=this.getFilterState(),this.querySources||(this.querySources=[]),this.optionsSources||(this.optionsSources=[]),this.query||(this.query={}),this.queryOptions||(this.queryOptions={}),this.querySources.push(function(){return c.toQuery()}),this.optionsSources.push(function(){return c.toOptions()}),this.debugMode===!0&&(console.log("Filterable"),console.log(this.querySources),console.log(this.optionsSources)),c.on("change",function(){var a;return f.isRemote()?(a=_.extend(f.getQuery(),f.getQueryOptions()),f.collection.applyFilter(a,f.getQueryOptions())):f.trigger("refresh")}),b},isRemote:function(){return this.getQueryOptions().remote===!0},getFilterState:function(){var b,c;return(b=this.collection.__filters)[c=this.cid]||(b[c]=new a(this.filterable))},setSortBy:function(a,b){return b==null&&(b={}),this.getFilterState().setOption("sortBy",a,b)},applyFilter:function(a,b){return a==null&&(a={}),b==null&&(b={}),b=_.defaults(b,this.getQueryOptions()),a=_.defaults(a,this.getQuery()),this.getFilterState().set({query:a,options:b},b)}},a=function(a){function b(){b.__super__.constructor.apply(this,arguments)}return c(b,a),b.prototype.defaults={options:{},query:{}},b.prototype.setOption=function(a,b,c){var d;return d={},d[a]=b,this.set("options",_.extend(this.toOptions(),d),c)},b.prototype.setQueryOption=function(a,b,c){var d;return d={},d[a]=b,this.set("query",_.extend(this.toQuery(),d),c)},b.prototype.toOptions=function(){return this.toJSON().options},b.prototype.toQuery=function(){return this.toJSON().query},b.prototype.toRemote=function(){var a;return a=this.toOptions(),_.extend(this.toQuery(),{limit:a.limit,page:a.page,sortBy:a.sortBy})},b}(Backbone.Model)}.call(this),function(){Luca.modules.GridLayout={_initializer:function(){this.gridSpan&&this.$el.addClass("span"+this.gridSpan),this.gridOffset&&this.$el.addClass("offset"+this.gridOffset),this.gridRowFluid&&this.$el.addClass("row-fluid");if(this.gridRow)return this.$el.addClass("row")}}}.call(this),function(){Luca.modules.LoadMaskable={__initializer:function(){var a=this;if(this.loadMask!==!0)return;if(this.loadMask===!0)return this.defer(function(){a.$el.addClass("with-mask");if(a.$(".load-mask").length===0)return a.loadMaskTarget().prepend(Luca.template(a.loadMaskTemplate,a)),a.$(".load-mask").hide()}).until("after:render"),this.on(this.loadmaskEnableEvent||"enable:loadmask",this.applyLoadMask,this),this.on(this.loadmaskDisableEvent||"disable:loadmask",this.applyLoadMask,this)},showLoadMask:function(){return this.trigger("enable:loadmask")},hideLoadMask:function(){return this.trigger("disable:loadmask")},loadMaskTarget:function(){return this.loadMaskEl!=null?this.$(this.loadMaskEl):this.$bodyEl()},disableLoadMask:function(){return this.$(".load-mask .bar").css("width","100%"),this.$(".load-mask").hide(),clearInterval(this.loadMaskInterval)},enableLoadMask:function(){var a,b=this;this.$(".load-mask").show().find(".bar").css("width","0%"),a=this.$(".load-mask .progress").width(),a<20&&(a=this.$el.width())<20&&(a=this.$el.parent().width()),this.loadMaskInterval=setInterval(function(){var a,c;return a=b.$(".load-mask .bar").width(),c=a+12,b.$(".load-mask .bar").css("width",c)},200);if(this.loadMaskTimeout==null)return;return _.delay(function(){return b.disableLoadMask()},this.loadMaskTimeout)},applyLoadMask:function(){return this.$(".load-mask").is(":visible")?this.disableLoadMask():this.enableLoadMask()}}}.call(this),function(){Luca.LocalStore=function(){function a(a){var b;this.name=a,b=localStorage.getItem(this.name),this.data=b&&JSON.parse(b)||{}}return a.prototype.guid=function(){var a;return a=function(){return((1+Math.random())*65536|0).toString(16).substring(1)},a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()},a.prototype.save=function(){return localStorage.setItem(this.name,JSON.stringify(this.data))},a.prototype.create=function(a){return a.id||(a.id=a.attribtues.id=this.guid()),this.data[a.id]=a,this.save(),a},a.prototype.update=function(a){return this.data[a.id]=a,this.save(),a},a.prototype.find=function(a){return this.data[a.id]},a.prototype.findAll=function(){return _.values(this.data)},a.prototype.destroy=function(a){return delete this.data[a.id],this.save(),a},a}(),Backbone.LocalSync=function(a,b,c){var d,e;return e=b.localStorage||b.collection.localStorage,d=function(){switch(a){case"read":return b.id?e.find(b):e.findAll();case"create":return e.create(b);case"update":return e.update(b);case"delete":return e.destroy(b)}}(),d?c.success(d):c.error("Record not found")}}.call(this),function(){var a;Luca.modules.ModalView={closeOnEscape:!0,showOnInitialize:!1,backdrop:!1,__initializer:function(){return this.$el.addClass("modal"),this.on("before:render",a,this),this},container:function(){return $("body")},toggle:function(){return this.$el.modal("toggle")},show:function(){return this.$el.modal("show")},hide:function(){return this.$el.modal("hide")}},a=function(){return this.$el.addClass("modal"),this.fade===!0&&this.$el.addClass("fade"),$("body").append(this.$el),this.$el.modal({backdrop:this.backdrop===!0,keyboard:this.closeOnEscape===!0,show:this.showOnInitialize===!0}),this}}.call(this),function(){Luca.modules.Paginatable={paginatorViewClass:"Luca.components.PaginationControl",paginationSelector:".toolbar.bottom",__included:function(){return _.extend(Luca.Collection.prototype,{__paginators:{}})},__initializer:function(){var a,b,c,d,e=this;if(this.paginatable===!1)return;Luca.isBackboneCollection(this.collection)||(this.collection=typeof (c=Luca.CollectionManager).get=="function"?(d=c.get())!=null?d.getOrCreate(this.collection):void 0:void 0);if(!Luca.isBackboneCollection(this.collection)){this.debug("Skipping Paginatable due to no collection being present on "+(this.name||this.cid)),this.debug("collection",this.collection);return}return _.bindAll(this,"paginationControl","pager"),this.getCollection||(this.getCollection=function(){return this.collection}),a=this.getCollection(),b=this.getPaginationState(),this.optionsSources||(this.optionsSources=[]),this.queryOptions||(this.queryOptions={}),this.optionsSources.push(function(){var a;return a=_(b.toJSON()).pick("limit","page","sortBy"),_.extend(a,{pager:e.pager})}),b.on("change:page",function(a){var b;return e.isRemote()?(b=_.extend(e.toQuery(),e.toQueryOptions()),e.collection.applyFilter(b,{remote:!0})):e.trigger("refresh")}),this.on("before:render",this.renderPaginationControl,this)},pager:function(a,b){return this.getPaginationState().set({numberOfPages:a,itemCount:b.length}),this.paginationControl().updateWithPageCount(a,b)},isRemote:function(){return this.getQueryOptions().remote===!0},getPaginationState:function(){var a,b;return(a=this.collection.__paginators)[b=this.cid]||(a[b]=this.paginationControl().state)},paginationContainer:function(){return this.$(">"+this.paginationSelector)},setCurrentPage:function(a,b){return a==null&&(a=1),b==null&&(b={}),this.getPaginationState().set("page",a,b)},setPage:function(a,b){return a==null&&(a=1),b==null&&(b={}),this.getPaginationState().set("page",a,b)},setLimit:function(a,b){return a==null&&(a=0),b==null&&(b={}),this.getPaginationState().set("limit",a,b)},paginationControl:function(){return this.paginator!=null?this.paginator:(_.defaults(this.paginatable||(this.paginatable={}),{page:1,limit:20}),this.paginator=Luca.util.lazyComponent({type:"pagination_control",collection:this.getCollection(),defaultState:this.paginatable,parent:this.name||this.cid,debugMode:this.debugMode}),this.paginator)},renderPaginationControl:function(){var a;return a=this.paginationControl(),this.paginationContainer().append(a.render().$el),a}}}.call(this),function(){Luca.modules.StateModel={__initializer:function(){var a=this;if(this.stateful!==!0)return;if(this.state!=null&&!Luca.isBackboneModel(this.state))return;return this.state=new Backbone.Model(this.defaultState||{}),this.set||(this.set=function(){return a.state.set.apply(a.state,arguments)}),this.get||(this.get=function(){return a.state.get.apply(a.state,arguments)}),this.state.on("change",function(b){var c,d,e,f,g,h;a.trigger("state:change",b),d=b.previousAttributes(),g=b.changedAttributes,h=[];for(e=0,f=g.length;e<f;e++)c=g[e],h.push(a.trigger("state:change:"+c,e,b.previous(c)));return h})}}}.call(this),function(){Luca.modules.Templating={__initializer:function(){var a,b,c;c=Luca.util.read.call(this,this.bodyTemplateVars)||{};if(a=this.bodyTemplate)return this.$el.empty(),b=Luca.template(a,c),Luca.View.prototype.$html.call(this,b)}}}.call(this),function(){var a,b;b={classes:{},model_classes:{},collection_classes:{},namespaces:["Luca.containers","Luca.components"]},a={cid_index:{},name_index:{}},Luca.config.defaultComponentClass=Luca.defaultComponentClass="Luca.View",Luca.config.defaultComponentType=Luca.defaultComponentType="view",Luca.registry.aliases={grid:"grid_view",form:"form_view",text:"text_field",button:"button_field",select:"select_field",card:"card_view",paged:"card_view",wizard:"card_view",collection:"collection_view",list:"collection_view",multi:"collection_multi_view",table:"table_view"},Luca.registerComponent=function(a,c,d){d==null&&(d="view"),Luca.trigger("component:registered",a,c);switch(d){case"model":return b.model_classes[a]=c;case"collection":return b.collection_classes[a]=c;default:return b.classes[a]=c}},Luca.development_mode_register=function(a,c){var d,e,f;return d=b.classes[a],Luca.enableDevelopmentTools===!0&&d!=null&&(f=Luca.util.resolve(d,window),e=Luca.registry.findInstancesByClassName(c),_(e).each(function(a){var b;return a!=null?(b=a.refreshCode)!=null?b.call(a,f):void 0:void 0})),Luca.registerComponent(a,c)},Luca.registry.addNamespace=Luca.registry.namespace=function(a){return b.namespaces.push(a),b.namespaces=_(b.namespaces).uniq()},Luca.registry.namespaces=function(a){return a==null&&(a=!0),_(b.namespaces).map(function(b){return a?Luca.util.resolve(b):b})},Luca.registry.lookup=function(a){var c,d,e,f,g,h;if(c=Luca.registry.aliases[a])a=c;return d=b.classes[a],d!=null?d:(e=Luca.util.classify(a),g=Luca.registry.namespaces(),f=(h=_(g).chain().map(function(a){return a[e]}).compact().value())!=null?h[0]:void 0)},Luca.registry.instances=function(){return _(a.cid_index).values()},Luca.registry.findInstancesByClass=function(a){return Luca.registry.findInstancesByClassName(a.displayName)},Luca.registry.findInstancesByClassName=function(a){var b;return _.isString(a)||(a=a.displayName),b=Luca.registry.instances(),_(b).select(function(b){var c,d;return c=b.displayName===a,b.displayName===a||(typeof b._superClass=="function"?(d=b._superClass())!=null?d.displayName:void 0:void 0)===a})},Luca.registry.classes=function(a){return a==null&&(a=!1),_(_.extend({},b.classes,b.model_classes,b.collection_classes)).map(function(b,c){return a?b:{className:b,ctype:c}})},Luca.cache=Luca.cacheInstance=function(b,c){var d;if(b==null)return;return(c!=null?c.doNotCache:void 0)===!0?c:(c!=null&&(a.cid_index[b]=c),c=a.cid_index[b],(c!=null?c.component_name:void 0)!=null?a.name_index[c.component_name]=c.cid:(c!=null?c.name:void 0)!=null&&(a.name_index[c.name]=c.cid),c!=null?c:(d=a.name_index[b],a.cid_index[d]))}}.call(this),function(){var a=Array.prototype.slice;Luca.Observer=function(){function b(a){var b=this;this.options=a!=null?a:{},_.extend(this,Backbone.Events),this.type=this.options.type,this.options.debugAll&&this.bind("all",function(a,b,c){return console.log("ALL",a,b,c)})}return b.prototype.relay=function(){var b,c;return c=arguments[0],b=2<=arguments.length?a.call(arguments,1):[],console.log("Relaying",trigger,b),this.trigger("event",c,b),this.trigger("event:"+b[0],c,b.slice(1))},b}(),Luca.Observer.enableObservers=function(a){return a==null&&(a={}),Luca.enableGlobalObserver=!0,Luca.ViewObserver=new Luca.Observer(_.extend(a,{type:"view"})),Luca.CollectionObserver=new Luca.Observer(_.extend(a,{type:"collection"}))}}.call(this),function(){var a,b,c,d=Array.prototype.slice;c=Luca.register("Luca.View"),c["extends"]("Backbone.View"),c.includes("Luca.Events","Luca.modules.DomHelpers"),c.mixesIn("DomHelpers","Templating","EnhancedProperties","CollectionEventBindings","ApplicationEventBindings","StateModel"),c.triggers("before:initialize","after:initialize","before:render","after:render","first:activation","activation","deactivation"),c.defines({initialize:function(b){return this.options=b!=null?b:{},this.trigger("before:initialize",this,this.options),_.extend(this,this.options),(this.autoBindEventHandlers===!0||this.bindAllEvents===!0)&&a.call(this),this.name!=null&&(this.cid=_.uniqueId(this.name)),this.$el.attr("data-luca-id",this.name||this.cid),Luca.cacheInstance(this.cid,this),this.setupHooks(_(Luca.View.prototype.hooks.concat(this.hooks)).uniq()),this.setupMixins(),this.delegateEvents(),this.trigger("after:initialize",this)},setupMixins:function(){var a,b,c,d,e,f,g,h;if(((d=this.mixins)!=null?d.length:void 0)>0){e=this.mixins,h=[];for(b=0,c=e.length;b<c;b++)a=e[b],h.push((f=Luca.mixin(a))!=null?(g=f.__initializer)!=null?g.call(this,this,a):void 0:void 0);return h}},setupHooks:function(a){var b=this;return a||(a=this.hooks),_(a).each(function(a){var c,d;d=Luca.util.hook(a),c=function(){var a;return(a=this[d])!=null?a.apply(this,arguments):void 0};if(a!=null?a.match(/once:/):void 0)c=_.once(c);return b.on(a,c,b)})},registerEvent:function(a,b){return this.events||(this.events={}),this.events[a]=b,this.delegateEvents()},definitionClass:function(){var a;return(a=Luca.util.resolve(this.displayName,window))!=null?a.prototype:void 0},collections:function(){return Luca.util.selectProperties(Luca.isBackboneCollection,this)},models:function(){return Luca.util.selectProperties(Luca.isBackboneModel,this)},views:function(){return Luca.util.selectProperties(Luca.isBackboneView,this)},debug:function(){var a;a=1<=arguments.length?d.call(arguments,0):[];if(!this.debugMode&&window.LucaDebugMode==null)return;return console.log([this.name||this.cid].concat(d.call(a)))},trigger:function(){return Luca.enableGlobalObserver&&(Luca.developmentMode===!0||this.observeEvents===!0)&&(Luca.ViewObserver||(Luca.ViewObserver=new Luca.Observer({type:"view"})),Luca.ViewObserver.relay(this,arguments)),Backbone.View.prototype.trigger.apply(this,arguments)}}),Luca.View._originalExtend=Backbone.View.extend,Luca.View.renderWrapper=function(a){var b;return b=a.render,b||(b=Luca.View.prototype.$attach),a.render=function(){var a,d,e,f,g,h=this;return c=this,this.deferrable?(f=this.deferrable_target,Luca.isBackboneCollection(this.deferrable)||(this.deferrable=this.collection),f||(f=this.deferrable),g=this.deferrable_event?this.deferrable_event:Luca.View.deferrableEvent,d=function(){return b.call(c),c.trigger("after:render",c)},c.defer(d).until(f,g),c.trigger("before:render",this),a=this.deferrable_trigger||this.deferUntil,a==null?f[this.deferrable_method||"fetch"].call(f):(e=_.once(function(){var a,b;return typeof (a=h.deferrable)[b=h.deferrable_method||"fetch"]=="function"?a[b]():void 0}),(this.deferrable_target||this).bind(this.deferrable_trigger,e)),this):(this.trigger("before:render",this),b.apply(this,arguments),this.trigger("after:render",this),this)},a},a=function(){var a,c,d,e,f;e=[this.events,this.componentEvents,this.collectionEvents,this.applicationEvents],f=[];for(c=0,d=e.length;c<d;c++)a=e[c],_.isEmpty(a)||f.push(b.call(this,a));return f},b=function(a){var b,c,d;a==null&&(a={}),d=[];for(b in a)c=a[b],_.isString(c)?d.push(_.bindAll(this,c)):d.push(void 0);return d},Luca.View.extend=function(a){var b,c,d,e;a=Luca.View.renderWrapper(a);if(a.mixins!=null&&_.isArray(a.mixins)){e=a.mixins;for(c=0,d=e.length;c<d;c++)b=e[c],Luca.decorate(a)["with"](b)}return Luca.View._originalExtend.call(this,a)},Luca.View.deferrableEvent="reset"}.call(this),function(){var a,b;a=Luca.define("Luca.Model"),a["extends"]("Backbone.Model"),a.includes("Luca.Events"),a.defines({initialize:function(){return Backbone.Model.prototype.initialize(this,arguments),b.call(this)},read:function(a){return _.isFunction(this[a])?this[a].call(this):this.get(a)},get:function(a){var b;return((b=this.computed)!=null?b.hasOwnProperty(a):void 0)?this._computed[a]:Backbone.Model.prototype.get.call(this,a)}}),b=function(){var a,b,c,d,e=this;if(_.isUndefined(this.computed))return;this._computed={},c=this.computed,d=[];for(a in c)b=c[a],this.on("change:"+a,function(){return e._computed[a]=e[a].call(e)}),_.isString(b)&&(b=b.split(",")),d.push(_(b).each(function(b){e.on("change:"+b,function(){return e.trigger("change:"+a)});if(e.has(b))return e.trigger("change:"+a)}));return d}}.call(this),function(){var a;a=Luca.define("Luca.Collection"),Backbone.QueryCollection!=null?a["extends"]("Backbone.QueryCollection"):a["extends"]("Backbone.Collection"),a.includes("Luca.Events"),a.defines({model:Luca.Model,cachedMethods:[],remoteFilter:!1,initialize:function(a,b){var c,d=this;a==null&&(a=[]),this.options=b,_.extend(this,this.options),this.setupMethodCaching(),this._reset(),this.cached&&console.log("The @cached property of Luca.Collection is being deprecated. Please change to cache_key");if(this.cache_key||(this.cache_key=this.cached))this.bootstrap_cache_key=_.isFunction(this.cache_key)?this.cache_key():this.cache_key;(this.registerAs||this.registerWith)&&console.log("This configuration API is deprecated. use @name and @manager properties instead"),this.name||(this.name=this.registerAs),this.manager||(this.manager=this.registerWith),this.manager=_.isFunction(this.manager)?this.manager():this.manager,this.name&&!this.manager&&(this.manager=Luca.CollectionManager.get()),this.manager&&(this.name||(this.name=this.cache_key()),this.name=_.isFunction(this.name)?this.name():this.name,!this.private&&!this.anonymous&&this.bind("after:initialize",function(){return d.register(d.manager,d.name,d)}));if(this.useLocalStorage===!0&&window.localStorage!=null)throw c=this.bootstrap_cache_key||this.name,"Must specify either a cached or registerAs property to use localStorage";return _.isArray(this.data)&&this.data.length>0&&(this.memoryCollection=!0),this.useNormalUrl!==!0&&this.__wrapUrl(),Backbone.Collection.prototype.initialize.apply(this,[a,this.options]),a&&this.reset(a,{silent:!0,parse:b!=null?b.parse:void 0}),this.trigger("after:initialize")},__wrapUrl:function(){var a,b,c=this;return _.isFunction(this.url)?this.url=_.wrap(this.url,function(a){var b,d,e,f,g;return g=a.apply(c),e=g.split("?"),e.length>1&&(b=_.last(e)),f=c.queryString(),b&&g.match(b)&&(f=f.replace(b,"")),d=""+g+"?"+f,d.match(/\?$/)&&(d=d.replace(/\?$/,"")),d}):(b=this.url,a=this.queryString(),this.url=_([b,a]).compact().join("?"))},queryString:function(){var a,b=this;return a=_(this.base_params||(this.base_params=Luca.Collection.baseParams())).inject(function(a,b,c){var d;return d=""+c+"="+b,a.push(d),a},[]),_.uniq(a).join("&")},resetFilter:function(){return this.base_params=_(Luca.Collection.baseParams()).clone(),this},applyFilter:function(a,b){return a==null&&(a={}),b==null&&(b={}),b.remote!=null==1||this.remoteFilter===!0?(this.applyParams(a),this.fetch(_.extend(b,{refresh:!0}))):this.reset(this.query(a))},applyParams:function(a){return this.base_params=_(Luca.Collection.baseParams()).clone(),_.extend(this.base_params,a),this},register:function(a,b,c){a==null&&(a=Luca.CollectionManager.get()),b==null&&(b="");if(!(b.length>=1))throw"Can not register with a collection manager without a key";if(a==null)throw"Can not register with a collection manager without a valid collection manager";_.isString(a)&&(a=Luca.util.nestedValue(a,window||global));if(!a)throw"Could not register with collection manager";if(_.isFunction(a.add))return a.add(b,c);if(_.isObject(a))return a[b]=c},loadFromBootstrap:function(){if(!this.bootstrap_cache_key)return;return this.reset(this.cached_models()),this.trigger("bootstrapped",this)},bootstrap:function(){return this.loadFromBootstrap()},cached_models:function(){return Luca.Collection.cache(this.bootstrap_cache_key)},fetch:function(a){var b
|
7
|
-
;a==null&&(a={}),this.trigger("before:fetch",this);if(this.memoryCollection===!0)return this.reset(this.data);if(this.cached_models().length&&!a.refresh)return this.bootstrap();b=_.isFunction(this.url)?this.url():this.url;if(!(b&&b.length>1||this.localStorage))return!0;this.fetching=!0;try{return Backbone.Collection.prototype.fetch.apply(this,arguments)}catch(c){throw console.log("Error in Collection.fetch",c),c}},onceLoaded:function(a,b){var c,d=this;b==null&&(b={autoFetch:!0});if(this.length>0&&!this.fetching){a.apply(this,[this]);return}c=function(){return a.apply(d,[d])},this.bind("reset",function(){return c(),this.unbind("reset",this)});if(!this.fetching&&!!b.autoFetch)return this.fetch()},ifLoaded:function(a,b){var c,d=this;b==null&&(b={scope:this,autoFetch:!0}),c=b.scope||this,this.length>0&&!this.fetching&&a.apply(c,[this]),this.bind("reset",function(b){return a.call(c,b)});if(!(this.fetching===!0||!b.autoFetch||this.length>0))return this.fetch()},parse:function(a){var b;return this.fetching=!1,this.trigger("after:response",a),b=this.root!=null?a[this.root]:a,this.bootstrap_cache_key&&Luca.Collection.cache(this.bootstrap_cache_key,b),b},restoreMethodCache:function(){var a,b,c,d;c=this._methodCache,d=[];for(b in c)a=c[b],a.original!=null?(a.args=void 0,d.push(this[b]=a.original)):d.push(void 0);return d},clearMethodCache:function(a){return this._methodCache[a].value=void 0},clearAllMethodsCache:function(){var a,b,c,d;c=this._methodCache,d=[];for(b in c)a=c[b],d.push(this.clearMethodCache(b));return d},setupMethodCaching:function(){var b,c;return a=this,c=["reset","add","remove"],b=this._methodCache={},_(this.cachedMethods).each(function(d){var e,f,g,h,i,j,k,l,m;b[d]={name:d,original:a[d],value:void 0},a[d]=function(){var c;return(c=b[d]).value||(c.value=b[d].original.apply(a,arguments))};for(h=0,j=c.length;h<j;h++)g=c[h],a.bind(g,function(){return a.clearAllMethodsCache()});e=d.split(":")[1];if(e){l=e.split(","),m=[];for(i=0,k=l.length;i<k;i++)f=l[i],m.push(a.bind("change:"+f,function(){return a.clearMethodCache({method:d})}));return m}})},query:function(a,b){return a==null&&(a={}),b==null&&(b={}),Backbone.QueryCollection!=null?Backbone.QueryCollection.prototype.query.apply(this,arguments):this.models}}),_.extend(Luca.Collection.prototype,{trigger:function(){return Luca.enableGlobalObserver&&(Luca.CollectionObserver||(Luca.CollectionObserver=new Luca.Observer({type:"collection"})),Luca.CollectionObserver.relay(this,arguments)),Backbone.View.prototype.trigger.apply(this,arguments)}}),Luca.Collection.baseParams=function(a){if(a)return Luca.Collection._baseParams=a;if(_.isFunction(Luca.Collection._baseParams))return Luca.Collection._baseParams();if(_.isObject(Luca.Collection._baseParams))return Luca.Collection._baseParams},Luca.Collection._bootstrapped_models={},Luca.Collection.bootstrap=function(a){return _.extend(Luca.Collection._bootstrapped_models,a)},Luca.Collection.cache=function(a,b){return b?Luca.Collection._bootstrapped_models[a]=b:Luca.Collection._bootstrapped_models[a]||[]}}.call(this),function(){var a;a=function(a,b){var c,d,e,f,g;return a==null&&(a={}),a.orientation||(a.orientation="top"),a.ctype||(a.ctype=this.toolbarType||"panel_toolbar"),f=""+this.cid+"-tbc-"+a.orientation,g=Luca.util.lazyComponent(a),d=this.make("div",{"class":"toolbar-container "+a.orientation,id:f},g.render().el),e=this.bodyClassName||this.bodyTagName,c=function(){switch(a.orientation){case"top":case"left":return e?"before":"prepend";case"bottom":case"right":return e?"after":"append"}}(),(b||this.$bodyEl())[c](d)},_.def("Luca.components.Panel")["extends"]("Luca.View")["with"]({topToolbar:void 0,bottomToolbar:void 0,loadMask:!1,loadMaskTemplate:["components/load_mask"],loadMaskTimeout:3e3,mixins:["LoadMaskable"],initialize:function(a){return this.options=a!=null?a:{},Luca.View.prototype.initialize.apply(this,arguments)},applyStyles:function(a,b){var c,d,e;a==null&&(a={}),b==null&&(b=!1),d=b?this.$bodyEl():this.$el;for(c in a)e=a[c],d.css(c,e);return this},beforeRender:function(){var a;return(a=Luca.View.prototype.beforeRender)!=null&&a.apply(this,arguments),this.styles!=null&&this.applyStyles(this.styles),this.bodyStyles!=null&&this.applyStyles(this.bodyStyles,!0),typeof this.renderToolbars=="function"?this.renderToolbars():void 0},$bodyEl:function(){var a,b,c,d;return c=this.bodyTagName||"div",b=this.bodyClassName||"view-body",this.bodyEl||(this.bodyEl=""+c+"."+b),a=this.$(this.bodyEl),a.length>0?a:a.length!==0||this.bodyClassName==null&&this.bodyTagName==null?$(this.el):(d=this.make(c,{"class":b,"data-auto-appended":!0}),$(this.el).append(d),this.$(this.bodyEl))},$wrap:function(a){return _.isString(a)&&!a.match(/[<>]/)&&(a=this.make("div",{"class":a})),this.$el.wrap(a)},$template:function(a,b){return b==null&&(b={}),this.$html(Luca.template(a,b))},$empty:function(){return this.$bodyEl().empty()},$html:function(a){return this.$bodyEl().html(a)},$append:function(a){return this.$bodyEl().append(a)},renderToolbars:function(){var a=this;return _(["top","left","right","bottom"]).each(function(b){var c;if(c=a[""+b+"Toolbar"])return a.renderToolbar(b,c)})},renderToolbar:function(b,c){return b==null&&(b="top"),c==null&&(c={}),c.parent=this,c.orientation=b,a.call(this,c,c.targetEl)}})}.call(this),function(){_.def("Luca.core.Field")["extends"]("Luca.View")["with"]({className:"luca-ui-text-field luca-ui-field",isField:!0,template:"fields/text_field",labelAlign:"top",hooks:["before:validation","after:validation","on:change"],statuses:["warning","error","success"],initialize:function(a){var b;return this.options=a!=null?a:{},_.extend(this,this.options),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.input_class||(this.input_class=""),this.input_type||(this.input_type=""),this.helperText||(this.helperText=""),this.required&&((b=this.label)!=null?!b.match(/^\*/):!void 0)&&(this.label||(this.label="*"+this.label)),this.inputStyles||(this.inputStyles=""),this.input_value||(this.input_value=this.value||""),this.disabled&&this.disable(),this.updateState(this.state),this.placeHolder||(this.placeHolder=""),Luca.View.prototype.initialize.apply(this,arguments)},beforeRender:function(){Luca.enableBootstrap&&this.$el.addClass("control-group");if(this.required)return this.$el.addClass("required")},change_handler:function(a){return this.trigger("on:change",this,a)},disable:function(){return this.getInputElement().attr("disabled",!0)},enable:function(){return this.getInputElement().attr("disabled",!1)},getValue:function(){var a,b;a=(b=this.getInputElement())!=null?b.attr("value"):void 0;if(_.str.isBlank(a))return a;switch(this.valueType){case"integer":return parseInt(a);case"string":return""+a;case"float":return parseFloat(a);default:return a}},setValue:function(a){var b;return(b=this.getInputElement())!=null?b.attr("value",a):void 0},getInputElement:function(){return this.input||(this.input=this.$("input").eq(0))},updateState:function(a){var b=this;return _(this.statuses).each(function(c){return b.$el.removeClass(c),b.$el.addClass(a)})}})}.call(this),function(){var a,b,c,d,e,f,g,h;b=Luca.register("Luca.core.Container"),b["extends"]("Luca.components.Panel"),b.triggers("before:components","before:render:components","before:layout","after:components","after:layout","first:activation"),b.defines({className:"luca-ui-container",componentTag:"div",componentClass:"luca-ui-panel",isContainer:!0,rendered:!1,components:[],componentEvents:{},initialize:function(a){return this.options=a!=null?a:{},_.extend(this,this.options),this.setupHooks(Luca.core.Container.prototype.hooks),this.components||(this.components=this.fields||(this.fields=this.pages||(this.pages=this.cards||(this.cards=this.views)))),h(this),Luca.View.prototype.initialize.apply(this,arguments)},beforeRender:function(){var a;return f.call(this),e.call(this),(a=Luca.components.Panel.prototype.beforeRender)!=null?a.apply(this,arguments):void 0},customizeContainerEl:function(a,b,c){return a},prepareLayout:function(){return b=this,this.componentContainers=_(this.components).map(function(c,d){return a.call(b,c,d)})},prepareComponents:function(){var a,b,c,d,e=this;d=this.components;for(b=0,c=d.length;b<c;b++)a=d[b],_.isString(a)&&(a={type:a});return _(this.components).each(function(a,b){var c,d,f,g;c=d=(g=e.componentContainers)!=null?g[b]:void 0,c["class"]=c["class"]||c.className||c.classes,e.generateComponentElements&&(f=e.make(e.componentTag,d,""),e.$append(f));if(a.container==null)return e.generateComponentElements&&(a.container="#"+d.id),a.container||(a.container=e.$bodyEl())})},createComponents:function(){var a,c=this;if(this.componentsCreated===!0)return;return a=this.componentIndex={name_index:{},cid_index:{},role_index:{}},b=this,this.components=_(this.components).map(function(a,d){var e,f,h;return e=Luca.isComponent(a)?a:(a.type||(a.type=a.ctype),a.type==null?a.components!=null?a.type=a.ctype="container":a.type=a.ctype=Luca.defaultComponentType:void 0,a=_.defaults(a,b.defaults||{}),f=Luca.util.lazyComponent(a)),!e.container&&((h=e.options)!=null?h.container:void 0)&&(e.container=e.options.container),e.container==null&&(console.log(e,d,c),console.error("could not assign container property to component on container "+(c.name||c.cid))),g(e).at(d)["in"](c.componentIndex),e}),this.componentsCreated=!0,a},renderComponents:function(a){return this.debugMode=a!=null?a:"",this.debug("container render components"),b=this,_(this.components).each(function(a){a.getParent=function(){return b};try{return this.$(a.container).eq(0).append(a.el),a.render()}catch(c){console.log("Error Rendering Component "+(a.name||a.cid),a),_.isObject(c)&&(console.log(c.message),console.log(c.stack));if(Luca.silenceRenderErrors!=null!=1)throw c}})},firstActivation:function(){var a;return a=this,this.each(function(b,c){var d;if((b!=null?b.previously_activated:void 0)!==!0)return b!=null&&(d=b.trigger)!=null&&d.call(b,"first:activation",b,a),b.previously_activated=!0})},_:function(){return _(this.components)},pluck:function(a){return this._().pluck(a)},invoke:function(a){return this._().invoke(a)},select:function(a){return this._().select(a)},detect:function(a){return this._().detect(attribute)},reject:function(a){return this._().reject(a)},map:function(a){return this._().map(a)},registerComponentEvents:function(a){var c,d,e,f,g,h,i,j,k=this;b=this,h=a||this.componentEvents||{},j=[];for(g in h){f=h[g],i=g.split(" "),d=i[0],e=i[1];if(!_.isFunction(this[f]))throw console.log("Error registering component event",g,d,e),"Invalid component event definition "+g+". Specified handler is not a method on the container";if(d==="*")j.push(this.eachComponent(function(a){return a.on(e,k[f],b)}));else{c=this.findComponentForEventBinding(d);if(c==null||!Luca.isComponent(c))throw console.log("Error registering component event",g,d,e),"Invalid component event definition: "+d;j.push(c!=null?c.bind(e,this[f],b):void 0)}}return j},subContainers:function(){return this.select(function(a){return a.isContainer===!0})},roles:function(){return _(this.allChildren()).pluck("role")},allChildren:function(){var a,b;return a=this.components,b=_(this.subContainers()).invoke("allChildren"),_([a,b]).chain().compact().flatten().value()},findComponentForEventBinding:function(a,b){return b==null&&(b=!0),this.findComponentByName(a,b)||this.findComponentByGetter(a,b)||this.findComponentByRole(a,b)},findComponentByGetter:function(a,b){return b==null&&(b=!1),_(this.allChildren()).detect(function(b){return b.getter===a})},findComponentByRole:function(a,b){return b==null&&(b=!1),_(this.allChildren()).detect(function(b){return b.role===a||b.type===a||b.ctype===a})},findComponentByName:function(a,b){return b==null&&(b=!1),_(this.allChildren()).detect(function(b){return b.name===a})},findComponentById:function(a,b){return b==null&&(b=!1),this.findComponent(a,"cid_index",b)},findComponent:function(a,b,c){var d,e,f,g;b==null&&(b="name"),c==null&&(c=!1),this.componentsCreated!==!0&&this.createComponents(),e=(g=this.componentIndex)!=null?g[b][a]:void 0,d=this.components[e];if(d)return d;if(c===!0)return f=_(this.components).detect(function(c){return c!=null?typeof c.findComponent=="function"?c.findComponent(a,b,!0):void 0:void 0}),f!=null?typeof f.findComponent=="function"?f.findComponent(a,b,!0):void 0:void 0},each:function(a){return this.eachComponent(a,!1)},eachComponent:function(a,b){var c=this;return b==null&&(b=!0),_(this.components).each(function(c,d){var e;a.call(c,c,d);if(b)return c!=null?(e=c.eachComponent)!=null?e.apply(c,[a,b]):void 0:void 0})},indexOf:function(a){var b;return b=_(this.components).pluck("name"),_(b).indexOf(a)},activeComponent:function(){return this.activeItem?this.components[this.activeItem]:this},componentElements:function(){return this.$("[data-luca-parent='"+(this.name||this.cid)+"']")},getComponent:function(a){return this.components[a]},isRootComponent:function(){return this.getParent==null},getRootComponent:function(){return this.isRootComponent()?this:this.getParent().getRootComponent()},selectByAttribute:function(a,b,c){var d;return b==null&&(b=void 0),c==null&&(c=!1),d=_(this.components).map(function(d){var e,f;return e=[],f=d[a],(f===b||b==null&&f!=null)&&e.push(d),c===!0&&e.push(typeof d.selectByAttribute=="function"?d.selectByAttribute(a,b,!0):void 0),_.compact(e)}),_.flatten(d)}}),Luca.core.Container.componentRenderer=function(a,b){var c;return c=$(b.container)[b.attachWith||"append"],c(b.render().el)},f=function(){return this.trigger("before:layout",this),this.prepareLayout(),this.trigger("after:layout",this)},a=function(a,b){var c,d;return d=[],a.height!=null&&d.push("height: "+(_.isNumber(a.height)?a.height+"px":a.height)),a.width!=null&&d.push("width: "+(_.isNumber(a.width)?a.width+"px":a.width)),a.float&&d.push("float: "+a.float),c={"class":(a!=null?a.classes:void 0)||this.componentClass,id:""+this.cid+"-"+b,style:d.join(";"),"data-luca-parent":this.name||this.cid},this.customizeContainerEl!=null&&(c=this.customizeContainerEl(c,a,b)),c},c=function(){var a;return b=this,a=_(this.allChildren()).select(function(a){return a.getter!=null}),_(a).each(function(a){var c;return b[c=a.getter]||(b[c]=function(){return console.log(a.getter,a,b),a})})},d=function(){var a;return b=this,a=_(this.allChildren()).select(function(a){return a.role!=null}),_(a).each(function(a){var c;return c=_.str.camelize("get_"+a.role),b[c]||(b[c]=function(){return a})})},e=function(){return this.trigger("before:components",this,this.components),this.prepareComponents(),this.createComponents(),this.trigger("before:render:components",this,this.components),this.renderComponents(),this.trigger("after:components",this,this.components),this.skipGetterMethods!==!0&&(c.call(this),d.call(this)),this.registerComponentEvents()},h=function(){return!0},g=function(a){return{at:function(b){return{"in":function(c){a.cid!=null&&(c.cid_index[a.cid]=b),a.role!=null&&(c.role_index[a.role]=b);if(a.name!=null)return c.name_index[a.name]=b}}}}}}.call(this),function(){var a,b,c;Luca.CollectionManager=function(){function c(a){var c,d,e,f;this.options=a!=null?a:{},_.extend(this,this.options),d=this;if(c=typeof (e=Luca.CollectionManager).get=="function"?e.get(this.name):void 0)throw"Attempt to create a collection manager with a name which already exists";(f=Luca.CollectionManager).instances||(f.instances={}),_.extend(this,Backbone.Events),_.extend(this,Luca.Events),Luca.CollectionManager.instances[this.name]=d,Luca.CollectionManager.get=function(a){return a==null?d:Luca.CollectionManager.instances[a]},this.state=new Luca.Model,this.initialCollections&&b.call(this)}return c.prototype.name="primary",c.prototype.collectionNamespace=Luca.Collection.namespace,c.prototype.__collections={},c.prototype.relayEvents=!0,c.prototype.add=function(a,b){var c;return(c=this.currentScope())[a]||(c[a]=b)},c.prototype.allCollections=function(){return _(this.currentScope()).values()},c.prototype.create=function(b,c,d){var e,f,g;c==null&&(c={}),d==null&&(d=[]),e=c.base,e||(e=a.call(this,b)),c.private&&(c.name="");try{f=new e(d,c)}catch(h){throw console.log("Error creating collection",e,c,b),h}return this.add(b,f),g=this,this.relayEvents===!0&&this.bind("*",function(){return console.log("Relay Events on Collection Manager *",f,arguments)}),f},c.prototype.currentScope=function(){var a,b;return(a=this.getScope())?(b=this.__collections)[a]||(b[a]={}):this.__collections},c.prototype.each=function(a){return _(this.all()).each(a)},c.prototype.get=function(a){return this.currentScope()[a]},c.prototype.getScope=function(){return},c.prototype.destroy=function(a){var b;return b=this.get(a),delete this.currentScope()[a],b},c.prototype.getOrCreate=function(a,b,c){return b==null&&(b={}),c==null&&(c=[]),this.get(a)||this.create(a,b,c,!1)},c.prototype.collectionCountDidChange=function(){if(this.allCollectionsLoaded())return this.trigger("all_collections_loaded"),this.trigger("initial:load")},c.prototype.allCollectionsLoaded=function(){return this.totalCollectionsCount()===this.loadedCollectionsCount()},c.prototype.totalCollectionsCount=function(){return this.state.get("collections_count")},c.prototype.loadedCollectionsCount=function(){return this.state.get("loaded_collections_count")},c.prototype.private=function(a,b,c){return b==null&&(b={}),c==null&&(c=[]),this.create(a,b,c,!0)},c}(),Luca.CollectionManager.isRunning=function(){return _.isEmpty(Luca.CollectionManager.instances)!==!0},Luca.CollectionManager.destroyAll=function(){return Luca.CollectionManager.instances={}},Luca.CollectionManager.loadCollectionsByName=function(a,b){var c,d,e,f,g;g=[];for(e=0,f=a.length;e<f;e++)d=a[e],c=this.getOrCreate(d),c.once("reset",function(){return b(c)}),g.push(c.fetch());return g},a=function(a){var b,c,d,e;return b=Luca.util.classify(a),c=(this.collectionNamespace||window||global)[b],c||(c=(this.collectionNamespace||window||global)[""+b+"Collection"]),c==null&&((e=Luca.Collection.namespaces)!=null?e.length:void 0)>0&&(d=_(Luca.Collection.namespaces.reverse()).map(function(a){return Luca.util.resolve(""+a+"."+b)||Luca.util.resolve(""+a+"."+b+"Collection")}),d=_(d).compact(),d.length>0&&(c=d[0])),c},c=function(){var a,b,c=this;return a=function(a){var b;return b=c.state.get("loaded_collections_count"),c.state.set("loaded_collections_count",b+1),c.trigger("collection_loaded",a.name),a.unbind("reset")},b=this.initialCollections,Luca.CollectionManager.loadCollectionsByName.call(this,b,a)},b=function(){var a=this;return this.state.set({loaded_collections_count:0,collections_count:this.initialCollections.length}),this.state.bind("change:loaded_collections_count",function(){return a.collectionCountDidChange()}),this.useProgressLoader&&(this.loaderView||(this.loaderView=new Luca.components.CollectionLoaderView({manager:this,name:"collection_loader_view"}))),c.call(this),this.initialCollectionsLoadedu,this}}.call(this),function(){Luca.SocketManager=function(){function a(a){this.options=a!=null?a:{},_.extend(Backbone.Events),this.loadTransport()}return a.prototype.connect=function(){switch(this.options.provider){case"socket.io":return this.socket=io.connect(this.options.socket_host);case"faye.js":return this.socket=new Faye.Client(this.options.socket_host)}},a.prototype.transportLoaded=function(){return this.connect()},a.prototype.transport_script=function(){switch(this.options.provider){case"socket.io":return""+this.options.transport_host+"/socket.io/socket.io.js";case"faye.js":return""+this.options.transport_host+"/faye.js"}},a.prototype.loadTransport=function(){var a,b=this;return a=document.createElement("script"),a.setAttribute("type","text/javascript"),a.setAttribute("src",this.transport_script()),a.onload=this.transportLoaded,Luca.util.isIE()&&(a.onreadystatechange=function(){if(a.readyState==="loaded")return b.transportLoaded()}),document.getElementsByTagName("head")[0].appendChild(a)},a}()}.call(this),function(){_.def("Luca.containers.SplitView")["extends"]("Luca.core.Container")["with"]({componentType:"split_view",containerTemplate:"containers/basic",className:"luca-ui-split-view",componentClass:"luca-ui-panel"})}.call(this),function(){_.def("Luca.containers.ColumnView")["extends"]("Luca.core.Container")["with"]({componentType:"column_view",className:"luca-ui-column-view",components:[],initialize:function(a){return this.options=a!=null?a:{},console.log("Column Views are deprecated in favor of just using grid css on a normal container"),Luca.core.Container.prototype.initialize.apply(this,arguments),this.setColumnWidths()},componentClass:"luca-ui-column",containerTemplate:"containers/basic",generateComponentElements:!0,autoColumnWidths:function(){var a,b=this;return a=[],_(this.components.length).times(function(){return a.push(parseInt(100/b.components.length))}),a},setColumnWidths:function(){return this.columnWidths=this.layout!=null?_(this.layout.split("/")).map(function(a){return parseInt(a)}):this.autoColumnWidths(),this.columnWidths=_(this.columnWidths).map(function(a){return""+a+"%"})},beforeLayout:function(){var a,b=this;return this.debug("column_view before layout"),_(this.columnWidths).each(function(a,c){return b.components[c].float="left",b.components[c].width=a}),(a=Luca.core.Container.prototype.beforeLayout)!=null?a.apply(this,arguments):void 0}})}.call(this),function(){var a;a=Luca.define("Luca.containers.CardView"),a["extends"]("Luca.core.Container"),a.defaults({className:"luca-ui-card-view-wrapper",activeCard:0,components:[],hooks:["before:card:switch","after:card:switch"],componentClass:"luca-ui-card",generateComponentElements:!0,initialize:function(a){return this.options=a,Luca.core.Container.prototype.initialize.apply(this,arguments),this.setupHooks(this.hooks),this.components||(this.components=this.pages||(this.pages=this.cards))},prepareComponents:function(){var a;return(a=Luca.core.Container.prototype.prepareComponents)!=null&&a.apply(this,arguments),this.componentElements().hide(),this.activeComponentElement().show()},activeComponentElement:function(){return this.componentElements().eq(this.activeCard)},activeComponent:function(){return this.getComponent(this.activeCard)},customizeContainerEl:function(a,b,c){return a.style+=c===this.activeCard?"display:block;":"display:none;",a},atFirst:function(){return this.activeCard===0},atLast:function(){return this.activeCard===this.components.length-1},next:function(){if(this.atLast())return;return this.activate(this.activeCard+1)},previous:function(){if(this.atFirst())return;return this.activate(this.activeCard-1)},cycle:function(){var a;return a=this.atLast()?0:this.activeCard+1,this.activate(a)},find:function(a){return Luca(a)},firstActivation:function(){return this.activeComponent().trigger("first:activation",this,this.activeComponent())},activate:function(a,b,c){var d,e,f,g,h,i,j=this;b==null&&(b=!1),_.isFunction(b)&&(b=!1,c=b);if(a===this.activeCard)return;e=this.activeComponent(),d=this.getComponent(a),d||(a=this.indexOf(a),d=this.getComponent(a));if(!d)return;b||(this.trigger("before:card:switch",e,d),e!=null&&(f=e.trigger)!=null&&f.apply(e,["before:deactivation",this,e,d]),d!=null&&(g=d.trigger)!=null&&g.apply(e,["before:activation",this,e,d]),_.defer(function(){return j.$el.data(j.activeAttribute||"active-card",d.name)})),this.componentElements().hide(),d.previously_activated||(d.trigger("first:activation"),d.previously_activated=!0),this.activeCard=a,this.activeComponentElement().show(),b||(this.trigger("after:card:switch",e,d),(h=e.trigger)!=null&&h.apply(e,["deactivation",this,e,d]),(i=d.trigger)!=null&&i.apply(d,["activation",this,e,d]));if(_.isFunction(c))return c.apply(this,[this,e,d])}})}.call(this),function(){_.def("Luca.ModalView")["extends"]("Luca.core.Container")["with"]({closeOnEscape:!0,showOnInitialize:!1,backdrop:!1,className:"luca-ui-container modal",container:function(){return $("body")},toggle:function(){return this.$el.modal("toggle")},show:function(){return this.$el.modal("show")},hide:function(){return this.$el.modal("hide")},render:function(){return this.$el.addClass("modal"),this.fade===!0&&this.$el.addClass("fade"),$("body").append(this.$el),this.$el.modal({backdrop:this.backdrop===!0,keyboard:this.closeOnEscape===!0,show:this.showOnInitialize===!0}),this}}),_.def("Luca.containers.ModalView")["extends"]("Luca.ModalView")["with"]()}.call(this),function(){_.def("Luca.PageView")["extends"]("Luca.containers.CardView")["with"]({version:2})}.call(this),function(){var a,b,c,d;c=Luca.register("Luca.components.PanelToolbar"),c["extends"]("Luca.View"),c.defines({buttons:[],className:"luca-ui-toolbar btn-toolbar",well:!0,orientation:"top",autoBindEventHandlers:!0,events:{"click a.btn, click .dropdown-menu li":"clickHandler"},initialize:function(a){var b;this.options=a!=null?a:{},this._super("initialize",this,arguments);if(this.group===!0&&((b=this.buttons)!=null?b.length:void 0)>=0)return this.buttons=[{group:!0,buttons:this.buttons}]},clickHandler:function(a){var b,c,d,e,f;d=e=$(a.target),d.is("i")&&(d=e=$(a.target).parent()),this.selectable===!0&&(e.siblings().removeClass("is-selected"),d.addClass("is-selected"));if(!(b=e.data("eventid")))return;return c=Luca.util.hook(b),f=this.parent||this,_.isFunction(f[c])?f[c].call(this,d,a):f.trigger(b,d,a)},beforeRender:function(){this._super("beforeRender",this,arguments),this.well===!0&&this.$el.addClass("well"),this.selectable===!0&&this.$el.addClass("btn-selectable"),this.$el.addClass("toolbar-"+this.orientation),this.align==="right"&&this.$el.addClass("pull-right");if(this.align==="left")return this.$el.addClass("pull-left")},render:function(){var a,b,c,e;this.$el.empty(),e=d(this.buttons);for(b=0,c=e.length;b<c;b++)a=e[b],this.$el.append(a);return this}}),b=Backbone.View.prototype.make,a=function(a,c){var e,f,g,h,i,j,k,l,m,n,o=this;c==null&&(c=!0);if(a.ctype!=null||a.type!=null){a.className||(a.className=""),a.className+="toolbar-component",l=Luca(a).render();if(Luca.isBackboneView(l))return l.$el}return a.spacer?b("div",{"class":"spacer "+a.spacer}):a.text?b("div",{"class":"toolbar-text"},a.text):(n="btn-group",a.wrapper!=null&&(n+=""+a.wrapper),a.align!=null&&(n+="pull-"+a.align+" align-"+a.align),a.selectable===!0&&(n+="btn-selectable"),a.group!=null&&a.buttons!=null?(h=d(a.buttons,!1),b("div",{"class":n},h)):(k=a.label||(a.label=""),a.eventId||(a.eventId=_.string.dasherize(a.label.toLowerCase())),a.icon&&(_.string.isBlank(k)&&(k=" "),a.white&&(m="icon-white"),k="<i class='"+(m||"")+" icon-"+a.icon+"' /> "+k),f={"class":_.compact(["btn",a.classes,a.className]).join(" "),"data-eventId":a.eventId,title:a.title||a.description},a.color!=null&&(f["class"]+=" btn-"+a.color),a.selected!=null&&(f["class"]+=" is-selected"),a.dropdown&&(k=""+k+" <span class='caret'></span>",f["class"]+=" dropdown-toggle",f["data-toggle"]="dropdown",j=_(a.dropdown).map(function(a){var c;return c=b("a",{},a[1]),b("li",{"data-eventId":a[0]},c)}),i=b("ul",{"class":"dropdown-menu"},j)),g=b("a",f,k),e="btn-group",a.align!=null&&(e+=" align-"+a.align),c===!0?b("div",{"class":e},[g,i]):g))},d=function(b,c){var d,e,f,g;b==null&&(b=[]),c==null&&(c=!0),g=[];for(e=0,f=b.length;e<f;e++)d=b[e],g.push(a(d,c));return g}}.call(this),function(){_.def("Luca.containers.PanelView")["extends"]("Luca.core.Container")["with"]({className:"luca-ui-panel",initialize:function(a){return this.options=a!=null?a:{},Luca.core.Container.prototype.initialize.apply(this,arguments)},afterLayout:function(){var a;if(this.template)return a=(Luca.templates||JST)[this.template](this),this.$el.html(a)},render:function(){return $(this.container).append(this.$el)},afterRender:function(){var a,b=this;(a=Luca.core.Container.prototype.afterRender)!=null&&a.apply(this,arguments);if(this.css)return _(this.css).each(function(a,c){return b.$el.css(c,a)})}})}.call(this),function(){_.def("Luca.containers.TabView")["extends"]("Luca.containers.CardView")["with"]({hooks:["before:select","after:select"],componentType:"tab_view",className:"luca-ui-tab-view tabbable",tab_position:"top",tabVerticalOffset:"50px",navClass:"nav-tabs",bodyTemplate:"containers/tab_view",bodyEl:"div.tab-content",initialize:function(a){return this.options=a!=null?a:{},this.navStyle==="list"&&(this.navClass="nav-list"),Luca.containers.CardView.prototype.initialize.apply(this,arguments),_.bindAll(this,"select","highlightSelectedTab"),this.setupHooks(this.hooks),this.bind("after:card:switch",this.highlightSelectedTab)},activeTabSelector:function(){return this.tabSelectors().eq(this.activeCard||this.activeTab||this.activeItem)},beforeLayout:function(){var a;return this.$el.addClass("tabs-"+this.tab_position),this.activeTabSelector().addClass("active"),this.createTabSelectors(),(a=Luca.containers.CardView.prototype.beforeLayout)!=null?a.apply(this,arguments):void 0},afterRender:function(){var a,b;(b=Luca.containers.CardView.prototype.afterRender)!=null&&b.apply(this,arguments),a=this.tabContainer().attr("id"),this.registerEvent("click #"+a+" li a","select");if(Luca.enableBootstrap&&(this.tab_position==="left"||this.tab_position==="right"))return this.tabContainerWrapper().addClass("span2"),this.tabContentWrapper().addClass("span9")},createTabSelectors:function(){var a;return a=this,this.each(function(b,c){var d,e,f,g;b.tabIcon&&(d="<i class='icon-"+b.tabIcon+"'></i>"),e="<a href='#'>"+(d||"")+" "+b.title+"</a>",f=a.make("li",{"class":"tab-selector","data-target":c},e),a.tabContainer().append(f);if(b.navHeading!=null&&((g=a.navHeadings)!=null?!g[b.navHeading]:!void 0))return $(f).before(a.make("li",{"class":"nav-header"},b.navHeading)),a.navHeadings||(a.navHeadings={}),a.navHeadings[b.navHeading]=!0})},highlightSelectedTab:function(){return this.tabSelectors().removeClass("active"),this.activeTabSelector().addClass("active")},select:function(a){var b,c;return a.preventDefault(),b=c=$(a.target),this.trigger("before:select",this),this.activate(c.parent().data("target")),this.trigger("after:select",this)},componentElements:function(){return this.$(">.tab-content >."+this.componentClass)},tabContentWrapper:function(){return $("#"+this.cid+"-tab-view-content")},tabContainerWrapper:function(){return $("#"+this.cid+"-tabs-selector")},tabContainer:function(){return this.$("ul."+this.navClass,this.tabContainerWrapper())},tabSelectors:function(){return this.$("li.tab-selector",this.tabContainer())}})}.call(this),function(){_.def("Luca.containers.Viewport").extend("Luca.containers.CardView")["with"]({activeItem:0,additionalClassNames:"luca-ui-viewport",fullscreen:!0,fluid:!1,initialize:function(a){this.options=a!=null?a:{},_.extend(this,this.options),Luca.enableBootstrap===!0&&(this.wrapperClass=this.fluid===!0?Luca.containers.Viewport.fluidWrapperClass:Luca.containers.Viewport.defaultWrapperClass),Luca.core.Container.prototype.initialize.apply(this,arguments);if(this.fullscreen===!0)return this.enableFullscreen()},enableFluid:function(){return this.enableWrapper()},disableFluid:function(){return this.disableWrapper()},enableWrapper:function(){if(this.wrapperClass!=null)return this.$el.parent().addClass(this.wrapperClass)},disableWrapper:function(){if(this.wrapperClass!=null)return this.$el.parent().removeClass(this.wrapperClass)},enableFullscreen:function(){return $("html,body").addClass("luca-ui-fullscreen"),this.$el.addClass("fullscreen-enabled")},disableFullscreen:function(){return $("html,body").removeClass("luca-ui-fullscreen"),this.$el.removeClass("fullscreen-enabled")},beforeRender:function(){var a;(a=Luca.containers.CardView.prototype.beforeRender)!=null&&a.apply(this,arguments),this.topNav!=null&&this.renderTopNavigation();if(this.bottomNav!=null)return this.renderBottomNavigation()},height:function(){return this.$el.height()},width:function(){return this.$el.width()},afterRender:function(){var a;(a=Luca.containers.CardView.prototype.after)!=null&&a.apply(this,arguments);if(Luca.enableBootstrap===!0&&this.containerClassName)return this.$el.children().wrap('<div class="#{ containerClassName }" />')},renderTopNavigation:function(){var a;if(this.topNav==null)return;return _.isString(this.topNav)&&(this.topNav=Luca.util.lazyComponent(this.topNav)),_.isObject(this.topNav)&&((a=this.topNav).ctype||(a.ctype=this.topNav.type||"nav_bar"),Luca.isBackboneView(this.topNav)||(this.topNav=Luca.util.lazyComponent(this.topNav))),this.topNav.app=this,$("body").prepend(this.topNav.render().el)},renderBottomNavigation:function(){}}),Luca.containers.Viewport.defaultWrapperClass="row",Luca.containers.Viewport.fluidWrapperClass="row-fluid"}.call(this),function(){_.def("Luca.components.Template")["extends"]("Luca.View")["with"]({initialize:function(a){return this.options=a!=null?a:{},console.log("The Use of Luca.components.Template directly is being DEPRECATED"),Luca.View.prototype.initialize.apply(this,arguments)}})}.call
|
8
|
-
(this),function(){Luca.util.startHistory=function(){return Backbone.history.start()},_.def("Luca.Application")["extends"]("Luca.containers.Viewport")["with"]({name:"MyApp",defaultState:{},autoBoot:!1,autoStartHistory:"before:render",useCollectionManager:!0,collectionManager:{},collectionManagerClass:"Luca.CollectionManager",plugin:!1,useController:!0,useKeyHandler:!1,keyEvents:{},components:[{ctype:"template",name:"welcome",template:"sample/welcome",templateContainer:"Luca.templates"}],initialize:function(a){var b,c,d,e,f=this;this.options=a!=null?a:{},c=this,d=this.name,b=typeof Luca.getApplication=="function"?Luca.getApplication():void 0,(e=Luca.Application).instances||(e.instances={}),Luca.Application.instances[d]=c,Luca.containers.Viewport.prototype.initialize.apply(this,arguments),this.state=new Luca.Model(this.defaultState),this.useController===!0&&this.setupMainController(),this.setupCollectionManager(),this.defer(function(){return c.render()}).until(this,"ready"),this.setupRouter(),this.useKeyRouter===!0&&console.log("The useKeyRouter property is being deprecated. switch to useKeyHandler instead"),(this.useKeyHandler===!0||this.useKeyRouter===!0)&&this.keyEvents!=null&&this.setupKeyHandler(),this.plugin!==!0&&!b&&(Luca.getApplication=function(a){return a==null?c:Luca.Application.instances[a]});if(this.autoBoot){if(Luca.util.resolve(this.name))throw"Attempting to override window."+this.name+" when it already exists";return $(function(){return window[d]=c,c.boot()})}},activeView:function(){var a;return(a=this.activeSubSection())?this.view(a):this.view(this.activeSection())},activeSection:function(){return this.get("active_section")},activeSubSection:function(){return this.get("active_sub_section")},activePages:function(){var a=this;return this.$(".luca-ui-controller").map(function(a,b){return $(b).data("active-section")})},boot:function(){return this.trigger("ready")},collection:function(){return this.collectionManager.getOrCreate.apply(this.collectionManager,arguments)},get:function(a){return this.state.get(a)},set:function(a,b,c){return this.state.set.apply(this.state,arguments)},view:function(a){return Luca.cache(a)},navigate_to:function(a,b){return this.getMainController().navigate_to(a,b)},getMainController:function(){return this.useController===!0?this.components[0]:Luca.cache("main_controller")},keyHandler:function(a){var b,c,d,e,f,g,h;if(!a||!this.keyEvents)return;c=$(a.target).is("input")||$(a.target).is("textarea");if(c)return;e=Luca.keyMap[a.keyCode];if(!e)return;f=(a!=null?a.metaKey:void 0)===!0,b=(a!=null?a.ctrlKey:void 0)===!0,g=this.keyEvents,g=f?this.keyEvents.meta:g,g=b?this.keyEvents.control:g,g=f&&b?this.keyEvents.meta_control:g;if(d=g!=null?g[e]:void 0)return this[d]!=null&&_.isFunction(this[d])?(h=this[d])!=null?h.call(this):void 0:this.trigger(d,a,e)},setupControllerBindings:function(){var a,b,c,d=this;return a=this,(b=this.getMainController())!=null&&b.bind("after:card:switch",function(b,c){return d.state.set({active_section:c.name}),a.trigger("page:change")}),(c=this.getMainController())!=null?c.each(function(b){var c;c=b.type||b.type;if(c.match(/controller$/))return b.bind("after:card:switch",function(b,c){return d.state.set({active_sub_section:c.name}),a.trigger("sub:page:change")})}):void 0},setupMainController:function(){var a;if(this.useController===!0)return a=this.components||[],this.components=[{type:"controller",name:"main_controller",components:a}],this.defer(this.setupControllerBindings,!1).until("after:components")},setupCollectionManager:function(){var a,b,c,d,e;if(this.useCollectionManager!==!0)return;if(this.collectionManager!=null&&((c=this.collectionManager)!=null?c.get:void 0)!=null)return;_.isString(this.collectionManagerClass)&&(this.collectionManagerClass=Luca.util.resolve(this.collectionManagerClass)),a=this.collectionManagerOptions||{},_.isObject(this.collectionManager)&&!_.isFunction((d=this.collectionManager)!=null?d.get:void 0)&&(a=this.collectionManager,this.collectionManager=void 0),_.isString(this.collectionManager)&&(a={name:this.collectionManager}),this.collectionManager=typeof (b=Luca.CollectionManager).get=="function"?b.get(a.name):void 0;if(!_.isFunction((e=this.collectionManager)!=null?e.get:void 0))return this.collectionManager=new this.collectionManagerClass(a)},setupRouter:function(){var a,b;a=this,_.isString(this.router)&&(b=Luca.util.resolve(this.router),this.router=new b({app:a}));if(this.router&&this.autoStartHistory)return this.autoStartHistory===!0&&(this.autoStartHistory="before:render"),this.defer(Luca.util.startHistory,!1).until(this,this.autoStartHistory)},setupKeyHandler:function(){var a,b,c,d,e,f,g;if(!this.keyEvents)return;(c=this.keyEvents).control_meta||(c.control_meta={}),this.keyEvents.meta_control&&_.extend(this.keyEvents.control_meta,this.keyEvents.meta_control),a=_.bind(this.keyHandler,this),f=this.keypressEvents||["keydown"],g=[];for(d=0,e=f.length;d<e;d++)b=f[d],g.push($(document).on(b,a));return g}})}.call(this),function(){_.def("Luca.components.Toolbar")["extends"]("Luca.core.Container")["with"]({className:"luca-ui-toolbar toolbar",position:"bottom",initialize:function(a){return this.options=a!=null?a:{},Luca.core.Container.prototype.initialize.apply(this,arguments)},prepareComponents:function(){var a=this;return _(this.components).each(function(b){return b.container=a.$el})},render:function(){return $(this.container).append(this.el)}})}.call(this),function(){_.def("Luca.components.CollectionLoaderView")["extends"]("Luca.components.Template")["with"]({className:"luca-ui-collection-loader-view",template:"components/collection_loader_view",initialize:function(a){return this.options=a!=null?a:{},Luca.components.Template.prototype.initialize.apply(this,arguments),this.container||(this.container=$("body")),this.manager||(this.manager=Luca.CollectionManager.get()),this.setupBindings()},modalContainer:function(){return $("#progress-modal",this.el)},setupBindings:function(){var a=this;return this.manager.bind("collection_loaded",function(b){var c,d,e,f;return d=a.manager.loadedCollectionsCount(),f=a.manager.totalCollectionsCount(),e=parseInt(d/f*100),c=_.string.titleize(_.string.humanize(b)),a.modalContainer().find(".progress .bar").attr("style","width: "+e+"%;"),a.modalContainer().find(".message").html("Loaded "+c+"...")}),this.manager.bind("all_collections_loaded",function(){return a.modalContainer().find(".message").html("All done!"),_.delay(function(){return a.modalContainer().modal("hide")},400)})}})}.call(this),function(){var a,b;a=Luca.define("Luca.components.CollectionView"),a["extends"]("Luca.components.Panel"),a.behavesAs("LoadMaskable","Filterable","Paginatable"),a.triggers("before:refresh","after:refresh","refresh","empty:results"),a.defaults({tagName:"ol",className:"luca-ui-collection-view",bodyClassName:"collection-ui-panel",itemTemplate:void 0,itemRenderer:void 0,itemTagName:"li",itemClassName:"collection-item",initialize:function(a){var b=this;this.options=a!=null?a:{},_.extend(this,this.options),_.bindAll(this,"refresh");if(this.collection==null&&!this.options.collection)throw console.log("Error on initialize of collection view",this),"Collection Views must specify a collection";if(this.itemTemplate==null&&this.itemRenderer==null&&this.itemProperty==null)throw"Collection Views must specify an item template or item renderer function";_.isString(this.collection)&&(Luca.CollectionManager.get()?this.collection=Luca.CollectionManager.get().getOrCreate(this.collection):console.log("String Collection but no collection manager"));if(!Luca.isBackboneCollection(this.collection))throw console.log("Missing Collection on "+(this.name||this.cid),this,this.collection),"Collection Views must have a valid backbone collection";return Luca.components.Panel.prototype.initialize.apply(this,arguments),this.autoRefreshOnModelsPresent!==!1&&this.defer(function(){if(b.collection.length>0)return b.refresh()}).until("after:render"),this.on("refresh",this.refresh,this)},attributesForItem:function(a,b){return _.extend({},{"class":this.itemClassName,"data-index":a.index,"data-model-id":a.model.get("id")})},contentForItem:function(a){var b,c;return a==null&&(a={}),this.itemTemplate!=null&&(c=Luca.template(this.itemTemplate))?b=c.call(this,a):this.itemRenderer!=null&&_.isFunction(this.itemRenderer)?b=this.itemRenderer.call(this,a,a.model,a.index):this.itemProperty&&a.model!=null?b=a.model.read(this.itemProperty):""},makeItem:function(a,c){var d,e,f;f=this.prepareItem!=null?this.prepareItem.call(this,a,c):{model:a,index:c},d=this.attributesForItem(f,a),e=this.contentForItem(f);try{return b(this.itemTagName,d,e)}catch(g){return console.log("Error generating DOM element for CollectionView",this,a,c)}},getCollection:function(){return this.collection},applyQuery:function(a,b){return a==null&&(a={}),b==null&&(b={}),this.query=a,this.queryOptions=b,this.refresh(),this},getQuery:function(){var a,b,c,d,e;a=this.query||(this.query={}),e=_(this.querySources||[]).compact();for(c=0,d=e.length;c<d;c++)b=e[c],a=_.extend(a,b()||{});return a},getQueryOptions:function(){var a,b,c,d,e;b=this.queryOptions||(this.queryOptions={}),e=_(this.optionsSources||[]).compact();for(c=0,d=e.length;c<d;c++)a=e[c],b=_.extend(b,a()||{});return b},getModels:function(a,b){var c;return((c=this.collection)!=null?c.query:void 0)?(a||(a=this.getQuery()),b||(b=this.getQueryOptions()),this.collection.query(a,b)):this.collection.models},locateItemElement:function(a){return this.$("."+this.itemClassName+"[data-model-id='"+a+"']")},refreshModel:function(a){var b;return b=this.collection.indexOf(a),this.locateItemElement(a.get("id")).empty().append(this.contentForItem({model:a,index:b},a)),this.trigger("model:refreshed",b,a)},refresh:function(a,b,c){var d,e,f,g;a||(a=this.getQuery()),b||(b=this.getQueryOptions()),c||(c=this.getModels(a,b)),this.$bodyEl().empty(),this.trigger("before:refresh",c,a,b),c.length===0&&this.trigger("empty:results"),d=0;for(f=0,g=c.length;f<g;f++)e=c[f],this.$append(this.makeItem(e,d++));return this.trigger("after:refresh",c,a,b),this},registerEvent:function(a,b,c){var d;return c==null&&_.isFunction(b)&&(c=b,b=void 0),d=_([a,""+this.itemTagName+"."+this.itemClassName,b]).compact().join(" "),Luca.View.prototype.registerEvent(d,c)},render:function(){return this.refresh(),this.$el.parent().length>0&&this.container!=null&&this.$attach(),this}}),b=Luca.View.prototype.make}.call(this),function(){_.def("Luca.components.Controller")["extends"]("Luca.containers.CardView")["with"]({additionalClassNames:["luca-ui-controller"],activeAttribute:"active-section",initialize:function(a){var b;this.options=a,Luca.containers.CardView.prototype.initialize.apply(this,arguments),this.defaultCard||(this.defaultCard=(b=this.components[0])!=null?b.name:void 0);if(!this.defaultCard)throw"Controllers must specify a defaultCard property and/or the first component must have a name";return this.state=new Backbone.Model({active_section:this.defaultCard})},each:function(a){var b=this;return _(this.components).each(function(c){return a.apply(b,[c])})},activeSection:function(){return this.get("activeSection")},controllers:function(a){return a==null&&(a=!1),this.select("ctype","controller",a)},availableSections:function(){var a,b=this;return a={},a[this.name]=this.sectionNames(),_(this.controllers()).reduce(function(a,b){return a[b.name]=b.sectionNames(),a},a)},sectionNames:function(a){return a==null&&(a=!1),this.pluck("name")},"default":function(a){return this.navigate_to(this.defaultCard,a)},navigate_to:function(a,b){var c=this;return a||(a=this.defaultCard),this.activate(a,!1,function(a,d,e){c.state.set({active_section:e.name});if(_.isFunction(b))return b.apply(e)}),this.find(a)}})}.call(this),function(){_.def("Luca.fields.ButtonField")["extends"]("Luca.core.Field")["with"]({readOnly:!0,events:{"click input":"click_handler"},hooks:["button:click"],className:"luca-ui-field luca-ui-button-field",template:"fields/button_field",click_handler:function(a){var b,c;return b=c=$(a.currentTarget),this.trigger("button:click")},initialize:function(a){var b;this.options=a!=null?a:{},_.extend(this.options),_.bindAll(this,"click_handler"),Luca.core.Field.prototype.initialize.apply(this,arguments);if((b=this.icon_class)!=null?b.length:void 0)return this.template="fields/button_field_link"},afterInitialize:function(){this.input_id||(this.input_id=_.uniqueId("button")),this.input_name||(this.input_name=this.name||(this.name=this.input_id)),this.input_value||(this.input_value=this.label||(this.label=this.text)),this.input_type||(this.input_type="button"),this.input_class||(this.input_class=this["class"]),this.icon_class||(this.icon_class=""),this.icon_class.length&&!this.icon_class.match(/^icon-/)&&(this.icon_class="icon-"+this.icon_class);if(this.white)return this.icon_class+=" icon-white"},setValue:function(){return!0}})}.call(this),function(){var a;a=Luca.View.prototype.make,_.def("Luca.fields.CheckboxArray")["extends"]("Luca.core.Field")["with"]({version:2,template:"fields/checkbox_array",className:"luca-ui-checkbox-array",events:{"click input":"clickHandler"},selectedItems:[],initialize:function(a){return this.options=a!=null?a:{},_.extend(this,this.options),_.extend(this,Luca.modules.Deferrable),_.bindAll(this,"renderCheckboxes","clickHandler","checkSelected"),Luca.core.Field.prototype.initialize.apply(this,arguments),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.valueField||(this.valueField="id"),this.displayField||(this.displayField="name")},afterInitialize:function(a){var b;this.options=a!=null?a:{};try{this.configure_collection()}catch(c){console.log("Error Configuring Collection",this,c.message)}return b=this,this.collection.length>0?this.renderCheckboxes():this.defer("renderCheckboxes").until(this.collection,"reset")},clickHandler:function(a){var b;b=$(a.target);if(b.prop("checked"))return this.selectedItems.push(b.val());if(_(this.selectedItems).include(b.val()))return this.selectedItems=_(this.selectedItems).without(b.val())},controls:function(){return this.$(".controls")},renderCheckboxes:function(){var b=this;return this.controls().empty(),this.selectedItems=[],this.collection.each(function(c){var d,e,f,g,h;return h=c.get(b.valueField),g=c.get(b.displayField),f=_.uniqueId(""+b.cid+"_checkbox"),e=a("input",{type:"checkbox","class":"array-checkbox",name:b.input_name,value:h,id:f}),d=a("label",{"for":f},e),$(d).append(" "+g),b.controls().append(d)}),this.trigger("checkboxes:rendered",this.checkboxesRendered=!0),this},uncheckAll:function(){return this.allFields().prop("checked",!1)},allFields:function(){return this.controls().find("input[type='checkbox']")},checkSelected:function(a){var b,c,d,e,f;a!=null&&(this.selectedItems=a),this.uncheckAll(),f=this.selectedItems;for(d=0,e=f.length;d<e;d++)c=f[d],b=this.controls().find("input[value='"+c+"']"),b.prop("checked",!0);return this.selectedItems},getValue:function(){var a,b,c,d,e;d=this.allFields(),e=[];for(b=0,c=d.length;b<c;b++)a=d[b],this.$(a).prop("checked")&&e.push(this.$(a).val());return e},setValue:function(a){var b;return this.selectedItems=a,this.checkboxesRendered===!0?this.checkSelected(a):(b=this,this.defer(function(){return b.checkSelected(a)}).until("checkboxes:rendered"))},getValues:function(){return this.getValue()},setValues:function(a){return this.setValue(a)}})}.call(this),function(){_.def("Luca.fields.CheckboxField")["extends"]("Luca.core.Field")["with"]({events:{"change input":"change_handler"},className:"luca-ui-checkbox-field luca-ui-field",template:"fields/checkbox_field",hooks:["checked","unchecked"],send_blanks:!0,change_handler:function(a){var b,c;return b=c=$(a.target),b.is(":checked")?this.trigger("checked"):this.trigger("unchecked"),this.trigger("on:change",this,a,b.is(":checked"))},initialize:function(a){return this.options=a!=null?a:{},_.extend(this,this.options),_.bindAll(this,"change_handler"),Luca.core.Field.prototype.initialize.apply(this,arguments)},afterInitialize:function(){return this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.input_value||(this.input_value=1),this.label||(this.label=this.name)},setValue:function(a){return this.getInputElement().attr("checked",a)},getValue:function(){return this.getInputElement().is(":checked")}})}.call(this),function(){_.def("Luca.fields.FileUploadField")["extends"]("Luca.core.Field")["with"]({template:"fields/file_upload_field",afterInitialize:function(){return this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.helperText||(this.helperText="")}})}.call(this),function(){_.def("Luca.fields.HiddenField")["extends"]("Luca.core.Field")["with"]({template:"fields/hidden_field",afterInitialize:function(){return this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.input_value||(this.input_value=this.value),this.label||(this.label=this.name)}})}.call(this),function(){_.def("Luca.components.LabelField")["extends"]("Luca.core.Field")["with"]({className:"luca-ui-field luca-ui-label-field",formatter:function(a){return a||(a=this.getValue()),_.str.titleize(a)},setValue:function(a){return this.trigger("change",a,this.getValue()),this.getInputElement().attr("value",a),this.$(".value").html(this.formatter(a))}})}.call(this),function(){_.def("Luca.fields.SelectField")["extends"]("Luca.core.Field")["with"]({events:{"change select":"change_handler"},hooks:["after:select"],className:"luca-ui-select-field luca-ui-field",template:"fields/select_field",includeBlank:!0,blankValue:"",blankText:"Select One",initialize:function(a){this.options=a!=null?a:{},_.extend(this,this.options),_.extend(this,Luca.modules.Deferrable),_.bindAll(this,"change_handler","populateOptions","beforeFetch"),Luca.core.Field.prototype.initialize.apply(this,arguments),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name);if(_.isUndefined(this.retainValue))return this.retainValue=!0},afterInitialize:function(){var a;if((a=this.collection)!=null?a.data:void 0)this.valueField||(this.valueField="id"),this.displayField||(this.displayField="name"),this.parseData();try{this.configure_collection()}catch(b){console.log("Error Configuring Collection",this,b.message)}return this.collection.bind("before:fetch",this.beforeFetch),this.collection.bind("reset",this.populateOptions)},parseData:function(){var a=this;return this.collection.data=_(this.collection.data).map(function(b){var c;return _.isArray(b)?(c={},c[a.valueField]=b[0],c[a.displayField]=b[1]||b[0],c):b})},getInputElement:function(){return this.input||(this.input=this.$("select").eq(0))},afterRender:function(){var a,b;return((a=this.collection)!=null?(b=a.models)!=null?b.length:void 0:void 0)>0?this.populateOptions():this.collection.trigger("reset")},setValue:function(a){return this.currentValue=a,Luca.core.Field.prototype.setValue.apply(this,arguments)},beforeFetch:function(){return this.resetOptions()},change_handler:function(a){return this.trigger("on:change",this,a)},resetOptions:function(){this.getInputElement().html("");if(this.includeBlank)return this.getInputElement().append("<option value='"+this.blankValue+"'>"+this.blankText+"</option>")},populateOptions:function(){var a,b=this;return this.resetOptions(),((a=this.collection)!=null?a.each:void 0)!=null&&this.collection.each(function(a){var c,d,e,f;return f=a.get(b.valueField),c=a.get(b.displayField),b.selected&&f===b.selected&&(e="selected"),d="<option "+e+" value='"+f+"'>"+c+"</option>",b.getInputElement().append(d)}),this.trigger("after:populate:options",this),this.setValue(this.currentValue)}})}.call(this),function(){_.def("Luca.fields.TextAreaField")["extends"]("Luca.core.Field")["with"]({events:{"keydown input":"keydown_handler","blur input":"blur_handler","focus input":"focus_handler"},template:"fields/text_area_field",height:"200px",width:"90%",initialize:function(a){return this.options=a!=null?a:{},_.bindAll(this,"keydown_handler"),Luca.core.Field.prototype.initialize.apply(this,arguments),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.input_class||(this.input_class=this["class"]),this.input_value||(this.input_value=""),this.inputStyles||(this.inputStyles="height:"+this.height+";width:"+this.width)},setValue:function(a){return $(this.field()).val(a)},getValue:function(){return $(this.field()).val()},field:function(){return this.input=$("textarea#"+this.input_id,this.el)},keydown_handler:function(a){var b,c;return b=c=$(a.currentTarget)},blur_handler:function(a){var b,c;return b=c=$(a.currentTarget)},focus_handler:function(a){var b,c;return b=c=$(a.currentTarget)}})}.call(this),function(){_.def("Luca.fields.TextField")["extends"]("Luca.core.Field")["with"]({events:{"blur input":"blur_handler","focus input":"focus_handler","change input":"change_handler"},template:"fields/text_field",autoBindEventHandlers:!0,send_blanks:!0,keyEventThrottle:300,initialize:function(a){return this.options=a!=null?a:{},this.enableKeyEvents&&this.registerEvent("keyup input","keyup_handler"),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.input_class||(this.input_class=this["class"]),this.input_value||(this.input_value=this.value||""),this.prepend&&(this.$el.addClass("input-prepend"),this.addOn=this.prepend),this.append&&(this.$el.addClass("input-append"),this.addOn=this.append),Luca.core.Field.prototype.initialize.apply(this,arguments)},keyup_handler:function(a){return this.trigger("on:keyup",this,a)},blur_handler:function(a){return this.trigger("on:blur",this,a)},focus_handler:function(a){return this.trigger("on:focus",this,a)},change_handler:function(a){return this.trigger("on:change",this,a)}})}.call(this),function(){_.def("Luca.fields.TypeAheadField")["extends"]("Luca.fields.TextField")["with"]({className:"luca-ui-field",getSource:function(){return Luca.util.read(this.source)||[]},matcher:function(a){return!0},beforeRender:function(){return Luca.fields.TextField.prototype.beforeRender.apply(this,arguments),this.getInputElement().attr("data-provide","typeahead")},afterRender:function(){return Luca.fields.TextField.prototype.afterRender.apply(this,arguments),this.getInputElement().typeahead({matcher:this.matcher,source:this.getSource()})}})}.call(this),function(){_.def("Luca.components.FormButtonToolbar")["extends"]("Luca.components.Toolbar")["with"]({className:"luca-ui-form-toolbar form-actions",position:"bottom",includeReset:!1,render:function(){return $(this.container).append(this.el)},initialize:function(a){this.options=a!=null?a:{},Luca.components.Toolbar.prototype.initialize.apply(this,arguments),this.components=[{ctype:"button_field",label:"Submit","class":"btn submit-button"}];if(this.includeReset)return this.components.push({ctype:"button_field",label:"Reset","class":"btn reset-button"})}})}.call(this),function(){_.def("Luca.components.FormView")["extends"]("Luca.core.Container")["with"]({tagName:"form",className:"luca-ui-form-view",hooks:["before:submit","before:reset","before:load","before:load:new","before:load:existing","after:submit","after:reset","after:load","after:load:new","after:load:existing","after:submit:success","after:submit:fatal_error","after:submit:error"],events:{"click .submit-button":"submitHandler","click .reset-button":"resetHandler"},toolbar:!0,legend:"",bodyClassName:"form-view-body",version:"0.9.33333333",initialize:function(a){this.options=a!=null?a:{},this.loadMask==null&&(this.loadMask=Luca.enableBootstrap),Luca.core.Container.prototype.initialize.apply(this,arguments),this.components||(this.components=this.fields),_.bindAll(this,"submitHandler","resetHandler","renderToolbars","applyLoadMask"),this.state||(this.state=new Backbone.Model),this.setupHooks(this.hooks),this.applyStyleClasses();if(this.toolbar!==!1&&!this.topToolbar&&!this.bottomToolbar){if(this.toolbar==="both"||this.toolbar==="top")this.topToolbar=this.getDefaultToolbar();if(this.toolbar!=="top")return this.bottomToolbar=this.getDefaultToolbar()}},getDefaultToolbar:function(){return Luca.components.FormView.defaultFormViewToolbar},applyStyleClasses:function(){Luca.enableBootstrap&&this.applyBootstrapStyleClasses(),this.labelAlign&&this.$el.addClass("label-align-"+this.labelAlign);if(this.fieldLayoutClass)return this.$el.addClass(this.fieldLayoutClass)},applyBootstrapStyleClasses:function(){this.labelAlign==="left"&&(this.inlineForm=!0),this.well&&this.$el.addClass("well"),this.searchForm&&this.$el.addClass("form-search"),this.horizontalForm&&this.$el.addClass("form-horizontal");if(this.inlineForm)return this.$el.addClass("form-inline")},resetHandler:function(a){var b,c;return b=c=$(a!=null?a.target:void 0),this.trigger("before:reset",this),this.reset(),this.trigger("after:reset",this)},submitHandler:function(a){var b,c;b=c=$(a!=null?a.target:void 0),this.trigger("before:submit",this),this.loadMask===!0&&this.trigger("enable:loadmask",this);if(this.hasModel())return this.submit()},afterComponents:function(){var a,b=this;return(a=Luca.core.Container.prototype.afterComponents)!=null&&a.apply(this,arguments),this.eachField(function(a){return a.getForm=function(){return b},a.getModel=function(){return b.currentModel()}})},eachField:function(a){return _(this.getFields()).map(a)},getField:function(a){var b;return b=_(this.getFields("name",a)).first(),b!=null?b:_(this.getFields("input_name",a)).first()},getFields:function(a,b){var c;return c=this.selectByAttribute("isField",!0,!0),a!=null&&b!=null&&(c=_(c).select(function(c){var d;return d=c[a],_.isFunction(d)&&(d=d.call(c)),d===b})),c},loadModel:function(a){var b,c,d,e;this.current_model=a,d=this,c=this.getFields(),this.trigger("before:load",this,this.current_model),this.current_model&&((e=this.current_model.beforeFormLoad)!=null&&e.apply(this.current_model,this),b="before:load:"+(this.current_model.isNew()?"new":"existing"),this.trigger(b,this,this.current_model)),this.setValues(this.current_model),this.trigger("after:load",this,this.current_model);if(this.current_model)return this.trigger("after:load:"+(this.current_model.isNew()?"new":"existing"),this,this.current_model)},reset:function(){if(this.current_model!=null)return this.loadModel(this.current_model)},clear:function(){var a=this;return this.current_model=this.defaultModel!=null?this.defaultModel():void 0,_(this.getFields()).each(function(b){try{return b.setValue("")}catch(c){return console.log("Error Clearing",a,b)}})},setValues:function(a,b){var c,d=this;b==null&&(b={}),a||(a=this.currentModel()),c=this.getFields(),_(c).each(function(b){var c,e;c=b.input_name||b.name,(e=a[c])&&_.isFunction(e)&&(e=e.apply(d)),!e&&Luca.isBackboneModel(a)&&(e=a.get(c));if(b.readOnly!==!0)return b!=null?b.setValue(e):void 0});if(b.silent!=null!=1)return this.syncFormWithModel()},getValues:function(a){var b,c=this;return a==null&&(a={}),a.reject_blank==null&&(a.reject_blank=!0),a.skip_buttons==null&&(a.skip_buttons=!0),a.blanks===!1&&(a.reject_blank=!0),b=_(this.getFields()).inject(function(b,c){var d,e,f,g,h;return g=c.getValue(),e=c.input_name||c.name,h=!!_.str.isBlank(g)||!!_.isUndefined(g),d=!a.reject_blank&&!c.send_blanks,a.debug&&console.log(""+e+" Options",a,"Value",g,"Value Is Blank?",h,"Allow Blanks?",d),a.skip_buttons&&c.ctype==="button_field"?f=!0:(h&&d===!1&&(f=!0),c.input_name==="id"&&h===!0&&(f=!0)),a.debug&&console.log("Skip is true on "+e),f!==!0&&(b[e]=g),b},a.defaults||{}),b},submit_success_handler:function(a,b,c){return this.trigger("after:submit",this,a,b),this.loadMask===!0&&this.trigger("disable:loadmask",this),b&&(b!=null?b.success:void 0)===!0?this.trigger("after:submit:success",this,a,b):this.trigger("after:submit:error",this,a,b)},submit_fatal_error_handler:function(a,b,c){return this.trigger("after:submit",this,a,b),this.trigger("after:submit:fatal_error",this,a,b)},submit:function(a,b){a==null&&(a=!0),b==null&&(b={}),_.bindAll(this,"submit_success_handler","submit_fatal_error_handler"),b.success||(b.success=this.submit_success_handler),b.error||(b.error=this.submit_fatal_error_handler),this.syncFormWithModel();if(!a)return;return this.current_model.save(this.current_model.toJSON(),b)},hasModel:function(){return this.current_model!=null},currentModel:function(a){return a==null&&(a={}),(a===!0||(a!=null?a.refresh:void 0)===!0)&&this.syncFormWithModel(),this.current_model},syncFormWithModel:function(){var a;return(a=this.current_model)!=null?a.set(this.getValues()):void 0},setLegend:function(a){return this.legend=a,$("fieldset legend",this.el).first().html(this.legend)},flash:function(a){return this.$(".toolbar-container.top").length>0?this.$(".toolbar-container.top").after(a):this.$bodyEl().prepend(a)},successFlashDelay:1500,successMessage:function(a){var b=this;return this.$(".alert.alert-success").remove(),this.flash(Luca.template("components/form_alert",{className:"alert alert-success",message:a})),_.delay(function(){return b.$(".alert.alert-success").fadeOut()},this.successFlashDelay||0)},errorMessage:function(a){return this.$(".alert.alert-error").remove(),this.flash(Luca.template("components/form_alert",{className:"alert alert-error",message:a}))}}),Luca.components.FormView.defaultFormViewToolbar={buttons:[{icon:"remove-sign",label:"Reset",eventId:"click:reset",className:"reset-button",align:"right"},{icon:"ok-sign",white:!0,label:"Save Changes",eventId:"click:submit",color:"success",className:"submit-button",align:"right"}]}}.call(this),function(){_.def("Luca.components.GridView").extend("Luca.components.Panel")["with"]({bodyTemplate:"components/grid_view",autoBindEventHandlers:!0,events:{"dblclick table tbody tr":"double_click_handler","click table tbody tr":"click_handler"},className:"luca-ui-g-view",rowClass:"luca-ui-g-row",wrapperClass:"luca-ui-g-view-wrapper",additionalWrapperClasses:[],wrapperStyles:{},scrollable:!0,emptyText:"No Results To display.",tableStyle:"striped",defaultHeight:285,defaultWidth:756,maxWidth:void 0,hooks:["before:grid:render","before:render:header","before:render:row","after:grid:render","row:double:click","row:click","after:collection:load"],initialize:function(a){var b=this;return this.options=a!=null?a:{},_.extend(this,this.options),_.extend(this,Luca.modules.Deferrable),this.loadMask==null&&(this.loadMask=Luca.enableBootstrap),this.loadMask===!0&&(this.loadMaskEl||(this.loadMaskEl=".luca-ui-g-view-body")),Luca.components.Panel.prototype.initialize.apply(this,arguments),this.configure_collection(!0),this.collection.bind("before:fetch",function(){if(b.loadMask===!0)return b.trigger("enable:loadmask")}),this.collection.bind("reset",function(a){return b.refresh(),b.loadMask===!0&&b.trigger("disable:loadmask"),b.trigger("after:collection:load",a)}),this.collection.bind("change",function(a){var c,d;if(b.rendered!==!0)return;try{return d=b.getRowEl(a.id||a.get("id")||a.cid),c=b.render_row(a,b.collection.indexOf(a),{cellsOnly:!0}),$(d).html(c.join(" "))}catch(e){return console.log("Error in change handler for GridView.collection",e,b,a)}})},beforeRender:function(){var a;return(a=Luca.components.Panel.prototype.beforeRender)!=null&&a.apply(this,arguments),this.trigger("before:grid:render",this),this.table=this.$("table.luca-ui-g-view"),this.header=this.$("thead"),this.body=this.$("tbody"),this.footer=this.$("tfoot"),this.wrapper=this.$("."+this.wrapperClass),this.applyCssClasses(),this.scrollable&&this.setDimensions(),this.renderHeader(),this.emptyMessage(),$(this.container).append(this.$el)},afterRender:function(){var a;return(a=Luca.components.Panel.prototype.afterRender)!=null&&a.apply(this,arguments),this.rendered=!0,this.refresh(),this.trigger("after:grid:render",this)},applyCssClasses:function(){var a,b=this;return this.scrollable&&this.$el.addClass("scrollable-g-view"),_(this.additionalWrapperClasses).each(function(a){var c;return(c=b.wrapper)!=null?c.addClass(a):void 0}),Luca.enableBootstrap&&this.table.addClass("table"),_((a=this.tableStyle)!=null?a.split(" "):void 0).each(function(a){return b.table.addClass("table-"+a)})},setDimensions:function(a){var b=this;return this.height||(this.height=this.defaultHeight),this.$(".luca-ui-g-view-body").height(this.height),this.$("tbody.scrollable").height(this.height-23),this.container_width=function(){return $(b.container).width()}(),this.width||(this.width=this.container_width>0?this.container_width:this.defaultWidth),this.width=_([this.width,this.maxWidth||this.width]).max(),this.$(".luca-ui-g-view-body").width(this.width),this.$(".luca-ui-g-view-body table"
|
9
|
-
).width(this.width),this.setDefaultColumnWidths()},resize:function(a){var b,c,d=this;b=a-this.width,this.width=a,this.$(".luca-ui-g-view-body").width(this.width),this.$(".luca-ui-g-view-body table").width(this.width);if(this.columns.length>0)return c=b/this.columns.length,_(this.columns).each(function(a,b){var e;return e=$(".column-"+b,d.el),e.width(a.width=a.width+c)})},padLastColumn:function(){var a,b;a=_(this.columns).inject(function(a,b){return a=b.width+a},0),b=this.width-a;if(b>0)return this.lastColumn().width+=b},setDefaultColumnWidths:function(){var a;return a=this.columns.length>0?this.width/this.columns.length:200,_(this.columns).each(function(b){return parseInt(b.width||(b.width=a))}),this.padLastColumn()},lastColumn:function(){return this.columns[this.columns.length-1]},emptyMessage:function(a){return a==null&&(a=""),a||(a=this.emptyText),this.body.html(""),this.body.append(Luca.templates["components/grid_view_empty_text"]({colspan:this.columns.length,text:a}))},refresh:function(){var a=this;this.body.html(""),this.collection.each(function(b,c){return a.render_row.apply(a,[b,c])});if(this.collection.models.length===0)return this.emptyMessage()},ifLoaded:function(a,b){return b||(b=this),a||(a=function(){return!0}),this.collection.ifLoaded(a,b)},applyFilter:function(a,b){return b==null&&(b={auto:!0,refresh:!0}),this.collection.applyFilter(a,b)},renderHeader:function(){var a,b=this;return this.trigger("before:render:header"),a=_(this.columns).map(function(a,b){var c;return c=a.width?"width:"+a.width+"px;":"","<th style='"+c+"' class='column-"+b+"'>"+a.header+"</th>"}),this.header.append("<tr>"+a+"</tr>")},getRowEl:function(a){return this.$("[data-record-id="+a+"]","table")},render_row:function(a,b,c){var d,e,f,g,h,i,j=this;return c==null&&(c={}),h=this.rowClass,g=(a!=null?a.get:void 0)&&(a!=null?a.attributes:void 0)?a.get("id"):"",this.trigger("before:render:row",a,b),e=_(this.columns).map(function(b,c){var d,e,f;return f=j.cell_renderer(a,b,c),e=b.width?"width:"+b.width+"px;":"",d=_.isUndefined(f)?"":f,"<td style='"+e+"' class='column-"+c+"'>"+d+"</td>"}),c.cellsOnly?e:(d="",this.alternateRowClasses&&(d=b%2===0?"even":"odd"),f="<tr data-record-id='"+g+"' data-row-index='"+b+"' class='"+h+" "+d+"' id='row-"+b+"'>"+e+"</tr>",c.contentOnly===!0?f:(i=this.body)!=null?i.append(f):void 0)},cell_renderer:function(a,b,c){var d;return _.isFunction(b.renderer)?b.renderer.apply(this,[a,b,c]):b.data.match(/\w+\.\w+/)?(d=a.attributes||a,Luca.util.nestedValue(b.data,d)):(typeof a.get=="function"?a.get(b.data):void 0)||a[b.data]},double_click_handler:function(a){var b,c,d,e;return b=c=$(a.currentTarget),e=c.data("row-index"),d=this.collection.at(e),this.trigger("row:double:click",this,d,e)},click_handler:function(a){var b,c,d,e;return b=c=$(a.currentTarget),e=c.data("row-index"),d=this.collection.at(e),this.trigger("row:click",this,d,e),$("."+this.rowClass,this.body).removeClass("selected-row"),b.addClass("selected-row")}})}.call(this),function(){_.def("Luca.components.LoadMask")["extends"]("Luca.View")["with"]({className:"luca-ui-load-mask",bodyTemplate:"components/load_mask"})}.call(this),function(){var a,b,c;a=Luca.define("Luca.components.MultiCollectionView"),a["extends"]("Luca.containers.CardView"),a.behavesAs("LoadMaskable","Filterable","Paginatable"),a.triggers("before:refresh","after:refresh","refresh","empty:results"),a.defaultsTo({version:1,stateful:!0,defaultState:{activeView:0},viewContainerClass:"luca-ui-multi-view-container",initialize:function(a){var d,e,f,g;this.options=a!=null?a:{},this.components||(this.components=this.views),g=this.components;for(e=0,f=g.length;e<f;e++)d=g[e],c(d);return this.on("refresh",this.refresh,this),this.on("after:card:switch",this.refresh,this),this.on("after:components",b,this),this.debug("multi collection , proto initialize"),Luca.containers.CardView.prototype.initialize.apply(this,arguments)},relayAfterRefresh:function(a,b,c){return this.trigger("after:refresh",a,b,c)},refresh:function(){var a;return(a=this.activeComponent())!=null?a.trigger("refresh"):void 0},getCollection:function(){return this.collection},applyQuery:function(a,b){return a==null&&(a={}),b==null&&(b={}),this.query=a,this.queryOptions=b,this},getQuery:function(){var a,b,c,d,e;this.debug("Get Query"),a=this.query||(this.query={}),e=this.querySources;for(c=0,d=e.length;c<d;c++)b=e[c],a=_.extend(a,b()||{});return a},getQueryOptions:function(){var a,b,c,d,e;this.debug("Get Query Options"),b=this.queryOptions||(this.queryOptions={}),e=this.optionsSources;for(c=0,d=e.length;c<d;c++)a=e[c],b=_.extend(b,a()||{});return b}}),b=function(){var a,b,c,d,e,f,g=this;b=this,e=this.components,f=[];for(c=0,d=e.length;c<d;c++)a=e[c],a.on("after:refresh",function(a,b,c){return g.debug("collection member after refresh"),g.trigger("after:refresh",a,b,c)}),f.push(_.extend(a,{collection:b.getCollection(),getQuery:function(){return b.getQuery.call(b)},getQueryOptions:function(){return b.getQueryOptions.call(b)}}));return f},c=function(a){var b;b=a.type||a.ctype;if(b==="collection"||b==="collection_view"||b==="table"||b==="table_view")return;throw"The MultiCollectionView expects to contain multiple collection views"}}.call(this),function(){_.def("Luca.components.NavBar")["extends"]("Luca.View")["with"]({fixed:!0,position:"top",className:"navbar",brand:"Luca.js",bodyTemplate:"nav_bar",bodyClassName:"luca-ui-navbar-body",beforeRender:function(){this.fixed&&this.$el.addClass("navbar-fixed-"+this.position),this.brand!=null&&this.content().append("<a class='brand' href='#'>"+this.brand+"</a>");if(this.template)return this.content().append(Luca.template(this.template,this))},render:function(){return this},content:function(){return this.$(".container").eq(0)}})}.call(this),function(){_.def("Luca.PageController")["extends"]("Luca.components.Controller")["with"]({version:2})}.call(this),function(){var a;a=Luca.register("Luca.components.PaginationControl"),a["extends"]("Luca.View"),a.defines({template:"components/pagination",stateful:!0,autoBindEventHandlers:!0,events:{"click a[data-page-number]":"selectPage","click a.next":"nextPage","click a.prev":"previousPage"},afterInitialize:function(){var a=this;return _.bindAll(this,"updateWithPageCount"),this.state.on("change",function(b,c){return a.updateWithPageCount(b.get("numberOfPages"))})},limit:function(){var a;return parseInt(this.state.get("limit")||((a=this.collection)!=null?a.length:void 0))},page:function(){return parseInt(this.state.get("page")||1)},nextPage:function(){if(!this.nextEnabled())return;return this.state.set("page",this.page()+1)},previousPage:function(){if(!this.previousEnabled())return;return this.state.set("page",this.page()-1)},selectPage:function(a){var b,c;return b=c=this.$(a.target),b.is("a.page")||(b=c=c.closest("a.page")),c.siblings().removeClass("is-selected"),b.addClass("is-selected"),this.setPage(c.data("page-number"))},setPage:function(a,b){return a==null&&(a=1),b==null&&(b={}),this.state.set("page",a,b)},setLimit:function(a,b){return a==null&&(a=1),b==null&&(b={}),this.state.set("limit",a,b)},pageButtonContainer:function(){return this.$(".group")},previousEnabled:function(){return this.page()>1},nextEnabled:function(){return this.page()<this.totalPages()},previousButton:function(){return this.$("a.page.prev")},nextButton:function(){return this.$("a.page.next")},pageButtons:function(){return this.$("a[data-page-number]",this.pageButtonContainer())},updateWithPageCount:function(a,b){var c,d=this;return this.pageCount=a,b==null&&(b=[]),c=b.length,console.log("Update With Page Count",this.pageCount,c),this.pageButtonContainer().empty(),_(this.pageCount).times(function(a){var b,c;return c=a+1,b=d.make("a",{"data-page-number":c,"class":"page"},c),d.pageButtonContainer().append(b)}),this.toggleNavigationButtons(),this.selectActivePageButton(),this},toggleNavigationButtons:function(){this.$("a.next, a.prev").addClass("disabled"),this.nextEnabled()&&this.nextButton().removeClass("disabled");if(this.previousEnabled())return this.previousButton().removeClass("disabled")},selectActivePageButton:function(){return this.activePageButton().addClass("is-selected")},activePageButton:function(){return this.pageButtons().filter("[data-page-number='"+this.page()+"']")},totalPages:function(){return this.pageCount},totalItems:function(){var a;return parseInt(((a=this.collection)!=null?a.length:void 0)||0)},itemsPerPage:function(a,b){return b==null&&(b={}),a!=null&&this.state.set("limit",a,b),parseInt(this.state.get("limit"))}})}.call(this),function(){_.def("Luca.components.RecordManager")["extends"]("Luca.containers.CardView")["with"]({events:{"click .record-manager-grid .edit-link":"edit_handler","click .record-manager-filter .filter-button":"filter_handler","click .record-manager-filter .reset-button":"reset_filter_handler","click .add-button":"add_handler","click .refresh-button":"filter_handler","click .back-to-search-button":"back_to_search_handler"},record_manager:!0,initialize:function(a){var b=this;this.options=a!=null?a:{},Luca.containers.CardView.prototype.initialize.apply(this,arguments);if(!this.name)throw"Record Managers must specify a name";return _.bindAll(this,"add_handler","edit_handler","filter_handler","reset_filter_handler"),this.filterConfig&&_.extend(this.components[0][0],this.filterConfig),this.gridConfig&&_.extend(this.components[0][1],this.gridConfig),this.editorConfig&&_.extend(this.components[1][0],this.editorConfig),this.bind("after:card:switch",function(){b.activeCard===0&&b.trigger("activation:search",b);if(b.activeCard===1)return b.trigger("activation:editor",b)})},components:[{ctype:"split_view",relayFirstActivation:!0,components:[{ctype:"form_view"},{ctype:"grid_view"}]},{ctype:"form_view"}],getSearch:function(a,b){return a==null&&(a=!1),b==null&&(b=!0),a===!0&&this.activate(0),b===!0&&this.getEditor().clear(),_.first(this.components)},getFilter:function(){return _.first(this.getSearch().components)},getGrid:function(){return _.last(this.getSearch().components)},getCollection:function(){return this.getGrid().collection},getEditor:function(a,b){var c=this;return a==null&&(a=!1),b==null&&(b=!1),a===!0&&this.activate(1,function(a,b,c){return c.reset()}),_.last(this.components)},beforeRender:function(){var a;return this.$el.addClass(""+this.resource+"-manager"),(a=Luca.containers.CardView.prototype.beforeRender)!=null&&a.apply(this,arguments),this.$el.addClass(""+this.resource+" record-manager"),this.$el.data("resource",this.resource),$(this.getGrid().el).addClass(""+this.resource+" record-manager-grid"),$(this.getFilter().el).addClass(""+this.resource+" record-manager-filter"),$(this.getEditor().el).addClass(""+this.resource+" record-manager-editor")},afterRender:function(){var a,b,c,d,e,f,g=this;return(f=Luca.containers.CardView.prototype.afterRender)!=null&&f.apply(this,arguments),e=this,d=this.getGrid(),c=this.getFilter(),b=this.getEditor(),a=this.getCollection(),d.bind("row:double:click",function(a,c,d){return e.getEditor(!0),b.loadModel(c)}),b.bind("before:submit",function(){return $(".form-view-flash-container",g.el).html(""),$(".form-view-body",g.el).spin("large")}),b.bind("after:submit",function(){return $(".form-view-body",g.el).spin(!1)}),b.bind("after:submit:fatal_error",function(){return $(".form-view-flash-container",g.el).append("<li class='error'>There was an internal server error saving this record. Please contact developers@benchprep.com to report this error.</li>"),$(".form-view-body",g.el).spin(!1)}),b.bind("after:submit:error",function(a,b,c){return _(c.errors).each(function(a){return $(".form-view-flash-container",g.el).append("<li class='error'>"+a+"</li>")})}),b.bind("after:submit:success",function(a,b,c){return $(".form-view-flash-container",g.el).append("<li class='success'>Successfully Saved Record</li>"),b.set(c.result),a.loadModel(b),d.refresh(),_.delay(function(){return $(".form-view-flash-container li.success",g.el).fadeOut(1e3),$(".form-view-flash-container",g.el).html("")},4e3)}),c.eachComponent(function(a){try{return a.bind("on:change",g.filter_handler)}catch(b){return}})},firstActivation:function(){return this.getGrid().trigger("first:activation",this,this.getGrid()),this.getFilter().trigger("first:activation",this,this.getGrid())},reload:function(){var a,b,c,d;return d=this,c=this.getGrid(),b=this.getFilter(),a=this.getEditor(),b.clear(),c.applyFilter()},manageRecord:function(a){var b,c=this;return b=this.getCollection().get(a),b?this.loadModel(b):(console.log("Could Not Find Model, building and fetching"),b=this.buildModel(),b.set({id:a},{silent:!0}),b.fetch({success:function(a,b){return c.loadModel(a)}}))},loadModel:function(a){return this.current_model=a,this.getEditor(!0).loadModel(this.current_model),this.trigger("model:loaded",this.current_model)},currentModel:function(){return this.getEditor(!1).currentModel()},buildModel:function(){var a,b,c;return b=this.getEditor(!1),a=this.getCollection(),a.add([{}],{silent:!0,at:0}),c=a.at(0)},createModel:function(){return this.loadModel(this.buildModel())},reset_filter_handler:function(a){return this.getFilter().clear(),this.getGrid().applyFilter(this.getFilter().getValues())},filter_handler:function(a){return this.getGrid().applyFilter(this.getFilter().getValues())},edit_handler:function(a){var b,c,d,e;return b=d=$(a.currentTarget),e=d.parents("tr").data("record-id"),e&&(c=this.getGrid().collection.get(e)),c||(c=this.getGrid().collection.at(row_index))},add_handler:function(a){var b,c,d;return b=c=$(a.currentTarget),d=c.parents(".record-manager").eq(0).data("resource")},destroy_handler:function(a){},back_to_search_handler:function(){}})}.call(this),function(){_.def("Luca.Router")["extends"]("Backbone.Router")["with"]({routes:{"":"default"},initialize:function(a){var b=this;return this.options=a,_.extend(this,this.options),this.routeHandlers=_(this.routes).values(),_(this.routeHandlers).each(function(a){return b.bind("route:"+a,function(){return b.trigger.apply(b,["change:navigation",a].concat(_(arguments).flatten()))})})},navigate:function(a,b){return b==null&&(b=!1),Backbone.Router.prototype.navigate.apply(this,arguments),this.buildPathFrom(Backbone.history.getFragment())},buildPathFrom:function(a){var b=this;return _(this.routes).each(function(c,d){var e,f;f=b._routeToRegExp(d);if(f.test(a))return e=b._extractParameters(f,a),b.trigger.apply(b,["change:navigation",c].concat(e))})}})}.call(this),function(){var a;_.def("Luca.components.TableView")["extends"]("Luca.components.CollectionView")["with"]({additionalClassNames:"table",tagName:"table",bodyTemplate:"table_view",bodyTagName:"tbody",bodyClassName:"table-body",itemTagName:"tr",stateful:!0,observeChanges:!0,columns:[],emptyText:"There are no results to display",itemRenderer:function(a,b){return Luca.components.TableView.rowRenderer.call(this,a,b)},initialize:function(a){var b,c=this;return this.options=a!=null?a:{},Luca.components.CollectionView.prototype.initialize.apply(this,arguments),this.columns=function(){var a,c,d,e;d=this.columns,e=[];for(a=0,c=d.length;a<c;a++)b=d[a],_.isString(b)&&(b={reader:b}),b.header==null&&(b.header=_.str.titleize(_.str.humanize(b.reader))),e.push(b);return e}.call(this),this.defer(function(){return Luca.components.TableView.renderHeader.call(c,c.columns,c.$("thead"))}).until("after:render")}}),a=Backbone.View.prototype.make,Luca.components.TableView.renderHeader=function(a,b){var c,d,e,f,g,h;e=0,d=function(){var b,d,f;f=[];for(b=0,d=a.length;b<d;b++)c=a[b],f.push("<th data-col-index='"+e++ +"'>"+c.header+"</th>");return f}(),this.$(b).append("<tr>"+d.join("")+"</tr>"),e=0,h=[];for(f=0,g=a.length;f<g;f++)c=a[f],c.width!=null&&h.push(this.$("th[data-col-index='"+e++ +"']",b).css("width",c.width));return h},Luca.components.TableView.rowRenderer=function(a,b,c){var d,e,f,g,h,i;d=0,h=this.columns,i=[];for(f=0,g=h.length;f<g;f++)e=h[f],i.push(Luca.components.TableView.renderColumn.call(this,e,a,b,d++));return i},Luca.components.TableView.renderColumn=function(b,c,d,e){var f;return f=d.read(b.reader),_.isFunction(b.renderer)&&(f=b.renderer.call(this,f,d,b)),a("td",{"data-col-index":e},f)}}.call(this),function(){_.def("Luca.components.ToolbarDialog")["extends"]("Luca.View")["with"]({className:"luca-ui-toolbar-dialog span well",styles:{position:"absolute","z-Index":"3000","float":"left"},initialize:function(a){return this.options=a!=null?a:{},this._super("initialize",this,arguments)},createWrapper:function(){return this.make("div",{"class":"component-picker span4 well",style:"position: absolute; z-index:12000"})},show:function(){return this.$el.parent().show()},hide:function(){return this.$el.parent().hide()},toggle:function(){return this.$el.parent().toggle()}})}.call(this),function(){}.call(this),function(){}.call(this),function(){}.call(this);
|
5
|
+
,f=j(d.type,b),f&&(f=g(d.type,d.value,b,a));if(c===f)return c}return!c})},h={$and:function(a,b){return d(a,b,!1,"filter")},$or:function(a,b){return d(a,b,!0,"filter")},$nor:function(a,b){return d(a,b,!0,"reject")},$not:function(a,b){return d(a,b,!1,"reject")}},a=function(a,b,d){var e,f,g,h;return g=JSON.stringify(b),e=(h=a._query_cache)!=null?h:a._query_cache={},f=e[g],f||(f=c(a,b,d),e[g]=f),f},b=function(a,b){var c,d,e;return c=_.intersection(["$and","$not","$or","$nor"],_(b).keys()),d=a.models,c.length===0?h.$and(d,b):(e=function(a,c){return h[c](a,b[c])},_.reduce(c,e,d))},c=function(a,c,d){var e;return e=b(a,c),d.sortBy&&(e=i(e,d)),e},i=function(a,b){return _(b.sortBy).isString()?a=_(a).sortBy(function(a){return a.get(b.sortBy)}):_(b.sortBy).isFunction()&&(a=_(a).sortBy(b.sortBy)),b.order==="desc"&&(a=a.reverse()),a},e=function(a,b){var c,d,e,f;return b.offset?e=b.offset:b.page?e=(b.page-1)*b.limit:e=0,c=e+b.limit,d=a.slice(e,c),b.pager&&_.isFunction(b.pager)&&(f=Math.ceil(a.length/b.limit),b.pager(f,d)),d};if(typeof require!="undefined"){if(typeof _=="undefined"||_===null)_=require("underscore");if(typeof Backbone=="undefined"||Backbone===null)Backbone=require("backbone")}Backbone.QueryCollection=Backbone.Collection.extend({query:function(b,d){var f;return d==null&&(d={}),d.cache?f=a(this,b,d):f=c(this,b,d),d.limit&&(f=e(f,d)),f},where:function(a,b){return b==null&&(b={}),new this.constructor(this.query(a,b))},reset_query_cache:function(){return this._query_cache={}}}),typeof exports!="undefined"&&(exports.QueryCollection=Backbone.QueryCollection)}.call(this),function(){}.call(this),!function(a){a(function(){a.support.transition=function(){var a=function(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd",transition:"transitionend"},c;for(c in b)if(a.style[c]!==undefined)return b[c]}();return a&&{end:a}}()})}(window.jQuery),!function(a){function b(){var b=this,d=setTimeout(function(){b.$element.off(a.support.transition.end),c.call(b)},500);this.$element.one(a.support.transition.end,function(){clearTimeout(d),c.call(b)})}function c(a){this.$element.hide().trigger("hidden"),d.call(this)}function d(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(a.proxy(this.hide,this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),f?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,a.proxy(e,this)):e.call(this)):b&&b()}function e(){this.$backdrop.remove(),this.$backdrop=null}function f(){var b=this;this.isShown&&this.options.keyboard?a(document).on("keyup.dismiss.modal",function(a){a.which==27&&b.hide()}):this.isShown||a(document).off("keyup.dismiss.modal")}var g=function(b,c){this.options=c,this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this))};g.prototype={constructor:g,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this,c=a.Event("show");this.$element.trigger(c);if(this.isShown||c.isDefaultPrevented())return;a("body").addClass("modal-open"),this.isShown=!0,f.call(this),d.call(this,function(){var c=a.support.transition&&b.$element.hasClass("fade");b.$element.parent().length||b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in"),c?b.$element.one(a.support.transition.end,function(){b.$element.trigger("shown")}):b.$element.trigger("shown")})},hide:function(d){d&&d.preventDefault();var e=this;d=a.Event("hide"),this.$element.trigger(d);if(!this.isShown||d.isDefaultPrevented())return;this.isShown=!1,a("body").removeClass("modal-open"),f.call(this),this.$element.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?b.call(this):c.call(this)}},a.fn.modal=function(b){return this.each(function(){var c=a(this),d=c.data("modal"),e=a.extend({},a.fn.modal.defaults,c.data(),typeof b=="object"&&b);d||c.data("modal",d=new g(this,e)),typeof b=="string"?d[b]():e.show&&d.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},a.fn.modal.Constructor=g,a(function(){a("body").on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({},e.data(),c.data());b.preventDefault(),e.modal(f)})})}(window.jQuery),!function(a){function b(){a(c).parent().removeClass("open")}var c='[data-toggle="dropdown"]',d=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};d.prototype={constructor:d,toggle:function(c){var d=a(this),e,f,g;if(d.is(".disabled, :disabled"))return;return f=d.attr("data-target"),f||(f=d.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,"")),e=a(f),e.length||(e=d.parent()),g=e.hasClass("open"),b(),g||e.toggleClass("open"),!1}},a.fn.dropdown=function(b){return this.each(function(){var c=a(this),e=c.data("dropdown");e||c.data("dropdown",e=new d(this)),typeof b=="string"&&e[b].call(c)})},a.fn.dropdown.Constructor=d,a(function(){a("html").on("click.dropdown.data-api",b),a("body").on("click.dropdown",".dropdown form",function(a){a.stopPropagation()}).on("click.dropdown.data-api",c,d.prototype.toggle)})}(window.jQuery),!function(a){var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,this.options.trigger!="manual"&&(e=this.options.trigger=="hover"?"mouseenter":"focus",f=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(e,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.show)return c.show();clearTimeout(this.timeout),c.hoverState="in",this.timeout=setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show)},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.hide)return c.hide();clearTimeout(this.timeout),c.hoverState="out",this.timeout=setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide)},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f=typeof this.options.placement=="function"?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.remove().css({top:0,left:0,display:"block"}).appendTo(b?this.$element:document.body),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight;switch(b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.css(g).addClass(f).addClass("in")}},isHTML:function(a){return typeof a!="string"||a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3||/^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(a)},setContent:function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.isHTML(b)?"html":"text"](b),a.removeClass("fade in top bottom left right")},hide:function(){function b(){var b=setTimeout(function(){d.off(a.support.transition.end).remove()},500);d.one(a.support.transition.end,function(){clearTimeout(b),d.remove()})}var c=this,d=this.tip();d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?b():d.remove()},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(b){return a.extend({},b?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a},tip:function(){return this.$tip=this.$tip||a(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()}},a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("tooltip"),f=typeof c=="object"&&c;e||d.data("tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover",title:"",delay:0}}(window.jQuery),!function(a){var b=function(a,b){this.init("popover",a,b)};b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype,{constructor:b,setContent:function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.isHTML(b)?"html":"text"](b),a.find(".popover-content > *")[this.isHTML(c)?"html":"text"](c),a.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-content")||(typeof c.content=="function"?c.content.call(b[0]):c.content),a},tip:function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip}}),a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("popover"),f=typeof c=="object"&&c;e||d.data("popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.defaults=a.extend({},a.fn.tooltip.defaults,{placement:"right",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'})}(window.jQuery),!function(a){var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed").remove()}var d=a(this),e=d.attr("data-target"),f;e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,"")),f=a(e),b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close"));if(b.isDefaultPrevented())return;f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.on(a.support.transition.end,c):c()},a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("alert");e||d.data("alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a(function(){a("body").on("click.alert.data-api",b,c.prototype.close)})}(window.jQuery),!function(a){var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.parent('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")},a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("button"),f=typeof c=="object"&&c;e||d.data("button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a(function(){a("body").on("click.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle")})})}(window.jQuery),!function(a){var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b,c,d,e;if(this.transitioning)return;b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find("> .accordion-group > .in");if(d&&d.length){e=d.data("collapse");if(e&&e.transitioning)return;d.collapse("hide"),e||d.data("collapse",null)}this.$element[b](0),this.transition("addClass",a.Event("show"),"shown"),this.$element[b](this.$element[0][c])},hide:function(){var b;if(this.transitioning)return;b=this.dimension(),this.reset(this.$element[b]()),this.transition("removeClass",a.Event("hide"),"hidden"),this.$element[b](0)},reset:function(a){var b=this.dimension();return this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element[a!==null?"addClass":"removeClass"]("collapse"),this},transition:function(b,c,d){var e=this,f=function(){c.type=="show"&&e.reset(),e.transitioning=0,e.$element.trigger(d)};this.$element.trigger(c);if(c.isDefaultPrevented())return;this.transitioning=1,this.$element[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("collapse"),f=typeof c=="object"&&c;e||d.data("collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a(function(){a("body").on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":c.data();a(e).collapse(f)})})}(window.jQuery),!function(a){var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.typeahead.defaults,c),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.$menu=a(this.options.menu).appendTo("body"),this.source=this.options.source,this.shown=!1,this.listen()};b.prototype={constructor:b,select:function(){var a=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(a)).change(),this.hide()},updater:function(a){return a},show:function(){var b=a.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:b.top+b.height,left:b.left}),this.$menu.show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(b){var c=this,d,e;return this.query=this.$element.val(),this.query?(d=a.grep(this.source,function(a){return c.matcher(a)}),d=this.sorter(d),d.length?this.render(d.slice(0,this.options.items)).show():this.shown?this.hide():this):this.shown?this.hide():this},matcher:function(a){return~a.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(a){var b=[],c=[],d=[],e;while(e=a.shift())e.toLowerCase().indexOf(this.query.toLowerCase())?~e.indexOf(this.query)?c.push(e):d.push(e):b.push(e);return b.concat(c,d)},highlighter:function(a){var b=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return a.replace(new RegExp("("+b+")","ig"),function(a,b){return"<strong>"+b+"</strong>"})},render:function(b){var c=this;return b=a(b).map(function(b,d){return b=a(c.options.item).attr("data-value",d),b.find("a").html(c.highlighter(d)),b[0]}),b.first().addClass("active"),this.$menu.html(b),this},next:function(b){var c=this.$menu.find(".active").removeClass("active"),d=c.next();d.length||(d=a(this.$menu.find("li")[0])),d.addClass("active")},prev:function(a){var b=this.$menu.find(".active").removeClass("active"),c=b.prev();c.length||(c=this.$menu.find("li").last()),c.addClass("active")},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),(a.browser.webkit||a.browser.msie)&&this.$element.on("keydown",a.proxy(this.keypress,this)),this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this))},keyup:function(a){switch(a.keyCode){case 40:case 38:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}a.stopPropagation(),a.preventDefault()},keypress:function(a){if(!this.shown)return;switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:if(a.type!="keydown")break;a.preventDefault(),this.prev();break;case 40:if(a.type!="keydown")break;a.preventDefault(),this.next()}a.stopPropagation()},blur:function(a){var b=this;setTimeout(function(){b.hide()},150)},click:function(a){a.stopPropagation(),a.preventDefault(),this.select()},mouseenter:function(b){this.$menu.find(".active").removeClass("active"),a(b.currentTarget).addClass("active")}},a.fn.typeahead=function(c){return this.each(function(){var d=a(this),e=d.data("typeahead"),f=typeof c=="object"&&c;e||d.data("typeahead",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>'},a.fn.typeahead.Constructor=b,a(function(){a("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(b){var c=a(this);if(c.data("typeahead"))return;b.preventDefault(),c.typeahead(c.data())})})}(window.jQuery),function(){var a,b,c=Array.prototype.slice;b=function(){var a,b,d,e,f,g,h;f=arguments[0],a=2<=arguments.length?c.call(arguments,1):[];if(f==null)return(h=_(Luca.Application.instances).values())!=null?h[0]:void 0;if(_.isString(f)&&(g=Luca.cache(f)))return g;if(_.isString(f)&&(g=Luca.find(f)))return g;if(_.isString(f)&&(g=Luca.registry.find(f)))return g;if(f instanceof jQuery&&(g=Luca.find(f)))return g;if(_.isObject(f)&&f.ctype!=null)return Luca.util.lazyComponent(f);_.isObject(f)&&f.defines&&f["extends"]&&(b=f.defines,e=f["extends"]);if(_.isFunction(d=_(a).last()))return d()},(window||global).Luca=function(){return b.apply(this,arguments)},_.extend(Luca,{VERSION:"0.9.75",core:{},collections:{},containers:{},components:{},models:{},concerns:{},util:{},fields:{},registry:{},options:{},config:{},getHelper:function(){return function(){return b.apply(this,arguments)}}}),_.extend(Luca,Backbone.Events),Luca.config.maintainStyleHierarchy=!0,Luca.config.maintainClassHierarchy=!0,Luca.config.autoApplyClassHierarchyAsCssClasses=!0,Luca.autoRegister=Luca.config.autoRegister=!0,Luca.developmentMode=Luca.config.developmentMode=!1,Luca.enableGlobalObserver=Luca.config.enableGlobalObserver=!1,Luca.config.enableBoostrap=Luca.config.enableBootstrap=!0,Luca.config.enhancedViewProperties=!0,Luca.keys=Luca.config.keys={ENTER:13,ESCAPE:27,KEYLEFT:37,KEYUP:38,KEYRIGHT:39,KEYDOWN:40,SPACEBAR:32,FORWARDSLASH:191},Luca.keyMap=Luca.config.keyMap=_(Luca.keys).inject(function(a,b,c){return a[b]=c.toLowerCase(),a},{}),Luca.config.showWarnings=!0,Luca.setupCollectionSpace=function(a){var b,c;return a==null&&(a={}),b=a.baseParams,c=a.modelBootstrap,b!=null?Luca.Collection.baseParams(b):Luca.warn("You should remember to set the base params for Luca.Collection class. You can do this by defining a property or function on Luca.config.baseParams"),c!=null?Luca.Collection.bootstrap(c):Luca.warn("You should remember to set the model bootstrap location for Luca.Collection. You can do this by defining a property or function on Luca.config.modelBootstrap")},Luca.initialize=function(a,b){var c,d;return b==null&&(b={}),c={views:{},collections:{},models:{},components:{},lib:{},util:{},concerns:{},register:function(){return Luca.register.apply(this,arguments)},onReady:function(){return Luca.onReady.apply(this,arguments)},getApplication:function(){var a;return(a=Luca.getApplication)!=null?a.apply(this,arguments):void 0},getCollectionManager:function(){var a;return(a=Luca.CollectionManager.get)!=null?a.apply(this,arguments):void 0}},d={},d[a]=_.extend(Luca.getHelper(),c),_.extend(Luca.config,b),_.extend(window||global,d),Luca.concern.namespace(""+a+".concerns"),Luca.registry.namespace(""+a+".views"),Luca.Collection.namespace(""+a+".collections"),Luca.on("ready",function(){return Luca.define.close(),Luca.setupCollectionSpace(b)})},Luca.onReady=function(a){return Luca.trigger("ready"),$(function(){return a.apply(this,arguments)})},Luca.warn=function(a){if(Luca.config.showWarnings===!0)return console.log(a)},Luca.find=function(a){return Luca($(a).data("luca-id"))},Luca.supportsEvents=Luca.supportsBackboneEvents=function(a){return Luca.isComponent(a)||_.isFunction(a!=null?a.trigger:void 0)||_.isFunction(a!=null?a.bind:void 0)},Luca.isComponent=function(a){return Luca.isBackboneModel(a)||Luca.isBackboneView(a)||Luca.isBackboneCollection(a)},Luca.isComponentPrototype=function(a){return Luca.isViewPrototype(a)||Luca.isModelPrototype(a)||Luca.isCollectionPrototype(a)},Luca.isBackboneModel=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),_.isFunction(a!=null?a.set:void 0)&&_.isFunction(a!=null?a.get:void 0)&&_.isObject(a!=null?a.attributes:void 0)},Luca.isBackboneView=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),_.isFunction(a!=null?a.render:void 0)&&!_.isUndefined(a!=null?a.el:void 0)},Luca.isBackboneCollection=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),_.isFunction(a!=null?a.fetch:void 0)&&_.isFunction(a!=null?a.reset:void 0)},Luca.isViewPrototype=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),a!=null&&a.prototype!=null&&a.prototype.make!=null&&a.prototype.$!=null&&a.prototype.render!=null},Luca.isModelPrototype=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),a!=null&&(typeof a.prototype=="function"?a.prototype(a.prototype.save!=null&&a.prototype.changedAttributes!=null):void 0)},Luca.isCollectionPrototype=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),a!=null&&a.prototype!=null&&!Luca.isModelPrototype(a)&&a.prototype.reset!=null&&a.prototype.select!=null&&a.prototype.reject!=null},Luca.inheritanceChain=function(a){return Luca.parentClasses(a)},Luca.parentClasses=function(a){var b,c,d;return b=[],_.isString(a)&&(a=Luca.util.resolve(a)),c=typeof a.componentMetaData=="function"?a.componentMetaData():void 0,c||(c=typeof (d=a.prototype).componentMetaData=="function"?d.componentMetaData():void 0),b=(c!=null?c.classHierarchy():void 0)||[a.displayName||a.prototype.displayName]},Luca.parentClass=function(a,b){var c,d,e,f,g;return b==null&&(b=!0),_.isString(a)&&(a=Luca.util.resolve(a)),c=typeof a.componentMetaData=="function"?(e=a.componentMetaData())!=null?e.meta["super class name"]:void 0:void 0,c||(c=typeof (d=a.prototype).componentMetaData=="function"?(f=d.componentMetaData())!=null?f.meta["super class name"]:void 0:void 0),c||a.displayName||((g=a.prototype)!=null?g.displayName:void 0),b?Luca.util.resolve(c):c},Luca.template=function(a,b){var c,d,e,f,g;window.JST||(window.JST={});if(_.isFunction(a))return a(b);d=(g=Luca.templates)!=null?g[a]:void 0,c=typeof JST!="undefined"&&JST!==null?JST[a]:void 0,d==null&&c==null&&(e=new RegExp(""+a+"$"),d=_(Luca.templates).detect(function(a,b){return e.exec(b)}),c=_(JST).detect(function(a,b){return e.exec(b)}));if(!d&&!c)throw"Could not find template named "+a;return f=d||c,b!=null?f(b):f},Luca.available_templates=function(a){var b;return a==null&&(a=""),b=_(Luca.templates).keys(),a.length>0?_(b).select(function(b){return b.match(a)}):b},a={module:function(a,b){_.extend(a,b);if(a.included&&_(a.included).isFunction())return a.included.apply(a)},"delete":function(a,b){var c;return c=a[b],delete a[b],c},idle:function(a,b){var c;return b==null&&(b=1e3),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}},idleShort:function(a,b){var c;return b==null&&(b=100),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}},idleMedium:function(a,b){var c;return b==null&&(b=2e3),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}},idleLong:function(a,b){var c;return b==null&&(b=5e3),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}}},_.mixin(a)}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/bootstrap_form_controls"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="btn-group form-actions">\n <a class="btn btn-primary submit-button">\n <i class="icon icon-ok icon-white"></i>\n Save Changes\n </a>\n <a class="btn reset-button cancel-button">\n <i class="icon icon-remove"></i>\n Cancel\n </a>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/collection_loader_view"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div id="progress-modal" class="modal" style="display: none">\n <div class="progress progress-info progress-striped active">\n <div class="bar" style="width:0%;"></div>\n </div>\n <div class="message">Initializing...</div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/form_alert"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="',className,'">\n <a class="close" href="#" data-dismiss="alert">x</a>\n ',message,"\n</div>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/grid_view"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="luca-ui-g-view-wrapper">\n <div class="g-view-header"></div>\n <div class="luca-ui-g-view-body">\n <table class="luca-ui-g-view scrollable-table" width="100%" cellpadding=0 cellspacing=0>\n <thead class="fixed"></thead>\n <tbody class="scrollable"></tbody>\n <tfoot></tfoot>\n </table>\n </div>\n <div class="luca-ui-g-view-header"></div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/grid_view_empty_text"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="empty-text empty-text-wrapper">\n <p>',text,"</p>\n</div>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/load_mask"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="load-mask">\n <div class="progress progress-striped active">\n <div class="bar" style="width:0%"></div>\n </div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/nav_bar"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="navbar-inner">\n <div class="luca-ui-navbar-body container">\n </div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/pagination"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="pagination">\n <a class="btn previous">\n <i class="icon icon-chevron-left"></i>\n </a>\n <div class="pagination-group">\n </div>\n <a class="btn next">\n <i class="icon icon-chevron-right"></i>\n </a>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/containers/basic"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div id="',id,'" class="',classes,'" style="',style,'"></div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/containers/tab_selector_container"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div id="',cid,'-tab-selector" class="tab-selector-container">\n <ul id="',cid,'-tabs-nav" class="nav nav-tabs">\n ');for(var i=0;i<components.length;i++){__p.push("\n ");var component=components[i];__p.push('\n <li class="tab-selector" data-target="',i,'">\n <a data-target="',i,'">\n ',component.title,"\n </a>\n </li>\n ")}__p.push("\n </ul>\n</div>\n")}return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/containers/tab_view"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<ul id="',cid,'-tabs-selector" class="nav ',navClass,'"></ul>\n<div id="',cid,'-tab-view-content" class="tab-content"></div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/containers/toolbar_wrapper"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="luca-ui-toolbar-wrapper" id="',id,'"></div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/button_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label> </label>\n<input style="',inputStyles,'" class="btn ',input_class,'" value="',input_value,'" type="',input_type,'" id="<%= input_id" />\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/button_field_link"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<a class="btn ',input_class,'">\n '),icon_class.length&&__p.push('\n <i class="',icon_class,'"></i>\n ',input_value,"\n "),__p.push("\n</a>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/checkbox_array"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="control-group">\n <label for="',input_id,'"><%= label =>\n <div class="controls"><div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/checkbox_array_item"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n <input id="',input_id,'" type="checkbox" name="',input_name,'" value="',value,'" />\n</label>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/checkbox_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n ',label,'\n <input type="checkbox" name="',input_name,'" value="',input_value,'" style="',inputStyles,'" />\n</label>\n\n'),helperText&&__p.push('\n<p class="helper-text help-block">\n ',helperText,"\n</p>\n"),__p.push("\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/file_upload_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n ',label,'\n <input type="file" name="',input_name,'" value="',input_value,'" style="',inputStyles,'" />\n</label>\n\n'),helperText&&__p.push('\n<p class="helper-text help-block">\n ',helperText,"\n</p>\n"),__p.push("\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/hidden_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push(' <input type="hidden" name="',input_name,'" value="',input_value,'" style="',inputStyles,'" />\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/select_field"]=function(obj){var __p=
|
6
|
+
[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n ',label,'\n</label>\n<div class="controls">\n <select name="',input_name,'" value="',input_value,'" style="',inputStyles,'" ></select>\n '),helperText&&__p.push('\n <p class="helper-text help-block">\n ',helperText,"\n </p>\n "),__p.push("\n</div>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/text_area_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n ',label,'\n</label>\n<div class="controls">\n <textarea placeholder="',placeHolder,'" name="',input_name,'" style="',inputStyles,'" >',input_value,"</textarea>\n "),helperText&&__p.push('\n <p class="helper-text help-block">\n ',helperText,"\n </p>\n "),__p.push("\n</div>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/text_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push(""),(typeof label!="undefined"&&typeof hideLabel!="undefined"&&!hideLabel||typeof hideLabel=="undefined")&&__p.push('\n<label class="control-label" for="',input_id,'">',label,"</label>\n"),__p.push('\n\n<div class="controls">\n'),typeof addOn!="undefined"&&__p.push('\n <span class="add-on">',addOn,"</span>\n"),__p.push('\n<input type="text" placeholder="',placeHolder,'" name="',input_name,'" style="',inputStyles,'" value="',input_value,'" />\n'),helperText&&__p.push('\n<p class="helper-text help-block">\n ',helperText,"\n</p>\n"),__p.push("\n\n</div>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/table_view"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<thead></thead>\n<tbody class="table-body"></tbody>\n<tfoot></tfoot>\n<caption></caption>\n');return __p.join("")}}.call(this),function(){var currentNamespace,__slice=Array.prototype.slice;Luca.util.resolve=function(a,b){var c;try{b||(b=window||global),c=_(a.split(/\./)).inject(function(a,b){return a=a!=null?a[b]:void 0},b)}catch(d){throw console.log("Error resolving",a,b),d}return c},Luca.util.nestedValue=Luca.util.resolve,Luca.util.argumentsLogger=function(a){return function(){return console.log(a,arguments)}},Luca.util.read=function(){var a,b;return b=arguments[0],a=2<=arguments.length?__slice.call(arguments,1):[],_.isFunction(b)?b.apply(this,a):b},Luca.util.classify=function(a){return a==null&&(a=""),_.string.camelize(_.string.capitalize(a))},Luca.util.hook=function(a){var b,c,d;return a==null&&(a=""),c=a.split(":"),d=c.shift(),c=_(c).map(function(a){return _.string.capitalize(a)}),b=d+c.join("")},Luca.util.toCssClass=function(){var a,b,c,d,e;return a=arguments[0],b=2<=arguments.length?__slice.call(arguments,1):[],d=a.split("."),e=function(){var a,e,f;f=[];for(a=0,e=d.length;a<e;a++){c=d[a];if(_(b).indexOf(c)!==-1)continue;c=_.str.underscored(c),c=c.replace(/_/g,"-"),f.push(c)}return f}(),e.join("-")},Luca.util.isIE=function(){try{return Object.defineProperty({},"",{}),!1}catch(a){return!0}},currentNamespace=window||global,Luca.util.namespace=function(namespace){return namespace==null?currentNamespace:(currentNamespace=_.isString(namespace)?Luca.util.resolve(namespace,window||global):namespace,currentNamespace!=null?currentNamespace:currentNamespace=eval("(window||global)."+namespace+" = {}"))},Luca.util.lazyComponent=function(config){var componentClass,constructor,ctype;_.isObject(config)&&(ctype=config.ctype||config.type),_.isString(config)&&(ctype=config),componentClass=Luca.registry.lookup(ctype);if(!componentClass)throw"Invalid Component Type: "+ctype+". Did you forget to register it?";return constructor=eval(componentClass),new constructor(config)},Luca.util.selectProperties=function(a,b,c){var d;return d=_(b).values(),_(d).select(a)},Luca.util.loadScript=function(a,b){var c;return c=document.createElement("script"),c.type="text/javascript",c.readyState&&(c.onreadystatechange=function(){return c.readyState==="loaded"||c.readyState==="complete"?(c.onreadystatechange=null,b()):c.onload=function(){return b()}}),c.src=a,document.body.appendChild(c)},Luca.util.make=Backbone.View.prototype.make,Luca.util.list=function(a,b,c){var d,e,f,g;b==null&&(b={}),d=c?"ol":"ul",d=Luca.util.make(d,b);if(_.isArray(a))for(f=0,g=a.length;f<g;f++)e=a[f],$(d).append(Luca.util.make("li",{},e));return d.outerHTML},Luca.util.label=function(a,b,c){var d;return a==null&&(a=""),c==null&&(c="label"),d=c,b!=null&&(d+=" "+c+"-"+b),Luca.util.make("span",{"class":d},a)},Luca.util.badge=function(a,b,c){var d;return a==null&&(a=""),c==null&&(c="badge"),d=c,b!=null&&(d+=" "+c+"-"+b),Luca.util.make("span",{"class":d},a)},Luca.util.setupHooks=function(a){var b=this;return a||(a=this.hooks),_(a).each(function(a){var c,d;d=Luca.util.hook(a),c=function(){var a;return(a=this[d])!=null?a.apply(this,arguments):void 0};if(a!=null?a.match(/once:/):void 0)c=_.once(c);return b.on(a,c,b)})},Luca.util.setupHooksAdvanced=function(a){var b=this;return a||(a=this.hooks),_(a).each(function(a){var c,d,e,f,g,h,i;f=b[Luca.util.hook(a)],_.isArray(f)||(f=[f]),i=[];for(g=0,h=f.length;g<h;g++){d=f[g],e=_.isString(d)?b[d]:void 0,_.isFunction(d)&&(e=d),c=function(){var a;return(a=this[e])!=null?a.apply(this,arguments):void 0};if(a!=null?a.match(/once:/):void 0)c=_.once(c);i.push(b.on(a,c,b))}return i})}}.call(this),function(){Luca.DevelopmentToolHelpers={refreshCode:function(){var a;return a=this,_(this.eventHandlerProperties()).each(function(b){return a[b]=a.definitionClass()[b]}),this.autoBindEventHandlers===!0&&this.bindAllEventHandlers(),this.delegateEvents()},eventHandlerProperties:function(){var a;return a=_(this.events).values(),_(a).select(function(a){return _.isString(a)})},eventHandlerFunctions:function(){var a,b=this;return a=_(this.events).values(),_(a).map(function(a){return _.isFunction(a)?a:b[a]})}}}.call(this),function(){var a,b=Array.prototype.slice;a=function(){function a(a,b,c){var d;this.object=a,c==null&&(c=!0),_.isFunction(b)?d=b:_.isString(b)&&_.isFunction(this.object[b])&&(d=this.object[b]);if(!_.isFunction(d))throw"Must pass a function or a string representing one";c===!0?this.fn=_.bind(function(){return _.defer(d)},this.object):this.fn=_.bind(d,this.object),this}return a.prototype.until=function(a,b){return a!=null&&b==null&&(b=a,a=this.object),a.once(b,this.fn),this.object},a}(),Luca.Events={defer:function(b,c){return c==null&&(c=!0),new a(this,b,c)},once:function(a,b,c){var d;return c||(c=this),d=function(){return b.apply(c,arguments),this.unbind(a,d)},this.bind(a,d)}},Luca.EventsExt={waitUntil:function(a,b){return this.waitFor.call(this,a,b)},waitFor:function(a,c){var d,e;return e=this,d={on:function(b){return b.waitFor.call(b,a,c)},and:function(){var d,f,g,h,i;f=1<=arguments.length?b.call(arguments,0):[],i=[];for(g=0,h=f.length;g<h;g++)d=f[g],d=_.isFunction(d)?d:e[d],i.push(e.once(a,d,c));return i},andThen:function(){return e.and.apply(e,arguments)}}},relayEvent:function(a){var c=this;return{on:function(){var d;return d=1<=arguments.length?b.call(arguments,0):[],{to:function(){var e,f,g,h,i,j;g=1<=arguments.length?b.call(arguments,0):[],j=[];for(h=0,i=g.length;h<i;h++)f=g[h],j.push(function(){var c,g,h,i=this;h=[];for(c=0,g=d.length;c<g;c++)e=d[c],h.push(e.on(a,function(){var c;return c=1<=arguments.length?b.call(arguments,0):[],c.unshift(a),f.trigger.apply(f,c)}));return h}.call(c));return j}}}}}}}.call(this),function(){Luca.concern=function(a){var b,c;return b=_(Luca.concern.namespaces).detect(function(b){var c;return((c=Luca.util.resolve(b))!=null?c[a]:void 0)!=null}),b||(b="Luca.concerns"),c=Luca.util.resolve(b)[a],c==null&&console.log("Could not find "+a+" in ",Luca.concern.namespaces),c},Luca.concern.namespaces=["Luca.concerns"],Luca.concern.namespace=function(a){return Luca.concern.namespaces.push(a),Luca.concern.namespaces=_(Luca.concern.namespaces).uniq()},Luca.concern.setup=function(){var a,b,c,d,e,f,g,h;if(((d=this.concerns)!=null?d.length:void 0)>0){e=this.concerns,h=[];for(b=0,c=e.length;b<c;b++)a=e[b],h.push((f=Luca.concern(a))!=null?(g=f.__initializer)!=null?g.call(this,this,a):void 0:void 0);return h}},Luca.decorate=function(a){var b,c,d;try{_.isString(a)&&(c=a,b=Luca.util.resolve(c)),_.isFunction(a)&&(b=a),d=b.prototype,c=c||b.displayName,c||(c=d.displayName)}catch(e){throw console.log(e.message),console.log(e.stack),console.log("Error calling Luca.decorate on ",b,d,c),e}return{"with":function(a){var e,f,g,h,i,j,k;g=Luca.concern(a),g.__displayName||(g.__displayName=a),h=_(g).chain().keys().select(function(a){return(""+a).match(/^__/)||a==="classMethods"}),i=_(g).omit(h.value()),_.extend(d,i);if(g.classMethods!=null){k=g.classMethods;for(f in k)e=k[f],b[f]=_.bind(e,b)}return g!=null&&typeof g.__included=="function"&&g.__included(c,b,g),j=d._superClass().prototype.concerns,d.concerns||(d.concerns=[]),d.concerns.push(a),d.concerns=d.concerns.concat(j),d.concerns=_(d.concerns).chain().uniq().compact().value(),d}}}}.call(this),function(){var ComponentDefinition,cd,__slice=Array.prototype.slice;ComponentDefinition=function(){function ComponentDefinition(a,b){var c;this.autoRegister=b!=null?b:!0,this.namespace=Luca.util.namespace(),this.componentId=this.componentName=a,this.superClassName="Luca.View",this.properties||(this.properties={}),this._classProperties||(this._classProperties={}),a.match(/\./)&&(this.namespaced=!0,c=a.split("."),this.componentId=c.pop(),this.namespace=c.join("."),Luca.registry.addNamespace(c.join("."))),Luca.define.__definitions.push(this)}return ComponentDefinition.create=function(a,b){return b==null&&(b=Luca.config.autoRegister),new ComponentDefinition(a,b)},ComponentDefinition.prototype.isValid=function(){return _.isObject(this.properties)?Luca.util.resolve(this.superClassName)==null?!1:this.componentName==null?!1:!0:!1},ComponentDefinition.prototype.isDefined=function(){return this.defined===!0},ComponentDefinition.prototype.isOpen=function(){return!!this.isValid()&&!this.isDefined()},ComponentDefinition.prototype.meta=function(a,b){var c,d;return d=this.namespace+"."+this.componentId,d=d.replace(/^\./,""),c=Luca.registry.addMetaData(d,a,b),this.properties.componentMetaData=function(){return Luca.registry.getMetaDataFor(d)}},ComponentDefinition.prototype["in"]=function(a){return this.namespace=a,this},ComponentDefinition.prototype.from=function(a){return this.superClassName=a,this},ComponentDefinition.prototype["extends"]=function(a){return this.superClassName=a,this},ComponentDefinition.prototype.extend=function(a){return this.superClassName=a,this},ComponentDefinition.prototype.triggers=function(){var a,b,c,d;b=1<=arguments.length?__slice.call(arguments,0):[],_.defaults(this.properties||(this.properties={}),{hooks:[]});for(c=0,d=b.length;c<d;c++)a=b[c],this.properties.hooks.push(a);return this.properties.hooks=_.uniq(this.properties.hooks),this.meta("hooks",this.properties.hooks),this},ComponentDefinition.prototype.includes=function(){var a,b,c,d;b=1<=arguments.length?__slice.call(arguments,0):[],_.defaults(this.properties||(this.properties={}),{include:[]});for(c=0,d=b.length;c<d;c++)a=b[c],this.properties.include.push(a);return this.properties.include=_.uniq(this.properties.include),this.meta("includes",this.properties.include),this},ComponentDefinition.prototype.mixesIn=function(){var a,b,c,d;b=1<=arguments.length?__slice.call(arguments,0):[],_.defaults(this.properties||(this.properties={}),{concerns:[]});for(c=0,d=b.length;c<d;c++)a=b[c],this.properties.concerns.push(a);return this.properties.concerns=_.uniq(this.properties.concerns),this.meta("concerns",this.properties.concerns),this},ComponentDefinition.prototype.contains=function(){var a;return a=1<=arguments.length?__slice.call(arguments,0):[],_.defaults(this.properties,{components:[]}),this.properties.components=a,this},ComponentDefinition.prototype.validatesConfigurationWith=function(a){return a==null&&(a={}),this.meta("configuration validations",a),this.properties.validatable=!0,this},ComponentDefinition.prototype.beforeDefinition=function(a){return this._classProperties.beforeDefinition=a,this},ComponentDefinition.prototype.afterDefinition=function(a){return this._classProperties.afterDefinition=a,this},ComponentDefinition.prototype.classConfiguration=function(a){return a==null&&(a={}),this.meta("class configuration",_.keys(a)),_.defaults(this._classProperties||(this._classProperties={}),a),this},ComponentDefinition.prototype.publicConfiguration=function(a){return a==null&&(a={}),this.meta("public configuration",_.keys(a)),_.defaults(this.properties||(this.properties={}),a),this},ComponentDefinition.prototype.privateConfiguration=function(a){return a==null&&(a={}),this.meta("private configuration",_.keys(a)),_.defaults(this.properties||(this.properties={}),a),this},ComponentDefinition.prototype.classInterface=function(a){return a==null&&(a={}),this.meta("class interface",_.keys(a)),_.defaults(this._classProperties||(this._classProperties={}),a),this},ComponentDefinition.prototype.publicInterface=function(a){return a==null&&(a={}),this.meta("public interface",_.keys(a)),_.defaults(this.properties||(this.properties={}),a),this},ComponentDefinition.prototype.privateInterface=function(a){return a==null&&(a={}),this.meta("private interface",_.keys(a)),_.defaults(this.properties||(this.properties={}),a),this},ComponentDefinition.prototype.definePrototype=function(properties){var at,componentType,definition,_base,_ref,_ref2;return properties==null&&(properties={}),_.defaults(this.properties||(this.properties={}),properties),at=this.namespaced?Luca.util.resolve(this.namespace,window||global):window||global,this.namespaced&&at==null&&(eval("(window||global)."+this.namespace+" = {}"),at=Luca.util.resolve(this.namespace,window||global)),this.meta("super class name",this.superClassName),this.meta("display name",this.componentName),this.properties.displayName=this.componentName,this.properties.componentMetaData=function(){return Luca.registry.getMetaDataFor(this.displayName)},(_ref=this._classProperties)!=null&&typeof _ref.beforeDefinition=="function"&&_ref.beforeDefinition(this),definition=at[this.componentId]=Luca.extend(this.superClassName,this.componentName,this.properties),this.autoRegister===!0&&(Luca.isViewPrototype(definition)&&(componentType="view"),Luca.isCollectionPrototype(definition)&&((_base=Luca.Collection).namespaces||(_base.namespaces=[]),Luca.Collection.namespaces.push(this.namespace),componentType="collection"),Luca.isModelPrototype(definition)&&(componentType="model"),Luca.registerComponent(_.string.underscored(this.componentId),this.componentName,componentType)),this.defined=!0,_.isEmpty(this._classProperties)||_.extend(definition,this._classProperties),definition!=null&&(_ref2=definition.afterDefinition)!=null&&_ref2.call(definition,this),definition},ComponentDefinition}(),cd=ComponentDefinition.prototype,cd.concerns=cd.behavesAs=cd.uses=cd.mixesIn,cd.register=cd.defines=cd.defaults=cd.exports=cd.defaultProperties=cd.definePrototype,cd.defaultsTo=cd.enhance=cd["with"]=cd.definePrototype,cd.publicMethods=cd.publicInterface,cd.privateMethods=cd.privateInterface,cd.classMethods=cd.classInterface,_.extend(Luca.define=ComponentDefinition.create,{__definitions:[],incomplete:function(){return _(Luca.define.__definitions).select(function(a){return a.isOpen()})},close:function(){var a,b,c,d;d=Luca.define.incomplete();for(b=0,c=d.length;b<c;b++)a=d[b],a.isValid()&&a.register();return Luca.define.__definitions.length=0},findDefinition:function(a){return _(Luca.define.__definitions).detect(function(b){return b.componentName===a})}}),Luca.register=function(a){return new ComponentDefinition(a,!0)},_.mixin({def:Luca.define}),Luca.extend=function(a,b,c){var d,e,f,g,h,i;c==null&&(c={}),f=Luca.util.resolve(a,window||global);if(!_.isFunction(f!=null?f.extend:void 0))throw"Error defining "+b+". "+a+" is not a valid component to extend from";c.displayName=b,c._superClass=function(){return f.displayName||(f.displayName=a),f},c._super=function(a,b,c){var d;return b==null&&(b=this),c==null&&(c=[]),(d=this._superClass().prototype[a])!=null?d.apply(b,c):void 0},d=f.extend(c);if(_.isArray(c!=null?c.include:void 0)){i=c.include;for(g=0,h=i.length;g<h;g++)e=i[g],_.isString(e)&&(e=Luca.util.resolve(e)),_.extend(d.prototype,e)}return d}}.call(this),function(){Luca.concerns.ApplicationEventBindings={__initializer:function(){var a,b,c,d,e,f,g;if(_.isEmpty(this.applicationEvents))return;a=this.app;if(_.isString(a)||_.isUndefined(a))a=(e=Luca.Application)!=null?typeof e.get=="function"?e.get(a):void 0:void 0;if(!Luca.supportsEvents(a))throw"Error binding to the application object on "+(this.name||this.cid);f=this.applicationEvents,g=[];for(c=0,d=f.length;c<d;c++){b=f[c],_.isString(c)&&(c=this[c]);if(!_.isFunction(c))throw"Error registering application event "+b+" on "+(this.name||this.cid);g.push(a.on(b,c))}return g}}}.call(this),function(){Luca.concerns.CollectionEventBindings={__initializer:function(){var a,b,c,d,e,f,g,h,i;if(_.isEmpty(this.collectionEvents))return;e=this.collectionManager||Luca.CollectionManager.get(),g=this.collectionEvents,i=[];for(f in g){c=g[f],h=f.split(" "),d=h[0],b=h[1],a=e.getOrCreate(d);if(!a)throw"Could not find collection specified by "+d;_.isString(c)&&(c=this[c]);if(!_.isFunction(c))throw"invalid collectionEvents configuration";try{i.push(a.on(b,c,a))}catch(j){throw console.log("Error Binding To Collection in registerCollectionEvents",this),j}}return i}}}.call(this),function(){Luca.concerns.Deferrable={configure_collection:function(a){var b,c,d;a==null&&(a=!0);if(!this.collection)return;_.isString(this.collection)&&(b=(c=Luca.CollectionManager)!=null?c.get():void 0)&&(this.collection=b.getOrCreate(this.collection)),this.collection&&_.isFunction(this.collection.fetch)&&_.isFunction(this.collection.reset)||(this.collection=new Luca.Collection(this.collection.initial_set,this.collection));if((d=this.collection)!=null?d.deferrable_trigger:void 0)this.deferrable_trigger=this.collection.deferrable_trigger;if(a)return this.deferrable=this.collection}}}.call(this),function(){Luca.concerns.DomHelpers={__initializer:function(){var a,b,c,d,e,f,g,h,i,j;b=_(this.additionalClassNames||[]).clone(),this.wrapperClass!=null&&this.$wrap(this.wrapperClass),_.isString(b)&&(b=b.split(" ")),this.gridSpan&&b.push("span"+this.gridSpan),this.gridOffset&&b.push("offset"+this.gridOffset),this.gridRowFluid&&b.push("row-fluid"),this.gridRow&&b.push("row");if(b==null)return;for(e=0,g=b.length;e<g;e++)a=b[e],this.$el.addClass(a);if(Luca.config.autoApplyClassHierarchyAsCssClasses===!0){c=(typeof this.componentMetaData=="function"?(i=this.componentMetaData())!=null?i.styleHierarchy():void 0:void 0)||[],j=[];for(f=0,h=c.length;f<h;f++)d=c[f],d!=="luca-view"&&d!=="backbone-view"&&j.push(this.$el.addClass(d));return j}},$wrap:function(a){return _.isString(a)&&!a.match(/[<>]/)&&(a=this.make("div",{"class":a,"data-wrapper":!0})),this.$el.wrap(a)},$wrapper:function(){return this.$el.parent('[data-wrapper="true"]')},$template:function(a,b){return b==null&&(b={}),this.$el.html(Luca.template(a,b))},$html:function(a){return this.$el.html(a)},$append:function(a){return this.$el.append(a)},$attach:function(){return this.$container().append(this.el)},$bodyEl:function(){return this.$el},$container:function(){return $(this.container)}}}.call(this),function(){Luca.concerns.EnhancedProperties={__initializer:function(){if(Luca.config.enhancedViewProperties!==!0)return;_.isString(this.collection)&&Luca.CollectionManager.get()&&(this.collection=Luca.CollectionManager.get().getOrCreate(this.collection)),this.template!=null&&this.$template(this.template,this);if(_.isString(this.collectionManager))return this.collectionManager=Luca.CollectionManager.get(this.collectionManager)}}}.call(this),function(){var a,b=Object.prototype.hasOwnProperty,c=function(a,c){function e(){this.constructor=a}for(var d in c)b.call(c,d)&&(a[d]=c[d]);return e.prototype=c.prototype,a.prototype=new e,a.__super__=c.prototype,a};Luca.concerns.Filterable={__included:function(a,b){return _.extend(Luca.Collection.prototype,{__filters:{}})},__initializer:function(a,b){var c,d,e,f=this;if(this.filterable===!1)return;Luca.isBackboneCollection(this.collection)||(this.collection=typeof (d=Luca.CollectionManager).get=="function"?(e=d.get())!=null?e.getOrCreate(this.collection):void 0:void 0);if(!Luca.isBackboneCollection(this.collection)){this.debug("Skipping Filterable due to no collection being present on "+(this.name||this.cid)),this.debug("Collection",this.collection);return}return this.getCollection||(this.getCollection=function(){return this.collection}),c=this.getFilterState(),this.querySources||(this.querySources=[]),this.optionsSources||(this.optionsSources=[]),this.query||(this.query={}),this.queryOptions||(this.queryOptions={}),this.querySources.push(function(a){return a==null&&(a={}),f.getFilterState().toQuery()}),this.optionsSources.push(function(a){return a==null&&(a={}),f.getFilterState().toOptions()}),c.on("change",function(){var a;return c=_.clone(f.getQuery()),a=_.clone(f.getQueryOptions()),a.limit!=null&&(c.limit=a.limit),a.page!=null&&(c.page=a.page),a.sortBy!=null&&(c.sortBy=a.sortBy),f.isRemote()?f.collection.applyFilter(c,{remote:!0}):f.trigger("refresh")}),b},isRemote:function(){return this.getQueryOptions().remote===!0},getFilterState:function(){var b,c;return(b=this.collection.__filters)[c=this.cid]||(b[c]=new a(this.filterable))},setSortBy:function(a,b){return b==null&&(b={}),this.getFilterState().setOption("sortBy",a,b)},applyFilter:function(a,b){return a==null&&(a={}),b==null&&(b={}),b=_.defaults(b,this.getQueryOptions()),a=_.defaults(a,this.getQuery()),this.getFilterState().set({query:a,options:b},b)}},a=function(a){function b(){b.__super__.constructor.apply(this,arguments)}return c(b,a),b.prototype.defaults={options:{},query:{}},b.prototype.setOption=function(a,b,c){var d;return d={},d[a]=b,this.set("options",_.extend(this.toOptions(),d),c)},b.prototype.setQueryOption=function(a,b,c){var d;return d={},d[a]=b,this.set("query",_.extend(this.toQuery(),d),c)},b.prototype.toOptions=function(){return this.toJSON().options},b.prototype.toQuery=function(){return this.toJSON().query},b.prototype.toRemote=function(){var a;return a=this.toOptions(),_.extend(this.toQuery(),{limit:a.limit,page:a.page,sortBy:a.sortBy})},b}(Backbone.Model)}.call(this),function(){Luca.concerns.GridLayout={_initializer:function(){this.gridSpan&&this.$el.addClass("span"+this.gridSpan),this.gridOffset&&this.$el.addClass("offset"+this.gridOffset),this.gridRowFluid&&this.$el.addClass("row-fluid");if(this.gridRow)return this.$el.addClass("row")}}}.call(this),function(){Luca.concerns.LoadMaskable={__initializer:function(){var a=this;if(this.loadMask!==!0)return;if(this.loadMask===!0)return this.defer(function(){a.$el.addClass("with-mask");if(a.$(".load-mask").length===0)return a.loadMaskTarget().prepend(Luca.template(a.loadMaskTemplate,a)),a.$(".load-mask").hide()}).until("after:render"),this.on(this.loadmaskEnableEvent||"enable:loadmask",this.applyLoadMask,this),this.on(this.loadmaskDisableEvent||"disable:loadmask",this.applyLoadMask,this)},showLoadMask:function(){return this.trigger("enable:loadmask")},hideLoadMask:function(){return this.trigger("disable:loadmask")},loadMaskTarget:function(){return this.loadMaskEl!=null?this.$(this.loadMaskEl):this.$bodyEl()},disableLoadMask:function(){return this.$(".load-mask .bar").css("width","100%"),this.$(".load-mask").hide(),clearInterval(this.loadMaskInterval)},enableLoadMask:function(){var a,b=this;this.$(".load-mask").show().find(".bar").css("width","0%"),a=this.$(".load-mask .progress").width(),a<20&&(a=this.$el.width())<20&&(a=this.$el.parent().width()),this.loadMaskInterval=setInterval(function(){var a,c;return a=b.$(".load-mask .bar").width(),c=a+12,b.$(".load-mask .bar").css("width",c)},200);if(this.loadMaskTimeout==null)return;return _.delay(function(){return b.disableLoadMask()},this.loadMaskTimeout)},applyLoadMask:function(){return this.$(".load-mask").is(":visible")?this.disableLoadMask():this.enableLoadMask()}}}.call(this),function(){Luca.LocalStore=function(){function a(a){var b;this.name=a,b=localStorage.getItem(this.name),this.data=b&&JSON.parse(b)||{}}return a.prototype.guid=function(){var a;return a=function(){return((1+Math.random())*65536|0).toString(16).substring(1)},a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()},a.prototype.save=function(){return localStorage.setItem(this.name,JSON.stringify(this.data))},a.prototype.create=function(a){return a.id||(a.id=a.attribtues.id=this.guid()),this.data[a.id]=a,this.save(),a},a.prototype.update=function(a){return this.data[a.id]=a,this.save(),a},a.prototype.find=function(a){return this.data[a.id]},a.prototype.findAll=function(){return _.values(this.data)},a.prototype.destroy=function(a){return delete this.data[a.id],this.save(),a},a}(),Backbone.LocalSync=function(a,b,c){var d,e;return e=b.localStorage||b.collection.localStorage,d=function(){switch(a){case"read":return b.id?e.find(b):e.findAll();case"create":return e.create(b);case"update":return e.update(b);case"delete":return e.destroy(b)}}(),d?c.success(d):c.error("Record not found")}}.call(this),function(){var a;Luca.concerns.ModalView={closeOnEscape:!0,showOnInitialize:!1,backdrop:!1,__initializer:function(){return this.$el.addClass("modal"),this.on("before:render",a,this),this},container:function(){return $("body")},toggle:function(){return this.$el.modal("toggle")},show:function(){return this.$el.modal("show")},hide:function(){return this.$el.modal("hide")}},a=function(){return this.$el.addClass("modal"),this.fade===!0&&this.$el.addClass("fade"),$("body").append(this.$el),this.$el.modal({backdrop:this.backdrop===!0,keyboard:this.closeOnEscape===!0,show:this.showOnInitialize===!0}),this}}.call(this),function(){Luca.concerns.ModelPresenter={classMethods:{getPresenter:function(a){var b;return(b=this.presenters)!=null?b[a]:void 0},registerPresenter:function(a,b){return this.presenters||(this.presenters={}),this.presenters[a]=b}},presentAs:function(a){var b,c=this;try{return b=this.componentMetaData().componentDefinition().getPresenter(a),b==null?this.toJSON():_(b).reduce(function(a,b){return a[b]=c.read(b),a},{})}catch(d){return console.log("Error presentAs",d.stack,d.message),this.toJSON()}}}}.call(this),function(){Luca.concerns.Paginatable={paginatorViewClass:"Luca.components.PaginationControl",paginationSelector:".toolbar.bottom",__included:function(){return _.extend(Luca.Collection.prototype,{__paginators:{}})},__initializer:function(){var a,b,c,d,e=this;if(this.paginatable===!1)return;Luca.isBackboneCollection(this.collection)||(this.collection=typeof (c=Luca.CollectionManager).get=="function"?(d=c.get())!=null?d.getOrCreate(this.collection):void 0:void 0);if(!Luca.isBackboneCollection(this.collection)){this.debug("Skipping Paginatable due to no collection being present on "+(this.name||this.cid)),this.debug("collection",this.collection);return}return _.bindAll(this,"paginationControl","pager"),this.getCollection||(this.getCollection=function(){return this.collection}),a=this.getCollection(),b=this.getPaginationState(),this.optionsSources||(this.optionsSources=[]),this.queryOptions||(this.queryOptions={}),this.optionsSources.push(function(){var a;return a=_(b.toJSON()).pick("limit","page","sortBy"),_.extend(a,{pager:e.pager})}),b.on("change:page",function(a){var b,c;return b=_.clone(e.getQuery()),c=_.clone(e.getQueryOptions()),c.limit!=null&&(b.limit=c.limit),c.page!=null&&(b.page=c.page),c.sortBy!=null&&(b.sortBy=c.sortBy),e.isRemote()?e.collection.applyFilter(b,{remote:!0}):e.trigger("refresh")}),this.on("before:render",this.renderPaginationControl,this)},pager:function(a,b){return this.getPaginationState().set({numberOfPages:a,itemCount:b.length}),this.paginationControl().updateWithPageCount(a,b)},isRemote:function(){return this.getQueryOptions().remote===!0},getPaginationState:function(){var a,b;return(a=this.collection.__paginators)[b=this.cid]||(a[b]=this.paginationControl().state)},paginationContainer:function(){return this.$(">"+this.paginationSelector)},setCurrentPage:function(a,b){return a==null&&(a=1),b==null&&(b={}),this.getPaginationState().set("page",a,b)},setPage:function(a,b){return a==null&&(a=1),b==null&&(b={}),this.getPaginationState().set("page",a,b)},setLimit:function(a,b){return a==null&&(a=0),b==null&&(b={}),this.getPaginationState().set("limit",a,b)},paginationControl:function(){return this.paginator!=null?this.paginator:(_.defaults(this.paginatable||(this.paginatable={}),{page:1,limit:20}),this.paginator=Luca.util.lazyComponent({type:"pagination_control",collection:this.getCollection(),defaultState:this.paginatable,parent:this.name||this.cid,debugMode:this.debugMode}),this.paginator)},renderPaginationControl:function(){var a;return a=this.paginationControl(),this.paginationContainer().append(a.render().$el),a}}}.call(this),function(){Luca.concerns.QueryCollectionBindings={getCollection:function(){return this.collection},loadModels:function(a,b){var c;return a==null&&(a=[]),b==null&&(b={}),(c=this.getCollection())!=null?c.reset(a,b):void 0},applyQuery:function(a,b){return a==null&&(a={}),b==null&&(b={}),this.query=a,this.queryOptions=b,this.refresh(),this},getQuery:function(a){var b,c,d,e,f;a==null&&(a={}),b=this.query||(this.query={}),f=_(this.querySources||[]).compact();for(d=0,e=f.length;d<e;d++)c=f[d],b=_.extend(b,c(a)||{});return b},getQueryOptions:function(a){var b,c,d,e;a==null&&(a={}),a=this.queryOptions||(this.queryOptions={}),e=_(this.optionsSources||[]).compact();for(c=0,d=e.length;c<d;c++)b=e[c],a=_.extend(a,b(a)||{});return a},getModels:function(a,b){var c;return((c=this.collection)!=null?c.query:void 0)?(a||(a=this.getQuery()),b||(b=this.getQueryOptions()),this.collection.query(a,b)):this.collection.models}}}.call(this),function(){Luca.concerns.StateModel={__initializer:function(){var a=this;if(this.stateful!==!0)return;if(this.state!=null&&!Luca.isBackboneModel(this.state))return;return this.state=new Backbone.Model(this.defaultState||{}),this.set||(this.set=function(){return a.state.set.apply(a.state,arguments)}),this.get||(this.get=function(){return a.state.get.apply(a.state,arguments)}),this.state.on("change",function(b){var c,d,e,f,g,h;a.trigger("state:change",b),d=b.previousAttributes(),g=b.changedAttributes,h=[];for(e=0,f=g.length;e<f;e++)c=g[e],h.push(a.trigger("state:change:"+c,e,b.previous(c)));return h})}}}.call(this),function(){Luca.concerns.Templating={__initializer:function(){var a,b,c;c=Luca.util.read.call(this,this.bodyTemplateVars)||{};if(a=this.bodyTemplate)return this.$el.empty(),b=Luca.template(a,c),Luca.View.prototype.$html.call(this,b)}}}.call(this),function(){var a,b;b={classes:{},model_classes:{},collection_classes:{},namespaces:["Luca.containers","Luca.components"]},a={cid_index:{},name_index:{}},Luca.config.defaultComponentClass=Luca.defaultComponentClass="Luca.View",Luca.config.defaultComponentType=Luca.defaultComponentType="view",Luca.registry.aliases={grid:"grid_view",form:"form_view",text:"text_field",button:"button_field",select:"select_field",card:"card_view",paged:"card_view",wizard:"card_view",collection:"collection_view",list:"collection_view",multi:"collection_multi_view",table:"table_view"},Luca.registerComponent=function(a,c,d){d==null&&(d="view"),Luca.trigger("component:registered",a,c);switch(d){case"model":return b.model_classes[a]=c;case"collection":return b.collection_classes[a]=c;default:return b.classes[a]=c}},Luca.development_mode_register=function(a,c){var d,e,f;return d=b.classes[a],Luca.enableDevelopmentTools===!0&&d!=null&&(f=Luca.util.resolve(d,window),e=Luca.registry.findInstancesByClassName(c),_(e).each(function(a){var b;return a!=null?(b=a.refreshCode)!=null?b.call(a,f):void 0:void 0})),Luca.registerComponent(a,c)},Luca.registry.addNamespace=Luca.registry.namespace=function(a){return b.namespaces.push(a),b.namespaces=_(b.namespaces).uniq()},Luca.registry.namespaces=function(a){return a==null&&(a=!0),_(b.namespaces).map(function(b){return a?Luca.util.resolve(b):b})},Luca.registry.lookup=function(a){var c,d,e,f,g,h;if(c=Luca.registry.aliases[a])a=c;return d=b.classes[a],d!=null?d:(e=Luca.util.classify(a),g=Luca.registry.namespaces(),f=(h=_(g).chain().map(function(a){return a[e]}).compact().value())!=null?h[0]:void 0)},Luca.registry.instances=function(){return _(a.cid_index).values()},Luca.registry.findInstancesByClass=function(a){return Luca.registry.findInstancesByClassName(a.displayName)},Luca.registry.findInstancesByClassName=function(a){var b;return _.isString
|
7
|
+
(a)||(a=a.displayName),b=Luca.registry.instances(),_(b).select(function(b){var c,d;return c=b.displayName===a,b.displayName===a||(typeof b._superClass=="function"?(d=b._superClass())!=null?d.displayName:void 0:void 0)===a})},Luca.registry.classes=function(a){return a==null&&(a=!1),_(_.extend({},b.classes,b.model_classes,b.collection_classes)).map(function(b,c){return a?b:{className:b,ctype:c}})},Luca.registry.find=function(a){return Luca.util.resolve(a)||Luca.define.findDefinition(a)},Luca.cache=Luca.cacheInstance=function(b,c){var d;if(b==null)return;return(c!=null?c.doNotCache:void 0)===!0?c:(c!=null&&(a.cid_index[b]=c),c=a.cid_index[b],(c!=null?c.component_name:void 0)!=null?a.name_index[c.component_name]=c.cid:(c!=null?c.name:void 0)!=null&&(a.name_index[c.name]=c.cid),c!=null?c:(d=a.name_index[b],a.cid_index[d]))}}.call(this),function(){var a;Luca.registry.componentMetaData={},Luca.registry.getMetaDataFor=function(b){return new a(Luca.registry.componentMetaData[b])},Luca.registry.addMetaData=function(a,b,c){var d,e;return d=(e=Luca.registry.componentMetaData)[a]||(e[a]={}),d[b]=_(c).clone(),d},a=function(){function a(a){this.meta=a!=null?a:{},_.defaults(this.meta,{"super class name":"","display name":"","public interface":[],"public configuration":[],"private interface":[],"private configuration":[],"class configuration":[],"class interface":[]})}return a.prototype.superClass=function(){return Luca.util.resolve(this.meta["super class name"])},a.prototype.componentDefinition=function(){return Luca.registry.find(this.meta["display name"])},a.prototype.componentPrototype=function(){var a;return(a=this.componentDefinition())!=null?a.prototype:void 0},a.prototype.prototypeFunctions=function(){return _.functions(this.componentPrototype())},a.prototype.classAttributes=function(){return _.uniq(this.classInterface().concat(this.classConfiguration()))},a.prototype.publicAttributes=function(){return _.uniq(this.publicInterface().concat(this.publicConfiguration()))},a.prototype.privateAttributes=function(){return _.uniq(this.privateInterface().concat(this.privateConfiguration()))},a.prototype.classMethods=function(){var a;return a=_.functions(this.componentDefinition()),_(a).intersection(this.classAttributes())},a.prototype.publicMethods=function(){return _(this.prototypeFunctions()).intersection(this.publicAttributes())},a.prototype.privateMethods=function(){return _(this.prototypeFunctions()).intersection(this.privateAttributes())},a.prototype.classConfiguration=function(){return this.meta["class configuration"]},a.prototype.publicConfiguration=function(){return this.meta["public configuration"]},a.prototype.privateConfiguration=function(){return this.meta["private configuration"]},a.prototype.classInterface=function(){return this.meta["class interface"]},a.prototype.publicInterface=function(){return this.meta["public interface"]},a.prototype.privateInterface=function(){return this.meta["private interface"]},a.prototype.triggers=function(){return this.meta.hooks},a.prototype.hooks=function(){return this.meta.hooks},a.prototype.styleHierarchy=function(){var a;return a=_(this.classHierarchy()).map(function(a){return Luca.util.toCssClass(a,"views","components","core","fields","containers")}),_(a).without("backbone-view","luca-view")},a.prototype.classHierarchy=function(){var a,b,c,d,e,f;a=[this.meta["display name"],this.meta["super class name"]],b=(c=this.superClass())!=null?(d=c.prototype)!=null?typeof d.componentMetaData=="function"?d.componentMetaData():void 0:void 0:void 0;while(!!b)a=a.concat(b!=null?b.classHierarchy():void 0),b=(e=b.superClass())!=null?(f=e.prototype)!=null?typeof f.componentMetaData=="function"?f.componentMetaData():void 0:void 0:void 0;return _(a).uniq()},a}()}.call(this),function(){var a=Array.prototype.slice;Luca.Observer=function(){function b(a){var b=this;this.options=a!=null?a:{},_.extend(this,Backbone.Events),this.type=this.options.type,this.options.debugAll&&this.bind("all",function(a,b,c){return console.log("ALL",a,b,c)})}return b.prototype.relay=function(){var b,c;return c=arguments[0],b=2<=arguments.length?a.call(arguments,1):[],console.log("Relaying",trigger,b),this.trigger("event",c,b),this.trigger("event:"+b[0],c,b.slice(1))},b}(),Luca.Observer.enableObservers=function(a){return a==null&&(a={}),Luca.enableGlobalObserver=!0,Luca.ViewObserver=new Luca.Observer(_.extend(a,{type:"view"})),Luca.CollectionObserver=new Luca.Observer(_.extend(a,{type:"collection"}))}}.call(this),function(){var a,b,c,d=Array.prototype.slice;c=Luca.register("Luca.View"),c["extends"]("Backbone.View"),c.includes("Luca.Events","Luca.concerns.DomHelpers"),c.mixesIn("DomHelpers","Templating","EnhancedProperties","CollectionEventBindings","ApplicationEventBindings","StateModel"),c.triggers("before:initialize","after:initialize","before:render","after:render","first:activation","activation","deactivation"),c.defines({initialize:function(b){return this.options=b!=null?b:{},this.trigger("before:initialize",this,this.options),_.extend(this,this.options),(this.autoBindEventHandlers===!0||this.bindAllEvents===!0)&&a.call(this),this.name!=null&&(this.cid=_.uniqueId(this.name)),this.$el.attr("data-luca-id",this.name||this.cid),Luca.cacheInstance(this.cid,this),this.setupHooks(_(Luca.View.prototype.hooks.concat(this.hooks)).uniq()),Luca.concern.setup.call(this),this.delegateEvents(),this.trigger("after:initialize",this)},setupHooks:Luca.util.setupHooks,registerEvent:function(a,b){return this.events||(this.events={}),this.events[a]=b,this.delegateEvents()},definitionClass:function(){var a;return(a=Luca.util.resolve(this.displayName,window))!=null?a.prototype:void 0},collections:function(){return Luca.util.selectProperties(Luca.isBackboneCollection,this)},models:function(){return Luca.util.selectProperties(Luca.isBackboneModel,this)},views:function(){return Luca.util.selectProperties(Luca.isBackboneView,this)},debug:function(){var a;a=1<=arguments.length?d.call(arguments,0):[];if(!this.debugMode&&window.LucaDebugMode==null)return;return console.log([this.name||this.cid].concat(d.call(a)))},trigger:function(){return Luca.enableGlobalObserver&&(Luca.developmentMode===!0||this.observeEvents===!0)&&(Luca.ViewObserver||(Luca.ViewObserver=new Luca.Observer({type:"view"})),Luca.ViewObserver.relay(this,arguments)),Backbone.View.prototype.trigger.apply(this,arguments)}}),Luca.View._originalExtend=Backbone.View.extend,Luca.View.renderWrapper=function(a){var b;return b=a.render,b||(b=Luca.View.prototype.$attach),a.render=function(){var a,d,e,f,g,h=this;return c=this,this.deferrable?(f=this.deferrable_target,Luca.isBackboneCollection(this.deferrable)||(this.deferrable=this.collection),f||(f=this.deferrable),g=this.deferrable_event?this.deferrable_event:Luca.View.deferrableEvent,d=function(){return b.call(c),c.trigger("after:render",c)},c.defer(d).until(f,g),c.trigger("before:render",this),a=this.deferrable_trigger||this.deferUntil,a==null?f[this.deferrable_method||"fetch"].call(f):(e=_.once(function(){var a,b;return typeof (a=h.deferrable)[b=h.deferrable_method||"fetch"]=="function"?a[b]():void 0}),(this.deferrable_target||this).bind(this.deferrable_trigger,e)),this):(this.trigger("before:render",this),b.apply(this,arguments),this.trigger("after:render",this),this)},a},a=function(){var a,c,d,e,f;e=[this.events,this.componentEvents,this.collectionEvents,this.applicationEvents],f=[];for(c=0,d=e.length;c<d;c++)a=e[c],_.isEmpty(a)||f.push(b.call(this,a));return f},b=function(a){var b,c,d;a==null&&(a={}),d=[];for(b in a)c=a[b],_.isString(c)?d.push(_.bindAll(this,c)):d.push(void 0);return d},Luca.View.deferrableEvent="reset",Luca.View.extend=function(a){var b,c,d,e,f;a==null&&(a={}),a=Luca.View.renderWrapper(a),a.concerns!=null&&(a.concerns||(a.concerns=a.concerns)),b=Luca.View._originalExtend.call(this,a);if(a.concerns!=null&&_.isArray(a.concerns)){f=a.concerns;for(d=0,e=f.length;d<e;d++)c=f[d],Luca.decorate(b)["with"](c)}return b}}.call(this),function(){var a,b;a=Luca.define("Luca.Model"),a["extends"]("Backbone.Model"),a.includes("Luca.Events"),a.defines({initialize:function(){return Backbone.Model.prototype.initialize(this,arguments),b.call(this),Luca.concern.setup.call(this)},read:function(a){return _.isFunction(this[a])?this[a].call(this):this.get(a)||this[a]},get:function(a){var b;return((b=this.computed)!=null?b.hasOwnProperty(a):void 0)?this._computed[a]:Backbone.Model.prototype.get.call(this,a)}}),b=function(){var a,b,c,d,e=this;if(_.isUndefined(this.computed))return;this._computed={},c=this.computed,d=[];for(a in c)b=c[a],this.on("change:"+a,function(){return e._computed[a]=e[a].call(e)}),_.isString(b)&&(b=b.split(",")),d.push(_(b).each(function(b){e.on("change:"+b,function(){return e.trigger("change:"+a)});if(e.has(b))return e.trigger("change:"+a)}));return d},Luca.Model._originalExtend=Backbone.Model.extend,Luca.Model.extend=function(a){var b,c,d,e,f;a==null&&(a={}),a.concerns!=null&&(a.concerns||(a.concerns=a.concerns)),b=Luca.Model._originalExtend.call(this,a);if(a.concerns!=null&&_.isArray(a.concerns)){f=a.concerns;for(d=0,e=f.length;d<e;d++)c=f[d],Luca.decorate(b)["with"](c)}return b}}.call(this),function(){var a;a=Luca.define("Luca.Collection"),a["extends"]("Backbone.QueryCollection"),a.includes("Luca.Events"),a.triggers("after:initialize","before:fetch","after:response"),a.defines({model:Luca.Model,cachedMethods:[],remoteFilter:!1,initialize:function(a,b){var c,d=this;a==null&&(a=[]),this.options=b,_.extend(this,this.options),this.setupMethodCaching(),this._reset(),this.cached&&console.log("The @cached property of Luca.Collection is being deprecated. Please change to cache_key");if(this.cache_key||(this.cache_key=this.cached))this.bootstrap_cache_key=_.isFunction(this.cache_key)?this.cache_key():this.cache_key;(this.registerAs||this.registerWith)&&console.log("This configuration API is deprecated. use @name and @manager properties instead"),this.name||(this.name=this.registerAs),this.manager||(this.manager=this.registerWith),this.manager=_.isFunction(this.manager)?this.manager():this.manager,this.name&&!this.manager&&(this.manager=Luca.CollectionManager.get()),this.manager&&(this.name||(this.name=this.cache_key()),this.name=_.isFunction(this.name)?this.name():this.name,!this.private&&!this.anonymous&&this.bind("after:initialize",function(){return d.register(d.manager,d.name,d)}));if(this.useLocalStorage===!0&&window.localStorage!=null)throw c=this.bootstrap_cache_key||this.name,"Must specify either a cached or registerAs property to use localStorage";return _.isArray(this.data)&&this.data.length>0&&(this.memoryCollection=!0),this.useNormalUrl!==!0&&this.__wrapUrl(),Backbone.Collection.prototype.initialize.apply(this,[a,this.options]),a&&this.reset(a,{silent:!0,parse:b!=null?b.parse:void 0}),Luca.concern.setup.call(this),Luca.util.setupHooks.call(this,this.hooks),this.trigger("after:initialize")},__wrapUrl:function(){var a,b,c=this;return _.isFunction(this.url)?this.url=_.wrap(this.url,function(a){var b,d,e,f,g;return g=a.apply(c),e=g.split("?"),e.length>1&&(b=_.last(e)),f=c.queryString(),b&&g.match(b)&&(f=f.replace(b,"")),d=""+g+"?"+f,d.match(/\?$/)&&(d=d.replace(/\?$/,"")),d}):(b=this.url,a=this.queryString(),this.url=_([b,a]).compact().join("?"))},queryString:function(){var a,b=this;return a=_(this.base_params||(this.base_params=Luca.Collection.baseParams())).inject(function(a,b,c){var d;return d=""+c+"="+b,a.push(d),a},[]),_.uniq(a).join("&")},resetFilter:function(){return this.base_params=_(Luca.Collection.baseParams()).clone(),this},applyFilter:function(a,b){return a==null&&(a={}),b==null&&(b={}),b=_(b).clone(),b.remote!=null==1||this.remoteFilter===!0?(this.applyParams(a),this.fetch(_.extend(b,{refresh:!0,remote:!0}))):this.reset(this.query(a,b))},applyParams:function(a){return this.base_params=_(Luca.Collection.baseParams()).clone(),_.extend(this.base_params,a),this},register:function(a,b,c){a==null&&(a=Luca.CollectionManager.get()),b==null&&(b="");if(!(b.length>=1))throw"Can not register with a collection manager without a key";if(a==null)throw"Can not register with a collection manager without a valid collection manager";_.isString(a)&&(a=Luca.util.nestedValue(a,window||global));if(!a)throw"Could not register with collection manager";if(_.isFunction(a.add))return a.add(b,c);if(_.isObject(a))return a[b]=c},loadFromBootstrap:function(){if(!this.bootstrap_cache_key)return;return this.reset(this.cached_models()),this.trigger("bootstrapped",this)},bootstrap:function(){return this.loadFromBootstrap()},cached_models:function(){return Luca.Collection.cache(this.bootstrap_cache_key)},fetch:function(a){var b;a==null&&(a={}),this.trigger("before:fetch",this);if(this.memoryCollection===!0)return this.reset(this.data);if(this.cached_models().length&&a.refresh!==!0&&a.remote!==!0)return this.bootstrap();b=_.isFunction(this.url)?this.url():this.url;if(!(b&&b.length>1||this.localStorage))return!0;this.fetching=!0;try{return Backbone.Collection.prototype.fetch.apply(this,arguments)}catch(c){throw console.log("Error in Collection.fetch",c),c}},onceLoaded:function(a,b){var c,d=this;b==null&&(b={}),_.defaults(b,{autoFetch:!0});if(this.length>0&&!this.fetching){a.apply(this,[this]);return}c=function(){return a.apply(d,[d])},this.bind("reset",function(){return c(),this.unbind("reset",this)});if(!this.fetching&&!!b.autoFetch)return this.fetch()},ifLoaded:function(a,b){var c,d=this;b==null&&(b={scope:this,autoFetch:!0}),c=b.scope||this,this.length>0&&!this.fetching&&a.apply(c,[this]),this.bind("reset",function(b){return a.call(c,b)});if(!(this.fetching===!0||!b.autoFetch||this.length>0))return this.fetch()},parse:function(a){var b;return this.fetching=!1,this.trigger("after:response",a),b=this.root!=null?a[this.root]:a,this.bootstrap_cache_key&&Luca.Collection.cache(this.bootstrap_cache_key,b),b},restoreMethodCache:function(){var a,b,c,d;c=this._methodCache,d=[];for(b in c)a=c[b],a.original!=null?(a.args=void 0,d.push(this[b]=a.original)):d.push(void 0);return d},clearMethodCache:function(a){return this._methodCache[a].value=void 0},clearAllMethodsCache:function(){var a,b,c,d;c=this._methodCache,d=[];for(b in c)a=c[b],d.push(this.clearMethodCache(b));return d},setupMethodCaching:function(){var b,c;return a=this,c=["reset","add","remove"],b=this._methodCache={},_(this.cachedMethods).each(function(d){var e,f,g,h,i,j,k,l,m;b[d]={name:d,original:a[d],value:void 0},a[d]=function(){var c;return(c=b[d]).value||(c.value=b[d].original.apply(a,arguments))};for(h=0,j=c.length;h<j;h++)g=c[h],a.bind(g,function(){return a.clearAllMethodsCache()});e=d.split(":")[1];if(e){l=e.split(","),m=[];for(i=0,k=l.length;i<k;i++)f=l[i],m.push(a.bind("change:"+f,function(){return a.clearMethodCache({method:d})}));return m}})},query:function(a,b){return a==null&&(a={}),b==null&&(b={}),Backbone.QueryCollection!=null?Backbone.QueryCollection.prototype.query.apply(this,arguments):this.models}}),_.extend(Luca.Collection.prototype,{trigger:function(){return Luca.enableGlobalObserver&&(Luca.CollectionObserver||(Luca.CollectionObserver=new Luca.Observer({type:"collection"})),Luca.CollectionObserver.relay(this,arguments)),Backbone.View.prototype.trigger.apply(this,arguments)}}),Luca.Collection._originalExtend=Backbone.Collection.extend,Luca.Collection.extend=function(a){var b,c,d,e,f;a==null&&(a={}),a.concerns!=null&&(a.concerns||(a.concerns=a.concerns)),b=Luca.Collection._originalExtend.call(this,a);if(a.concerns!=null&&_.isArray(a.concerns)){f=a.concerns;for(d=0,e=f.length;d<e;d++)c=f[d],Luca.decorate(b)["with"](c)}return b},Luca.Collection.namespace=function(a){var b;return _.isString(a)&&(a=Luca.util.resolve(a)),a!=null&&(Luca.Collection.__defaultNamespace=a),(b=Luca.Collection).__defaultNamespace||(b.__defaultNamespace=window||global),Luca.util.read(Luca.Collection.__defaultNamespace)},Luca.Collection.baseParams=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),a&&(Luca.Collection._baseParams=a),Luca.util.read(Luca.Collection._baseParams)},Luca.Collection._bootstrapped_models={},Luca.Collection.bootstrap=function(a){return _.extend(Luca.Collection._bootstrapped_models,a)},Luca.Collection.cache=function(a,b){return b?Luca.Collection._bootstrapped_models[a]=b:Luca.Collection._bootstrapped_models[a]||[]}}.call(this),function(){var a;a=function(a,b){var c,d,e,f,g;return a==null&&(a={}),a.orientation||(a.orientation="top"),a.ctype||(a.ctype=this.toolbarType||"panel_toolbar"),f=""+this.cid+"-tbc-"+a.orientation,g=Luca.util.lazyComponent(a),d=this.make("div",{"class":"toolbar-container "+a.orientation,id:f},g.render().el),e=this.bodyClassName||this.bodyTagName,c=function(){switch(a.orientation){case"top":case"left":return e?"before":"prepend";case"bottom":case"right":return e?"after":"append"}}(),(b||this.$bodyEl())[c](d)},_.def("Luca.components.Panel")["extends"]("Luca.View")["with"]({topToolbar:void 0,bottomToolbar:void 0,loadMask:!1,loadMaskTemplate:["components/load_mask"],loadMaskTimeout:3e3,mixins:["LoadMaskable"],initialize:function(a){return this.options=a!=null?a:{},Luca.View.prototype.initialize.apply(this,arguments)},applyStyles:function(a,b){var c,d,e;a==null&&(a={}),b==null&&(b=!1),d=b?this.$bodyEl():this.$el;for(c in a)e=a[c],d.css(c,e);return this},beforeRender:function(){var a;return(a=Luca.View.prototype.beforeRender)!=null&&a.apply(this,arguments),this.styles!=null&&this.applyStyles(this.styles),this.bodyStyles!=null&&this.applyStyles(this.bodyStyles,!0),typeof this.renderToolbars=="function"?this.renderToolbars():void 0},$bodyEl:function(){var a,b,c,d;return c=this.bodyTagName||"div",b=this.bodyClassName||"view-body",this.bodyEl||(this.bodyEl=""+c+"."+b),a=this.$(this.bodyEl),a.length>0?a:a.length!==0||this.bodyClassName==null&&this.bodyTagName==null?$(this.el):(d=this.make(c,{"class":b,"data-auto-appended":!0}),$(this.el).append(d),this.$(this.bodyEl))},$wrap:function(a){return _.isString(a)&&!a.match(/[<>]/)&&(a=this.make("div",{"class":a})),this.$el.wrap(a)},$template:function(a,b){return b==null&&(b={}),this.$html(Luca.template(a,b))},$empty:function(){return this.$bodyEl().empty()},$html:function(a){return this.$bodyEl().html(a)},$append:function(a){return this.$bodyEl().append(a)},renderToolbars:function(){var a=this;return _(["top","left","right","bottom"]).each(function(b){var c;if(c=a[""+b+"Toolbar"])return a.renderToolbar(b,c)})},renderToolbar:function(b,c){return b==null&&(b="top"),c==null&&(c={}),c.parent=this,c.orientation=b,a.call(this,c,c.targetEl)}})}.call(this),function(){var a;a=Luca.register("Luca.core.Field"),a["extends"]("Luca.View"),a.triggers("before:validation","after:validation","on:change"),a.publicConfiguration({labelAlign:"top",className:"luca-ui-text-field luca-ui-field",statuses:["warning","error","success"]}),a.publicInterface({disable:function(){return this.getInputElement().attr("disabled",!0)},enable:function(){return this.getInputElement().attr("disabled",!1)},getValue:function(){var a,b;a=(b=this.getInputElement())!=null?b.attr("value"):void 0;if(_.str.isBlank(a))return a;switch(this.valueType){case"integer":return parseInt(a);case"string":return""+a;case"float":return parseFloat(a);default:return a}},setValue:function(a){var b;return(b=this.getInputElement())!=null?b.attr("value",a):void 0},updateState:function(a){var b=this;return _(this.statuses).each(function(c){return b.$el.removeClass(c),b.$el.addClass(a)})}}),a.privateConfiguration({isField:!0,template:"fields/text_field"}),a.defines({initialize:function(a){var b;this.options=a!=null?a:{},_.extend(this,this.options),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.input_class||(this.input_class=""),this.input_type||(this.input_type=""),this.helperText||(this.helperText="");if(this.label==null||this.label.length===0)this.label=this.name;return this.required&&((b=this.label)!=null?!b.match(/^\*/):!void 0)&&(this.label||(this.label="*"+this.label)),this.inputStyles||(this.inputStyles=""),this.input_value||(this.input_value=this.value||""),this.disabled&&this.disable(),this.updateState(this.state),this.placeHolder||(this.placeHolder=""),Luca.View.prototype.initialize.apply(this,arguments)},beforeRender:function(){Luca.config.enableBoostrap&&this.$el.addClass("control-group");if(this.required)return this.$el.addClass("required")},change_handler:function(a){return this.trigger("on:change",this,a)},getInputElement:function(){return this.input||(this.input=this.$("input").eq(0))}})}.call(this),function(){var a,b,c,d,e,f,g,h;b=Luca.register("Luca.core.Container"),b["extends"]("Luca.components.Panel"),b.triggers("before:components","before:render:components","before:layout","after:components","after:layout","first:activation"),b.defines({className:"luca-ui-container",componentTag:"div",componentClass:"luca-ui-panel",isContainer:!0,rendered:!1,components:[],componentEvents:{},initialize:function(a){var b,c,d,e;this.options=a!=null?a:{},_.extend(this,this.options),this.components||(this.components=this.fields||(this.fields=this.pages||(this.pages=this.cards||(this.cards=this.views)))),e=this.components;for(c=0,d=e.length;c<d;c++)b=e[c],_.isString(b)&&(b={type:b,role:b,name:b});return _.bindAll(this,"beforeRender"),this.setupHooks(Luca.core.Container.prototype.hooks),h(this),Luca.View.prototype.initialize.apply(this,arguments)},beforeRender:function(){var a;return f.call(this),e.call(this),(a=Luca.components.Panel.prototype.beforeRender)!=null?a.apply(this,arguments):void 0},customizeContainerEl:function(a,b,c){return a},prepareLayout:function(){return b=this,this.componentContainers=_(this.components).map(function(c,d){return a.call(b,c,d)})},prepareComponents:function(){var a=this;return b=this,_(this.components).each(function(c,d){var e,f,g,h,i,j;e=f=(i=a.componentContainers)!=null?i[d]:void 0,e["class"]=e["class"]||e.className||e.classes,a.generateComponentElements&&(h=a.make(a.componentTag,f,""),a.$append(h)),b.defaults!=null&&(c=_.defaults(c,b.defaults||{})),_.isArray(b.extensions)&&_.isObject((j=b.extensions)!=null?j[d]:void 0)&&(g=b.extensions[d],c=_.extend(c,g)),c.role!=null&&_.isObject(b.extensions)&&_.isObject(b.extensions[c.role])&&(g=b.extensions[c.role],c=_.extend(c,g));if(c.container==null)return a.generateComponentElements&&(c.container="#"+f.id),c.container||(c.container=a.$bodyEl())})},createComponents:function(){var a,c=this;if(this.componentsCreated===!0)return;return a=this.componentIndex={name_index:{},cid_index:{},role_index:{}},b=this,this.components=_(this.components).map(function(a,d){var e,f,h;return e=Luca.isComponent(a)?a:(a.type||(a.type=a.ctype),a.type==null?a.components!=null?a.type=a.ctype="container":a.type=a.ctype=Luca.defaultComponentType:void 0,a._parentCid||(a._parentCid=b.cid),f=Luca.util.lazyComponent(a)),!e.container&&((h=e.options)!=null?h.container:void 0)&&(e.container=e.options.container),e.getParent||(e.getParent=function(){return Luca(e._parentCid)}),e.container==null&&(console.log(e,d,c),console.error("could not assign container property to component on container "+(c.name||c.cid))),g(e).at(d)["in"](c.componentIndex),e}),this.componentsCreated=!0,a},renderComponents:function(a){return this.debugMode=a!=null?a:"",this.debug("container render components"),b=this,_(this.components).each(function(a){try{return this.$(a.container).eq(0).append(a.el),a.render()}catch(b){console.log("Error Rendering Component "+(a.name||a.cid),a),_.isObject(b)&&(console.log(b.message),console.log(b.stack));if(Luca.silenceRenderErrors!=null!=1)throw b}})},firstActivation:function(){var a;return a=this,this.each(function(b,c){var d;if((b!=null?b.previously_activated:void 0)!==!0)return b!=null&&(d=b.trigger)!=null&&d.call(b,"first:activation",b,a),b.previously_activated=!0})},_:function(){return _(this.components)},pluck:function(a){return this._().pluck(a)},invoke:function(a){return this._().invoke(a)},select:function(a){return this._().select(a)},detect:function(a){return this._().detect(attribute)},reject:function(a){return this._().reject(a)},map:function(a){return this._().map(a)},registerComponentEvents:function(a){var c,d,e,f,g,h,i,j,k=this;b=this,h=a||this.componentEvents||{},j=[];for(g in h){f=h[g],i=g.split(" "),d=i[0],e=i[1];if(!_.isFunction(this[f]))throw console.log("Error registering component event",g,d,e),"Invalid component event definition "+g+". Specified handler is not a method on the container";if(d==="*")j.push(this.eachComponent(function(a){return a.on(e,k[f],b)}));else{c=this.findComponentForEventBinding(d);if(c==null||!Luca.isComponent(c))throw console.log("Error registering component event",g,d,e),"Invalid component event definition: "+d;j.push(c!=null?c.bind(e,this[f],b):void 0)}}return j},subContainers:function(){return this.select(function(a){return a.isContainer===!0})},roles:function(){return _(this.allChildren()).pluck("role")},allChildren:function(){var a,b;return a=this.components,b=_(this.subContainers()).invoke("allChildren"),_([a,b]).chain().compact().flatten().value()},findComponentForEventBinding:function(a,b){return b==null&&(b=!0),this.findComponentByName(a,b)||this.findComponentByGetter(a,b)||this.findComponentByRole(a,b)},findComponentByGetter:function(a,b){return b==null&&(b=!1),_(this.allChildren()).detect(function(b){return b.getter===a})},findComponentByRole:function(a,b){return b==null&&(b=!1),_(this.allChildren()).detect(function(b){return b.role===a||b.type===a||b.ctype===a})},findComponentByName:function(a,b){return b==null&&(b=!1),_(this.allChildren()).detect(function(b){return b.name===a})},findComponentById:function(a,b){return b==null&&(b=!1),this.findComponent(a,"cid_index",b)},findComponent:function(a,b,c){var d,e,f,g;b==null&&(b="name"),c==null&&(c=!1),this.componentsCreated!==!0&&this.createComponents(),e=(g=this.componentIndex)!=null?g[b][a]:void 0,d=this.components[e];if(d)return d;if(c===!0)return f=_(this.components).detect(function(c){return c!=null?typeof c.findComponent=="function"?c.findComponent(a,b,!0):void 0:void 0}),f!=null?typeof f.findComponent=="function"?f.findComponent(a,b,!0):void 0:void 0},each:function(a){return this.eachComponent(a,!1)},eachComponent:function(a,b){var c=this;return b==null&&(b=!0),_(this.components).each(function(c,d){var e;a.call(c,c,d);if(b)return c!=null?(e=c.eachComponent)!=null?e.apply(c,[a,b]):void 0:void 0})},indexOf:function(a){var b;return b=_(this.components).pluck("name"),_(b).indexOf(a)},activeComponent:function(){return this.activeItem?this.components[this.activeItem]:this},componentElements:function(){return this.$("[data-luca-parent='"+(this.name||this.cid)+"']")},getComponent:function(a){return this.components[a]},isRootComponent:function(){return this.rootComponent===!0||this.getParent==null},getRootComponent:function(){return this.isRootComponent()?this:this.getParent().getRootComponent()},selectByAttribute:function(a,b,c){var d;return b==null&&(b=void 0),c==null&&(c=!1),d=_(this.components).map(function(d){var e,f;return e=[],f=d[a],(f===b||b==null&&f!=null)&&e.push(d),c===!0&&e.push(typeof d.selectByAttribute=="function"?d.selectByAttribute(a,b,!0):void 0),_.compact(e)}),_.flatten(d)}}),Luca.core.Container.componentRenderer=function(a,b){var c;return c=$(b.container)[b.attachWith||"append"],c(b.render().el)},f=function(){return this.trigger("before:layout",this),this.prepareLayout(),this.trigger("after:layout",this)},a=function(a,b){var c,d;return d=[],a.height!=null&&d.push("height: "+(_.isNumber(a.height)?a.height+"px":a.height)),a.width!=null&&d.push("width: "+(_.isNumber(a.width)?a.width+"px":a.width)),a.float&&d.push("float: "+a.float),c={"class":(a!=null?a.classes:void 0)||this.componentClass,id:""+this.cid+"-"+b,style:d.join(";"),"data-luca-parent":this.name||this.cid},this.customizeContainerEl!=null&&(c=this.customizeContainerEl(c,a,b)),c},c=function(){var a;return b=this,a=_(this.allChildren()).select(function(a){return a.getter!=null}),_(a).each(function(a){var c;return b[c=a.getter]||(b[c]=function(){return console.log(a.getter,a,b),a})})},d=function(){var a;return b=this,a=_(this.allChildren()).select(function(a){return a.role!=null}),_(a).each(function(a){var c;return c=_.str.camelize("get_"+a.role),b[c]||(b[c]=function(){return a})})},e=function(){return this.trigger("before:components",this,this.components),this.prepareComponents(),this.createComponents(),this.trigger("before:render:components",this,this.components),this.renderComponents(),this.trigger("after:components",this,this.components),this.skipGetterMethods!==!0&&(c.call(this),d.call(this)),this.registerComponentEvents()},h=function(){return!0},g=function(a){return{at:function(b){return{"in":function(c){a.cid!=null&&(c.cid_index[a.cid]=b),a.role!=null&&(c.role_index[a.role]=b);if(a.name!=null)return c.name_index[a.name]=b}}}}}}.call(this),function(){var a,b,c;Luca.CollectionManager=function(){function c(a){var c,d,e,f;this.options=a!=null?a:{},_.extend(this,this.options),d=this;if(c=typeof (e=Luca.CollectionManager).get=="function"?e.get(this.name):void 0)throw"Attempt to create a collection manager with a name which already exists";this.collectionNamespace||(this.collectionNamespace=Luca.util.read(Luca.Collection.namespace)),(f=Luca.CollectionManager).instances||(f.instances={}),_.extend(this,Backbone.Events),_.extend(this,Luca.Events),Luca.CollectionManager.instances[this.name]=d,Luca.CollectionManager.get=function(a){return a==null?d:Luca.CollectionManager.instances[a]},this.state=new Luca.Model,this.initialCollections&&b.call(this)}return c.prototype.name="primary",c.prototype.__collections={},c.prototype.relayEvents=!0,c.prototype.add=function(a,b){var c;return(c=this.currentScope())[a]||(c[a]=b)},c.prototype.allCollections=function(){return _(this.currentScope()).values()},c.prototype.create=function(b,c,d){var e,f,g;c==null&&(c={}),d==null&&(d=[]),e=c.base,e||(e=a.call(this,b)),c.private&&(c.name="");try{f=new e(d,c)}catch(h){throw console.log("Error creating collection",e,c,b),h}return this.add(b,f),g=this,this.relayEvents===!0&&this.bind("*",function(){return console.log("Relay Events on Collection Manager *",f,arguments)}),f},c.prototype.currentScope=function(){var a,b;return(a=this.getScope())?(b=this.__collections)[a]||(b[a]={}):this.__collections},c.prototype.each=function(a){return _(this.all()).each(a)},c.prototype.get=function(a){return this.currentScope()[a]},c.prototype.getScope=function(){return},c.prototype.destroy=function(a){var b;return b=this.get(a),delete this.currentScope()[a],b},c.prototype.getOrCreate=function(a,b,c){return b==null&&(b={}),c==null&&(c=[]),this.get(a)||this.create(a,b,c,!1)},c.prototype.collectionCountDidChange=function(){if(this.allCollectionsLoaded())return this.trigger("all_collections_loaded"),this.trigger("initial:load")},c.prototype.allCollectionsLoaded=function(){return this.totalCollectionsCount()===this.loadedCollectionsCount()},c.prototype.totalCollectionsCount=function(){return this.state.get("collections_count")},c.prototype.loadedCollectionsCount=function(){return this.state.get("loaded_collections_count")},c.prototype.private=function(a,b,c){return b==null&&(b={}),c==null&&(c=[]),this.create(a,b,c,!0)},c}(),Luca.CollectionManager.isRunning=function(){return _.isEmpty(Luca.CollectionManager.instances)!==!0},Luca.CollectionManager.destroyAll=function(){return Luca.CollectionManager.instances={}},Luca.CollectionManager.loadCollectionsByName=function(a,b){var c,d,e,f,g;g=[];for(e=0,f=a.length;e<f;e++)d=a[e],c=this.getOrCreate(d),c.once("reset",function(){return b(c)}),g.push(c.fetch());return g},a=function(a){var b,c,d,e;return b=Luca.util.classify(a),_.isString(this.collectionNamespace)&&(this.collectionNamespace=Luca.util.resolve(this.collectionNamespace)),c=(this.collectionNamespace||window||global)[b],c||(c=(this.collectionNamespace||window||global)[""+b+"Collection"]),c==null&&((e=Luca.Collection.namespaces)!=null?e.length:void 0)>0&&(d=_(Luca.Collection.namespaces.reverse()).map(function(a){return Luca.util.resolve(""+a+"."+b)||Luca.util.resolve(""+a+"."+b+"Collection")}),d=_(d).compact(),d.length>0&&(c=d[0])),c},c=function(){var a,b,c=this;return a=function(a){var b;return b=c.state.get("loaded_collections_count"),c.state.set("loaded_collections_count",b+1),c.trigger("collection_loaded",a.name),a.unbind("reset")},b=this.initialCollections,Luca.CollectionManager.loadCollectionsByName.call(this,b,a)},b=function(){var a=this;return this.state.set({loaded_collections_count:0,collections_count:this.initialCollections.length}),this.state.bind("change:loaded_collections_count",function(){return a.collectionCountDidChange()}),this.useProgressLoader&&(this.loaderView||(this.loaderView=new Luca.components.CollectionLoaderView({manager:this,name:"collection_loader_view"}))),c.call(
|
8
|
+
this),this.initialCollectionsLoadedu,this}}.call(this),function(){Luca.SocketManager=function(){function a(a){this.options=a!=null?a:{},_.extend(Backbone.Events),this.loadTransport()}return a.prototype.connect=function(){switch(this.options.provider){case"socket.io":return this.socket=io.connect(this.options.socket_host);case"faye.js":return this.socket=new Faye.Client(this.options.socket_host)}},a.prototype.transportLoaded=function(){return this.connect()},a.prototype.transport_script=function(){switch(this.options.provider){case"socket.io":return""+this.options.transport_host+"/socket.io/socket.io.js";case"faye.js":return""+this.options.transport_host+"/faye.js"}},a.prototype.loadTransport=function(){var a,b=this;return a=document.createElement("script"),a.setAttribute("type","text/javascript"),a.setAttribute("src",this.transport_script()),a.onload=this.transportLoaded,Luca.util.isIE()&&(a.onreadystatechange=function(){if(a.readyState==="loaded")return b.transportLoaded()}),document.getElementsByTagName("head")[0].appendChild(a)},a}()}.call(this),function(){_.def("Luca.containers.SplitView")["extends"]("Luca.core.Container")["with"]({componentType:"split_view",containerTemplate:"containers/basic",className:"luca-ui-split-view",componentClass:"luca-ui-panel"})}.call(this),function(){_.def("Luca.containers.ColumnView")["extends"]("Luca.core.Container")["with"]({componentType:"column_view",className:"luca-ui-column-view",components:[],initialize:function(a){return this.options=a!=null?a:{},console.log("Column Views are deprecated in favor of just using grid css on a normal container"),Luca.core.Container.prototype.initialize.apply(this,arguments),this.setColumnWidths()},componentClass:"luca-ui-column",containerTemplate:"containers/basic",generateComponentElements:!0,autoColumnWidths:function(){var a,b=this;return a=[],_(this.components.length).times(function(){return a.push(parseInt(100/b.components.length))}),a},setColumnWidths:function(){return this.columnWidths=this.layout!=null?_(this.layout.split("/")).map(function(a){return parseInt(a)}):this.autoColumnWidths(),this.columnWidths=_(this.columnWidths).map(function(a){return""+a+"%"})},beforeLayout:function(){var a,b=this;return this.debug("column_view before layout"),_(this.columnWidths).each(function(a,c){return b.components[c].float="left",b.components[c].width=a}),(a=Luca.core.Container.prototype.beforeLayout)!=null?a.apply(this,arguments):void 0}})}.call(this),function(){var a;a=Luca.define("Luca.containers.CardView"),a["extends"]("Luca.core.Container"),a.defaults({className:"luca-ui-card-view-wrapper",activeCard:0,components:[],hooks:["before:card:switch","after:card:switch"],componentClass:"luca-ui-card",generateComponentElements:!0,initialize:function(a){return this.options=a,this.components||(this.components=this.pages||(this.pages=this.cards)),Luca.core.Container.prototype.initialize.apply(this,arguments),this.setupHooks(this.hooks)},prepareComponents:function(){var a;return(a=Luca.core.Container.prototype.prepareComponents)!=null&&a.apply(this,arguments),this.componentElements().hide(),this.activeComponentElement().show()},activeComponentElement:function(){return this.componentElements().eq(this.activeCard)},activeComponent:function(){return this.getComponent(this.activeCard)},customizeContainerEl:function(a,b,c){return a.style+=c===this.activeCard?"display:block;":"display:none;",a},atFirst:function(){return this.activeCard===0},atLast:function(){return this.activeCard===this.components.length-1},next:function(){if(this.atLast())return;return this.activate(this.activeCard+1)},previous:function(){if(this.atFirst())return;return this.activate(this.activeCard-1)},cycle:function(){var a;return a=this.atLast()?0:this.activeCard+1,this.activate(a)},find:function(a){return Luca(a)},firstActivation:function(){return this.activeComponent().trigger("first:activation",this,this.activeComponent())},activate:function(a,b,c){var d,e,f,g=this;b==null&&(b=!1),_.isFunction(b)&&(b=!1,c=b);if(a===this.activeCard)return;f=this.activeComponent(),e=this.getComponent(a),e||(a=this.indexOf(a),e=this.getComponent(a));if(!e)return;b!==!0&&(this.trigger("before:card:switch",f,e),f!=null&&f.trigger("before:deactivation",this,f,e),e!=null&&e.trigger("before:activation",this,f,e),_.defer(function(){return g.$el.data(g.activeAttribute||"active-card",e.name)})),this.componentElements().hide(),e.previously_activated!==!0&&(e.trigger("first:activation"),e.previously_activated=!0),this.activeCard=a,this.activeComponentElement().show(),b!==!0&&(this.trigger("after:card:switch",f,e),f!=null&&f.trigger("deactivation",this,f,e),e!=null&&e.trigger("activation",this,f,e)),d=this,Luca.containers.CardView.activationContext==="current"&&(d=e);if(_.isFunction(c))return c.apply(d,[this,f,e])}}),Luca.containers.CardView.activationContext="current"}.call(this),function(){_.def("Luca.ModalView")["extends"]("Luca.core.Container")["with"]({closeOnEscape:!0,showOnInitialize:!1,backdrop:!1,className:"luca-ui-container modal",container:function(){return $("body")},toggle:function(){return this.$el.modal("toggle")},show:function(){return this.$el.modal("show")},hide:function(){return this.$el.modal("hide")},render:function(){return this.$el.addClass("modal"),this.fade===!0&&this.$el.addClass("fade"),$("body").append(this.$el),this.$el.modal({backdrop:this.backdrop===!0,keyboard:this.closeOnEscape===!0,show:this.showOnInitialize===!0}),this}}),_.def("Luca.containers.ModalView")["extends"]("Luca.ModalView")["with"]()}.call(this),function(){_.def("Luca.PageView")["extends"]("Luca.containers.CardView")["with"]({version:2})}.call(this),function(){var a,b,c,d;c=Luca.register("Luca.components.PanelToolbar"),c["extends"]("Luca.View"),c.defines({buttons:[],className:"luca-ui-toolbar btn-toolbar",well:!0,orientation:"top",autoBindEventHandlers:!0,events:{"click a.btn, click .dropdown-menu li":"clickHandler"},initialize:function(a){var b;this.options=a!=null?a:{},this._super("initialize",this,arguments);if(this.group===!0&&((b=this.buttons)!=null?b.length:void 0)>=0)return this.buttons=[{group:!0,buttons:this.buttons}]},clickHandler:function(a){var b,c,d,e,f;d=e=$(a.target),d.is("i")&&(d=e=$(a.target).parent()),this.selectable===!0&&(e.siblings().removeClass("is-selected"),d.addClass("is-selected"));if(!(b=e.data("eventid")))return;return c=Luca.util.hook(b),f=this.parent||this,_.isFunction(f[c])?f[c].call(this,d,a):f.trigger(b,d,a)},beforeRender:function(){this._super("beforeRender",this,arguments),this.well===!0&&this.$el.addClass("well"),this.selectable===!0&&this.$el.addClass("btn-selectable"),this.$el.addClass("toolbar-"+this.orientation),this.align==="right"&&this.$el.addClass("pull-right");if(this.align==="left")return this.$el.addClass("pull-left")},render:function(){var a,b,c,e;this.$el.empty(),e=d(this.buttons);for(b=0,c=e.length;b<c;b++)a=e[b],this.$el.append(a);return this}}),b=Backbone.View.prototype.make,a=function(a,c){var e,f,g,h,i,j,k,l,m,n,o=this;c==null&&(c=!0);if(a.ctype!=null||a.type!=null){a.className||(a.className=""),a.className+="toolbar-component",l=Luca(a).render();if(Luca.isBackboneView(l))return l.$el}return a.spacer?b("div",{"class":"spacer "+a.spacer}):a.text?b("div",{"class":"toolbar-text"},a.text):(n="btn-group",a.wrapper!=null&&(n+=""+a.wrapper),a.align!=null&&(n+="pull-"+a.align+" align-"+a.align),a.selectable===!0&&(n+="btn-selectable"),a.group!=null&&a.buttons!=null?(h=d(a.buttons,!1),b("div",{"class":n},h)):(k=a.label||(a.label=""),a.eventId||(a.eventId=_.string.dasherize(a.label.toLowerCase())),a.icon&&(_.string.isBlank(k)&&(k=" "),a.white&&(m="icon-white"),k="<i class='"+(m||"")+" icon-"+a.icon+"' /> "+k),f={"class":_.compact(["btn",a.classes,a.className]).join(" "),"data-eventId":a.eventId,title:a.title||a.description},a.color!=null&&(f["class"]+=" btn-"+a.color),a.selected!=null&&(f["class"]+=" is-selected"),a.dropdown&&(k=""+k+" <span class='caret'></span>",f["class"]+=" dropdown-toggle",f["data-toggle"]="dropdown",j=_(a.dropdown).map(function(a){var c;return c=b("a",{},a[1]),b("li",{"data-eventId":a[0]},c)}),i=b("ul",{"class":"dropdown-menu"},j)),g=b("a",f,k),e="btn-group",a.align!=null&&(e+=" align-"+a.align),c===!0?b("div",{"class":e},[g,i]):g))},d=function(b,c){var d,e,f,g;b==null&&(b=[]),c==null&&(c=!0),g=[];for(e=0,f=b.length;e<f;e++)d=b[e],g.push(a(d,c));return g}}.call(this),function(){_.def("Luca.containers.PanelView")["extends"]("Luca.core.Container")["with"]({className:"luca-ui-panel",initialize:function(a){return this.options=a!=null?a:{},Luca.core.Container.prototype.initialize.apply(this,arguments)},afterLayout:function(){var a;if(this.template)return a=(Luca.templates||JST)[this.template](this),this.$el.html(a)},render:function(){return $(this.container).append(this.$el)},afterRender:function(){var a,b=this;(a=Luca.core.Container.prototype.afterRender)!=null&&a.apply(this,arguments);if(this.css)return _(this.css).each(function(a,c){return b.$el.css(c,a)})}})}.call(this),function(){var a;_.def("Luca.containers.TabView")["extends"]("Luca.containers.CardView")["with"],a=Luca.register("Luca.containers.TabView"),a.triggers("before:select","after:select"),a.publicConfiguration({tab_position:"top",tabVerticalOffset:"50px"}),a.privateConfiguration({additionalClassNames:"tabbable",navClass:"nav-tabs",bodyTemplate:"containers/tab_view",bodyEl:"div.tab-content"}),a.defines({initialize:function(a){return this.options=a!=null?a:{},this.navStyle==="list"&&(this.navClass="nav-list"),Luca.containers.CardView.prototype.initialize.apply(this,arguments),_.bindAll(this,"select","highlightSelectedTab"),this.setupHooks(this.hooks),this.bind("after:card:switch",this.highlightSelectedTab)},activeTabSelector:function(){return this.tabSelectors().eq(this.activeCard||this.activeTab||this.activeItem)},beforeLayout:function(){var a;return this.$el.addClass("tabs-"+this.tab_position),this.activeTabSelector().addClass("active"),this.createTabSelectors(),(a=Luca.containers.CardView.prototype.beforeLayout)!=null?a.apply(this,arguments):void 0},afterRender:function(){var a,b;(b=Luca.containers.CardView.prototype.afterRender)!=null&&b.apply(this,arguments),a=this.tabContainer().attr("id"),this.registerEvent("click #"+a+" li a","select");if(Luca.config.enableBoostrap&&(this.tab_position==="left"||this.tab_position==="right"))return this.tabContainerWrapper().addClass("span2"),this.tabContentWrapper().addClass("span9")},createTabSelectors:function(){return a=this,this.each(function(b,c){var d,e,f,g;b.tabIcon&&(d="<i class='icon-"+b.tabIcon+"'></i>"),e="<a href='#'>"+(d||"")+" "+b.title+"</a>",f=a.make("li",{"class":"tab-selector","data-target":c},e),a.tabContainer().append(f);if(b.navHeading!=null&&((g=a.navHeadings)!=null?!g[b.navHeading]:!void 0))return $(f).before(a.make("li",{"class":"nav-header"},b.navHeading)),a.navHeadings||(a.navHeadings={}),a.navHeadings[b.navHeading]=!0})},highlightSelectedTab:function(){return this.tabSelectors().removeClass("active"),this.activeTabSelector().addClass("active")},select:function(a){var b,c;return a.preventDefault(),b=c=$(a.target),this.trigger("before:select",this),this.activate(c.parent().data("target")),this.trigger("after:select",this)},componentElements:function(){return this.$(">.tab-content >."+this.componentClass)},tabContentWrapper:function(){return $("#"+this.cid+"-tab-view-content")},tabContainerWrapper:function(){return $("#"+this.cid+"-tabs-selector")},tabContainer:function(){return this.$("ul."+this.navClass,this.tabContainerWrapper())},tabSelectors:function(){return this.$("li.tab-selector",this.tabContainer())}})}.call(this),function(){_.def("Luca.containers.Viewport").extend("Luca.containers.CardView")["with"]({activeItem:0,additionalClassNames:"luca-ui-viewport",fullscreen:!0,fluid:!1,initialize:function(a){this.options=a!=null?a:{},_.extend(this,this.options),Luca.config.enableBoostrap===!0&&(this.wrapperClass=this.fluid===!0?Luca.containers.Viewport.fluidWrapperClass:Luca.containers.Viewport.defaultWrapperClass),Luca.core.Container.prototype.initialize.apply(this,arguments);if(this.fullscreen===!0)return this.enableFullscreen()},enableFluid:function(){return this.enableWrapper()},disableFluid:function(){return this.disableWrapper()},enableWrapper:function(){if(this.wrapperClass!=null)return this.$el.parent().addClass(this.wrapperClass)},disableWrapper:function(){if(this.wrapperClass!=null)return this.$el.parent().removeClass(this.wrapperClass)},enableFullscreen:function(){return $("html,body").addClass("luca-ui-fullscreen"),this.$el.addClass("fullscreen-enabled")},disableFullscreen:function(){return $("html,body").removeClass("luca-ui-fullscreen"),this.$el.removeClass("fullscreen-enabled")},beforeRender:function(){var a;(a=Luca.containers.CardView.prototype.beforeRender)!=null&&a.apply(this,arguments),this.topNav!=null&&this.renderTopNavigation();if(this.bottomNav!=null)return this.renderBottomNavigation()},height:function(){return this.$el.height()},width:function(){return this.$el.width()},afterRender:function(){var a;(a=Luca.containers.CardView.prototype.after)!=null&&a.apply(this,arguments);if(Luca.config.enableBoostrap===!0&&this.containerClassName)return this.$el.children().wrap('<div class="#{ containerClassName }" />')},renderTopNavigation:function(){var a;if(this.topNav==null)return;return _.isString(this.topNav)&&(this.topNav=Luca.util.lazyComponent(this.topNav)),_.isObject(this.topNav)&&((a=this.topNav).ctype||(a.ctype=this.topNav.type||"nav_bar"),Luca.isBackboneView(this.topNav)||(this.topNav=Luca.util.lazyComponent(this.topNav))),this.topNav.app=this,$("body").prepend(this.topNav.render().el)},renderBottomNavigation:function(){}}),Luca.containers.Viewport.defaultWrapperClass="row",Luca.containers.Viewport.fluidWrapperClass="row-fluid"}.call(this),function(){_.def("Luca.components.Template")["extends"]("Luca.View")["with"]({initialize:function(a){return this.options=a!=null?a:{},console.log("The Use of Luca.components.Template directly is being DEPRECATED"),Luca.View.prototype.initialize.apply(this,arguments)}})}.call(this),function(){var a,b=Array.prototype.slice;a=Luca.register("Luca.Application"),a["extends"]("Luca.containers.Viewport"),a.triggers("controller:change","action:change"),a.publicInterface({name:"MyApp",defaultState:{},autoBoot:!1,autoStartHistory:"before:render",useCollectionManager:!0,collectionManager:{},collectionManagerClass:"Luca.CollectionManager",plugin:!1,useController:!0,useKeyHandler:!1,keyEvents:{},components:[{type:"template",name:"welcome",template:"sample/welcome",templateContainer:"Luca.templates"}],initialize:function(a){var b,c,d,e=this;this.options=a!=null?a:{},c=this,d=this.name,b=typeof Luca.getApplication=="function"?Luca.getApplication():void 0,Luca.Application.registerInstance(this),Luca.containers.Viewport.prototype.initialize.apply(this,arguments),this.state=new Luca.Model(this.defaultState),this.useController===!0&&this.setupMainController(),this.setupCollectionManager(),this.defer(function(){return c.render()}).until(this,"ready"),this.setupRouter(),this.useKeyRouter===!0&&console.log("The useKeyRouter property is being deprecated. switch to useKeyHandler instead"),(this.useKeyHandler===!0||this.useKeyRouter===!0)&&this.keyEvents!=null&&this.setupKeyHandler(),this.plugin!==!0&&!b&&(Luca.getApplication=function(a){return a==null?c:Luca.Application.instances[a]});if(this.autoBoot){if(Luca.util.resolve(this.name))throw"Attempting to override window."+this.name+" when it already exists";return $(function(){return window[d]=c,c.boot()})}},activeView:function(){var a;return(a=this.activeSubSection())?this.view(a):this.view(this.activeSection())},activeSection:function(){return this.get("active_section")},activeSubSection:function(){return this.get("active_sub_section")},activePages:function(){var a=this;return this.$(".luca-ui-controller").map(function(a,b){return $(b).data("active-section")})},boot:function(){return this.trigger("ready")},collection:function(){return this.collectionManager.getOrCreate.apply(this.collectionManager,arguments)},get:function(a){return this.state.get(a)},set:function(a,b,c){return this.state.set.apply(this.state,arguments)},view:function(a){return Luca.cache(a)},navigate_to:function(a,b){return this.getMainController().navigate_to(a,b)}}),a.privateInterface({keyHandler:function(a){var b,c,d,e,f,g,h;if(!a||!this.keyEvents)return;c=$(a.target).is("input")||$(a.target).is("textarea");if(c)return;e=Luca.keyMap[a.keyCode];if(!e)return;f=(a!=null?a.metaKey:void 0)===!0,b=(a!=null?a.ctrlKey:void 0)===!0,g=this.keyEvents,g=f?this.keyEvents.meta:g,g=b?this.keyEvents.control:g,g=f&&b?this.keyEvents.meta_control:g;if(d=g!=null?g[e]:void 0)return this[d]!=null&&_.isFunction(this[d])?(h=this[d])!=null?h.call(this):void 0:this.trigger(d,a,e)},setupControllerBindings:function(){var a,b,c,d=this;return a=this,(b=this.getMainController())!=null&&b.bind("after:card:switch",function(b,c){return d.state.set({active_section:c.name}),a.trigger("controller:change")}),(c=this.getMainController())!=null?c.each(function(b){var c;c=b.type||b.type;if(c.match(/controller$/))return b.bind("after:card:switch",function(b,c){return d.state.set({active_sub_section:c.name}),a.trigger("action:change")})}):void 0},setupMainController:function(){var a,b=this;if(this.useController===!0)return a=this.components||[],this.components=[{type:"controller",name:"main_controller",role:"main_controller",components:a}],this.getMainController=function(){return b.findComponentByRole("main_controller")},this.defer(this.setupControllerBindings,!1).until("after:components")},setupCollectionManager:function(){var a,b,c,d,e;if(this.useCollectionManager!==!0)return;if(this.collectionManager!=null&&((c=this.collectionManager)!=null?c.get:void 0)!=null)return;_.isString(this.collectionManagerClass)&&(this.collectionManagerClass=Luca.util.resolve(this.collectionManagerClass)),a=this.collectionManagerOptions||{},_.isObject(this.collectionManager)&&!_.isFunction((d=this.collectionManager)!=null?d.get:void 0)&&(a=this.collectionManager,this.collectionManager=void 0),_.isString(this.collectionManager)&&(a={name:this.collectionManager}),this.collectionManager=typeof (b=Luca.CollectionManager).get=="function"?b.get(a.name):void 0;if(!_.isFunction((e=this.collectionManager)!=null?e.get:void 0))return this.collectionManager=new this.collectionManagerClass(a)},setupRouter:function(){var a,b;a=this,_.isString(this.router)&&(b=Luca.util.resolve(this.router),this.router=new b({app:a}));if(this.router&&this.autoStartHistory)return this.autoStartHistory===!0&&(this.autoStartHistory="before:render"),this.defer(Luca.Application.startHistory,!1).until(this,this.autoStartHistory)},setupKeyHandler:function(){var a,b,c,d,e,f,g;if(!this.keyEvents)return;(c=this.keyEvents).control_meta||(c.control_meta={}),this.keyEvents.meta_control&&_.extend(this.keyEvents.control_meta,this.keyEvents.meta_control),a=_.bind(this.keyHandler,this),f=this.keypressEvents||["keydown"],g=[];for(d=0,e=f.length;d<e;d++)b=f[d],g.push($(document).on(b,a));return g}}),a.classInterface({instances:{},registerInstance:function(a){return Luca.Application.instances[a.name]=a},routeTo:function(){var a,c,d,e,f,g;return e=1<=arguments.length?b.call(arguments,0):[],d=_(e).last(),c=_(e).first(),a=void 0,g=void 0,f=function(){var g,h,i,j,k,l,m,n,o,p,q;h=1<=arguments.length?b.call(arguments,0):[],l=this.app||Luca(),i=0,e.length===1&&(n=Luca(c))&&(e=n.controllerPath());for(o=0,p=e.length;o<p;o++){k=e[o];if(!_.isString(k))continue;j=e[++i],g=void 0,_.isFunction(j)?g=j:_.isObject(j)&&j.action!=null?g=j.action:k===d&&(m=(q=Luca(d))!=null?q.routeHandler:void 0)&&(g=Luca.util.read(m)),_.isString(g)&&(a=function(){return this[g].apply(this,h)}),_.isFunction(g)&&(a=j),l=l.navigate_to(k,a)}return f.action=function(a){return e.push({action:a})},f}},startHistory:function(){return Backbone.history.start()}}),a.register()}.call(this),function(){var a;_.def("Luca.components.Toolbar")["extends"]("Luca.core.Container")["with"],a=Luca.register("Luca.components.Toolbar"),a["extends"]("Luca.core.Container"),a.defines({className:"luca-ui-toolbar toolbar",position:"bottom",prepareComponents:function(){var a=this;return _(this.components).each(function(b){return b.container=a.$el})},render:function(){return $(this.container).append(this.el),this}})}.call(this),function(){var a;a=Luca.register("Luca.components.CollectionLoaderView"),a["extends"]("Luca.View"),a.defines({className:"luca-ui-collection-loader-view",template:"components/collection_loader_view",initialize:function(a){return this.options=a!=null?a:{},Luca.components.Template.prototype.initialize.apply(this,arguments),this.container||(this.container=$("body")),this.manager||(this.manager=Luca.CollectionManager.get()),this.setupBindings()},modalContainer:function(){return $("#progress-modal",this.el)},setupBindings:function(){var a=this;return this.manager.bind("collection_loaded",function(b){var c,d,e,f;return d=a.manager.loadedCollectionsCount(),f=a.manager.totalCollectionsCount(),e=parseInt(d/f*100),c=_.string.titleize(_.string.humanize(b)),a.modalContainer().find(".progress .bar").attr("style","width: "+e+"%;"),a.modalContainer().find(".message").html("Loaded "+c+"...")}),this.manager.bind("all_collections_loaded",function(){return a.modalContainer().find(".message").html("All done!"),_.delay(function(){return a.modalContainer().modal("hide")},400)})}})}.call(this),function(){var a,b;a=Luca.register("Luca.components.CollectionView"),a["extends"]("Luca.components.Panel"),a.mixesIn("QueryCollectionBindings","LoadMaskable","Filterable","Paginatable"),a.triggers("before:refresh","after:refresh","refresh","empty:results"),a.publicConfiguration({tagName:"ol",bodyClassName:"collection-ui-panel",itemTagName:"li",itemClassName:"collection-item",itemTemplate:void 0,itemRenderer:void 0,itemProperty:void 0}),a.defines({initialize:function(a){var b=this;this.options=a!=null?a:{},_.extend(this,this.options),_.bindAll(this,"refresh");if(this.collection==null&&!this.options.collection)throw console.log("Error on initialize of collection view",this),"Collection Views must specify a collection";if(this.itemTemplate==null&&this.itemRenderer==null&&this.itemProperty==null)throw"Collection Views must specify an item template or item renderer function";_.isString(this.collection)&&(Luca.CollectionManager.get()?this.collection=Luca.CollectionManager.get().getOrCreate(this.collection):console.log("String Collection but no collection manager"));if(!Luca.isBackboneCollection(this.collection))throw console.log("Missing Collection on "+(this.name||this.cid),this,this.collection),"Collection Views must have a valid backbone collection";return this.collection.on("before:fetch",function(){return b.trigger("enable:loadmask")}),this.collection.bind("reset",function(){return b.refresh(),b.trigger("disable:loadmask")}),this.collection.bind("remove",function(){return b.refresh()}),this.collection.bind("add",function(){return b.refresh()}),this.observeChanges===!0&&this.collection.on("change",this.refreshModel,this),Luca.components.Panel.prototype.initialize.apply(this,arguments),this.on("refresh",this.refresh,this)},attributesForItem:function(a,b){return _.extend({},{"class":this.itemClassName,"data-index":a.index,"data-model-id":a.model.get("id")})},contentForItem:function(a){var b,c;return a==null&&(a={}),this.itemTemplate!=null&&(c=Luca.template(this.itemTemplate))?b=c.call(this,a):this.itemRenderer!=null&&_.isFunction(this.itemRenderer)?b=this.itemRenderer.call(this,a,a.model,a.index):this.itemProperty&&a.model!=null?b=a.model.read(this.itemProperty):""},makeItem:function(a,c){var d,e,f;f=this.prepareItem!=null?this.prepareItem.call(this,a,c):{model:a,index:c},d=this.attributesForItem(f,a),e=this.contentForItem(f);try{return b(this.itemTagName,d,e)}catch(g){return console.log("Error generating DOM element for CollectionView",this,a,c)}},locateItemElement:function(a){return this.$("."+this.itemClassName+"[data-model-id='"+a+"']")},refreshModel:function(a){var b;return b=this.collection.indexOf(a),this.locateItemElement(a.get("id")).empty().append(this.contentForItem({model:a,index:b},a)),this.trigger("model:refreshed",b,a)},refresh:function(a,b,c){var d,e,f,g;a||(a=this.getQuery()),b||(b=this.getQueryOptions()),c||(c=this.getModels(a,b)),this.$bodyEl().empty(),this.trigger("before:refresh",c,a,b),c.length===0&&this.trigger("empty:results"),d=0;for(f=0,g=c.length;f<g;f++)e=c[f],this.$append(this.makeItem(e,d++));return this.trigger("after:refresh",c,a,b),this},registerEvent:function(a,b,c){var d;return c==null&&_.isFunction(b)&&(c=b,b=void 0),d=_([a,""+this.itemTagName+"."+this.itemClassName,b]).compact().join(" "),Luca.View.prototype.registerEvent(d,c)},render:function(){return this.refresh(),this.$el.parent().length>0&&this.container!=null&&this.$attach(),this}}),b=Luca.View.prototype.make}.call(this),function(){var a;a=Luca.register("Luca.components.Controller"),a["extends"]("Luca.containers.CardView"),a.publicInterface({"default":function(a){return this.navigate_to(this.defaultPage||this.defaultCard,a)},activePage:function(){return this.activeSection()},navigate_to:function(a,b){var c=this;return a||(a=this.defaultCard),this.activate(a,!1,function(a,d,e){c.state.set({active_section:e.name});if(_.isFunction(b))return b.apply(e)}),this.find(a)}}),a.classMethods({controllerPath:function(){var a,b,c;b=this,c=[b.name],a=!1;while(b&&!a)b=typeof b.getParent=="function"?b.getParent():void 0,(b!=null?b.role:void 0)==="main_controller"&&(a=!0),b!=null&&!a&&c.push(b.name);return c.reverse()}}),a.defines({additionalClassNames:"luca-ui-controller",activeAttribute:"active-section",stateful:!0,initialize:function(a){var b;this.options=a,this.defaultCard||(this.defaultCard=this.defaultPage||(this.defaultPage=((b=this.components[0])!=null?b.name:void 0)||0)),this.defaultPage||(this.defaultPage=this.defaultCard),this.defaultState||(this.defaultState={active_section:this.defaultPage}),Luca.containers.CardView.prototype.initialize.apply(this,arguments);if(this.defaultCard==null)throw"Controllers must specify a defaultCard property and/or the first component must have a name";return this._().each(function(a){return a.controllerPath=Luca.components.Controller.controllerPath})},each:function(a){var b=this;return _(this.components).each(function(c){return a.call(b,c)})},activeSection:function(){return this.get("active_section")},pageControllers:function(a){return a==null&&(a=!1),this.controllers.apply(this,arguments)},controllers:function(a){return a==null&&(a=!1),this.select(function(a){var b;return b=a.type||a.ctype,b==="controller"||b==="page_controller"})},availablePages:function(){return this.availableSections.apply(this,arguments)},availableSections:function(){var a,b=this;return a={},a[this.name]=this.sectionNames(),_(this.controllers()).reduce(function(a,b){return a[b.name]=b.sectionNames(),a},a)},pageNames:function(){return this.sectionNames()},sectionNames:function(a){return a==null&&(a=!1),this.pluck("name")}})}.call(this),function(){var a;a=Luca.register("Luca.fields.ButtonField"),a["extends"]("Luca.core.Field"),a.triggers("button:click"),a.publicConfiguration({readOnly:!0,input_value:void 0,input_type:"button",icon_class:void 0,input_name:void 0,white:void 0}),a.privateConfiguration({isButton:!0,template:"fields/button_field",events:{"click input":"click_handler"}}),a.privateInterface({click_handler:function(a){var b,c;return b=c=$(a.currentTarget),this.trigger("button:click")},initialize:function(a){var b;this.options=a!=null?a:{},_.extend(this.options),_.bindAll(this,"click_handler"),Luca.core.Field.prototype.initialize.apply(this,arguments);if((b=this.icon_class)!=null?b.length:void 0)return this.template="fields/button_field_link"},afterInitialize:function(){this.input_id||(this.input_id=_.uniqueId("button")),this.input_name||(this.input_name=this.name||(this.name=this.input_id)),this.input_value||(this.input_value=this.label||(this.label=this.text)),this.input_class||(this.input_class=this["class"]),this.icon_class||(this.icon_class=""),this.icon_class.length&&!this.icon_class.match(/^icon-/)&&(this.icon_class="icon-"+this.icon_class);if(this.white)return this.icon_class+=" icon-white"},setValue:function(){return!0}}),a.defines({version:1})}.call(this),function(){var a,b;b=Luca.View.prototype.make,a=Luca.register("Luca.fields.CheckboxArray"),a["extends"]("Luca.core.Field"),a.defines({version:2,template:"fields/checkbox_array",className:"luca-ui-checkbox-array",events:{"click input":"clickHandler"},selectedItems:[],initialize:function(a){return this.options=a!=null?a:{},_.extend(this,this.options),_.extend(this,Luca.concerns.Deferrable),_.bindAll(this,"renderCheckboxes","clickHandler","checkSelected"),Luca.core.Field.prototype.initialize.apply(this,arguments),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.valueField||(this.valueField="id"),this.displayField||(this.displayField="name")},afterInitialize:function(a){var b;this.options=a!=null?a:{};try{this.configure_collection()}catch(c){console.log("Error Configuring Collection",this,c.message)}b=this;if(!Luca.isBackboneCollection(this.collection))throw"Checkbox Array Fields must specify a @collection property";return this.collection.length>0?this.renderCheckboxes():this.defer("renderCheckboxes").until(this.collection,"reset")},clickHandler:function(a){var b;b=$(a.target);if(b.prop("checked"))return this.selectedItems.push(b.val());if(_(this.selectedItems).include(b.val()))return this.selectedItems=_(this.selectedItems).without(b.val())},controls:function(){return this.$(".controls")},renderCheckboxes:function(){var a=this;return this.controls().empty(),this.selectedItems=[],this.collection.each(function(c){var d,e,f,g,h;return h=c.get(a.valueField),g=c.get(a.displayField),f=_.uniqueId(""+a.cid+"_checkbox"),e=b("input",{type:"checkbox","class":"array-checkbox",name:a.input_name,value:h,id:f}),d=b("label",{"for":f},e),$(d).append(" "+g),a.controls().append(d)}),this.trigger("checkboxes:rendered",this.checkboxesRendered=!0),this},uncheckAll:function(){return this.allFields().prop("checked",!1)},allFields:function(){return this.controls().find("input[type='checkbox']")},checkSelected:function(a){var b,c,d,e,f;a!=null&&(this.selectedItems=a),this.uncheckAll(),f=this.selectedItems;for(d=0,e=f.length;d<e;d++)c=f[d],b=this.controls().find("input[value='"+c+"']"),b.prop("checked",!0);return this.selectedItems},getValue:function(){var a,b,c,d,e;d=this.allFields(),e=[];for(b=0,c=d.length;b<c;b++)a=d[b],this.$(a).prop("checked")&&e.push(this.$(a).val());return e},setValue:function(a){var b;return this.selectedItems=a,this.checkboxesRendered===!0?this.checkSelected(a):(b=this,this.defer(function(){return b.checkSelected(a)}).until("checkboxes:rendered"))},getValues:function(){return this.getValue()},setValues:function(a){return this.setValue(a)}})}.call(this),function(){var a;a=Luca.register("Luca.fields.CheckboxField"),a["extends"]("Luca.core.Field"),a.triggers("checked","unchecked"),a.publicConfiguration({send_blanks:!0,input_value:1}),a.privateConfiguration({template:"fields/checkbox_field",events:{"change input":"change_handler"}}),a.privateInterface({change_handler:function(a){var b,c;return b=c=$(a.target),b.is(":checked")?this.trigger("checked"):this.trigger("unchecked"),this.trigger("on:change",this,a,b.is(":checked"))},initialize:function(a){return this.options=a!=null?a:{},_.extend(this,this.options),_.bindAll(this,"change_handler"),Luca.core.Field.prototype.initialize.apply(this,arguments),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name)}}),a.publicInterface({setValue:function(a){return this.getInputElement().attr("checked",a)},getValue:function(){return this.getInputElement().is(":checked")}}),a.defines({version:1})}.call(this),function(){var a;a=Luca.register("Luca.fields.FileUploadField"),a["extends"]("Luca.core.Field"),a.defines({version:1,template:"fields/file_upload_field",afterInitialize:function(){return this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.helperText||(this.helperText="")}})}.call(this),function(){var a;a=Luca.register("Luca.fields.HiddenField"),a["extends"]("Luca.core.Field"),a.defines({template:"fields/hidden_field",afterInitialize:function(){return this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.input_value||(this.input_value=this.value),this.label||(this.label=this.name)}})}.call(this),function(){var a;a=Luca.register
|
9
|
+
("Luca.components.LabelField"),a["extends"]("Luca.core.Field"),a.defines({formatter:function(a){return a||(a=this.getValue()),_.str.titleize(a)},setValue:function(a){return this.trigger("change",a,this.getValue()),this.getInputElement().attr("value",a),this.$(".value").html(this.formatter(a))}})}.call(this),function(){var a;a=Luca.register("Luca.fields.SelectField"),a["extends"]("Luca.core.Field"),a.triggers("after:select"),a.defines({events:{"change select":"change_handler"},template:"fields/select_field",includeBlank:!0,blankValue:"",blankText:"Select One",initialize:function(a){this.options=a!=null?a:{},_.extend(this,this.options),_.extend(this,Luca.concerns.Deferrable),_.bindAll(this,"change_handler","populateOptions","beforeFetch"),Luca.core.Field.prototype.initialize.apply(this,arguments),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name);if(_.isUndefined(this.retainValue))return this.retainValue=!0},afterInitialize:function(){var a;if((a=this.collection)!=null?a.data:void 0)this.valueField||(this.valueField="id"),this.displayField||(this.displayField="name"),this.parseData();try{this.configure_collection()}catch(b){console.log("Error Configuring Collection",this,b.message)}return this.collection.bind("before:fetch",this.beforeFetch),this.collection.bind("reset",this.populateOptions)},parseData:function(){var a=this;return this.collection.data=_(this.collection.data).map(function(b){var c;return _.isArray(b)?(c={},c[a.valueField]=b[0],c[a.displayField]=b[1]||b[0],c):b})},getInputElement:function(){return this.input||(this.input=this.$("select").eq(0))},afterRender:function(){var a,b;return((a=this.collection)!=null?(b=a.models)!=null?b.length:void 0:void 0)>0?this.populateOptions():this.collection.trigger("reset")},setValue:function(a){return this.currentValue=a,Luca.core.Field.prototype.setValue.apply(this,arguments)},beforeFetch:function(){return this.resetOptions()},change_handler:function(a){return this.trigger("on:change",this,a)},resetOptions:function(){this.getInputElement().html("");if(this.includeBlank)return this.getInputElement().append("<option value='"+this.blankValue+"'>"+this.blankText+"</option>")},populateOptions:function(){var a,b=this;return this.resetOptions(),((a=this.collection)!=null?a.each:void 0)!=null&&this.collection.each(function(a){var c,d,e,f;return f=a.get(b.valueField),c=a.get(b.displayField),b.selected&&f===b.selected&&(e="selected"),d="<option "+e+" value='"+f+"'>"+c+"</option>",b.getInputElement().append(d)}),this.trigger("after:populate:options",this),this.setValue(this.currentValue)}})}.call(this),function(){_.def("Luca.fields.TextAreaField")["extends"]("Luca.core.Field")["with"]({events:{"keydown input":"keydown_handler","blur input":"blur_handler","focus input":"focus_handler"},template:"fields/text_area_field",height:"200px",width:"90%",initialize:function(a){return this.options=a!=null?a:{},_.bindAll(this,"keydown_handler"),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.input_class||(this.input_class=this["class"]),this.input_value||(this.input_value=""),this.inputStyles||(this.inputStyles="height:"+this.height+";width:"+this.width),this.placeHolder||(this.placeHolder=""),Luca.core.Field.prototype.initialize.apply(this,arguments)},setValue:function(a){return $(this.field()).val(a)},getValue:function(){return $(this.field()).val()},field:function(){return this.input=$("textarea#"+this.input_id,this.el)},keydown_handler:function(a){var b,c;return b=c=$(a.currentTarget)},blur_handler:function(a){var b,c;return b=c=$(a.currentTarget)},focus_handler:function(a){var b,c;return b=c=$(a.currentTarget)}})}.call(this),function(){var a;a=Luca.register("Luca.fields.TextField"),a["extends"]("Luca.core.Field"),a.defines({events:{"blur input":"blur_handler","focus input":"focus_handler","change input":"change_handler"},template:"fields/text_field",autoBindEventHandlers:!0,send_blanks:!0,keyEventThrottle:300,initialize:function(a){return this.options=a!=null?a:{},this.enableKeyEvents&&this.registerEvent("keyup input","keyup_handler"),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.input_class||(this.input_class=this["class"]),this.input_value||(this.input_value=this.value||""),this.prepend&&(this.$el.addClass("input-prepend"),this.addOn=this.prepend),this.append&&(this.$el.addClass("input-append"),this.addOn=this.append),this.placeHolder||(this.placeHolder=""),Luca.core.Field.prototype.initialize.apply(this,arguments)},keyup_handler:function(a){return this.trigger("on:keyup",this,a)},blur_handler:function(a){return this.trigger("on:blur",this,a)},focus_handler:function(a){return this.trigger("on:focus",this,a)},change_handler:function(a){return this.trigger("on:change",this,a)}})}.call(this),function(){var a;a=Luca.register("Luca.fields.TypeAheadField"),a["extends"]("Luca.fields.TextField"),a.defines({getSource:function(){return Luca.util.read(this.source)||[]},matcher:function(a){return!0},beforeRender:function(){return Luca.fields.TextField.prototype.beforeRender.apply(this,arguments),this.getInputElement().attr("data-provide","typeahead")},afterRender:function(){return Luca.fields.TextField.prototype.afterRender.apply(this,arguments),this.getInputElement().typeahead({matcher:this.matcher,source:this.getSource()})}})}.call(this),function(){var a;a=Luca.register("Luca.components.FormButtonToolbar"),a["extends"]("Luca.components.Toolbar"),a.defines({className:"luca-ui-form-toolbar form-actions",position:"bottom",includeReset:!1,render:function(){return $(this.container).append(this.el),this},initialize:function(a){this.options=a!=null?a:{},Luca.components.Toolbar.prototype.initialize.apply(this,arguments),this.components=[{ctype:"button_field",label:"Submit","class":"btn submit-button"}];if(this.includeReset)return this.components.push({ctype:"button_field",label:"Reset","class":"btn reset-button"})}})}.call(this),function(){var a;a=Luca.register("Luca.components.FormView"),a["extends"]("Luca.core.Container"),a.triggers("before:submit","before:reset","before:load","before:load:new","before:load:existing","after:submit","after:reset","after:load","after:load:new","after:load:existing","after:submit:success","after:submit:fatal_error","after:submit:error"),a.defines({tagName:"form",className:"luca-ui-form-view",events:{"click .submit-button":"submitHandler","click .reset-button":"resetHandler"},toolbar:!0,legend:"",bodyClassName:"form-view-body",version:1,initialize:function(a){this.options=a!=null?a:{},this.loadMask==null&&(this.loadMask=Luca.config.enableBoostrap),Luca.core.Container.prototype.initialize.apply(this,arguments),this.components||(this.components=this.fields),_.bindAll(this,"submitHandler","resetHandler","renderToolbars"),this.state||(this.state=new Backbone.Model),this.setupHooks(this.hooks),this.applyStyleClasses();if(this.toolbar!==!1&&!this.topToolbar&&!this.bottomToolbar){if(this.toolbar==="both"||this.toolbar==="top")this.topToolbar=this.getDefaultToolbar();if(this.toolbar!=="top")return this.bottomToolbar=this.getDefaultToolbar()}},getDefaultToolbar:function(){return Luca.components.FormView.defaultFormViewToolbar},applyStyleClasses:function(){Luca.config.enableBoostrap&&this.applyBootstrapStyleClasses(),this.labelAlign&&this.$el.addClass("label-align-"+this.labelAlign);if(this.fieldLayoutClass)return this.$el.addClass(this.fieldLayoutClass)},applyBootstrapStyleClasses:function(){this.labelAlign==="left"&&(this.inlineForm=!0),this.well&&this.$el.addClass("well"),this.searchForm&&this.$el.addClass("form-search"),this.horizontalForm&&this.$el.addClass("form-horizontal");if(this.inlineForm)return this.$el.addClass("form-inline")},resetHandler:function(a){var b,c;return b=c=$(a!=null?a.target:void 0),this.trigger("before:reset",this),this.reset(),this.trigger("after:reset",this)},submitHandler:function(a){var b,c;b=c=$(a!=null?a.target:void 0),this.trigger("before:submit",this),this.loadMask===!0&&this.trigger("enable:loadmask",this);if(this.hasModel())return this.submit()},afterComponents:function(){var a,b=this;return(a=Luca.core.Container.prototype.afterComponents)!=null&&a.apply(this,arguments),this.eachField(function(a){return a.getForm=function(){return b},a.getModel=function(){return b.currentModel()}})},eachField:function(a){return _(this.getFields()).map(a)},getField:function(a){var b;return b=_(this.getFields("name",a)).first(),b!=null?b:_(this.getFields("input_name",a)).first()},getFields:function(a,b){var c;return c=this.selectByAttribute("isField",!0,!0),a!=null&&b!=null&&(c=_(c).select(function(c){var d;return d=c[a],_.isFunction(d)&&(d=d.call(c)),d===b})),c},loadModel:function(a){var b,c,d,e;this.current_model=a,d=this,c=this.getFields(),this.trigger("before:load",this,this.current_model),this.current_model&&((e=this.current_model.beforeFormLoad)!=null&&e.apply(this.current_model,this),b="before:load:"+(this.current_model.isNew()?"new":"existing"),this.trigger(b,this,this.current_model)),this.setValues(this.current_model),this.trigger("after:load",this,this.current_model);if(this.current_model)return this.trigger("after:load:"+(this.current_model.isNew()?"new":"existing"),this,this.current_model)},reset:function(){if(this.current_model!=null)return this.loadModel(this.current_model)},clear:function(){var a=this;return this.current_model=this.defaultModel!=null?this.defaultModel():void 0,_(this.getFields()).each(function(b){try{return b.setValue("")}catch(c){return console.log("Error Clearing",a,b)}})},setValues:function(a,b){var c,d=this;b==null&&(b={}),a||(a=this.currentModel()),c=this.getFields(),_(c).each(function(b){var c,e;c=b.input_name||b.name,(e=a[c])&&_.isFunction(e)&&(e=e.apply(d)),!e&&Luca.isBackboneModel(a)&&(e=a.get(c));if(b.readOnly!==!0)return b!=null?b.setValue(e):void 0});if(b.silent!=null!=1)return this.syncFormWithModel()},getValues:function(a){var b,c=this;return a==null&&(a={}),a.reject_blank==null&&(a.reject_blank=!0),a.skip_buttons==null&&(a.skip_buttons=!0),a.blanks===!1&&(a.reject_blank=!0),b=_(this.getFields()).inject(function(b,c){var d,e,f,g,h;return g=c.getValue(),e=c.input_name||c.name,h=!!_.str.isBlank(g)||!!_.isUndefined(g),d=!a.reject_blank&&!c.send_blanks,a.debug&&console.log(""+e+" Options",a,"Value",g,"Value Is Blank?",h,"Allow Blanks?",d),a.skip_buttons&&c.isButton?f=!0:(h&&d===!1&&(f=!0),c.input_name==="id"&&h===!0&&(f=!0)),a.debug&&console.log("Skip is true on "+e),f!==!0&&(b[e]=g),b},a.defaults||{}),b},submit_success_handler:function(a,b,c){return this.trigger("after:submit",this,a,b),this.loadMask===!0&&this.trigger("disable:loadmask",this),b&&(b!=null?b.success:void 0)===!0?this.trigger("after:submit:success",this,a,b):this.trigger("after:submit:error",this,a,b)},submit_fatal_error_handler:function(a,b,c){return this.trigger("after:submit",this,a,b),this.trigger("after:submit:fatal_error",this,a,b)},submit:function(a,b){a==null&&(a=!0),b==null&&(b={}),_.bindAll(this,"submit_success_handler","submit_fatal_error_handler"),b.success||(b.success=this.submit_success_handler),b.error||(b.error=this.submit_fatal_error_handler),this.syncFormWithModel();if(!a)return;return this.current_model.save(this.current_model.toJSON(),b)},hasModel:function(){return this.current_model!=null},currentModel:function(a){return a==null&&(a={}),(a===!0||(a!=null?a.refresh:void 0)===!0)&&this.syncFormWithModel(),this.current_model},syncFormWithModel:function(){var a;return(a=this.current_model)!=null?a.set(this.getValues()):void 0},setLegend:function(a){return this.legend=a,$("fieldset legend",this.el).first().html(this.legend)},flash:function(a){return this.$(".toolbar-container.top").length>0?this.$(".toolbar-container.top").after(a):this.$bodyEl().prepend(a)},successFlashDelay:1500,successMessage:function(a){var b=this;return this.$(".alert.alert-success").remove(),this.flash(Luca.template("components/form_alert",{className:"alert alert-success",message:a})),_.delay(function(){return b.$(".alert.alert-success").fadeOut()},this.successFlashDelay||0)},errorMessage:function(a){return this.$(".alert.alert-error").remove(),this.flash(Luca.template("components/form_alert",{className:"alert alert-error",message:a}))}}),Luca.components.FormView.defaultFormViewToolbar={buttons:[{icon:"remove-sign",label:"Reset",eventId:"click:reset",className:"reset-button",align:"right"},{icon:"ok-sign",white:!0,label:"Save Changes",eventId:"click:submit",color:"success",className:"submit-button",align:"right"}]}}.call(this),function(){_.def("Luca.components.GridView").extend("Luca.components.Panel")["with"]({bodyTemplate:"components/grid_view",autoBindEventHandlers:!0,events:{"dblclick table tbody tr":"double_click_handler","click table tbody tr":"click_handler"},className:"luca-ui-g-view",rowClass:"luca-ui-g-row",wrapperClass:"luca-ui-g-view-wrapper",additionalWrapperClasses:[],wrapperStyles:{},scrollable:!0,emptyText:"No Results To display.",tableStyle:"striped",defaultHeight:285,defaultWidth:756,maxWidth:void 0,hooks:["before:grid:render","before:render:header","before:render:row","after:grid:render","row:double:click","row:click","after:collection:load"],initialize:function(a){var b=this;return this.options=a!=null?a:{},_.extend(this,this.options),_.extend(this,Luca.concerns.Deferrable),this.loadMask==null&&(this.loadMask=Luca.config.enableBoostrap),this.loadMask===!0&&(this.loadMaskEl||(this.loadMaskEl=".luca-ui-g-view-body")),Luca.components.Panel.prototype.initialize.apply(this,arguments),this.configure_collection(!0),this.collection.bind("before:fetch",function(){if(b.loadMask===!0)return b.trigger("enable:loadmask")}),this.collection.bind("reset",function(a){return b.refresh(),b.loadMask===!0&&b.trigger("disable:loadmask"),b.trigger("after:collection:load",a)}),this.collection.bind("change",function(a){var c,d;if(b.rendered!==!0)return;try{return d=b.getRowEl(a.id||a.get("id")||a.cid),c=b.render_row(a,b.collection.indexOf(a),{cellsOnly:!0}),$(d).html(c.join(" "))}catch(e){return console.log("Error in change handler for GridView.collection",e,b,a)}})},beforeRender:function(){var a;return(a=Luca.components.Panel.prototype.beforeRender)!=null&&a.apply(this,arguments),this.trigger("before:grid:render",this),this.table=this.$("table.luca-ui-g-view"),this.header=this.$("thead"),this.body=this.$("tbody"),this.footer=this.$("tfoot"),this.wrapper=this.$("."+this.wrapperClass),this.applyCssClasses(),this.scrollable&&this.setDimensions(),this.renderHeader(),this.emptyMessage(),$(this.container).append(this.$el)},afterRender:function(){var a;return(a=Luca.components.Panel.prototype.afterRender)!=null&&a.apply(this,arguments),this.rendered=!0,this.refresh(),this.trigger("after:grid:render",this)},applyCssClasses:function(){var a,b=this;return this.scrollable&&this.$el.addClass("scrollable-g-view"),_(this.additionalWrapperClasses).each(function(a){var c;return(c=b.wrapper)!=null?c.addClass(a):void 0}),Luca.config.enableBoostrap&&this.table.addClass("table"),_((a=this.tableStyle)!=null?a.split(" "):void 0).each(function(a){return b.table.addClass("table-"+a)})},setDimensions:function(a){var b=this;return this.height||(this.height=this.defaultHeight),this.$(".luca-ui-g-view-body").height(this.height),this.$("tbody.scrollable").height(this.height-23),this.container_width=function(){return $(b.container).width()}(),this.width||(this.width=this.container_width>0?this.container_width:this.defaultWidth),this.width=_([this.width,this.maxWidth||this.width]).max(),this.$(".luca-ui-g-view-body").width(this.width),this.$(".luca-ui-g-view-body table").width(this.width),this.setDefaultColumnWidths()},resize:function(a){var b,c,d=this;b=a-this.width,this.width=a,this.$(".luca-ui-g-view-body").width(this.width),this.$(".luca-ui-g-view-body table").width(this.width);if(this.columns.length>0)return c=b/this.columns.length,_(this.columns).each(function(a,b){var e;return e=$(".column-"+b,d.el),e.width(a.width=a.width+c)})},padLastColumn:function(){var a,b;a=_(this.columns).inject(function(a,b){return a=b.width+a},0),b=this.width-a;if(b>0)return this.lastColumn().width+=b},setDefaultColumnWidths:function(){var a;return a=this.columns.length>0?this.width/this.columns.length:200,_(this.columns).each(function(b){return parseInt(b.width||(b.width=a))}),this.padLastColumn()},lastColumn:function(){return this.columns[this.columns.length-1]},emptyMessage:function(a){return a==null&&(a=""),a||(a=this.emptyText),this.body.html(""),this.body.append(Luca.templates["components/grid_view_empty_text"]({colspan:this.columns.length,text:a}))},refresh:function(){var a=this;this.body.html(""),this.collection.each(function(b,c){return a.render_row.apply(a,[b,c])});if(this.collection.models.length===0)return this.emptyMessage()},ifLoaded:function(a,b){return b||(b=this),a||(a=function(){return!0}),this.collection.ifLoaded(a,b)},applyFilter:function(a,b){return b==null&&(b={auto:!0,refresh:!0}),this.collection.applyFilter(a,b)},renderHeader:function(){var a,b=this;return this.trigger("before:render:header"),a=_(this.columns).map(function(a,b){var c;return c=a.width?"width:"+a.width+"px;":"","<th style='"+c+"' class='column-"+b+"'>"+a.header+"</th>"}),this.header.append("<tr>"+a+"</tr>")},getRowEl:function(a){return this.$("[data-record-id="+a+"]","table")},render_row:function(a,b,c){var d,e,f,g,h,i,j=this;return c==null&&(c={}),h=this.rowClass,g=(a!=null?a.get:void 0)&&(a!=null?a.attributes:void 0)?a.get("id"):"",this.trigger("before:render:row",a,b),e=_(this.columns).map(function(b,c){var d,e,f;return f=j.cell_renderer(a,b,c),e=b.width?"width:"+b.width+"px;":"",d=_.isUndefined(f)?"":f,"<td style='"+e+"' class='column-"+c+"'>"+d+"</td>"}),c.cellsOnly?e:(d="",this.alternateRowClasses&&(d=b%2===0?"even":"odd"),f="<tr data-record-id='"+g+"' data-row-index='"+b+"' class='"+h+" "+d+"' id='row-"+b+"'>"+e+"</tr>",c.contentOnly===!0?f:(i=this.body)!=null?i.append(f):void 0)},cell_renderer:function(a,b,c){var d;return _.isFunction(b.renderer)?b.renderer.apply(this,[a,b,c]):b.data.match(/\w+\.\w+/)?(d=a.attributes||a,Luca.util.nestedValue(b.data,d)):(typeof a.get=="function"?a.get(b.data):void 0)||a[b.data]},double_click_handler:function(a){var b,c,d,e;return b=c=$(a.currentTarget),e=c.data("row-index"),d=this.collection.at(e),this.trigger("row:double:click",this,d,e)},click_handler:function(a){var b,c,d,e;return b=c=$(a.currentTarget),e=c.data("row-index"),d=this.collection.at(e),this.trigger("row:click",this,d,e),$("."+this.rowClass,this.body).removeClass("selected-row"),b.addClass("selected-row")}})}.call(this),function(){_.def("Luca.components.LoadMask")["extends"]("Luca.View")["with"]({className:"luca-ui-load-mask",bodyTemplate:"components/load_mask"})}.call(this),function(){var a,b,c;a=Luca.register("Luca.components.MultiCollectionView"),a["extends"]("Luca.containers.CardView"),a.mixesIn("QueryCollectionBindings","LoadMaskable","Filterable","Paginatable"),a.triggers("before:refresh","after:refresh","refresh","empty:results"),a.defines({version:1,stateful:!0,defaultState:{activeView:0},viewContainerClass:"luca-ui-multi-view-container",initialize:function(a){var d,e,f,g;this.options=a!=null?a:{},this.components||(this.components=this.views),g=this.components;for(e=0,f=g.length;e<f;e++)d=g[e],c(d);return Luca.containers.CardView.prototype.initialize.apply(this,arguments),this.on("refresh",this.refresh,this),this.on("after:card:switch",this.refresh,this),this.on("after:components",b,this)},relayAfterRefresh:function(a,b,c){return this.trigger("after:refresh",a,b,c)},refresh:function(){var a;return(a=this.activeComponent())!=null?a.trigger("refresh"):void 0}}),b=function(){var a,b,c,d,e,f,g=this;b=this,e=this.components,f=[];for(c=0,d=e.length;c<d;c++)a=e[c],a.on("after:refresh",function(a,b,c){return g.debug("collection member after refresh"),g.trigger("after:refresh",a,b,c)}),f.push(_.extend(a,{collection:b.getCollection(),getQuery:function(){return b.getQuery.call(b)},getQueryOptions:function(){return b.getQueryOptions.call(b)}}));return f},c=function(a){var b;b=a.type||a.ctype;if(b==="collection"||b==="collection_view"||b==="table"||b==="table_view")return;throw"The MultiCollectionView expects to contain multiple collection views"}}.call(this),function(){_.def("Luca.components.NavBar")["extends"]("Luca.View")["with"]({fixed:!0,position:"top",className:"navbar",brand:"Luca.js",bodyTemplate:"nav_bar",bodyClassName:"luca-ui-navbar-body",beforeRender:function(){this.fixed&&this.$el.addClass("navbar-fixed-"+this.position),this.brand!=null&&this.content().append("<a class='brand' href='#'>"+this.brand+"</a>");if(this.template)return this.content().append(Luca.template(this.template,this))},render:function(){return this},content:function(){return this.$(".container").eq(0)}})}.call(this),function(){_.def("Luca.PageController")["extends"]("Luca.components.Controller")["with"]({version:2})}.call(this),function(){var a;a=Luca.register("Luca.components.PaginationControl"),a["extends"]("Luca.View"),a.defines({template:"components/pagination",stateful:!0,autoBindEventHandlers:!0,events:{"click a[data-page-number]":"selectPage","click a.next":"nextPage","click a.prev":"previousPage"},afterInitialize:function(){var a,b=this;return _.bindAll(this,"updateWithPageCount"),(a=this.state)!=null?a.on("change",function(a,c){return b.updateWithPageCount(a.get("numberOfPages"))}):void 0},limit:function(){var a;return parseInt(this.state.get("limit")||((a=this.collection)!=null?a.length:void 0))},page:function(){return parseInt(this.state.get("page")||1)},nextPage:function(){if(!this.nextEnabled())return;return this.state.set("page",this.page()+1)},previousPage:function(){if(!this.previousEnabled())return;return this.state.set("page",this.page()-1)},selectPage:function(a){var b,c;return b=c=this.$(a.target),b.is("a.page")||(b=c=c.closest("a.page")),c.siblings().removeClass("is-selected"),b.addClass("is-selected"),this.setPage(c.data("page-number"))},setPage:function(a,b){return a==null&&(a=1),b==null&&(b={}),this.state.set("page",a,b)},setLimit:function(a,b){return a==null&&(a=1),b==null&&(b={}),this.state.set("limit",a,b)},pageButtonContainer:function(){return this.$(".group")},previousEnabled:function(){return this.page()>1},nextEnabled:function(){return this.page()<this.totalPages()},previousButton:function(){return this.$("a.page.prev")},nextButton:function(){return this.$("a.page.next")},pageButtons:function(){return this.$("a[data-page-number]",this.pageButtonContainer())},updateWithPageCount:function(a,b){var c,d=this;return this.pageCount=a,b==null&&(b=[]),c=b.length,this.pageButtonContainer().empty(),_(this.pageCount).times(function(a){var b,c;return c=a+1,b=d.make("a",{"data-page-number":c,"class":"page"},c),d.pageButtonContainer().append(b)}),this.toggleNavigationButtons(),this.selectActivePageButton(),this},toggleNavigationButtons:function(){this.$("a.next, a.prev").addClass("disabled"),this.nextEnabled()&&this.nextButton().removeClass("disabled");if(this.previousEnabled())return this.previousButton().removeClass("disabled")},selectActivePageButton:function(){return this.activePageButton().addClass("is-selected")},activePageButton:function(){return this.pageButtons().filter("[data-page-number='"+this.page()+"']")},totalPages:function(){return this.pageCount},totalItems:function(){var a;return parseInt(((a=this.collection)!=null?a.length:void 0)||0)},itemsPerPage:function(a,b){return b==null&&(b={}),a!=null&&this.state.set("limit",a,b),parseInt(this.state.get("limit"))}})}.call(this),function(){_.def("Luca.components.RecordManager")["extends"]("Luca.containers.CardView")["with"]({events:{"click .record-manager-grid .edit-link":"edit_handler","click .record-manager-filter .filter-button":"filter_handler","click .record-manager-filter .reset-button":"reset_filter_handler","click .add-button":"add_handler","click .refresh-button":"filter_handler","click .back-to-search-button":"back_to_search_handler"},record_manager:!0,initialize:function(a){var b=this;this.options=a!=null?a:{},Luca.containers.CardView.prototype.initialize.apply(this,arguments);if(!this.name)throw"Record Managers must specify a name";return _.bindAll(this,"add_handler","edit_handler","filter_handler","reset_filter_handler"),this.filterConfig&&_.extend(this.components[0][0],this.filterConfig),this.gridConfig&&_.extend(this.components[0][1],this.gridConfig),this.editorConfig&&_.extend(this.components[1][0],this.editorConfig),this.bind("after:card:switch",function(){b.activeCard===0&&b.trigger("activation:search",b);if(b.activeCard===1)return b.trigger("activation:editor",b)})},components:[{ctype:"split_view",relayFirstActivation:!0,components:[{ctype:"form_view"},{ctype:"grid_view"}]},{ctype:"form_view"}],getSearch:function(a,b){return a==null&&(a=!1),b==null&&(b=!0),a===!0&&this.activate(0),b===!0&&this.getEditor().clear(),_.first(this.components)},getFilter:function(){return _.first(this.getSearch().components)},getGrid:function(){return _.last(this.getSearch().components)},getCollection:function(){return this.getGrid().collection},getEditor:function(a,b){var c=this;return a==null&&(a=!1),b==null&&(b=!1),a===!0&&this.activate(1,function(a,b,c){return c.reset()}),_.last(this.components)},beforeRender:function(){var a;return this.$el.addClass(""+this.resource+"-manager"),(a=Luca.containers.CardView.prototype.beforeRender)!=null&&a.apply(this,arguments),this.$el.addClass(""+this.resource+" record-manager"),this.$el.data("resource",this.resource),$(this.getGrid().el).addClass(""+this.resource+" record-manager-grid"),$(this.getFilter().el).addClass(""+this.resource+" record-manager-filter"),$(this.getEditor().el).addClass(""+this.resource+" record-manager-editor")},afterRender:function(){var a,b,c,d,e,f,g=this;return(f=Luca.containers.CardView.prototype.afterRender)!=null&&f.apply(this,arguments),e=this,d=this.getGrid(),c=this.getFilter(),b=this.getEditor(),a=this.getCollection(),d.bind("row:double:click",function(a,c,d){return e.getEditor(!0),b.loadModel(c)}),b.bind("before:submit",function(){return $(".form-view-flash-container",g.el).html(""),$(".form-view-body",g.el).spin("large")}),b.bind("after:submit",function(){return $(".form-view-body",g.el).spin(!1)}),b.bind("after:submit:fatal_error",function(){return $(".form-view-flash-container",g.el).append("<li class='error'>There was an internal server error saving this record. Please contact developers@benchprep.com to report this error.</li>"),$(".form-view-body",g.el).spin(!1)}),b.bind("after:submit:error",function(a,b,c){return _(c.errors).each(function(a){return $(".form-view-flash-container",g.el).append("<li class='error'>"+a+"</li>")})}),b.bind("after:submit:success",function(a,b,c){return $(".form-view-flash-container",g.el).append("<li class='success'>Successfully Saved Record</li>"),b.set(c.result),a.loadModel(b),d.refresh(),_.delay(function(){return $(".form-view-flash-container li.success",g.el).fadeOut(1e3),$(".form-view-flash-container",g.el).html("")},4e3)}),c.eachComponent(function(a){try{return a.bind("on:change",g.filter_handler)}catch(b){return}})},firstActivation:function(){return this.getGrid().trigger("first:activation",this,this.getGrid()),this.getFilter().trigger("first:activation",this,this.getGrid())},reload:function(){var a,b,c,d;return d=this,c=this.getGrid(),b=this.getFilter(),a=this.getEditor(),b.clear(),c.applyFilter()},manageRecord:function(a){var b,c=this;return b=this.getCollection().get(a),b?this.loadModel(b):(console.log("Could Not Find Model, building and fetching"),b=this.buildModel(),b.set({id:a},{silent:!0}),b.fetch({success:function(a,b){return c.loadModel(a)}}))},loadModel:function(a){return this.current_model=a,this.getEditor(!0).loadModel(this.current_model),this.trigger("model:loaded",this.current_model)},currentModel:function(){return this.getEditor(!1).currentModel()},buildModel:function(){var a,b,c;return b=this.getEditor(!1),a=this.getCollection(),a.add([{}],{silent:!0,at:0}),c=a.at(0)},createModel:function(){return this.loadModel(this.buildModel())},reset_filter_handler:function(a){return this.getFilter().clear(),this.getGrid().applyFilter(this.getFilter().getValues())},filter_handler:function(a){return this.getGrid().applyFilter(this.getFilter().getValues())},edit_handler:function(a){var b,c,d,e;return b=d=$(a.currentTarget),e=d.parents("tr").data("record-id"),e&&(c=this.getGrid().collection.get(e)),c||(c=this.getGrid().collection.at(row_index))},add_handler:function(a){var b,c,d;return b=c=$(a.currentTarget),d=c.parents(".record-manager").eq(0).data("resource")},destroy_handler:function(a){},back_to_search_handler:function(){}})}.call(this),function(){_.def("Luca.Router")["extends"]("Backbone.Router")["with"]({routes:{"":"default"},initialize:function(a){var b,c=this;return this.options=a,_.extend(this,this.options),this.routeHandlers=_(this.routes).values(),_(this.routeHandlers).each(function(a){return c.bind("route:"+a,function(){return c.trigger.apply(c,["change:navigation",a].concat(_(arguments).flatten()))})}),(b=Backbone.Router.initialize)!=null?b.apply(this,arguments):void 0},navigate:function(a,b){return b==null&&(b=!1),Backbone.Router.prototype.navigate.apply(this,arguments),this.buildPathFrom(Backbone.history.getFragment())},buildPathFrom:function(a){var b=this;return _(this.routes).each(function(c,d){var e,f;f=b._routeToRegExp(d);if(f.test(a))return e=b._extractParameters(f,a),b.trigger.apply(b,["change:navigation",c].concat(e))})}})}.call(this),function(){var a;_.def("Luca.components.TableView")["extends"]("Luca.components.CollectionView")["with"]({additionalClassNames:"table",tagName:"table",bodyTemplate:"table_view",bodyTagName:"tbody",bodyClassName:"table-body",itemTagName:"tr",stateful:!0,observeChanges:!0,widths:[],columns:[],emptyText:"There are no results to display",itemRenderer:function(a,b){return Luca.components.TableView.rowRenderer.call(this,a,b)},initialize:function(a){var b,c,d,e=this;return this.options=a!=null?a:{},Luca.components.CollectionView.prototype.initialize.apply(this,arguments),c=0,this.columns=function(){var a,e,f,g;f=this.columns,g=[];for(a=0,e=f.length;a<e;a++){b=f[a];if(d=this.widths[c])b.width=d;_.isString(b)&&(b={reader:b}),b.header==null&&(b.header=_.str.titleize(_.str.humanize(b.reader))),c++,g.push(b)}return g}.call(this),this.defer(function(){return Luca.components.TableView.renderHeader.call(e,e.columns,e.$("thead"))}).until("after:render")}}),a=Backbone.View.prototype.make,Luca.components.TableView.renderHeader=function(a,b){var c,d,e,f,g,h;e=0,d=function(){var b,d,f;f=[];for(b=0,d=a.length;b<d;b++)c=a[b],f.push("<th data-col-index='"+e++ +"'>"+c.header+"</th>");return f}(),this.$(b).append("<tr>"+d.join("")+"</tr>"),e=0,h=[];for(f=0,g=a.length;f<g;f++)c=a[f],c.width!=null&&h.push(this.$("th[data-col-index='"+e++ +"']",b).css("width",c.width));return h},Luca.components.TableView.rowRenderer=function(a,b,c){var d,e,f,g,h,i;d=0,h=this.columns,i=[];for(f=0,g=h.length;f<g;f++)e=h[f],i.push(Luca.components.TableView.renderColumn.call(this,e,a,b,d++));return i},Luca.components.TableView.renderColumn=function(b,c,d,e){var f;return f=d.read(b.reader),_.isFunction(b.renderer)&&(f=b.renderer.call(this,f,d,b)),a("td",{"data-col-index":e},f)}}.call(this),function(){_.def("Luca.components.ToolbarDialog")["extends"]("Luca.View")["with"]({className:"luca-ui-toolbar-dialog span well",styles:{position:"absolute","z-Index":"3000","float":"left"},initialize:function(a){return this.options=a!=null?a:{},this._super("initialize",this,arguments)},createWrapper:function(){return this.make("div",{"class":"component-picker span4 well",style:"position: absolute; z-index:12000"})},show:function(){return this.$el.parent().show()},hide:function(){return this.$el.parent().hide()},toggle:function(){return this.$el.parent().toggle()}})}.call(this),function(){}.call(this),function(){}.call(this),function(){}.call(this);
|
@@ -80,11 +80,11 @@
|
|
80
80
|
}).call(this);
|
81
81
|
(function() {
|
82
82
|
this.JST || (this.JST = {});
|
83
|
-
this.JST["luca-src/templates/fields/text_area_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<label for="', input_id ,'">\n ', label ,'\n</label>\n<div class="controls">\n <textarea name="', input_name ,'" style="', inputStyles ,'" >', input_value ,'</textarea>\n '); if(helperText) { __p.push('\n <p class="helper-text help-block">\n ', helperText ,'\n </p>\n '); } __p.push('\n</div>\n');}return __p.join('');};
|
83
|
+
this.JST["luca-src/templates/fields/text_area_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<label for="', input_id ,'">\n ', label ,'\n</label>\n<div class="controls">\n <textarea placeholder="', placeHolder ,'" name="', input_name ,'" style="', inputStyles ,'" >', input_value ,'</textarea>\n '); if(helperText) { __p.push('\n <p class="helper-text help-block">\n ', helperText ,'\n </p>\n '); } __p.push('\n</div>\n');}return __p.join('');};
|
84
84
|
}).call(this);
|
85
85
|
(function() {
|
86
86
|
this.JST || (this.JST = {});
|
87
|
-
this.JST["luca-src/templates/fields/text_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push(''); if(typeof(label)!=="undefined" && (typeof(hideLabel) !== "undefined" && !hideLabel) || (typeof(hideLabel)==="undefined")) {__p.push('\n<label class="control-label" for="', input_id ,'">', label ,'</label>\n'); } __p.push('\n\n<div class="controls">\n'); if( typeof(addOn) !== "undefined" ) { __p.push('\n <span class="add-on">', addOn ,'</span>\n'); } __p.push('\n<input type="text" name="', input_name ,'" style="', inputStyles ,'" value="', input_value ,'" />\n'); if(helperText) { __p.push('\n<p class="helper-text help-block">\n ', helperText ,'\n</p>\n'); } __p.push('\n\n</div>\n');}return __p.join('');};
|
87
|
+
this.JST["luca-src/templates/fields/text_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push(''); if(typeof(label)!=="undefined" && (typeof(hideLabel) !== "undefined" && !hideLabel) || (typeof(hideLabel)==="undefined")) {__p.push('\n<label class="control-label" for="', input_id ,'">', label ,'</label>\n'); } __p.push('\n\n<div class="controls">\n'); if( typeof(addOn) !== "undefined" ) { __p.push('\n <span class="add-on">', addOn ,'</span>\n'); } __p.push('\n<input type="text" placeholder="', placeHolder ,'" name="', input_name ,'" style="', inputStyles ,'" value="', input_value ,'" />\n'); if(helperText) { __p.push('\n<p class="helper-text help-block">\n ', helperText ,'\n</p>\n'); } __p.push('\n\n</div>\n');}return __p.join('');};
|
88
88
|
}).call(this);
|
89
89
|
(function() {
|
90
90
|
this.JST || (this.JST = {});
|
@@ -1,12 +1,19 @@
|
|
1
1
|
(function() {
|
2
|
-
var UnderscoreExtensions,
|
2
|
+
var UnderscoreExtensions, lucaUtilityHelper,
|
3
3
|
__slice = Array.prototype.slice;
|
4
4
|
|
5
|
-
|
6
|
-
var args, definition, fallback, inheritsFrom, payload, result;
|
5
|
+
lucaUtilityHelper = function() {
|
6
|
+
var args, definition, fallback, inheritsFrom, payload, result, _ref;
|
7
7
|
payload = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
8
|
+
if (payload == null) {
|
9
|
+
return (_ref = _(Luca.Application.instances).values()) != null ? _ref[0] : void 0;
|
10
|
+
}
|
8
11
|
if (_.isString(payload) && (result = Luca.cache(payload))) return result;
|
9
12
|
if (_.isString(payload) && (result = Luca.find(payload))) return result;
|
13
|
+
if (_.isString(payload) && (result = Luca.registry.find(payload))) {
|
14
|
+
return result;
|
15
|
+
}
|
16
|
+
if (payload instanceof jQuery && (result = Luca.find(payload))) return result;
|
10
17
|
if (_.isObject(payload) && (payload.ctype != null)) {
|
11
18
|
return Luca.util.lazyComponent(payload);
|
12
19
|
}
|
@@ -17,32 +24,49 @@
|
|
17
24
|
if (_.isFunction(fallback = _(args).last())) return fallback();
|
18
25
|
};
|
19
26
|
|
27
|
+
(window || global).Luca = function() {
|
28
|
+
return lucaUtilityHelper.apply(this, arguments);
|
29
|
+
};
|
30
|
+
|
20
31
|
_.extend(Luca, {
|
21
|
-
VERSION: "0.9.
|
32
|
+
VERSION: "0.9.75",
|
22
33
|
core: {},
|
34
|
+
collections: {},
|
23
35
|
containers: {},
|
24
36
|
components: {},
|
25
|
-
|
37
|
+
models: {},
|
38
|
+
concerns: {},
|
26
39
|
util: {},
|
27
40
|
fields: {},
|
28
41
|
registry: {},
|
29
42
|
options: {},
|
30
|
-
config: {}
|
43
|
+
config: {},
|
44
|
+
getHelper: function() {
|
45
|
+
return function() {
|
46
|
+
return lucaUtilityHelper.apply(this, arguments);
|
47
|
+
};
|
48
|
+
}
|
31
49
|
});
|
32
50
|
|
33
51
|
_.extend(Luca, Backbone.Events);
|
34
52
|
|
53
|
+
Luca.config.maintainStyleHierarchy = true;
|
54
|
+
|
55
|
+
Luca.config.maintainClassHierarchy = true;
|
56
|
+
|
57
|
+
Luca.config.autoApplyClassHierarchyAsCssClasses = true;
|
58
|
+
|
35
59
|
Luca.autoRegister = Luca.config.autoRegister = true;
|
36
60
|
|
37
61
|
Luca.developmentMode = Luca.config.developmentMode = false;
|
38
62
|
|
39
63
|
Luca.enableGlobalObserver = Luca.config.enableGlobalObserver = false;
|
40
64
|
|
41
|
-
Luca.
|
65
|
+
Luca.config.enableBoostrap = Luca.config.enableBootstrap = true;
|
42
66
|
|
43
67
|
Luca.config.enhancedViewProperties = true;
|
44
68
|
|
45
|
-
Luca.keys = {
|
69
|
+
Luca.keys = Luca.config.keys = {
|
46
70
|
ENTER: 13,
|
47
71
|
ESCAPE: 27,
|
48
72
|
KEYLEFT: 37,
|
@@ -53,11 +77,79 @@
|
|
53
77
|
FORWARDSLASH: 191
|
54
78
|
};
|
55
79
|
|
56
|
-
Luca.keyMap = _(Luca.keys).inject(function(memo, value, symbol) {
|
80
|
+
Luca.keyMap = Luca.config.keyMap = _(Luca.keys).inject(function(memo, value, symbol) {
|
57
81
|
memo[value] = symbol.toLowerCase();
|
58
82
|
return memo;
|
59
83
|
}, {});
|
60
84
|
|
85
|
+
Luca.config.showWarnings = true;
|
86
|
+
|
87
|
+
Luca.setupCollectionSpace = function(options) {
|
88
|
+
var baseParams, modelBootstrap;
|
89
|
+
if (options == null) options = {};
|
90
|
+
baseParams = options.baseParams, modelBootstrap = options.modelBootstrap;
|
91
|
+
if (baseParams != null) {
|
92
|
+
Luca.Collection.baseParams(baseParams);
|
93
|
+
} else {
|
94
|
+
Luca.warn('You should remember to set the base params for Luca.Collection class. You can do this by defining a property or function on Luca.config.baseParams');
|
95
|
+
}
|
96
|
+
if (modelBootstrap != null) {
|
97
|
+
return Luca.Collection.bootstrap(modelBootstrap);
|
98
|
+
} else {
|
99
|
+
return Luca.warn("You should remember to set the model bootstrap location for Luca.Collection. You can do this by defining a property or function on Luca.config.modelBootstrap");
|
100
|
+
}
|
101
|
+
};
|
102
|
+
|
103
|
+
Luca.initialize = function(namespace, options) {
|
104
|
+
var defaults, object;
|
105
|
+
if (options == null) options = {};
|
106
|
+
defaults = {
|
107
|
+
views: {},
|
108
|
+
collections: {},
|
109
|
+
models: {},
|
110
|
+
components: {},
|
111
|
+
lib: {},
|
112
|
+
util: {},
|
113
|
+
concerns: {},
|
114
|
+
register: function() {
|
115
|
+
return Luca.register.apply(this, arguments);
|
116
|
+
},
|
117
|
+
onReady: function() {
|
118
|
+
return Luca.onReady.apply(this, arguments);
|
119
|
+
},
|
120
|
+
getApplication: function() {
|
121
|
+
var _ref;
|
122
|
+
return (_ref = Luca.getApplication) != null ? _ref.apply(this, arguments) : void 0;
|
123
|
+
},
|
124
|
+
getCollectionManager: function() {
|
125
|
+
var _ref;
|
126
|
+
return (_ref = Luca.CollectionManager.get) != null ? _ref.apply(this, arguments) : void 0;
|
127
|
+
}
|
128
|
+
};
|
129
|
+
object = {};
|
130
|
+
object[namespace] = _.extend(Luca.getHelper(), defaults);
|
131
|
+
_.extend(Luca.config, options);
|
132
|
+
_.extend(window || global, object);
|
133
|
+
Luca.concern.namespace("" + namespace + ".concerns");
|
134
|
+
Luca.registry.namespace("" + namespace + ".views");
|
135
|
+
Luca.Collection.namespace("" + namespace + ".collections");
|
136
|
+
return Luca.on("ready", function() {
|
137
|
+
Luca.define.close();
|
138
|
+
return Luca.setupCollectionSpace(options);
|
139
|
+
});
|
140
|
+
};
|
141
|
+
|
142
|
+
Luca.onReady = function(callback) {
|
143
|
+
Luca.trigger("ready");
|
144
|
+
return $(function() {
|
145
|
+
return callback.apply(this, arguments);
|
146
|
+
});
|
147
|
+
};
|
148
|
+
|
149
|
+
Luca.warn = function(message) {
|
150
|
+
if (Luca.config.showWarnings === true) return console.log(message);
|
151
|
+
};
|
152
|
+
|
61
153
|
Luca.find = function(el) {
|
62
154
|
return Luca($(el).data('luca-id'));
|
63
155
|
};
|
@@ -105,36 +197,29 @@
|
|
105
197
|
};
|
106
198
|
|
107
199
|
Luca.inheritanceChain = function(obj) {
|
108
|
-
return
|
109
|
-
return Luca.util.resolve(className);
|
110
|
-
});
|
200
|
+
return Luca.parentClasses(obj);
|
111
201
|
};
|
112
202
|
|
113
203
|
Luca.parentClasses = function(obj) {
|
114
|
-
var
|
204
|
+
var list, metaData, _base;
|
115
205
|
list = [];
|
116
206
|
if (_.isString(obj)) obj = Luca.util.resolve(obj);
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
_results = [];
|
121
|
-
while (!!(Luca.parentClass(obj) != null)) {
|
122
|
-
_results.push(obj = Luca.parentClass(obj));
|
123
|
-
}
|
124
|
-
return _results;
|
125
|
-
})();
|
126
|
-
list = list.concat(classes);
|
127
|
-
return _.uniq(list);
|
207
|
+
metaData = typeof obj.componentMetaData === "function" ? obj.componentMetaData() : void 0;
|
208
|
+
metaData || (metaData = typeof (_base = obj.prototype).componentMetaData === "function" ? _base.componentMetaData() : void 0);
|
209
|
+
return list = (metaData != null ? metaData.classHierarchy() : void 0) || [obj.displayName || obj.prototype.displayName];
|
128
210
|
};
|
129
211
|
|
130
|
-
Luca.parentClass = function(obj) {
|
131
|
-
var
|
132
|
-
|
212
|
+
Luca.parentClass = function(obj, resolve) {
|
213
|
+
var parent, _base, _ref, _ref2, _ref3;
|
214
|
+
if (resolve == null) resolve = true;
|
133
215
|
if (_.isString(obj)) obj = Luca.util.resolve(obj);
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
216
|
+
parent = typeof obj.componentMetaData === "function" ? (_ref = obj.componentMetaData()) != null ? _ref.meta["super class name"] : void 0 : void 0;
|
217
|
+
parent || (parent = typeof (_base = obj.prototype).componentMetaData === "function" ? (_ref2 = _base.componentMetaData()) != null ? _ref2.meta["super class name"] : void 0 : void 0);
|
218
|
+
parent || obj.displayName || ((_ref3 = obj.prototype) != null ? _ref3.displayName : void 0);
|
219
|
+
if (resolve) {
|
220
|
+
return Luca.util.resolve(parent);
|
221
|
+
} else {
|
222
|
+
return parent;
|
138
223
|
}
|
139
224
|
};
|
140
225
|
|
@@ -312,11 +397,11 @@
|
|
312
397
|
}).call(this);
|
313
398
|
(function() {
|
314
399
|
this.JST || (this.JST = {});
|
315
|
-
this.JST["luca-src/templates/fields/text_area_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<label for="', input_id ,'">\n ', label ,'\n</label>\n<div class="controls">\n <textarea name="', input_name ,'" style="', inputStyles ,'" >', input_value ,'</textarea>\n '); if(helperText) { __p.push('\n <p class="helper-text help-block">\n ', helperText ,'\n </p>\n '); } __p.push('\n</div>\n');}return __p.join('');};
|
400
|
+
this.JST["luca-src/templates/fields/text_area_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<label for="', input_id ,'">\n ', label ,'\n</label>\n<div class="controls">\n <textarea placeholder="', placeHolder ,'" name="', input_name ,'" style="', inputStyles ,'" >', input_value ,'</textarea>\n '); if(helperText) { __p.push('\n <p class="helper-text help-block">\n ', helperText ,'\n </p>\n '); } __p.push('\n</div>\n');}return __p.join('');};
|
316
401
|
}).call(this);
|
317
402
|
(function() {
|
318
403
|
this.JST || (this.JST = {});
|
319
|
-
this.JST["luca-src/templates/fields/text_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push(''); if(typeof(label)!=="undefined" && (typeof(hideLabel) !== "undefined" && !hideLabel) || (typeof(hideLabel)==="undefined")) {__p.push('\n<label class="control-label" for="', input_id ,'">', label ,'</label>\n'); } __p.push('\n\n<div class="controls">\n'); if( typeof(addOn) !== "undefined" ) { __p.push('\n <span class="add-on">', addOn ,'</span>\n'); } __p.push('\n<input type="text" name="', input_name ,'" style="', inputStyles ,'" value="', input_value ,'" />\n'); if(helperText) { __p.push('\n<p class="helper-text help-block">\n ', helperText ,'\n</p>\n'); } __p.push('\n\n</div>\n');}return __p.join('');};
|
404
|
+
this.JST["luca-src/templates/fields/text_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push(''); if(typeof(label)!=="undefined" && (typeof(hideLabel) !== "undefined" && !hideLabel) || (typeof(hideLabel)==="undefined")) {__p.push('\n<label class="control-label" for="', input_id ,'">', label ,'</label>\n'); } __p.push('\n\n<div class="controls">\n'); if( typeof(addOn) !== "undefined" ) { __p.push('\n <span class="add-on">', addOn ,'</span>\n'); } __p.push('\n<input type="text" placeholder="', placeHolder ,'" name="', input_name ,'" style="', inputStyles ,'" value="', input_value ,'" />\n'); if(helperText) { __p.push('\n<p class="helper-text help-block">\n ', helperText ,'\n</p>\n'); } __p.push('\n\n</div>\n');}return __p.join('');};
|
320
405
|
}).call(this);
|
321
406
|
(function() {
|
322
407
|
this.JST || (this.JST = {});
|
@@ -374,6 +459,25 @@
|
|
374
459
|
return fn = prefix + parts.join('');
|
375
460
|
};
|
376
461
|
|
462
|
+
Luca.util.toCssClass = function() {
|
463
|
+
var componentName, exclusions, part, parts, transformed;
|
464
|
+
componentName = arguments[0], exclusions = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
465
|
+
parts = componentName.split('.');
|
466
|
+
transformed = (function() {
|
467
|
+
var _i, _len, _results;
|
468
|
+
_results = [];
|
469
|
+
for (_i = 0, _len = parts.length; _i < _len; _i++) {
|
470
|
+
part = parts[_i];
|
471
|
+
if (!(_(exclusions).indexOf(part) === -1)) continue;
|
472
|
+
part = _.str.underscored(part);
|
473
|
+
part = part.replace(/_/g, '-');
|
474
|
+
_results.push(part);
|
475
|
+
}
|
476
|
+
return _results;
|
477
|
+
})();
|
478
|
+
return transformed.join('-');
|
479
|
+
};
|
480
|
+
|
377
481
|
Luca.util.isIE = function() {
|
378
482
|
try {
|
379
483
|
Object.defineProperty({}, '', {});
|
@@ -468,6 +572,48 @@
|
|
468
572
|
}, contents);
|
469
573
|
};
|
470
574
|
|
575
|
+
Luca.util.setupHooks = function(set) {
|
576
|
+
var _this = this;
|
577
|
+
set || (set = this.hooks);
|
578
|
+
return _(set).each(function(eventId) {
|
579
|
+
var callback, fn;
|
580
|
+
fn = Luca.util.hook(eventId);
|
581
|
+
callback = function() {
|
582
|
+
var _ref;
|
583
|
+
return (_ref = this[fn]) != null ? _ref.apply(this, arguments) : void 0;
|
584
|
+
};
|
585
|
+
if (eventId != null ? eventId.match(/once:/) : void 0) {
|
586
|
+
callback = _.once(callback);
|
587
|
+
}
|
588
|
+
return _this.on(eventId, callback, _this);
|
589
|
+
});
|
590
|
+
};
|
591
|
+
|
592
|
+
Luca.util.setupHooksAdvanced = function(set) {
|
593
|
+
var _this = this;
|
594
|
+
set || (set = this.hooks);
|
595
|
+
return _(set).each(function(eventId) {
|
596
|
+
var callback, entry, fn, hookSetup, _i, _len, _results;
|
597
|
+
hookSetup = _this[Luca.util.hook(eventId)];
|
598
|
+
if (!_.isArray(hookSetup)) hookSetup = [hookSetup];
|
599
|
+
_results = [];
|
600
|
+
for (_i = 0, _len = hookSetup.length; _i < _len; _i++) {
|
601
|
+
entry = hookSetup[_i];
|
602
|
+
fn = _.isString(entry) ? _this[entry] : void 0;
|
603
|
+
if (_.isFunction(entry)) fn = entry;
|
604
|
+
callback = function() {
|
605
|
+
var _ref;
|
606
|
+
return (_ref = this[fn]) != null ? _ref.apply(this, arguments) : void 0;
|
607
|
+
};
|
608
|
+
if (eventId != null ? eventId.match(/once:/) : void 0) {
|
609
|
+
callback = _.once(callback);
|
610
|
+
}
|
611
|
+
_results.push(_this.on(eventId, callback, _this));
|
612
|
+
}
|
613
|
+
return _results;
|
614
|
+
});
|
615
|
+
};
|
616
|
+
|
471
617
|
}).call(this);
|
472
618
|
(function() {
|
473
619
|
|
@@ -626,22 +772,105 @@
|
|
626
772
|
|
627
773
|
}).call(this);
|
628
774
|
(function() {
|
629
|
-
var DefineProxy,
|
630
|
-
__slice = Array.prototype.slice;
|
631
775
|
|
632
|
-
|
633
|
-
|
634
|
-
|
776
|
+
Luca.concern = function(mixinName) {
|
777
|
+
var namespace, resolved;
|
778
|
+
namespace = _(Luca.concern.namespaces).detect(function(space) {
|
779
|
+
var _ref;
|
780
|
+
return ((_ref = Luca.util.resolve(space)) != null ? _ref[mixinName] : void 0) != null;
|
781
|
+
});
|
782
|
+
namespace || (namespace = "Luca.concerns");
|
783
|
+
resolved = Luca.util.resolve(namespace)[mixinName];
|
784
|
+
if (resolved == null) {
|
785
|
+
console.log("Could not find " + mixinName + " in ", Luca.concern.namespaces);
|
635
786
|
}
|
636
|
-
|
787
|
+
return resolved;
|
788
|
+
};
|
637
789
|
|
638
|
-
|
790
|
+
Luca.concern.namespaces = ["Luca.concerns"];
|
791
|
+
|
792
|
+
Luca.concern.namespace = function(namespace) {
|
793
|
+
Luca.concern.namespaces.push(namespace);
|
794
|
+
return Luca.concern.namespaces = _(Luca.concern.namespaces).uniq();
|
795
|
+
};
|
639
796
|
|
640
|
-
|
797
|
+
Luca.concern.setup = function() {
|
798
|
+
var module, _i, _len, _ref, _ref2, _ref3, _ref4, _results;
|
799
|
+
if (((_ref = this.concerns) != null ? _ref.length : void 0) > 0) {
|
800
|
+
_ref2 = this.concerns;
|
801
|
+
_results = [];
|
802
|
+
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
803
|
+
module = _ref2[_i];
|
804
|
+
_results.push((_ref3 = Luca.concern(module)) != null ? (_ref4 = _ref3.__initializer) != null ? _ref4.call(this, this, module) : void 0 : void 0);
|
805
|
+
}
|
806
|
+
return _results;
|
807
|
+
}
|
808
|
+
};
|
809
|
+
|
810
|
+
Luca.decorate = function(target) {
|
811
|
+
var componentClass, componentName, componentPrototype;
|
812
|
+
try {
|
813
|
+
if (_.isString(target)) {
|
814
|
+
componentName = target;
|
815
|
+
componentClass = Luca.util.resolve(componentName);
|
816
|
+
}
|
817
|
+
if (_.isFunction(target)) componentClass = target;
|
818
|
+
componentPrototype = componentClass.prototype;
|
819
|
+
componentName = componentName || componentClass.displayName;
|
820
|
+
componentName || (componentName = componentPrototype.displayName);
|
821
|
+
} catch (e) {
|
822
|
+
console.log(e.message);
|
823
|
+
console.log(e.stack);
|
824
|
+
console.log("Error calling Luca.decorate on ", componentClass, componentPrototype, componentName);
|
825
|
+
throw e;
|
826
|
+
}
|
827
|
+
return {
|
828
|
+
"with": function(mixinName) {
|
829
|
+
var fn, method, mixinDefinition, mixinPrivates, sanitized, superclassMixins, _ref;
|
830
|
+
mixinDefinition = Luca.concern(mixinName);
|
831
|
+
mixinDefinition.__displayName || (mixinDefinition.__displayName = mixinName);
|
832
|
+
mixinPrivates = _(mixinDefinition).chain().keys().select(function(key) {
|
833
|
+
return ("" + key).match(/^__/) || key === "classMethods";
|
834
|
+
});
|
835
|
+
sanitized = _(mixinDefinition).omit(mixinPrivates.value());
|
836
|
+
_.extend(componentPrototype, sanitized);
|
837
|
+
if (mixinDefinition.classMethods != null) {
|
838
|
+
_ref = mixinDefinition.classMethods;
|
839
|
+
for (method in _ref) {
|
840
|
+
fn = _ref[method];
|
841
|
+
componentClass[method] = _.bind(fn, componentClass);
|
842
|
+
}
|
843
|
+
}
|
844
|
+
if (mixinDefinition != null) {
|
845
|
+
if (typeof mixinDefinition.__included === "function") {
|
846
|
+
mixinDefinition.__included(componentName, componentClass, mixinDefinition);
|
847
|
+
}
|
848
|
+
}
|
849
|
+
superclassMixins = componentPrototype._superClass().prototype.concerns;
|
850
|
+
componentPrototype.concerns || (componentPrototype.concerns = []);
|
851
|
+
componentPrototype.concerns.push(mixinName);
|
852
|
+
componentPrototype.concerns = componentPrototype.concerns.concat(superclassMixins);
|
853
|
+
componentPrototype.concerns = _(componentPrototype.concerns).chain().uniq().compact().value();
|
854
|
+
return componentPrototype;
|
855
|
+
}
|
856
|
+
};
|
857
|
+
};
|
858
|
+
|
859
|
+
}).call(this);
|
860
|
+
(function() {
|
861
|
+
var ComponentDefinition, cd,
|
862
|
+
__slice = Array.prototype.slice;
|
863
|
+
|
864
|
+
ComponentDefinition = (function() {
|
865
|
+
|
866
|
+
function ComponentDefinition(componentName, autoRegister) {
|
641
867
|
var parts;
|
868
|
+
this.autoRegister = autoRegister != null ? autoRegister : true;
|
642
869
|
this.namespace = Luca.util.namespace();
|
643
870
|
this.componentId = this.componentName = componentName;
|
644
871
|
this.superClassName = 'Luca.View';
|
872
|
+
this.properties || (this.properties = {});
|
873
|
+
this._classProperties || (this._classProperties = {});
|
645
874
|
if (componentName.match(/\./)) {
|
646
875
|
this.namespaced = true;
|
647
876
|
parts = componentName.split('.');
|
@@ -649,29 +878,60 @@
|
|
649
878
|
this.namespace = parts.join('.');
|
650
879
|
Luca.registry.addNamespace(parts.join('.'));
|
651
880
|
}
|
881
|
+
Luca.define.__definitions.push(this);
|
652
882
|
}
|
653
883
|
|
654
|
-
|
884
|
+
ComponentDefinition.create = function(componentName, autoRegister) {
|
885
|
+
if (autoRegister == null) autoRegister = Luca.config.autoRegister;
|
886
|
+
return new ComponentDefinition(componentName, autoRegister);
|
887
|
+
};
|
888
|
+
|
889
|
+
ComponentDefinition.prototype.isValid = function() {
|
890
|
+
if (!_.isObject(this.properties)) return false;
|
891
|
+
if (Luca.util.resolve(this.superClassName) == null) return false;
|
892
|
+
if (this.componentName == null) return false;
|
893
|
+
return true;
|
894
|
+
};
|
895
|
+
|
896
|
+
ComponentDefinition.prototype.isDefined = function() {
|
897
|
+
return this.defined === true;
|
898
|
+
};
|
899
|
+
|
900
|
+
ComponentDefinition.prototype.isOpen = function() {
|
901
|
+
return !!(this.isValid() && !this.isDefined());
|
902
|
+
};
|
903
|
+
|
904
|
+
ComponentDefinition.prototype.meta = function(key, value) {
|
905
|
+
var data, metaKey;
|
906
|
+
metaKey = this.namespace + '.' + this.componentId;
|
907
|
+
metaKey = metaKey.replace(/^\./, '');
|
908
|
+
data = Luca.registry.addMetaData(metaKey, key, value);
|
909
|
+
return this.properties.componentMetaData = function() {
|
910
|
+
return Luca.registry.getMetaDataFor(metaKey);
|
911
|
+
};
|
912
|
+
};
|
913
|
+
|
914
|
+
ComponentDefinition.prototype["in"] = function(namespace) {
|
655
915
|
this.namespace = namespace;
|
656
916
|
return this;
|
657
917
|
};
|
658
918
|
|
659
|
-
|
919
|
+
ComponentDefinition.prototype.from = function(superClassName) {
|
660
920
|
this.superClassName = superClassName;
|
661
921
|
return this;
|
662
922
|
};
|
663
923
|
|
664
|
-
|
924
|
+
ComponentDefinition.prototype["extends"] = function(superClassName) {
|
665
925
|
this.superClassName = superClassName;
|
666
926
|
return this;
|
667
927
|
};
|
668
928
|
|
669
|
-
|
929
|
+
ComponentDefinition.prototype.extend = function(superClassName) {
|
670
930
|
this.superClassName = superClassName;
|
671
931
|
return this;
|
672
932
|
};
|
673
933
|
|
674
|
-
|
934
|
+
ComponentDefinition.prototype.triggers = function() {
|
675
935
|
var hook, hooks, _i, _len;
|
676
936
|
hooks = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
677
937
|
_.defaults(this.properties || (this.properties = {}), {
|
@@ -682,10 +942,11 @@
|
|
682
942
|
this.properties.hooks.push(hook);
|
683
943
|
}
|
684
944
|
this.properties.hooks = _.uniq(this.properties.hooks);
|
945
|
+
this.meta("hooks", this.properties.hooks);
|
685
946
|
return this;
|
686
947
|
};
|
687
948
|
|
688
|
-
|
949
|
+
ComponentDefinition.prototype.includes = function() {
|
689
950
|
var include, includes, _i, _len;
|
690
951
|
includes = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
691
952
|
_.defaults(this.properties || (this.properties = {}), {
|
@@ -696,25 +957,96 @@
|
|
696
957
|
this.properties.include.push(include);
|
697
958
|
}
|
698
959
|
this.properties.include = _.uniq(this.properties.include);
|
960
|
+
this.meta("includes", this.properties.include);
|
699
961
|
return this;
|
700
962
|
};
|
701
963
|
|
702
|
-
|
703
|
-
var
|
704
|
-
|
964
|
+
ComponentDefinition.prototype.mixesIn = function() {
|
965
|
+
var concern, concerns, _i, _len;
|
966
|
+
concerns = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
705
967
|
_.defaults(this.properties || (this.properties = {}), {
|
706
|
-
|
968
|
+
concerns: []
|
707
969
|
});
|
708
|
-
for (_i = 0, _len =
|
709
|
-
|
710
|
-
this.properties.
|
970
|
+
for (_i = 0, _len = concerns.length; _i < _len; _i++) {
|
971
|
+
concern = concerns[_i];
|
972
|
+
this.properties.concerns.push(concern);
|
711
973
|
}
|
712
|
-
this.properties.
|
974
|
+
this.properties.concerns = _.uniq(this.properties.concerns);
|
975
|
+
this.meta("concerns", this.properties.concerns);
|
976
|
+
return this;
|
977
|
+
};
|
978
|
+
|
979
|
+
ComponentDefinition.prototype.contains = function() {
|
980
|
+
var components;
|
981
|
+
components = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
982
|
+
_.defaults(this.properties, {
|
983
|
+
components: []
|
984
|
+
});
|
985
|
+
this.properties.components = components;
|
986
|
+
return this;
|
987
|
+
};
|
988
|
+
|
989
|
+
ComponentDefinition.prototype.validatesConfigurationWith = function(validationConfiguration) {
|
990
|
+
if (validationConfiguration == null) validationConfiguration = {};
|
991
|
+
this.meta("configuration validations", validationConfiguration);
|
992
|
+
this.properties.validatable = true;
|
993
|
+
return this;
|
994
|
+
};
|
995
|
+
|
996
|
+
ComponentDefinition.prototype.beforeDefinition = function(callback) {
|
997
|
+
this._classProperties.beforeDefinition = callback;
|
713
998
|
return this;
|
714
999
|
};
|
715
1000
|
|
716
|
-
|
717
|
-
|
1001
|
+
ComponentDefinition.prototype.afterDefinition = function(callback) {
|
1002
|
+
this._classProperties.afterDefinition = callback;
|
1003
|
+
return this;
|
1004
|
+
};
|
1005
|
+
|
1006
|
+
ComponentDefinition.prototype.classConfiguration = function(properties) {
|
1007
|
+
if (properties == null) properties = {};
|
1008
|
+
this.meta("class configuration", _.keys(properties));
|
1009
|
+
_.defaults((this._classProperties || (this._classProperties = {})), properties);
|
1010
|
+
return this;
|
1011
|
+
};
|
1012
|
+
|
1013
|
+
ComponentDefinition.prototype.publicConfiguration = function(properties) {
|
1014
|
+
if (properties == null) properties = {};
|
1015
|
+
this.meta("public configuration", _.keys(properties));
|
1016
|
+
_.defaults((this.properties || (this.properties = {})), properties);
|
1017
|
+
return this;
|
1018
|
+
};
|
1019
|
+
|
1020
|
+
ComponentDefinition.prototype.privateConfiguration = function(properties) {
|
1021
|
+
if (properties == null) properties = {};
|
1022
|
+
this.meta("private configuration", _.keys(properties));
|
1023
|
+
_.defaults((this.properties || (this.properties = {})), properties);
|
1024
|
+
return this;
|
1025
|
+
};
|
1026
|
+
|
1027
|
+
ComponentDefinition.prototype.classInterface = function(properties) {
|
1028
|
+
if (properties == null) properties = {};
|
1029
|
+
this.meta("class interface", _.keys(properties));
|
1030
|
+
_.defaults((this._classProperties || (this._classProperties = {})), properties);
|
1031
|
+
return this;
|
1032
|
+
};
|
1033
|
+
|
1034
|
+
ComponentDefinition.prototype.publicInterface = function(properties) {
|
1035
|
+
if (properties == null) properties = {};
|
1036
|
+
this.meta("public interface", _.keys(properties));
|
1037
|
+
_.defaults((this.properties || (this.properties = {})), properties);
|
1038
|
+
return this;
|
1039
|
+
};
|
1040
|
+
|
1041
|
+
ComponentDefinition.prototype.privateInterface = function(properties) {
|
1042
|
+
if (properties == null) properties = {};
|
1043
|
+
this.meta("private interface", _.keys(properties));
|
1044
|
+
_.defaults((this.properties || (this.properties = {})), properties);
|
1045
|
+
return this;
|
1046
|
+
};
|
1047
|
+
|
1048
|
+
ComponentDefinition.prototype.definePrototype = function(properties) {
|
1049
|
+
var at, componentType, definition, _base, _ref, _ref2;
|
718
1050
|
if (properties == null) properties = {};
|
719
1051
|
_.defaults((this.properties || (this.properties = {})), properties);
|
720
1052
|
at = this.namespaced ? Luca.util.resolve(this.namespace, window || global) : window || global;
|
@@ -722,35 +1054,93 @@
|
|
722
1054
|
eval("(window||global)." + this.namespace + " = {}");
|
723
1055
|
at = Luca.util.resolve(this.namespace, window || global);
|
724
1056
|
}
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
1057
|
+
this.meta("super class name", this.superClassName);
|
1058
|
+
this.meta("display name", this.componentName);
|
1059
|
+
this.properties.displayName = this.componentName;
|
1060
|
+
this.properties.componentMetaData = function() {
|
1061
|
+
return Luca.registry.getMetaDataFor(this.displayName);
|
1062
|
+
};
|
1063
|
+
if ((_ref = this._classProperties) != null) {
|
1064
|
+
if (typeof _ref.beforeDefinition === "function") {
|
1065
|
+
_ref.beforeDefinition(this);
|
1066
|
+
}
|
1067
|
+
}
|
1068
|
+
definition = at[this.componentId] = Luca.extend(this.superClassName, this.componentName, this.properties);
|
1069
|
+
if (this.autoRegister === true) {
|
1070
|
+
if (Luca.isViewPrototype(definition)) componentType = "view";
|
1071
|
+
if (Luca.isCollectionPrototype(definition)) {
|
729
1072
|
(_base = Luca.Collection).namespaces || (_base.namespaces = []);
|
730
1073
|
Luca.Collection.namespaces.push(this.namespace);
|
731
1074
|
componentType = "collection";
|
732
1075
|
}
|
733
|
-
if (Luca.isModelPrototype(
|
1076
|
+
if (Luca.isModelPrototype(definition)) componentType = "model";
|
734
1077
|
Luca.registerComponent(_.string.underscored(this.componentId), this.componentName, componentType);
|
735
1078
|
}
|
736
|
-
|
1079
|
+
this.defined = true;
|
1080
|
+
if (!_.isEmpty(this._classProperties)) {
|
1081
|
+
_.extend(definition, this._classProperties);
|
1082
|
+
}
|
1083
|
+
if (definition != null) {
|
1084
|
+
if ((_ref2 = definition.afterDefinition) != null) {
|
1085
|
+
_ref2.call(definition, this);
|
1086
|
+
}
|
1087
|
+
}
|
1088
|
+
return definition;
|
737
1089
|
};
|
738
1090
|
|
739
|
-
return
|
1091
|
+
return ComponentDefinition;
|
740
1092
|
|
741
1093
|
})();
|
742
1094
|
|
743
|
-
|
1095
|
+
cd = ComponentDefinition.prototype;
|
1096
|
+
|
1097
|
+
cd.concerns = cd.behavesAs = cd.uses = cd.mixesIn;
|
1098
|
+
|
1099
|
+
cd.register = cd.defines = cd.defaults = cd.exports = cd.defaultProperties = cd.definePrototype;
|
1100
|
+
|
1101
|
+
cd.defaultsTo = cd.enhance = cd["with"] = cd.definePrototype;
|
1102
|
+
|
1103
|
+
cd.publicMethods = cd.publicInterface;
|
1104
|
+
|
1105
|
+
cd.privateMethods = cd.privateInterface;
|
1106
|
+
|
1107
|
+
cd.classMethods = cd.classInterface;
|
1108
|
+
|
1109
|
+
_.extend((Luca.define = ComponentDefinition.create), {
|
1110
|
+
__definitions: [],
|
1111
|
+
incomplete: function() {
|
1112
|
+
return _(Luca.define.__definitions).select(function(definition) {
|
1113
|
+
return definition.isOpen();
|
1114
|
+
});
|
1115
|
+
},
|
1116
|
+
close: function() {
|
1117
|
+
var open, _i, _len, _ref;
|
1118
|
+
_ref = Luca.define.incomplete();
|
1119
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
1120
|
+
open = _ref[_i];
|
1121
|
+
if (open.isValid()) open.register();
|
1122
|
+
}
|
1123
|
+
return Luca.define.__definitions.length = 0;
|
1124
|
+
},
|
1125
|
+
findDefinition: function(componentName) {
|
1126
|
+
return _(Luca.define.__definitions).detect(function(definition) {
|
1127
|
+
return definition.componentName === componentName;
|
1128
|
+
});
|
1129
|
+
}
|
1130
|
+
});
|
744
1131
|
|
745
|
-
|
1132
|
+
Luca.register = function(componentName) {
|
1133
|
+
return new ComponentDefinition(componentName, true);
|
1134
|
+
};
|
746
1135
|
|
747
|
-
|
1136
|
+
_.mixin({
|
1137
|
+
def: Luca.define
|
1138
|
+
});
|
748
1139
|
|
749
1140
|
Luca.extend = function(superClassName, childName, properties) {
|
750
1141
|
var definition, include, superClass, _i, _len, _ref;
|
751
1142
|
if (properties == null) properties = {};
|
752
1143
|
superClass = Luca.util.resolve(superClassName, window || global);
|
753
|
-
superClass.__initializers || (superClass.__initializers = []);
|
754
1144
|
if (!_.isFunction(superClass != null ? superClass.extend : void 0)) {
|
755
1145
|
throw "Error defining " + childName + ". " + superClassName + " is not a valid component to extend from";
|
756
1146
|
}
|
@@ -777,59 +1167,10 @@
|
|
777
1167
|
return definition;
|
778
1168
|
};
|
779
1169
|
|
780
|
-
Luca.mixin = function(mixinName) {
|
781
|
-
var namespace, resolved;
|
782
|
-
namespace = _(Luca.mixin.namespaces).detect(function(space) {
|
783
|
-
var _ref;
|
784
|
-
return ((_ref = Luca.util.resolve(space)) != null ? _ref[mixinName] : void 0) != null;
|
785
|
-
});
|
786
|
-
namespace || (namespace = "Luca.modules");
|
787
|
-
resolved = Luca.util.resolve(namespace)[mixinName];
|
788
|
-
if (resolved == null) {
|
789
|
-
console.log("Could not find " + mixinName + " in ", Luca.mixin.namespaces);
|
790
|
-
}
|
791
|
-
return resolved;
|
792
|
-
};
|
793
|
-
|
794
|
-
Luca.mixin.namespaces = ["Luca.modules"];
|
795
|
-
|
796
|
-
Luca.mixin.namespace = function(namespace) {
|
797
|
-
Luca.mixin.namespaces.push(namespace);
|
798
|
-
return Luca.mixin.namespaces = _(Luca.mixin.namespaces).uniq();
|
799
|
-
};
|
800
|
-
|
801
|
-
Luca.decorate = function(componentPrototype) {
|
802
|
-
if (_.isString(componentPrototype)) {
|
803
|
-
componentPrototype = Luca.util.resolve(componentPrototype).prototype;
|
804
|
-
}
|
805
|
-
return {
|
806
|
-
"with": function(mixin) {
|
807
|
-
var mixinDefinition, mixinPrivates, sanitized, superclassMixins, _ref;
|
808
|
-
mixinDefinition = Luca.mixin(mixin);
|
809
|
-
mixinPrivates = _(mixinDefinition).chain().keys().select(function(key) {
|
810
|
-
return ("" + key).match(/^__/);
|
811
|
-
});
|
812
|
-
sanitized = _(mixinDefinition).omit(mixinPrivates.value());
|
813
|
-
_.extend(componentPrototype, sanitized);
|
814
|
-
if (mixinDefinition != null) {
|
815
|
-
if ((_ref = mixinDefinition.__included) != null) {
|
816
|
-
_ref.call(mixinDefinition, mixin);
|
817
|
-
}
|
818
|
-
}
|
819
|
-
superclassMixins = componentPrototype._superClass().prototype.mixins;
|
820
|
-
componentPrototype.mixins || (componentPrototype.mixins = []);
|
821
|
-
componentPrototype.mixins.push(mixin);
|
822
|
-
componentPrototype.mixins = componentPrototype.mixins.concat(superclassMixins);
|
823
|
-
componentPrototype.mixins = _(componentPrototype.mixins).chain().uniq().compact().value();
|
824
|
-
return componentPrototype;
|
825
|
-
}
|
826
|
-
};
|
827
|
-
};
|
828
|
-
|
829
1170
|
}).call(this);
|
830
1171
|
(function() {
|
831
1172
|
|
832
|
-
Luca.
|
1173
|
+
Luca.concerns.ApplicationEventBindings = {
|
833
1174
|
__initializer: function() {
|
834
1175
|
var app, eventTrigger, handler, _len, _ref, _ref2, _results;
|
835
1176
|
if (_.isEmpty(this.applicationEvents)) return;
|
@@ -857,7 +1198,7 @@
|
|
857
1198
|
}).call(this);
|
858
1199
|
(function() {
|
859
1200
|
|
860
|
-
Luca.
|
1201
|
+
Luca.concerns.CollectionEventBindings = {
|
861
1202
|
__initializer: function() {
|
862
1203
|
var collection, eventTrigger, handler, key, manager, signature, _ref, _ref2, _results;
|
863
1204
|
if (_.isEmpty(this.collectionEvents)) return;
|
@@ -885,7 +1226,7 @@
|
|
885
1226
|
}).call(this);
|
886
1227
|
(function() {
|
887
1228
|
|
888
|
-
Luca.
|
1229
|
+
Luca.concerns.Deferrable = {
|
889
1230
|
configure_collection: function(setAsDeferrable) {
|
890
1231
|
var collectionManager, _ref, _ref2;
|
891
1232
|
if (setAsDeferrable == null) setAsDeferrable = true;
|
@@ -906,9 +1247,9 @@
|
|
906
1247
|
}).call(this);
|
907
1248
|
(function() {
|
908
1249
|
|
909
|
-
Luca.
|
1250
|
+
Luca.concerns.DomHelpers = {
|
910
1251
|
__initializer: function() {
|
911
|
-
var additional, additionalClasses, _i, _len, _results;
|
1252
|
+
var additional, additionalClasses, classes, cssClass, _i, _j, _len, _len2, _ref, _results;
|
912
1253
|
additionalClasses = _(this.additionalClassNames || []).clone();
|
913
1254
|
if (this.wrapperClass != null) this.$wrap(this.wrapperClass);
|
914
1255
|
if (_.isString(additionalClasses)) {
|
@@ -919,21 +1260,34 @@
|
|
919
1260
|
if (this.gridRowFluid) additionalClasses.push("row-fluid");
|
920
1261
|
if (this.gridRow) additionalClasses.push("row");
|
921
1262
|
if (additionalClasses == null) return;
|
922
|
-
_results = [];
|
923
1263
|
for (_i = 0, _len = additionalClasses.length; _i < _len; _i++) {
|
924
1264
|
additional = additionalClasses[_i];
|
925
|
-
|
1265
|
+
this.$el.addClass(additional);
|
1266
|
+
}
|
1267
|
+
if (Luca.config.autoApplyClassHierarchyAsCssClasses === true) {
|
1268
|
+
classes = (typeof this.componentMetaData === "function" ? (_ref = this.componentMetaData()) != null ? _ref.styleHierarchy() : void 0 : void 0) || [];
|
1269
|
+
_results = [];
|
1270
|
+
for (_j = 0, _len2 = classes.length; _j < _len2; _j++) {
|
1271
|
+
cssClass = classes[_j];
|
1272
|
+
if (cssClass !== "luca-view" && cssClass !== "backbone-view") {
|
1273
|
+
_results.push(this.$el.addClass(cssClass));
|
1274
|
+
}
|
1275
|
+
}
|
1276
|
+
return _results;
|
926
1277
|
}
|
927
|
-
return _results;
|
928
1278
|
},
|
929
1279
|
$wrap: function(wrapper) {
|
930
1280
|
if (_.isString(wrapper) && !wrapper.match(/[<>]/)) {
|
931
1281
|
wrapper = this.make("div", {
|
932
|
-
"class": wrapper
|
1282
|
+
"class": wrapper,
|
1283
|
+
"data-wrapper": true
|
933
1284
|
});
|
934
1285
|
}
|
935
1286
|
return this.$el.wrap(wrapper);
|
936
1287
|
},
|
1288
|
+
$wrapper: function() {
|
1289
|
+
return this.$el.parent('[data-wrapper="true"]');
|
1290
|
+
},
|
937
1291
|
$template: function(template, variables) {
|
938
1292
|
if (variables == null) variables = {};
|
939
1293
|
return this.$el.html(Luca.template(template, variables));
|
@@ -958,7 +1312,7 @@
|
|
958
1312
|
}).call(this);
|
959
1313
|
(function() {
|
960
1314
|
|
961
|
-
Luca.
|
1315
|
+
Luca.concerns.EnhancedProperties = {
|
962
1316
|
__initializer: function() {
|
963
1317
|
if (Luca.config.enhancedViewProperties !== true) return;
|
964
1318
|
if (_.isString(this.collection) && Luca.CollectionManager.get()) {
|
@@ -977,7 +1331,7 @@
|
|
977
1331
|
__hasProp = Object.prototype.hasOwnProperty,
|
978
1332
|
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
|
979
1333
|
|
980
|
-
Luca.
|
1334
|
+
Luca.concerns.Filterable = {
|
981
1335
|
__included: function(component, module) {
|
982
1336
|
return _.extend(Luca.Collection.prototype, {
|
983
1337
|
__filters: {}
|
@@ -1003,22 +1357,25 @@
|
|
1003
1357
|
this.optionsSources || (this.optionsSources = []);
|
1004
1358
|
this.query || (this.query = {});
|
1005
1359
|
this.queryOptions || (this.queryOptions = {});
|
1006
|
-
this.querySources.push((function() {
|
1007
|
-
|
1360
|
+
this.querySources.push((function(options) {
|
1361
|
+
if (options == null) options = {};
|
1362
|
+
return _this.getFilterState().toQuery();
|
1008
1363
|
}));
|
1009
|
-
this.optionsSources.push((function() {
|
1010
|
-
|
1364
|
+
this.optionsSources.push((function(options) {
|
1365
|
+
if (options == null) options = {};
|
1366
|
+
return _this.getFilterState().toOptions();
|
1011
1367
|
}));
|
1012
|
-
if (this.debugMode === true) {
|
1013
|
-
console.log("Filterable");
|
1014
|
-
console.log(this.querySources);
|
1015
|
-
console.log(this.optionsSources);
|
1016
|
-
}
|
1017
1368
|
filter.on("change", function() {
|
1018
|
-
var
|
1369
|
+
var options;
|
1370
|
+
filter = _.clone(_this.getQuery());
|
1371
|
+
options = _.clone(_this.getQueryOptions());
|
1372
|
+
if (options.limit != null) filter.limit = options.limit;
|
1373
|
+
if (options.page != null) filter.page = options.page;
|
1374
|
+
if (options.sortBy != null) filter.sortBy = options.sortBy;
|
1019
1375
|
if (_this.isRemote()) {
|
1020
|
-
|
1021
|
-
|
1376
|
+
return _this.collection.applyFilter(filter, {
|
1377
|
+
remote: true
|
1378
|
+
});
|
1022
1379
|
} else {
|
1023
1380
|
return _this.trigger("refresh");
|
1024
1381
|
}
|
@@ -1100,7 +1457,7 @@
|
|
1100
1457
|
}).call(this);
|
1101
1458
|
(function() {
|
1102
1459
|
|
1103
|
-
Luca.
|
1460
|
+
Luca.concerns.GridLayout = {
|
1104
1461
|
_initializer: function() {
|
1105
1462
|
if (this.gridSpan) this.$el.addClass("span" + this.gridSpan);
|
1106
1463
|
if (this.gridOffset) this.$el.addClass("offset" + this.gridOffset);
|
@@ -1112,7 +1469,7 @@
|
|
1112
1469
|
}).call(this);
|
1113
1470
|
(function() {
|
1114
1471
|
|
1115
|
-
Luca.
|
1472
|
+
Luca.concerns.LoadMaskable = {
|
1116
1473
|
__initializer: function() {
|
1117
1474
|
var _this = this;
|
1118
1475
|
if (this.loadMask !== true) return;
|
@@ -1259,7 +1616,7 @@
|
|
1259
1616
|
(function() {
|
1260
1617
|
var applyModalConfig;
|
1261
1618
|
|
1262
|
-
Luca.
|
1619
|
+
Luca.concerns.ModalView = {
|
1263
1620
|
closeOnEscape: true,
|
1264
1621
|
showOnInitialize: false,
|
1265
1622
|
backdrop: false,
|
@@ -1297,7 +1654,38 @@
|
|
1297
1654
|
}).call(this);
|
1298
1655
|
(function() {
|
1299
1656
|
|
1300
|
-
Luca.
|
1657
|
+
Luca.concerns.ModelPresenter = {
|
1658
|
+
classMethods: {
|
1659
|
+
getPresenter: function(format) {
|
1660
|
+
var _ref;
|
1661
|
+
return (_ref = this.presenters) != null ? _ref[format] : void 0;
|
1662
|
+
},
|
1663
|
+
registerPresenter: function(format, config) {
|
1664
|
+
this.presenters || (this.presenters = {});
|
1665
|
+
return this.presenters[format] = config;
|
1666
|
+
}
|
1667
|
+
},
|
1668
|
+
presentAs: function(format) {
|
1669
|
+
var attributeList,
|
1670
|
+
_this = this;
|
1671
|
+
try {
|
1672
|
+
attributeList = this.componentMetaData().componentDefinition().getPresenter(format);
|
1673
|
+
if (attributeList == null) return this.toJSON();
|
1674
|
+
return _(attributeList).reduce(function(memo, attribute) {
|
1675
|
+
memo[attribute] = _this.read(attribute);
|
1676
|
+
return memo;
|
1677
|
+
}, {});
|
1678
|
+
} catch (e) {
|
1679
|
+
console.log("Error presentAs", e.stack, e.message);
|
1680
|
+
return this.toJSON();
|
1681
|
+
}
|
1682
|
+
}
|
1683
|
+
};
|
1684
|
+
|
1685
|
+
}).call(this);
|
1686
|
+
(function() {
|
1687
|
+
|
1688
|
+
Luca.concerns.Paginatable = {
|
1301
1689
|
paginatorViewClass: 'Luca.components.PaginationControl',
|
1302
1690
|
paginationSelector: ".toolbar.bottom",
|
1303
1691
|
__included: function() {
|
@@ -1333,9 +1721,13 @@
|
|
1333
1721
|
});
|
1334
1722
|
});
|
1335
1723
|
paginationState.on("change:page", function(state) {
|
1336
|
-
var filter;
|
1724
|
+
var filter, options;
|
1725
|
+
filter = _.clone(_this.getQuery());
|
1726
|
+
options = _.clone(_this.getQueryOptions());
|
1727
|
+
if (options.limit != null) filter.limit = options.limit;
|
1728
|
+
if (options.page != null) filter.page = options.page;
|
1729
|
+
if (options.sortBy != null) filter.sortBy = options.sortBy;
|
1337
1730
|
if (_this.isRemote()) {
|
1338
|
-
filter = _.extend(_this.toQuery(), _this.toQueryOptions());
|
1339
1731
|
return _this.collection.applyFilter(filter, {
|
1340
1732
|
remote: true
|
1341
1733
|
});
|
@@ -1403,7 +1795,62 @@
|
|
1403
1795
|
}).call(this);
|
1404
1796
|
(function() {
|
1405
1797
|
|
1406
|
-
Luca.
|
1798
|
+
Luca.concerns.QueryCollectionBindings = {
|
1799
|
+
getCollection: function() {
|
1800
|
+
return this.collection;
|
1801
|
+
},
|
1802
|
+
loadModels: function(models, options) {
|
1803
|
+
var _ref;
|
1804
|
+
if (models == null) models = [];
|
1805
|
+
if (options == null) options = {};
|
1806
|
+
return (_ref = this.getCollection()) != null ? _ref.reset(models, options) : void 0;
|
1807
|
+
},
|
1808
|
+
applyQuery: function(query, queryOptions) {
|
1809
|
+
if (query == null) query = {};
|
1810
|
+
if (queryOptions == null) queryOptions = {};
|
1811
|
+
this.query = query;
|
1812
|
+
this.queryOptions = queryOptions;
|
1813
|
+
this.refresh();
|
1814
|
+
return this;
|
1815
|
+
},
|
1816
|
+
getQuery: function(options) {
|
1817
|
+
var query, querySource, _i, _len, _ref;
|
1818
|
+
if (options == null) options = {};
|
1819
|
+
query = this.query || (this.query = {});
|
1820
|
+
_ref = _(this.querySources || []).compact();
|
1821
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
1822
|
+
querySource = _ref[_i];
|
1823
|
+
query = _.extend(query, querySource(options) || {});
|
1824
|
+
}
|
1825
|
+
return query;
|
1826
|
+
},
|
1827
|
+
getQueryOptions: function(options) {
|
1828
|
+
var optionSource, _i, _len, _ref;
|
1829
|
+
if (options == null) options = {};
|
1830
|
+
options = this.queryOptions || (this.queryOptions = {});
|
1831
|
+
_ref = _(this.optionsSources || []).compact();
|
1832
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
1833
|
+
optionSource = _ref[_i];
|
1834
|
+
options = _.extend(options, optionSource(options) || {});
|
1835
|
+
}
|
1836
|
+
return options;
|
1837
|
+
},
|
1838
|
+
getModels: function(query, options) {
|
1839
|
+
var _ref;
|
1840
|
+
if ((_ref = this.collection) != null ? _ref.query : void 0) {
|
1841
|
+
query || (query = this.getQuery());
|
1842
|
+
options || (options = this.getQueryOptions());
|
1843
|
+
return this.collection.query(query, options);
|
1844
|
+
} else {
|
1845
|
+
return this.collection.models;
|
1846
|
+
}
|
1847
|
+
}
|
1848
|
+
};
|
1849
|
+
|
1850
|
+
}).call(this);
|
1851
|
+
(function() {
|
1852
|
+
|
1853
|
+
Luca.concerns.StateModel = {
|
1407
1854
|
__initializer: function() {
|
1408
1855
|
var _this = this;
|
1409
1856
|
if (this.stateful !== true) return;
|
@@ -1433,7 +1880,7 @@
|
|
1433
1880
|
}).call(this);
|
1434
1881
|
(function() {
|
1435
1882
|
|
1436
|
-
Luca.
|
1883
|
+
Luca.concerns.Templating = {
|
1437
1884
|
__initializer: function() {
|
1438
1885
|
var template, templateContent, templateVars;
|
1439
1886
|
templateVars = Luca.util.read.call(this, this.bodyTemplateVars) || {};
|
@@ -1568,6 +2015,10 @@
|
|
1568
2015
|
});
|
1569
2016
|
};
|
1570
2017
|
|
2018
|
+
Luca.registry.find = function(search) {
|
2019
|
+
return Luca.util.resolve(search) || Luca.define.findDefinition(search);
|
2020
|
+
};
|
2021
|
+
|
1571
2022
|
Luca.cache = Luca.cacheInstance = function(cacheKey, object) {
|
1572
2023
|
var lookup_id;
|
1573
2024
|
if (cacheKey == null) return;
|
@@ -1584,6 +2035,137 @@
|
|
1584
2035
|
return componentCacheStore.cid_index[lookup_id];
|
1585
2036
|
};
|
1586
2037
|
|
2038
|
+
}).call(this);
|
2039
|
+
(function() {
|
2040
|
+
var MetaDataProxy;
|
2041
|
+
|
2042
|
+
Luca.registry.componentMetaData = {};
|
2043
|
+
|
2044
|
+
Luca.registry.getMetaDataFor = function(componentName) {
|
2045
|
+
return new MetaDataProxy(Luca.registry.componentMetaData[componentName]);
|
2046
|
+
};
|
2047
|
+
|
2048
|
+
Luca.registry.addMetaData = function(componentName, key, value) {
|
2049
|
+
var data, _base;
|
2050
|
+
data = (_base = Luca.registry.componentMetaData)[componentName] || (_base[componentName] = {});
|
2051
|
+
data[key] = _(value).clone();
|
2052
|
+
return data;
|
2053
|
+
};
|
2054
|
+
|
2055
|
+
MetaDataProxy = (function() {
|
2056
|
+
|
2057
|
+
function MetaDataProxy(meta) {
|
2058
|
+
this.meta = meta != null ? meta : {};
|
2059
|
+
_.defaults(this.meta, {
|
2060
|
+
"super class name": "",
|
2061
|
+
"display name": "",
|
2062
|
+
"public interface": [],
|
2063
|
+
"public configuration": [],
|
2064
|
+
"private interface": [],
|
2065
|
+
"private configuration": [],
|
2066
|
+
"class configuration": [],
|
2067
|
+
"class interface": []
|
2068
|
+
});
|
2069
|
+
}
|
2070
|
+
|
2071
|
+
MetaDataProxy.prototype.superClass = function() {
|
2072
|
+
return Luca.util.resolve(this.meta["super class name"]);
|
2073
|
+
};
|
2074
|
+
|
2075
|
+
MetaDataProxy.prototype.componentDefinition = function() {
|
2076
|
+
return Luca.registry.find(this.meta["display name"]);
|
2077
|
+
};
|
2078
|
+
|
2079
|
+
MetaDataProxy.prototype.componentPrototype = function() {
|
2080
|
+
var _ref;
|
2081
|
+
return (_ref = this.componentDefinition()) != null ? _ref.prototype : void 0;
|
2082
|
+
};
|
2083
|
+
|
2084
|
+
MetaDataProxy.prototype.prototypeFunctions = function() {
|
2085
|
+
return _.functions(this.componentPrototype());
|
2086
|
+
};
|
2087
|
+
|
2088
|
+
MetaDataProxy.prototype.classAttributes = function() {
|
2089
|
+
return _.uniq(this.classInterface().concat(this.classConfiguration()));
|
2090
|
+
};
|
2091
|
+
|
2092
|
+
MetaDataProxy.prototype.publicAttributes = function() {
|
2093
|
+
return _.uniq(this.publicInterface().concat(this.publicConfiguration()));
|
2094
|
+
};
|
2095
|
+
|
2096
|
+
MetaDataProxy.prototype.privateAttributes = function() {
|
2097
|
+
return _.uniq(this.privateInterface().concat(this.privateConfiguration()));
|
2098
|
+
};
|
2099
|
+
|
2100
|
+
MetaDataProxy.prototype.classMethods = function() {
|
2101
|
+
var list;
|
2102
|
+
list = _.functions(this.componentDefinition());
|
2103
|
+
return _(list).intersection(this.classAttributes());
|
2104
|
+
};
|
2105
|
+
|
2106
|
+
MetaDataProxy.prototype.publicMethods = function() {
|
2107
|
+
return _(this.prototypeFunctions()).intersection(this.publicAttributes());
|
2108
|
+
};
|
2109
|
+
|
2110
|
+
MetaDataProxy.prototype.privateMethods = function() {
|
2111
|
+
return _(this.prototypeFunctions()).intersection(this.privateAttributes());
|
2112
|
+
};
|
2113
|
+
|
2114
|
+
MetaDataProxy.prototype.classConfiguration = function() {
|
2115
|
+
return this.meta["class configuration"];
|
2116
|
+
};
|
2117
|
+
|
2118
|
+
MetaDataProxy.prototype.publicConfiguration = function() {
|
2119
|
+
return this.meta["public configuration"];
|
2120
|
+
};
|
2121
|
+
|
2122
|
+
MetaDataProxy.prototype.privateConfiguration = function() {
|
2123
|
+
return this.meta["private configuration"];
|
2124
|
+
};
|
2125
|
+
|
2126
|
+
MetaDataProxy.prototype.classInterface = function() {
|
2127
|
+
return this.meta["class interface"];
|
2128
|
+
};
|
2129
|
+
|
2130
|
+
MetaDataProxy.prototype.publicInterface = function() {
|
2131
|
+
return this.meta["public interface"];
|
2132
|
+
};
|
2133
|
+
|
2134
|
+
MetaDataProxy.prototype.privateInterface = function() {
|
2135
|
+
return this.meta["private interface"];
|
2136
|
+
};
|
2137
|
+
|
2138
|
+
MetaDataProxy.prototype.triggers = function() {
|
2139
|
+
return this.meta["hooks"];
|
2140
|
+
};
|
2141
|
+
|
2142
|
+
MetaDataProxy.prototype.hooks = function() {
|
2143
|
+
return this.meta["hooks"];
|
2144
|
+
};
|
2145
|
+
|
2146
|
+
MetaDataProxy.prototype.styleHierarchy = function() {
|
2147
|
+
var list;
|
2148
|
+
list = _(this.classHierarchy()).map(function(cls) {
|
2149
|
+
return Luca.util.toCssClass(cls, 'views', 'components', 'core', 'fields', 'containers');
|
2150
|
+
});
|
2151
|
+
return _(list).without('backbone-view', 'luca-view');
|
2152
|
+
};
|
2153
|
+
|
2154
|
+
MetaDataProxy.prototype.classHierarchy = function() {
|
2155
|
+
var list, proxy, _ref, _ref2, _ref3, _ref4;
|
2156
|
+
list = [this.meta["display name"], this.meta["super class name"]];
|
2157
|
+
proxy = (_ref = this.superClass()) != null ? (_ref2 = _ref.prototype) != null ? typeof _ref2.componentMetaData === "function" ? _ref2.componentMetaData() : void 0 : void 0 : void 0;
|
2158
|
+
while (!!proxy) {
|
2159
|
+
list = list.concat(proxy != null ? proxy.classHierarchy() : void 0);
|
2160
|
+
proxy = (_ref3 = proxy.superClass()) != null ? (_ref4 = _ref3.prototype) != null ? typeof _ref4.componentMetaData === "function" ? _ref4.componentMetaData() : void 0 : void 0 : void 0;
|
2161
|
+
}
|
2162
|
+
return _(list).uniq();
|
2163
|
+
};
|
2164
|
+
|
2165
|
+
return MetaDataProxy;
|
2166
|
+
|
2167
|
+
})();
|
2168
|
+
|
1587
2169
|
}).call(this);
|
1588
2170
|
(function() {
|
1589
2171
|
var __slice = Array.prototype.slice;
|
@@ -1634,7 +2216,7 @@
|
|
1634
2216
|
|
1635
2217
|
view["extends"]("Backbone.View");
|
1636
2218
|
|
1637
|
-
view.includes("Luca.Events", "Luca.
|
2219
|
+
view.includes("Luca.Events", "Luca.concerns.DomHelpers");
|
1638
2220
|
|
1639
2221
|
view.mixesIn("DomHelpers", "Templating", "EnhancedProperties", "CollectionEventBindings", "ApplicationEventBindings", "StateModel");
|
1640
2222
|
|
@@ -1652,38 +2234,11 @@
|
|
1652
2234
|
this.$el.attr("data-luca-id", this.name || this.cid);
|
1653
2235
|
Luca.cacheInstance(this.cid, this);
|
1654
2236
|
this.setupHooks(_(Luca.View.prototype.hooks.concat(this.hooks)).uniq());
|
1655
|
-
|
2237
|
+
Luca.concern.setup.call(this);
|
1656
2238
|
this.delegateEvents();
|
1657
2239
|
return this.trigger("after:initialize", this);
|
1658
2240
|
},
|
1659
|
-
|
1660
|
-
var module, _i, _len, _ref, _ref2, _ref3, _ref4, _results;
|
1661
|
-
if (((_ref = this.mixins) != null ? _ref.length : void 0) > 0) {
|
1662
|
-
_ref2 = this.mixins;
|
1663
|
-
_results = [];
|
1664
|
-
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
1665
|
-
module = _ref2[_i];
|
1666
|
-
_results.push((_ref3 = Luca.mixin(module)) != null ? (_ref4 = _ref3.__initializer) != null ? _ref4.call(this, this, module) : void 0 : void 0);
|
1667
|
-
}
|
1668
|
-
return _results;
|
1669
|
-
}
|
1670
|
-
},
|
1671
|
-
setupHooks: function(set) {
|
1672
|
-
var _this = this;
|
1673
|
-
set || (set = this.hooks);
|
1674
|
-
return _(set).each(function(eventId) {
|
1675
|
-
var callback, fn;
|
1676
|
-
fn = Luca.util.hook(eventId);
|
1677
|
-
callback = function() {
|
1678
|
-
var _ref;
|
1679
|
-
return (_ref = this[fn]) != null ? _ref.apply(this, arguments) : void 0;
|
1680
|
-
};
|
1681
|
-
if (eventId != null ? eventId.match(/once:/) : void 0) {
|
1682
|
-
callback = _.once(callback);
|
1683
|
-
}
|
1684
|
-
return _this.on(eventId, callback, _this);
|
1685
|
-
});
|
1686
|
-
},
|
2241
|
+
setupHooks: Luca.util.setupHooks,
|
1687
2242
|
registerEvent: function(selector, handler) {
|
1688
2243
|
this.events || (this.events = {});
|
1689
2244
|
this.events[selector] = handler;
|
@@ -1791,21 +2346,26 @@
|
|
1791
2346
|
return _results;
|
1792
2347
|
};
|
1793
2348
|
|
2349
|
+
Luca.View.deferrableEvent = "reset";
|
2350
|
+
|
1794
2351
|
Luca.View.extend = function(definition) {
|
1795
|
-
var module, _i, _len, _ref;
|
2352
|
+
var componentClass, module, _i, _len, _ref;
|
2353
|
+
if (definition == null) definition = {};
|
1796
2354
|
definition = Luca.View.renderWrapper(definition);
|
1797
|
-
if (
|
1798
|
-
|
2355
|
+
if (definition.concerns != null) {
|
2356
|
+
definition.concerns || (definition.concerns = definition.concerns);
|
2357
|
+
}
|
2358
|
+
componentClass = Luca.View._originalExtend.call(this, definition);
|
2359
|
+
if ((definition.concerns != null) && _.isArray(definition.concerns)) {
|
2360
|
+
_ref = definition.concerns;
|
1799
2361
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
1800
2362
|
module = _ref[_i];
|
1801
|
-
Luca.decorate(
|
2363
|
+
Luca.decorate(componentClass)["with"](module);
|
1802
2364
|
}
|
1803
2365
|
}
|
1804
|
-
return
|
2366
|
+
return componentClass;
|
1805
2367
|
};
|
1806
2368
|
|
1807
|
-
Luca.View.deferrableEvent = "reset";
|
1808
|
-
|
1809
2369
|
}).call(this);
|
1810
2370
|
(function() {
|
1811
2371
|
var model, setupComputedProperties;
|
@@ -1819,13 +2379,14 @@
|
|
1819
2379
|
model.defines({
|
1820
2380
|
initialize: function() {
|
1821
2381
|
Backbone.Model.prototype.initialize(this, arguments);
|
1822
|
-
|
2382
|
+
setupComputedProperties.call(this);
|
2383
|
+
return Luca.concern.setup.call(this);
|
1823
2384
|
},
|
1824
2385
|
read: function(attr) {
|
1825
2386
|
if (_.isFunction(this[attr])) {
|
1826
2387
|
return this[attr].call(this);
|
1827
2388
|
} else {
|
1828
|
-
return this.get(attr);
|
2389
|
+
return this.get(attr) || this[attr];
|
1829
2390
|
}
|
1830
2391
|
},
|
1831
2392
|
get: function(attr) {
|
@@ -1861,20 +2422,37 @@
|
|
1861
2422
|
return _results;
|
1862
2423
|
};
|
1863
2424
|
|
2425
|
+
Luca.Model._originalExtend = Backbone.Model.extend;
|
2426
|
+
|
2427
|
+
Luca.Model.extend = function(definition) {
|
2428
|
+
var componentClass, module, _i, _len, _ref;
|
2429
|
+
if (definition == null) definition = {};
|
2430
|
+
if (definition.concerns != null) {
|
2431
|
+
definition.concerns || (definition.concerns = definition.concerns);
|
2432
|
+
}
|
2433
|
+
componentClass = Luca.Model._originalExtend.call(this, definition);
|
2434
|
+
if ((definition.concerns != null) && _.isArray(definition.concerns)) {
|
2435
|
+
_ref = definition.concerns;
|
2436
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
2437
|
+
module = _ref[_i];
|
2438
|
+
Luca.decorate(componentClass)["with"](module);
|
2439
|
+
}
|
2440
|
+
}
|
2441
|
+
return componentClass;
|
2442
|
+
};
|
2443
|
+
|
1864
2444
|
}).call(this);
|
1865
2445
|
(function() {
|
1866
2446
|
var collection;
|
1867
2447
|
|
1868
2448
|
collection = Luca.define('Luca.Collection');
|
1869
2449
|
|
1870
|
-
|
1871
|
-
collection["extends"]('Backbone.QueryCollection');
|
1872
|
-
} else {
|
1873
|
-
collection["extends"]('Backbone.Collection');
|
1874
|
-
}
|
2450
|
+
collection["extends"]('Backbone.QueryCollection');
|
1875
2451
|
|
1876
2452
|
collection.includes('Luca.Events');
|
1877
2453
|
|
2454
|
+
collection.triggers("after:initialize", "before:fetch", "after:response");
|
2455
|
+
|
1878
2456
|
collection.defines({
|
1879
2457
|
model: Luca.Model,
|
1880
2458
|
cachedMethods: [],
|
@@ -1925,6 +2503,8 @@
|
|
1925
2503
|
parse: options != null ? options.parse : void 0
|
1926
2504
|
});
|
1927
2505
|
}
|
2506
|
+
Luca.concern.setup.call(this);
|
2507
|
+
Luca.util.setupHooks.call(this, this.hooks);
|
1928
2508
|
return this.trigger("after:initialize");
|
1929
2509
|
},
|
1930
2510
|
__wrapUrl: function() {
|
@@ -1968,13 +2548,15 @@
|
|
1968
2548
|
applyFilter: function(filter, options) {
|
1969
2549
|
if (filter == null) filter = {};
|
1970
2550
|
if (options == null) options = {};
|
2551
|
+
options = _(options).clone();
|
1971
2552
|
if ((options.remote != null) === true || this.remoteFilter === true) {
|
1972
2553
|
this.applyParams(filter);
|
1973
2554
|
return this.fetch(_.extend(options, {
|
1974
|
-
refresh: true
|
2555
|
+
refresh: true,
|
2556
|
+
remote: true
|
1975
2557
|
}));
|
1976
2558
|
} else {
|
1977
|
-
return this.reset(this.query(filter));
|
2559
|
+
return this.reset(this.query(filter, options));
|
1978
2560
|
}
|
1979
2561
|
},
|
1980
2562
|
applyParams: function(params) {
|
@@ -2020,7 +2602,9 @@
|
|
2020
2602
|
if (options == null) options = {};
|
2021
2603
|
this.trigger("before:fetch", this);
|
2022
2604
|
if (this.memoryCollection === true) return this.reset(this.data);
|
2023
|
-
if (this.cached_models().length && !options.refresh
|
2605
|
+
if (this.cached_models().length && !(options.refresh === true || options.remote === true)) {
|
2606
|
+
return this.bootstrap();
|
2607
|
+
}
|
2024
2608
|
url = _.isFunction(this.url) ? this.url() : this.url;
|
2025
2609
|
if (!((url && url.length > 1) || this.localStorage)) return true;
|
2026
2610
|
this.fetching = true;
|
@@ -2034,11 +2618,10 @@
|
|
2034
2618
|
onceLoaded: function(fn, options) {
|
2035
2619
|
var wrapped,
|
2036
2620
|
_this = this;
|
2037
|
-
if (options == null) {
|
2038
|
-
|
2039
|
-
|
2040
|
-
|
2041
|
-
}
|
2621
|
+
if (options == null) options = {};
|
2622
|
+
_.defaults(options, {
|
2623
|
+
autoFetch: true
|
2624
|
+
});
|
2042
2625
|
if (this.length > 0 && !this.fetching) {
|
2043
2626
|
fn.apply(this, [this]);
|
2044
2627
|
return;
|
@@ -2169,14 +2752,37 @@
|
|
2169
2752
|
}
|
2170
2753
|
});
|
2171
2754
|
|
2172
|
-
Luca.Collection.
|
2173
|
-
|
2174
|
-
|
2175
|
-
|
2755
|
+
Luca.Collection._originalExtend = Backbone.Collection.extend;
|
2756
|
+
|
2757
|
+
Luca.Collection.extend = function(definition) {
|
2758
|
+
var componentClass, module, _i, _len, _ref;
|
2759
|
+
if (definition == null) definition = {};
|
2760
|
+
if (definition.concerns != null) {
|
2761
|
+
definition.concerns || (definition.concerns = definition.concerns);
|
2176
2762
|
}
|
2177
|
-
|
2178
|
-
|
2763
|
+
componentClass = Luca.Collection._originalExtend.call(this, definition);
|
2764
|
+
if ((definition.concerns != null) && _.isArray(definition.concerns)) {
|
2765
|
+
_ref = definition.concerns;
|
2766
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
2767
|
+
module = _ref[_i];
|
2768
|
+
Luca.decorate(componentClass)["with"](module);
|
2769
|
+
}
|
2179
2770
|
}
|
2771
|
+
return componentClass;
|
2772
|
+
};
|
2773
|
+
|
2774
|
+
Luca.Collection.namespace = function(namespace) {
|
2775
|
+
var _base;
|
2776
|
+
if (_.isString(namespace)) namespace = Luca.util.resolve(namespace);
|
2777
|
+
if (namespace != null) Luca.Collection.__defaultNamespace = namespace;
|
2778
|
+
(_base = Luca.Collection).__defaultNamespace || (_base.__defaultNamespace = window || global);
|
2779
|
+
return Luca.util.read(Luca.Collection.__defaultNamespace);
|
2780
|
+
};
|
2781
|
+
|
2782
|
+
Luca.Collection.baseParams = function(obj) {
|
2783
|
+
if (_.isString(obj)) obj = Luca.util.resolve(obj);
|
2784
|
+
if (obj) Luca.Collection._baseParams = obj;
|
2785
|
+
return Luca.util.read(Luca.Collection._baseParams);
|
2180
2786
|
};
|
2181
2787
|
|
2182
2788
|
Luca.Collection._bootstrapped_models = {};
|
@@ -2317,40 +2923,21 @@
|
|
2317
2923
|
|
2318
2924
|
}).call(this);
|
2319
2925
|
(function() {
|
2926
|
+
var field;
|
2320
2927
|
|
2321
|
-
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2928
|
+
field = Luca.register("Luca.core.Field");
|
2929
|
+
|
2930
|
+
field["extends"]("Luca.View");
|
2931
|
+
|
2932
|
+
field.triggers("before:validation", "after:validation", "on:change");
|
2933
|
+
|
2934
|
+
field.publicConfiguration({
|
2325
2935
|
labelAlign: 'top',
|
2326
|
-
|
2327
|
-
statuses: ["warning", "error", "success"]
|
2328
|
-
|
2329
|
-
|
2330
|
-
|
2331
|
-
_.extend(this, this.options);
|
2332
|
-
this.input_id || (this.input_id = _.uniqueId('field'));
|
2333
|
-
this.input_name || (this.input_name = this.name);
|
2334
|
-
this.input_class || (this.input_class = "");
|
2335
|
-
this.input_type || (this.input_type = "");
|
2336
|
-
this.helperText || (this.helperText = "");
|
2337
|
-
if (this.required && !((_ref = this.label) != null ? _ref.match(/^\*/) : void 0)) {
|
2338
|
-
this.label || (this.label = "*" + this.label);
|
2339
|
-
}
|
2340
|
-
this.inputStyles || (this.inputStyles = "");
|
2341
|
-
this.input_value || (this.input_value = this.value || "");
|
2342
|
-
if (this.disabled) this.disable();
|
2343
|
-
this.updateState(this.state);
|
2344
|
-
this.placeHolder || (this.placeHolder = "");
|
2345
|
-
return Luca.View.prototype.initialize.apply(this, arguments);
|
2346
|
-
},
|
2347
|
-
beforeRender: function() {
|
2348
|
-
if (Luca.enableBootstrap) this.$el.addClass('control-group');
|
2349
|
-
if (this.required) return this.$el.addClass('required');
|
2350
|
-
},
|
2351
|
-
change_handler: function(e) {
|
2352
|
-
return this.trigger("on:change", this, e);
|
2353
|
-
},
|
2936
|
+
className: 'luca-ui-text-field luca-ui-field',
|
2937
|
+
statuses: ["warning", "error", "success"]
|
2938
|
+
});
|
2939
|
+
|
2940
|
+
field.publicInterface({
|
2354
2941
|
disable: function() {
|
2355
2942
|
return this.getInputElement().attr('disabled', true);
|
2356
2943
|
},
|
@@ -2376,9 +2963,6 @@
|
|
2376
2963
|
var _ref;
|
2377
2964
|
return (_ref = this.getInputElement()) != null ? _ref.attr('value', value) : void 0;
|
2378
2965
|
},
|
2379
|
-
getInputElement: function() {
|
2380
|
-
return this.input || (this.input = this.$('input').eq(0));
|
2381
|
-
},
|
2382
2966
|
updateState: function(state) {
|
2383
2967
|
var _this = this;
|
2384
2968
|
return _(this.statuses).each(function(cls) {
|
@@ -2388,6 +2972,44 @@
|
|
2388
2972
|
}
|
2389
2973
|
});
|
2390
2974
|
|
2975
|
+
field.privateConfiguration({
|
2976
|
+
isField: true,
|
2977
|
+
template: 'fields/text_field'
|
2978
|
+
});
|
2979
|
+
|
2980
|
+
field.defines({
|
2981
|
+
initialize: function(options) {
|
2982
|
+
var _ref;
|
2983
|
+
this.options = options != null ? options : {};
|
2984
|
+
_.extend(this, this.options);
|
2985
|
+
this.input_id || (this.input_id = _.uniqueId('field'));
|
2986
|
+
this.input_name || (this.input_name = this.name);
|
2987
|
+
this.input_class || (this.input_class = "");
|
2988
|
+
this.input_type || (this.input_type = "");
|
2989
|
+
this.helperText || (this.helperText = "");
|
2990
|
+
if (!(this.label != null) || this.label.length === 0) this.label = this.name;
|
2991
|
+
if (this.required && !((_ref = this.label) != null ? _ref.match(/^\*/) : void 0)) {
|
2992
|
+
this.label || (this.label = "*" + this.label);
|
2993
|
+
}
|
2994
|
+
this.inputStyles || (this.inputStyles = "");
|
2995
|
+
this.input_value || (this.input_value = this.value || "");
|
2996
|
+
if (this.disabled) this.disable();
|
2997
|
+
this.updateState(this.state);
|
2998
|
+
this.placeHolder || (this.placeHolder = "");
|
2999
|
+
return Luca.View.prototype.initialize.apply(this, arguments);
|
3000
|
+
},
|
3001
|
+
beforeRender: function() {
|
3002
|
+
if (Luca.config.enableBoostrap) this.$el.addClass('control-group');
|
3003
|
+
if (this.required) return this.$el.addClass('required');
|
3004
|
+
},
|
3005
|
+
change_handler: function(e) {
|
3006
|
+
return this.trigger("on:change", this, e);
|
3007
|
+
},
|
3008
|
+
getInputElement: function() {
|
3009
|
+
return this.input || (this.input = this.$('input').eq(0));
|
3010
|
+
}
|
3011
|
+
});
|
3012
|
+
|
2391
3013
|
}).call(this);
|
2392
3014
|
(function() {
|
2393
3015
|
var applyDOMConfig, container, createGetterMethods, createMethodsToGetComponentsByRole, doComponents, doLayout, indexComponent, validateContainerConfiguration;
|
@@ -2407,10 +3029,23 @@
|
|
2407
3029
|
components: [],
|
2408
3030
|
componentEvents: {},
|
2409
3031
|
initialize: function(options) {
|
3032
|
+
var component, _i, _len, _ref;
|
2410
3033
|
this.options = options != null ? options : {};
|
2411
3034
|
_.extend(this, this.options);
|
2412
|
-
this.setupHooks(Luca.core.Container.prototype.hooks);
|
2413
3035
|
this.components || (this.components = this.fields || (this.fields = this.pages || (this.pages = this.cards || (this.cards = this.views))));
|
3036
|
+
_ref = this.components;
|
3037
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
3038
|
+
component = _ref[_i];
|
3039
|
+
if (_.isString(component)) {
|
3040
|
+
component = {
|
3041
|
+
type: component,
|
3042
|
+
role: component,
|
3043
|
+
name: component
|
3044
|
+
};
|
3045
|
+
}
|
3046
|
+
}
|
3047
|
+
_.bindAll(this, "beforeRender");
|
3048
|
+
this.setupHooks(Luca.core.Container.prototype.hooks);
|
2414
3049
|
validateContainerConfiguration(this);
|
2415
3050
|
return Luca.View.prototype.initialize.apply(this, arguments);
|
2416
3051
|
},
|
@@ -2430,25 +3065,27 @@
|
|
2430
3065
|
});
|
2431
3066
|
},
|
2432
3067
|
prepareComponents: function() {
|
2433
|
-
var
|
2434
|
-
|
2435
|
-
_ref = this.components;
|
2436
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
2437
|
-
component = _ref[_i];
|
2438
|
-
if (_.isString(component)) {
|
2439
|
-
component = {
|
2440
|
-
type: component
|
2441
|
-
};
|
2442
|
-
}
|
2443
|
-
}
|
3068
|
+
var _this = this;
|
3069
|
+
container = this;
|
2444
3070
|
return _(this.components).each(function(component, index) {
|
2445
|
-
var ce, componentContainerElement, panel, _ref2;
|
2446
|
-
ce = componentContainerElement = (
|
3071
|
+
var ce, componentContainerElement, componentExtension, panel, _ref, _ref2;
|
3072
|
+
ce = componentContainerElement = (_ref = _this.componentContainers) != null ? _ref[index] : void 0;
|
2447
3073
|
ce["class"] = ce["class"] || ce.className || ce.classes;
|
2448
3074
|
if (_this.generateComponentElements) {
|
2449
3075
|
panel = _this.make(_this.componentTag, componentContainerElement, '');
|
2450
3076
|
_this.$append(panel);
|
2451
3077
|
}
|
3078
|
+
if (container.defaults != null) {
|
3079
|
+
component = _.defaults(component, container.defaults || {});
|
3080
|
+
}
|
3081
|
+
if (_.isArray(container.extensions) && _.isObject((_ref2 = container.extensions) != null ? _ref2[index] : void 0)) {
|
3082
|
+
componentExtension = container.extensions[index];
|
3083
|
+
component = _.extend(component, componentExtension);
|
3084
|
+
}
|
3085
|
+
if ((component.role != null) && _.isObject(container.extensions) && _.isObject(container.extensions[component.role])) {
|
3086
|
+
componentExtension = container.extensions[component.role];
|
3087
|
+
component = _.extend(component, componentExtension);
|
3088
|
+
}
|
2452
3089
|
if (component.container == null) {
|
2453
3090
|
if (_this.generateComponentElements) {
|
2454
3091
|
component.container = "#" + componentContainerElement.id;
|
@@ -2469,10 +3106,13 @@
|
|
2469
3106
|
container = this;
|
2470
3107
|
this.components = _(this.components).map(function(object, index) {
|
2471
3108
|
var component, created, _ref;
|
2472
|
-
component = Luca.isComponent(object) ? object : (object.type || (object.type = object.ctype), !(object.type != null) ? object.components != null ? object.type = object.ctype = 'container' : object.type = object.ctype = Luca.defaultComponentType : void 0, object
|
3109
|
+
component = Luca.isComponent(object) ? object : (object.type || (object.type = object.ctype), !(object.type != null) ? object.components != null ? object.type = object.ctype = 'container' : object.type = object.ctype = Luca.defaultComponentType : void 0, object._parentCid || (object._parentCid = container.cid), created = Luca.util.lazyComponent(object));
|
2473
3110
|
if (!component.container && ((_ref = component.options) != null ? _ref.container : void 0)) {
|
2474
3111
|
component.container = component.options.container;
|
2475
3112
|
}
|
3113
|
+
component.getParent || (component.getParent = function() {
|
3114
|
+
return Luca(component._parentCid);
|
3115
|
+
});
|
2476
3116
|
if (!(component.container != null)) {
|
2477
3117
|
console.log(component, index, _this);
|
2478
3118
|
console.error("could not assign container property to component on container " + (_this.name || _this.cid));
|
@@ -2488,9 +3128,6 @@
|
|
2488
3128
|
this.debug("container render components");
|
2489
3129
|
container = this;
|
2490
3130
|
return _(this.components).each(function(component) {
|
2491
|
-
component.getParent = function() {
|
2492
|
-
return container;
|
2493
|
-
};
|
2494
3131
|
try {
|
2495
3132
|
this.$(component.container).eq(0).append(component.el);
|
2496
3133
|
return component.render();
|
@@ -2653,7 +3290,7 @@
|
|
2653
3290
|
return this.components[needle];
|
2654
3291
|
},
|
2655
3292
|
isRootComponent: function() {
|
2656
|
-
return !(this.getParent != null);
|
3293
|
+
return this.rootComponent === true || !(this.getParent != null);
|
2657
3294
|
},
|
2658
3295
|
getRootComponent: function() {
|
2659
3296
|
if (this.isRootComponent()) {
|
@@ -2788,8 +3425,6 @@
|
|
2788
3425
|
|
2789
3426
|
CollectionManager.prototype.name = "primary";
|
2790
3427
|
|
2791
|
-
CollectionManager.prototype.collectionNamespace = Luca.Collection.namespace;
|
2792
|
-
|
2793
3428
|
CollectionManager.prototype.__collections = {};
|
2794
3429
|
|
2795
3430
|
CollectionManager.prototype.relayEvents = true;
|
@@ -2802,6 +3437,7 @@
|
|
2802
3437
|
if (existing = typeof (_base = Luca.CollectionManager).get === "function" ? _base.get(this.name) : void 0) {
|
2803
3438
|
throw 'Attempt to create a collection manager with a name which already exists';
|
2804
3439
|
}
|
3440
|
+
this.collectionNamespace || (this.collectionNamespace = Luca.util.read(Luca.Collection.namespace));
|
2805
3441
|
(_base2 = Luca.CollectionManager).instances || (_base2.instances = {});
|
2806
3442
|
_.extend(this, Backbone.Events);
|
2807
3443
|
_.extend(this, Luca.Events);
|
@@ -2934,6 +3570,9 @@
|
|
2934
3570
|
guessCollectionClass = function(key) {
|
2935
3571
|
var classified, guess, guesses, _ref;
|
2936
3572
|
classified = Luca.util.classify(key);
|
3573
|
+
if (_.isString(this.collectionNamespace)) {
|
3574
|
+
this.collectionNamespace = Luca.util.resolve(this.collectionNamespace);
|
3575
|
+
}
|
2937
3576
|
guess = (this.collectionNamespace || (window || global))[classified];
|
2938
3577
|
guess || (guess = (this.collectionNamespace || (window || global))["" + classified + "Collection"]);
|
2939
3578
|
if (!(guess != null) && ((_ref = Luca.Collection.namespaces) != null ? _ref.length : void 0) > 0) {
|
@@ -3104,9 +3743,9 @@
|
|
3104
3743
|
generateComponentElements: true,
|
3105
3744
|
initialize: function(options) {
|
3106
3745
|
this.options = options;
|
3746
|
+
this.components || (this.components = this.pages || (this.pages = this.cards));
|
3107
3747
|
Luca.core.Container.prototype.initialize.apply(this, arguments);
|
3108
|
-
this.setupHooks(this.hooks);
|
3109
|
-
return this.components || (this.components = this.pages || (this.pages = this.cards));
|
3748
|
+
return this.setupHooks(this.hooks);
|
3110
3749
|
},
|
3111
3750
|
prepareComponents: function() {
|
3112
3751
|
var _ref;
|
@@ -3152,7 +3791,7 @@
|
|
3152
3791
|
return this.activeComponent().trigger("first:activation", this, this.activeComponent());
|
3153
3792
|
},
|
3154
3793
|
activate: function(index, silent, callback) {
|
3155
|
-
var current, previous,
|
3794
|
+
var activationContext, current, previous,
|
3156
3795
|
_this = this;
|
3157
3796
|
if (silent == null) silent = false;
|
3158
3797
|
if (_.isFunction(silent)) {
|
@@ -3167,44 +3806,46 @@
|
|
3167
3806
|
current = this.getComponent(index);
|
3168
3807
|
}
|
3169
3808
|
if (!current) return;
|
3170
|
-
if (
|
3809
|
+
if (silent !== true) {
|
3171
3810
|
this.trigger("before:card:switch", previous, current);
|
3172
3811
|
if (previous != null) {
|
3173
|
-
|
3174
|
-
_ref.apply(previous, ["before:deactivation", this, previous, current]);
|
3175
|
-
}
|
3812
|
+
previous.trigger("before:deactivation", this, previous, current);
|
3176
3813
|
}
|
3177
3814
|
if (current != null) {
|
3178
|
-
|
3179
|
-
_ref2.apply(previous, ["before:activation", this, previous, current]);
|
3180
|
-
}
|
3815
|
+
current.trigger("before:activation", this, previous, current);
|
3181
3816
|
}
|
3182
3817
|
_.defer(function() {
|
3183
3818
|
return _this.$el.data(_this.activeAttribute || "active-card", current.name);
|
3184
3819
|
});
|
3185
3820
|
}
|
3186
3821
|
this.componentElements().hide();
|
3187
|
-
if (
|
3822
|
+
if (current.previously_activated !== true) {
|
3188
3823
|
current.trigger("first:activation");
|
3189
3824
|
current.previously_activated = true;
|
3190
3825
|
}
|
3191
3826
|
this.activeCard = index;
|
3192
3827
|
this.activeComponentElement().show();
|
3193
|
-
if (
|
3828
|
+
if (silent !== true) {
|
3194
3829
|
this.trigger("after:card:switch", previous, current);
|
3195
|
-
if (
|
3196
|
-
|
3830
|
+
if (previous != null) {
|
3831
|
+
previous.trigger("deactivation", this, previous, current);
|
3197
3832
|
}
|
3198
|
-
if (
|
3199
|
-
|
3833
|
+
if (current != null) {
|
3834
|
+
current.trigger("activation", this, previous, current);
|
3200
3835
|
}
|
3201
3836
|
}
|
3837
|
+
activationContext = this;
|
3838
|
+
if (Luca.containers.CardView.activationContext === "current") {
|
3839
|
+
activationContext = current;
|
3840
|
+
}
|
3202
3841
|
if (_.isFunction(callback)) {
|
3203
|
-
return callback.apply(
|
3842
|
+
return callback.apply(activationContext, [this, previous, current]);
|
3204
3843
|
}
|
3205
3844
|
}
|
3206
3845
|
});
|
3207
3846
|
|
3847
|
+
Luca.containers.CardView.activationContext = "current";
|
3848
|
+
|
3208
3849
|
}).call(this);
|
3209
3850
|
(function() {
|
3210
3851
|
|
@@ -3439,16 +4080,27 @@
|
|
3439
4080
|
|
3440
4081
|
}).call(this);
|
3441
4082
|
(function() {
|
4083
|
+
var tabView;
|
3442
4084
|
|
3443
|
-
_.def('Luca.containers.TabView')["extends"]('Luca.containers.CardView')["with"]
|
3444
|
-
|
3445
|
-
|
3446
|
-
|
4085
|
+
_.def('Luca.containers.TabView')["extends"]('Luca.containers.CardView')["with"];
|
4086
|
+
|
4087
|
+
tabView = Luca.register("Luca.containers.TabView");
|
4088
|
+
|
4089
|
+
tabView.triggers("before:select", "after:select");
|
4090
|
+
|
4091
|
+
tabView.publicConfiguration({
|
3447
4092
|
tab_position: 'top',
|
3448
|
-
tabVerticalOffset: '50px'
|
4093
|
+
tabVerticalOffset: '50px'
|
4094
|
+
});
|
4095
|
+
|
4096
|
+
tabView.privateConfiguration({
|
4097
|
+
additionalClassNames: 'tabbable',
|
3449
4098
|
navClass: "nav-tabs",
|
3450
4099
|
bodyTemplate: "containers/tab_view",
|
3451
|
-
bodyEl: "div.tab-content"
|
4100
|
+
bodyEl: "div.tab-content"
|
4101
|
+
});
|
4102
|
+
|
4103
|
+
tabView.defines({
|
3452
4104
|
initialize: function(options) {
|
3453
4105
|
this.options = options != null ? options : {};
|
3454
4106
|
if (this.navStyle === "list") this.navClass = "nav-list";
|
@@ -3474,13 +4126,12 @@
|
|
3474
4126
|
}
|
3475
4127
|
tabContainerId = this.tabContainer().attr("id");
|
3476
4128
|
this.registerEvent("click #" + tabContainerId + " li a", "select");
|
3477
|
-
if (Luca.
|
4129
|
+
if (Luca.config.enableBoostrap && (this.tab_position === "left" || this.tab_position === "right")) {
|
3478
4130
|
this.tabContainerWrapper().addClass("span2");
|
3479
4131
|
return this.tabContentWrapper().addClass("span9");
|
3480
4132
|
}
|
3481
4133
|
},
|
3482
4134
|
createTabSelectors: function() {
|
3483
|
-
var tabView;
|
3484
4135
|
tabView = this;
|
3485
4136
|
return this.each(function(component, index) {
|
3486
4137
|
var icon, link, selector, _ref;
|
@@ -3542,7 +4193,7 @@
|
|
3542
4193
|
initialize: function(options) {
|
3543
4194
|
this.options = options != null ? options : {};
|
3544
4195
|
_.extend(this, this.options);
|
3545
|
-
if (Luca.
|
4196
|
+
if (Luca.config.enableBoostrap === true) {
|
3546
4197
|
this.wrapperClass = this.fluid === true ? Luca.containers.Viewport.fluidWrapperClass : Luca.containers.Viewport.defaultWrapperClass;
|
3547
4198
|
}
|
3548
4199
|
Luca.core.Container.prototype.initialize.apply(this, arguments);
|
@@ -3591,7 +4242,7 @@
|
|
3591
4242
|
if ((_ref = Luca.containers.CardView.prototype.after) != null) {
|
3592
4243
|
_ref.apply(this, arguments);
|
3593
4244
|
}
|
3594
|
-
if (Luca.
|
4245
|
+
if (Luca.config.enableBoostrap === true && this.containerClassName) {
|
3595
4246
|
return this.$el.children().wrap('<div class="#{ containerClassName }" />');
|
3596
4247
|
}
|
3597
4248
|
},
|
@@ -3630,12 +4281,16 @@
|
|
3630
4281
|
|
3631
4282
|
}).call(this);
|
3632
4283
|
(function() {
|
4284
|
+
var application,
|
4285
|
+
__slice = Array.prototype.slice;
|
3633
4286
|
|
3634
|
-
|
3635
|
-
|
3636
|
-
|
4287
|
+
application = Luca.register("Luca.Application");
|
4288
|
+
|
4289
|
+
application["extends"]("Luca.containers.Viewport");
|
3637
4290
|
|
3638
|
-
|
4291
|
+
application.triggers("controller:change", "action:change");
|
4292
|
+
|
4293
|
+
application.publicInterface({
|
3639
4294
|
name: "MyApp",
|
3640
4295
|
defaultState: {},
|
3641
4296
|
autoBoot: false,
|
@@ -3649,21 +4304,20 @@
|
|
3649
4304
|
keyEvents: {},
|
3650
4305
|
components: [
|
3651
4306
|
{
|
3652
|
-
|
4307
|
+
type: 'template',
|
3653
4308
|
name: 'welcome',
|
3654
4309
|
template: 'sample/welcome',
|
3655
4310
|
templateContainer: "Luca.templates"
|
3656
4311
|
}
|
3657
4312
|
],
|
3658
4313
|
initialize: function(options) {
|
3659
|
-
var alreadyRunning, app, appName,
|
4314
|
+
var alreadyRunning, app, appName,
|
3660
4315
|
_this = this;
|
3661
4316
|
this.options = options != null ? options : {};
|
3662
4317
|
app = this;
|
3663
4318
|
appName = this.name;
|
3664
4319
|
alreadyRunning = typeof Luca.getApplication === "function" ? Luca.getApplication() : void 0;
|
3665
|
-
|
3666
|
-
Luca.Application.instances[appName] = app;
|
4320
|
+
Luca.Application.registerInstance(this);
|
3667
4321
|
Luca.containers.Viewport.prototype.initialize.apply(this, arguments);
|
3668
4322
|
this.state = new Luca.Model(this.defaultState);
|
3669
4323
|
if (this.useController === true) this.setupMainController();
|
@@ -3731,11 +4385,10 @@
|
|
3731
4385
|
},
|
3732
4386
|
navigate_to: function(component_name, callback) {
|
3733
4387
|
return this.getMainController().navigate_to(component_name, callback);
|
3734
|
-
}
|
3735
|
-
|
3736
|
-
|
3737
|
-
|
3738
|
-
},
|
4388
|
+
}
|
4389
|
+
});
|
4390
|
+
|
4391
|
+
application.privateInterface({
|
3739
4392
|
keyHandler: function(e) {
|
3740
4393
|
var control, isInputEvent, keyEvent, keyname, meta, source, _ref;
|
3741
4394
|
if (!(e && this.keyEvents)) return;
|
@@ -3766,7 +4419,7 @@
|
|
3766
4419
|
_this.state.set({
|
3767
4420
|
active_section: current.name
|
3768
4421
|
});
|
3769
|
-
return app.trigger("
|
4422
|
+
return app.trigger("controller:change");
|
3770
4423
|
});
|
3771
4424
|
}
|
3772
4425
|
return (_ref2 = this.getMainController()) != null ? _ref2.each(function(component) {
|
@@ -3777,22 +4430,27 @@
|
|
3777
4430
|
_this.state.set({
|
3778
4431
|
active_sub_section: current.name
|
3779
4432
|
});
|
3780
|
-
return app.trigger("
|
4433
|
+
return app.trigger("action:change");
|
3781
4434
|
});
|
3782
4435
|
}
|
3783
4436
|
}) : void 0;
|
3784
4437
|
},
|
3785
4438
|
setupMainController: function() {
|
3786
|
-
var definedComponents
|
4439
|
+
var definedComponents,
|
4440
|
+
_this = this;
|
3787
4441
|
if (this.useController === true) {
|
3788
4442
|
definedComponents = this.components || [];
|
3789
4443
|
this.components = [
|
3790
4444
|
{
|
3791
4445
|
type: 'controller',
|
3792
4446
|
name: "main_controller",
|
4447
|
+
role: "main_controller",
|
3793
4448
|
components: definedComponents
|
3794
4449
|
}
|
3795
4450
|
];
|
4451
|
+
this.getMainController = function() {
|
4452
|
+
return _this.findComponentByRole('main_controller');
|
4453
|
+
};
|
3796
4454
|
return this.defer(this.setupControllerBindings, false).until("after:components");
|
3797
4455
|
}
|
3798
4456
|
},
|
@@ -3833,7 +4491,7 @@
|
|
3833
4491
|
if (this.autoStartHistory === true) {
|
3834
4492
|
this.autoStartHistory = "before:render";
|
3835
4493
|
}
|
3836
|
-
return this.defer(Luca.
|
4494
|
+
return this.defer(Luca.Application.startHistory, false).until(this, this.autoStartHistory);
|
3837
4495
|
}
|
3838
4496
|
},
|
3839
4497
|
setupKeyHandler: function() {
|
@@ -3854,16 +4512,74 @@
|
|
3854
4512
|
}
|
3855
4513
|
});
|
3856
4514
|
|
4515
|
+
application.classInterface({
|
4516
|
+
instances: {},
|
4517
|
+
registerInstance: function(app) {
|
4518
|
+
return Luca.Application.instances[app.name] = app;
|
4519
|
+
},
|
4520
|
+
routeTo: function() {
|
4521
|
+
var callback, first, last, pages, routeHelper, specifiedAction;
|
4522
|
+
pages = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
4523
|
+
last = _(pages).last();
|
4524
|
+
first = _(pages).first();
|
4525
|
+
callback = void 0;
|
4526
|
+
specifiedAction = void 0;
|
4527
|
+
return routeHelper = function() {
|
4528
|
+
var action, args, index, nextItem, page, path, routeHandler, target, _i, _len, _ref;
|
4529
|
+
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
4530
|
+
path = this.app || Luca();
|
4531
|
+
index = 0;
|
4532
|
+
if (pages.length === 1 && (target = Luca(first))) {
|
4533
|
+
pages = target.controllerPath();
|
4534
|
+
}
|
4535
|
+
for (_i = 0, _len = pages.length; _i < _len; _i++) {
|
4536
|
+
page = pages[_i];
|
4537
|
+
if (!(_.isString(page))) continue;
|
4538
|
+
nextItem = pages[++index];
|
4539
|
+
action = void 0;
|
4540
|
+
if (_.isFunction(nextItem)) {
|
4541
|
+
action = nextItem;
|
4542
|
+
} else if (_.isObject(nextItem) && (nextItem.action != null)) {
|
4543
|
+
action = nextItem.action;
|
4544
|
+
} else if (page === last && (routeHandler = (_ref = Luca(last)) != null ? _ref.routeHandler : void 0)) {
|
4545
|
+
action = Luca.util.read(routeHandler);
|
4546
|
+
}
|
4547
|
+
if (_.isString(action)) {
|
4548
|
+
callback = function() {
|
4549
|
+
return this[action].apply(this, args);
|
4550
|
+
};
|
4551
|
+
}
|
4552
|
+
if (_.isFunction(action)) callback = nextItem;
|
4553
|
+
path = path.navigate_to(page, callback);
|
4554
|
+
}
|
4555
|
+
routeHelper.action = function(action) {
|
4556
|
+
return pages.push({
|
4557
|
+
action: action
|
4558
|
+
});
|
4559
|
+
};
|
4560
|
+
return routeHelper;
|
4561
|
+
};
|
4562
|
+
},
|
4563
|
+
startHistory: function() {
|
4564
|
+
return Backbone.history.start();
|
4565
|
+
}
|
4566
|
+
});
|
4567
|
+
|
4568
|
+
application.register();
|
4569
|
+
|
3857
4570
|
}).call(this);
|
3858
4571
|
(function() {
|
4572
|
+
var toolbar;
|
4573
|
+
|
4574
|
+
_.def('Luca.components.Toolbar')["extends"]('Luca.core.Container')["with"];
|
3859
4575
|
|
3860
|
-
|
4576
|
+
toolbar = Luca.register("Luca.components.Toolbar");
|
4577
|
+
|
4578
|
+
toolbar["extends"]("Luca.core.Container");
|
4579
|
+
|
4580
|
+
toolbar.defines({
|
3861
4581
|
className: 'luca-ui-toolbar toolbar',
|
3862
4582
|
position: 'bottom',
|
3863
|
-
initialize: function(options) {
|
3864
|
-
this.options = options != null ? options : {};
|
3865
|
-
return Luca.core.Container.prototype.initialize.apply(this, arguments);
|
3866
|
-
},
|
3867
4583
|
prepareComponents: function() {
|
3868
4584
|
var _this = this;
|
3869
4585
|
return _(this.components).each(function(component) {
|
@@ -3871,14 +4587,20 @@
|
|
3871
4587
|
});
|
3872
4588
|
},
|
3873
4589
|
render: function() {
|
3874
|
-
|
4590
|
+
$(this.container).append(this.el);
|
4591
|
+
return this;
|
3875
4592
|
}
|
3876
4593
|
});
|
3877
4594
|
|
3878
4595
|
}).call(this);
|
3879
4596
|
(function() {
|
4597
|
+
var loaderView;
|
4598
|
+
|
4599
|
+
loaderView = Luca.register("Luca.components.CollectionLoaderView");
|
3880
4600
|
|
3881
|
-
|
4601
|
+
loaderView["extends"]("Luca.View");
|
4602
|
+
|
4603
|
+
loaderView.defines({
|
3882
4604
|
className: 'luca-ui-collection-loader-view',
|
3883
4605
|
template: "components/collection_loader_view",
|
3884
4606
|
initialize: function(options) {
|
@@ -3915,22 +4637,25 @@
|
|
3915
4637
|
(function() {
|
3916
4638
|
var collectionView, make;
|
3917
4639
|
|
3918
|
-
collectionView = Luca.
|
4640
|
+
collectionView = Luca.register("Luca.components.CollectionView");
|
3919
4641
|
|
3920
4642
|
collectionView["extends"]("Luca.components.Panel");
|
3921
4643
|
|
3922
|
-
collectionView.
|
4644
|
+
collectionView.mixesIn("QueryCollectionBindings", "LoadMaskable", "Filterable", "Paginatable");
|
3923
4645
|
|
3924
4646
|
collectionView.triggers("before:refresh", "after:refresh", "refresh", "empty:results");
|
3925
4647
|
|
3926
|
-
collectionView.
|
4648
|
+
collectionView.publicConfiguration({
|
3927
4649
|
tagName: "ol",
|
3928
|
-
className: "luca-ui-collection-view",
|
3929
4650
|
bodyClassName: "collection-ui-panel",
|
3930
|
-
itemTemplate: void 0,
|
3931
|
-
itemRenderer: void 0,
|
3932
4651
|
itemTagName: 'li',
|
3933
4652
|
itemClassName: 'collection-item',
|
4653
|
+
itemTemplate: void 0,
|
4654
|
+
itemRenderer: void 0,
|
4655
|
+
itemProperty: void 0
|
4656
|
+
});
|
4657
|
+
|
4658
|
+
collectionView.defines({
|
3934
4659
|
initialize: function(options) {
|
3935
4660
|
var _this = this;
|
3936
4661
|
this.options = options != null ? options : {};
|
@@ -3953,29 +4678,24 @@
|
|
3953
4678
|
if (!Luca.isBackboneCollection(this.collection)) {
|
3954
4679
|
console.log("Missing Collection on " + (this.name || this.cid), this, this.collection);
|
3955
4680
|
throw "Collection Views must have a valid backbone collection";
|
3956
|
-
this.collection.on("before:fetch", function() {
|
3957
|
-
return _this.trigger("enable:loadmask");
|
3958
|
-
});
|
3959
|
-
this.collection.bind("reset", function() {
|
3960
|
-
_this.refresh();
|
3961
|
-
return _this.trigger("disable:loadmask");
|
3962
|
-
});
|
3963
|
-
this.collection.bind("remove", function() {
|
3964
|
-
return _this.refresh();
|
3965
|
-
});
|
3966
|
-
this.collection.bind("add", function() {
|
3967
|
-
return _this.refresh();
|
3968
|
-
});
|
3969
|
-
if (this.observeChanges === true) {
|
3970
|
-
this.collection.on("change", this.refreshModel, this);
|
3971
|
-
}
|
3972
4681
|
}
|
3973
|
-
|
3974
|
-
|
3975
|
-
|
3976
|
-
|
3977
|
-
|
4682
|
+
this.collection.on("before:fetch", function() {
|
4683
|
+
return _this.trigger("enable:loadmask");
|
4684
|
+
});
|
4685
|
+
this.collection.bind("reset", function() {
|
4686
|
+
_this.refresh();
|
4687
|
+
return _this.trigger("disable:loadmask");
|
4688
|
+
});
|
4689
|
+
this.collection.bind("remove", function() {
|
4690
|
+
return _this.refresh();
|
4691
|
+
});
|
4692
|
+
this.collection.bind("add", function() {
|
4693
|
+
return _this.refresh();
|
4694
|
+
});
|
4695
|
+
if (this.observeChanges === true) {
|
4696
|
+
this.collection.on("change", this.refreshModel, this);
|
3978
4697
|
}
|
4698
|
+
Luca.components.Panel.prototype.initialize.apply(this, arguments);
|
3979
4699
|
return this.on("refresh", this.refresh, this);
|
3980
4700
|
},
|
3981
4701
|
attributesForItem: function(item, model) {
|
@@ -4013,47 +4733,6 @@
|
|
4013
4733
|
return console.log("Error generating DOM element for CollectionView", this, model, index);
|
4014
4734
|
}
|
4015
4735
|
},
|
4016
|
-
getCollection: function() {
|
4017
|
-
return this.collection;
|
4018
|
-
},
|
4019
|
-
applyQuery: function(query, queryOptions) {
|
4020
|
-
if (query == null) query = {};
|
4021
|
-
if (queryOptions == null) queryOptions = {};
|
4022
|
-
this.query = query;
|
4023
|
-
this.queryOptions = queryOptions;
|
4024
|
-
this.refresh();
|
4025
|
-
return this;
|
4026
|
-
},
|
4027
|
-
getQuery: function() {
|
4028
|
-
var query, querySource, _i, _len, _ref;
|
4029
|
-
query = this.query || (this.query = {});
|
4030
|
-
_ref = _(this.querySources || []).compact();
|
4031
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
4032
|
-
querySource = _ref[_i];
|
4033
|
-
query = _.extend(query, querySource() || {});
|
4034
|
-
}
|
4035
|
-
return query;
|
4036
|
-
},
|
4037
|
-
getQueryOptions: function() {
|
4038
|
-
var optionSource, options, _i, _len, _ref;
|
4039
|
-
options = this.queryOptions || (this.queryOptions = {});
|
4040
|
-
_ref = _(this.optionsSources || []).compact();
|
4041
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
4042
|
-
optionSource = _ref[_i];
|
4043
|
-
options = _.extend(options, optionSource() || {});
|
4044
|
-
}
|
4045
|
-
return options;
|
4046
|
-
},
|
4047
|
-
getModels: function(query, options) {
|
4048
|
-
var _ref;
|
4049
|
-
if ((_ref = this.collection) != null ? _ref.query : void 0) {
|
4050
|
-
query || (query = this.getQuery());
|
4051
|
-
options || (options = this.getQueryOptions());
|
4052
|
-
return this.collection.query(query, options);
|
4053
|
-
} else {
|
4054
|
-
return this.collection.models;
|
4055
|
-
}
|
4056
|
-
},
|
4057
4736
|
locateItemElement: function(id) {
|
4058
4737
|
return this.$("." + this.itemClassName + "[data-model-id='" + id + "']");
|
4059
4738
|
},
|
@@ -4102,34 +4781,92 @@
|
|
4102
4781
|
|
4103
4782
|
}).call(this);
|
4104
4783
|
(function() {
|
4784
|
+
var controller;
|
4785
|
+
|
4786
|
+
controller = Luca.register("Luca.components.Controller");
|
4787
|
+
|
4788
|
+
controller["extends"]("Luca.containers.CardView");
|
4789
|
+
|
4790
|
+
controller.publicInterface({
|
4791
|
+
"default": function(callback) {
|
4792
|
+
return this.navigate_to(this.defaultPage || this.defaultCard, callback);
|
4793
|
+
},
|
4794
|
+
activePage: function() {
|
4795
|
+
return this.activeSection();
|
4796
|
+
},
|
4797
|
+
navigate_to: function(section, callback) {
|
4798
|
+
var _this = this;
|
4799
|
+
section || (section = this.defaultCard);
|
4800
|
+
this.activate(section, false, function(activator, previous, current) {
|
4801
|
+
_this.state.set({
|
4802
|
+
active_section: current.name
|
4803
|
+
});
|
4804
|
+
if (_.isFunction(callback)) return callback.apply(current);
|
4805
|
+
});
|
4806
|
+
return this.find(section);
|
4807
|
+
}
|
4808
|
+
});
|
4809
|
+
|
4810
|
+
controller.classMethods({
|
4811
|
+
controllerPath: function() {
|
4812
|
+
var atBase, component, list;
|
4813
|
+
component = this;
|
4814
|
+
list = [component.name];
|
4815
|
+
atBase = false;
|
4816
|
+
while (component && !atBase) {
|
4817
|
+
component = typeof component.getParent === "function" ? component.getParent() : void 0;
|
4818
|
+
if ((component != null ? component.role : void 0) === "main_controller") {
|
4819
|
+
atBase = true;
|
4820
|
+
}
|
4821
|
+
if ((component != null) && !atBase) list.push(component.name);
|
4822
|
+
}
|
4823
|
+
return list.reverse();
|
4824
|
+
}
|
4825
|
+
});
|
4105
4826
|
|
4106
|
-
|
4107
|
-
additionalClassNames:
|
4827
|
+
controller.defines({
|
4828
|
+
additionalClassNames: 'luca-ui-controller',
|
4108
4829
|
activeAttribute: "active-section",
|
4830
|
+
stateful: true,
|
4109
4831
|
initialize: function(options) {
|
4110
4832
|
var _ref;
|
4111
4833
|
this.options = options;
|
4834
|
+
this.defaultCard || (this.defaultCard = this.defaultPage || (this.defaultPage = ((_ref = this.components[0]) != null ? _ref.name : void 0) || 0));
|
4835
|
+
this.defaultPage || (this.defaultPage = this.defaultCard);
|
4836
|
+
this.defaultState || (this.defaultState = {
|
4837
|
+
active_section: this.defaultPage
|
4838
|
+
});
|
4112
4839
|
Luca.containers.CardView.prototype.initialize.apply(this, arguments);
|
4113
|
-
|
4114
|
-
if (!this.defaultCard) {
|
4840
|
+
if (this.defaultCard == null) {
|
4115
4841
|
throw "Controllers must specify a defaultCard property and/or the first component must have a name";
|
4116
4842
|
}
|
4117
|
-
return this.
|
4118
|
-
|
4843
|
+
return this._().each(function(component) {
|
4844
|
+
return component.controllerPath = Luca.components.Controller.controllerPath;
|
4119
4845
|
});
|
4120
4846
|
},
|
4121
4847
|
each: function(fn) {
|
4122
4848
|
var _this = this;
|
4123
4849
|
return _(this.components).each(function(component) {
|
4124
|
-
return fn.
|
4850
|
+
return fn.call(_this, component);
|
4125
4851
|
});
|
4126
4852
|
},
|
4127
4853
|
activeSection: function() {
|
4128
|
-
return this.get("
|
4854
|
+
return this.get("active_section");
|
4855
|
+
},
|
4856
|
+
pageControllers: function(deep) {
|
4857
|
+
if (deep == null) deep = false;
|
4858
|
+
return this.controllers.apply(this, arguments);
|
4129
4859
|
},
|
4130
4860
|
controllers: function(deep) {
|
4131
4861
|
if (deep == null) deep = false;
|
4132
|
-
return this.select(
|
4862
|
+
return this.select(function(component) {
|
4863
|
+
var type;
|
4864
|
+
type = component.type || component.ctype;
|
4865
|
+
return type === "controller" || type === "page_controller";
|
4866
|
+
});
|
4867
|
+
},
|
4868
|
+
availablePages: function() {
|
4869
|
+
return this.availableSections.apply(this, arguments);
|
4133
4870
|
},
|
4134
4871
|
availableSections: function() {
|
4135
4872
|
var base,
|
@@ -4141,37 +4878,43 @@
|
|
4141
4878
|
return memo;
|
4142
4879
|
}, base);
|
4143
4880
|
},
|
4881
|
+
pageNames: function() {
|
4882
|
+
return this.sectionNames();
|
4883
|
+
},
|
4144
4884
|
sectionNames: function(deep) {
|
4145
4885
|
if (deep == null) deep = false;
|
4146
4886
|
return this.pluck('name');
|
4147
|
-
},
|
4148
|
-
"default": function(callback) {
|
4149
|
-
return this.navigate_to(this.defaultCard, callback);
|
4150
|
-
},
|
4151
|
-
navigate_to: function(section, callback) {
|
4152
|
-
var _this = this;
|
4153
|
-
section || (section = this.defaultCard);
|
4154
|
-
this.activate(section, false, function(activator, previous, current) {
|
4155
|
-
_this.state.set({
|
4156
|
-
active_section: current.name
|
4157
|
-
});
|
4158
|
-
if (_.isFunction(callback)) return callback.apply(current);
|
4159
|
-
});
|
4160
|
-
return this.find(section);
|
4161
4887
|
}
|
4162
4888
|
});
|
4163
4889
|
|
4164
4890
|
}).call(this);
|
4165
4891
|
(function() {
|
4892
|
+
var buttonField;
|
4893
|
+
|
4894
|
+
buttonField = Luca.register("Luca.fields.ButtonField");
|
4166
4895
|
|
4167
|
-
|
4896
|
+
buttonField["extends"]("Luca.core.Field");
|
4897
|
+
|
4898
|
+
buttonField.triggers("button:click");
|
4899
|
+
|
4900
|
+
buttonField.publicConfiguration({
|
4168
4901
|
readOnly: true,
|
4902
|
+
input_value: void 0,
|
4903
|
+
input_type: "button",
|
4904
|
+
icon_class: void 0,
|
4905
|
+
input_name: void 0,
|
4906
|
+
white: void 0
|
4907
|
+
});
|
4908
|
+
|
4909
|
+
buttonField.privateConfiguration({
|
4910
|
+
isButton: true,
|
4911
|
+
template: "fields/button_field",
|
4169
4912
|
events: {
|
4170
4913
|
"click input": "click_handler"
|
4171
|
-
}
|
4172
|
-
|
4173
|
-
|
4174
|
-
|
4914
|
+
}
|
4915
|
+
});
|
4916
|
+
|
4917
|
+
buttonField.privateInterface({
|
4175
4918
|
click_handler: function(e) {
|
4176
4919
|
var me, my;
|
4177
4920
|
me = my = $(e.currentTarget);
|
@@ -4191,7 +4934,6 @@
|
|
4191
4934
|
this.input_id || (this.input_id = _.uniqueId('button'));
|
4192
4935
|
this.input_name || (this.input_name = this.name || (this.name = this.input_id));
|
4193
4936
|
this.input_value || (this.input_value = this.label || (this.label = this.text));
|
4194
|
-
this.input_type || (this.input_type = "button");
|
4195
4937
|
this.input_class || (this.input_class = this["class"]);
|
4196
4938
|
this.icon_class || (this.icon_class = "");
|
4197
4939
|
if (this.icon_class.length && !this.icon_class.match(/^icon-/)) {
|
@@ -4204,13 +4946,21 @@
|
|
4204
4946
|
}
|
4205
4947
|
});
|
4206
4948
|
|
4949
|
+
buttonField.defines({
|
4950
|
+
version: 1
|
4951
|
+
});
|
4952
|
+
|
4207
4953
|
}).call(this);
|
4208
4954
|
(function() {
|
4209
|
-
var make;
|
4955
|
+
var checkboxArray, make;
|
4210
4956
|
|
4211
4957
|
make = Luca.View.prototype.make;
|
4212
4958
|
|
4213
|
-
|
4959
|
+
checkboxArray = Luca.register("Luca.fields.CheckboxArray");
|
4960
|
+
|
4961
|
+
checkboxArray["extends"]("Luca.core.Field");
|
4962
|
+
|
4963
|
+
checkboxArray.defines({
|
4214
4964
|
version: 2,
|
4215
4965
|
template: "fields/checkbox_array",
|
4216
4966
|
className: "luca-ui-checkbox-array",
|
@@ -4221,7 +4971,7 @@
|
|
4221
4971
|
initialize: function(options) {
|
4222
4972
|
this.options = options != null ? options : {};
|
4223
4973
|
_.extend(this, this.options);
|
4224
|
-
_.extend(this, Luca.
|
4974
|
+
_.extend(this, Luca.concerns.Deferrable);
|
4225
4975
|
_.bindAll(this, "renderCheckboxes", "clickHandler", "checkSelected");
|
4226
4976
|
Luca.core.Field.prototype.initialize.apply(this, arguments);
|
4227
4977
|
this.input_id || (this.input_id = _.uniqueId('field'));
|
@@ -4239,6 +4989,9 @@
|
|
4239
4989
|
console.log("Error Configuring Collection", this, e.message);
|
4240
4990
|
}
|
4241
4991
|
cbArray = this;
|
4992
|
+
if (!Luca.isBackboneCollection(this.collection)) {
|
4993
|
+
throw "Checkbox Array Fields must specify a @collection property";
|
4994
|
+
}
|
4242
4995
|
if (this.collection.length > 0) {
|
4243
4996
|
return this.renderCheckboxes();
|
4244
4997
|
} else {
|
@@ -4334,15 +5087,27 @@
|
|
4334
5087
|
|
4335
5088
|
}).call(this);
|
4336
5089
|
(function() {
|
5090
|
+
var checkboxField;
|
5091
|
+
|
5092
|
+
checkboxField = Luca.register("Luca.fields.CheckboxField");
|
4337
5093
|
|
4338
|
-
|
5094
|
+
checkboxField["extends"]("Luca.core.Field");
|
5095
|
+
|
5096
|
+
checkboxField.triggers("checked", "unchecked");
|
5097
|
+
|
5098
|
+
checkboxField.publicConfiguration({
|
5099
|
+
send_blanks: true,
|
5100
|
+
input_value: 1
|
5101
|
+
});
|
5102
|
+
|
5103
|
+
checkboxField.privateConfiguration({
|
5104
|
+
template: 'fields/checkbox_field',
|
4339
5105
|
events: {
|
4340
5106
|
"change input": "change_handler"
|
4341
|
-
}
|
4342
|
-
|
4343
|
-
|
4344
|
-
|
4345
|
-
send_blanks: true,
|
5107
|
+
}
|
5108
|
+
});
|
5109
|
+
|
5110
|
+
checkboxField.privateInterface({
|
4346
5111
|
change_handler: function(e) {
|
4347
5112
|
var me, my;
|
4348
5113
|
me = my = $(e.target);
|
@@ -4357,14 +5122,14 @@
|
|
4357
5122
|
this.options = options != null ? options : {};
|
4358
5123
|
_.extend(this, this.options);
|
4359
5124
|
_.bindAll(this, "change_handler");
|
4360
|
-
|
4361
|
-
},
|
4362
|
-
afterInitialize: function() {
|
5125
|
+
Luca.core.Field.prototype.initialize.apply(this, arguments);
|
4363
5126
|
this.input_id || (this.input_id = _.uniqueId('field'));
|
4364
5127
|
this.input_name || (this.input_name = this.name);
|
4365
|
-
this.input_value || (this.input_value = 1);
|
4366
5128
|
return this.label || (this.label = this.name);
|
4367
|
-
}
|
5129
|
+
}
|
5130
|
+
});
|
5131
|
+
|
5132
|
+
checkboxField.publicInterface({
|
4368
5133
|
setValue: function(checked) {
|
4369
5134
|
return this.getInputElement().attr('checked', checked);
|
4370
5135
|
},
|
@@ -4373,10 +5138,20 @@
|
|
4373
5138
|
}
|
4374
5139
|
});
|
4375
5140
|
|
5141
|
+
checkboxField.defines({
|
5142
|
+
version: 1
|
5143
|
+
});
|
5144
|
+
|
4376
5145
|
}).call(this);
|
4377
5146
|
(function() {
|
5147
|
+
var fileUpload;
|
5148
|
+
|
5149
|
+
fileUpload = Luca.register("Luca.fields.FileUploadField");
|
5150
|
+
|
5151
|
+
fileUpload["extends"]("Luca.core.Field");
|
4378
5152
|
|
4379
|
-
|
5153
|
+
fileUpload.defines({
|
5154
|
+
version: 1,
|
4380
5155
|
template: 'fields/file_upload_field',
|
4381
5156
|
afterInitialize: function() {
|
4382
5157
|
this.input_id || (this.input_id = _.uniqueId('field'));
|
@@ -4388,8 +5163,13 @@
|
|
4388
5163
|
|
4389
5164
|
}).call(this);
|
4390
5165
|
(function() {
|
5166
|
+
var hiddenField;
|
5167
|
+
|
5168
|
+
hiddenField = Luca.register("Luca.fields.HiddenField");
|
4391
5169
|
|
4392
|
-
|
5170
|
+
hiddenField["extends"]("Luca.core.Field");
|
5171
|
+
|
5172
|
+
hiddenField.defines({
|
4393
5173
|
template: 'fields/hidden_field',
|
4394
5174
|
afterInitialize: function() {
|
4395
5175
|
this.input_id || (this.input_id = _.uniqueId('field'));
|
@@ -4401,9 +5181,13 @@
|
|
4401
5181
|
|
4402
5182
|
}).call(this);
|
4403
5183
|
(function() {
|
5184
|
+
var labelField;
|
5185
|
+
|
5186
|
+
labelField = Luca.register("Luca.components.LabelField");
|
4404
5187
|
|
4405
|
-
|
4406
|
-
|
5188
|
+
labelField["extends"]("Luca.core.Field");
|
5189
|
+
|
5190
|
+
labelField.defines({
|
4407
5191
|
formatter: function(value) {
|
4408
5192
|
value || (value = this.getValue());
|
4409
5193
|
return _.str.titleize(value);
|
@@ -4417,13 +5201,18 @@
|
|
4417
5201
|
|
4418
5202
|
}).call(this);
|
4419
5203
|
(function() {
|
5204
|
+
var selectField;
|
5205
|
+
|
5206
|
+
selectField = Luca.register("Luca.fields.SelectField");
|
5207
|
+
|
5208
|
+
selectField["extends"]("Luca.core.Field");
|
5209
|
+
|
5210
|
+
selectField.triggers("after:select");
|
4420
5211
|
|
4421
|
-
|
5212
|
+
selectField.defines({
|
4422
5213
|
events: {
|
4423
5214
|
"change select": "change_handler"
|
4424
5215
|
},
|
4425
|
-
hooks: ["after:select"],
|
4426
|
-
className: 'luca-ui-select-field luca-ui-field',
|
4427
5216
|
template: "fields/select_field",
|
4428
5217
|
includeBlank: true,
|
4429
5218
|
blankValue: '',
|
@@ -4431,7 +5220,7 @@
|
|
4431
5220
|
initialize: function(options) {
|
4432
5221
|
this.options = options != null ? options : {};
|
4433
5222
|
_.extend(this, this.options);
|
4434
|
-
_.extend(this, Luca.
|
5223
|
+
_.extend(this, Luca.concerns.Deferrable);
|
4435
5224
|
_.bindAll(this, "change_handler", "populateOptions", "beforeFetch");
|
4436
5225
|
Luca.core.Field.prototype.initialize.apply(this, arguments);
|
4437
5226
|
this.input_id || (this.input_id = _.uniqueId('field'));
|
@@ -4526,13 +5315,14 @@
|
|
4526
5315
|
initialize: function(options) {
|
4527
5316
|
this.options = options != null ? options : {};
|
4528
5317
|
_.bindAll(this, "keydown_handler");
|
4529
|
-
Luca.core.Field.prototype.initialize.apply(this, arguments);
|
4530
5318
|
this.input_id || (this.input_id = _.uniqueId('field'));
|
4531
5319
|
this.input_name || (this.input_name = this.name);
|
4532
5320
|
this.label || (this.label = this.name);
|
4533
5321
|
this.input_class || (this.input_class = this["class"]);
|
4534
5322
|
this.input_value || (this.input_value = "");
|
4535
|
-
|
5323
|
+
this.inputStyles || (this.inputStyles = "height:" + this.height + ";width:" + this.width);
|
5324
|
+
this.placeHolder || (this.placeHolder = "");
|
5325
|
+
return Luca.core.Field.prototype.initialize.apply(this, arguments);
|
4536
5326
|
},
|
4537
5327
|
setValue: function(value) {
|
4538
5328
|
return $(this.field()).val(value);
|
@@ -4559,8 +5349,13 @@
|
|
4559
5349
|
|
4560
5350
|
}).call(this);
|
4561
5351
|
(function() {
|
5352
|
+
var textField;
|
5353
|
+
|
5354
|
+
textField = Luca.register('Luca.fields.TextField');
|
4562
5355
|
|
4563
|
-
|
5356
|
+
textField["extends"]('Luca.core.Field');
|
5357
|
+
|
5358
|
+
textField.defines({
|
4564
5359
|
events: {
|
4565
5360
|
"blur input": "blur_handler",
|
4566
5361
|
"focus input": "focus_handler",
|
@@ -4586,6 +5381,7 @@
|
|
4586
5381
|
this.$el.addClass('input-append');
|
4587
5382
|
this.addOn = this.append;
|
4588
5383
|
}
|
5384
|
+
this.placeHolder || (this.placeHolder = "");
|
4589
5385
|
return Luca.core.Field.prototype.initialize.apply(this, arguments);
|
4590
5386
|
},
|
4591
5387
|
keyup_handler: function(e) {
|
@@ -4604,9 +5400,13 @@
|
|
4604
5400
|
|
4605
5401
|
}).call(this);
|
4606
5402
|
(function() {
|
5403
|
+
var typeAheadField;
|
5404
|
+
|
5405
|
+
typeAheadField = Luca.register("Luca.fields.TypeAheadField");
|
5406
|
+
|
5407
|
+
typeAheadField["extends"]("Luca.fields.TextField");
|
4607
5408
|
|
4608
|
-
|
4609
|
-
className: 'luca-ui-field',
|
5409
|
+
typeAheadField.defines({
|
4610
5410
|
getSource: function() {
|
4611
5411
|
return Luca.util.read(this.source) || [];
|
4612
5412
|
},
|
@@ -4628,13 +5428,19 @@
|
|
4628
5428
|
|
4629
5429
|
}).call(this);
|
4630
5430
|
(function() {
|
5431
|
+
var toolbar;
|
4631
5432
|
|
4632
|
-
|
5433
|
+
toolbar = Luca.register("Luca.components.FormButtonToolbar");
|
5434
|
+
|
5435
|
+
toolbar["extends"]("Luca.components.Toolbar");
|
5436
|
+
|
5437
|
+
toolbar.defines({
|
4633
5438
|
className: 'luca-ui-form-toolbar form-actions',
|
4634
5439
|
position: 'bottom',
|
4635
5440
|
includeReset: false,
|
4636
5441
|
render: function() {
|
4637
|
-
|
5442
|
+
$(this.container).append(this.el);
|
5443
|
+
return this;
|
4638
5444
|
},
|
4639
5445
|
initialize: function(options) {
|
4640
5446
|
this.options = options != null ? options : {};
|
@@ -4658,11 +5464,17 @@
|
|
4658
5464
|
|
4659
5465
|
}).call(this);
|
4660
5466
|
(function() {
|
5467
|
+
var formView;
|
5468
|
+
|
5469
|
+
formView = Luca.register("Luca.components.FormView");
|
4661
5470
|
|
4662
|
-
|
5471
|
+
formView["extends"]("Luca.core.Container");
|
5472
|
+
|
5473
|
+
formView.triggers("before:submit", "before:reset", "before:load", "before:load:new", "before:load:existing", "after:submit", "after:reset", "after:load", "after:load:new", "after:load:existing", "after:submit:success", "after:submit:fatal_error", "after:submit:error");
|
5474
|
+
|
5475
|
+
formView.defines({
|
4663
5476
|
tagName: 'form',
|
4664
5477
|
className: 'luca-ui-form-view',
|
4665
|
-
hooks: ["before:submit", "before:reset", "before:load", "before:load:new", "before:load:existing", "after:submit", "after:reset", "after:load", "after:load:new", "after:load:existing", "after:submit:success", "after:submit:fatal_error", "after:submit:error"],
|
4666
5478
|
events: {
|
4667
5479
|
"click .submit-button": "submitHandler",
|
4668
5480
|
"click .reset-button": "resetHandler"
|
@@ -4670,13 +5482,13 @@
|
|
4670
5482
|
toolbar: true,
|
4671
5483
|
legend: "",
|
4672
5484
|
bodyClassName: "form-view-body",
|
4673
|
-
version:
|
5485
|
+
version: 1,
|
4674
5486
|
initialize: function(options) {
|
4675
5487
|
this.options = options != null ? options : {};
|
4676
|
-
if (this.loadMask == null) this.loadMask = Luca.
|
5488
|
+
if (this.loadMask == null) this.loadMask = Luca.config.enableBoostrap;
|
4677
5489
|
Luca.core.Container.prototype.initialize.apply(this, arguments);
|
4678
5490
|
this.components || (this.components = this.fields);
|
4679
|
-
_.bindAll(this, "submitHandler", "resetHandler", "renderToolbars"
|
5491
|
+
_.bindAll(this, "submitHandler", "resetHandler", "renderToolbars");
|
4680
5492
|
this.state || (this.state = new Backbone.Model);
|
4681
5493
|
this.setupHooks(this.hooks);
|
4682
5494
|
this.applyStyleClasses();
|
@@ -4693,7 +5505,7 @@
|
|
4693
5505
|
return Luca.components.FormView.defaultFormViewToolbar;
|
4694
5506
|
},
|
4695
5507
|
applyStyleClasses: function() {
|
4696
|
-
if (Luca.
|
5508
|
+
if (Luca.config.enableBoostrap) this.applyBootstrapStyleClasses();
|
4697
5509
|
if (this.labelAlign) this.$el.addClass("label-align-" + this.labelAlign);
|
4698
5510
|
if (this.fieldLayoutClass) return this.$el.addClass(this.fieldLayoutClass);
|
4699
5511
|
},
|
@@ -4823,7 +5635,7 @@
|
|
4823
5635
|
if (options.debug) {
|
4824
5636
|
console.log("" + key + " Options", options, "Value", value, "Value Is Blank?", valueIsBlank, "Allow Blanks?", allowBlankValues);
|
4825
5637
|
}
|
4826
|
-
if (options.skip_buttons && field.
|
5638
|
+
if (options.skip_buttons && field.isButton) {
|
4827
5639
|
skip = true;
|
4828
5640
|
} else {
|
4829
5641
|
if (valueIsBlank && allowBlankValues === false) skip = true;
|
@@ -4950,8 +5762,8 @@
|
|
4950
5762
|
var _this = this;
|
4951
5763
|
this.options = options != null ? options : {};
|
4952
5764
|
_.extend(this, this.options);
|
4953
|
-
_.extend(this, Luca.
|
4954
|
-
if (this.loadMask == null) this.loadMask = Luca.
|
5765
|
+
_.extend(this, Luca.concerns.Deferrable);
|
5766
|
+
if (this.loadMask == null) this.loadMask = Luca.config.enableBoostrap;
|
4955
5767
|
if (this.loadMask === true) {
|
4956
5768
|
this.loadMaskEl || (this.loadMaskEl = ".luca-ui-g-view-body");
|
4957
5769
|
}
|
@@ -5013,7 +5825,7 @@
|
|
5013
5825
|
var _ref;
|
5014
5826
|
return (_ref = _this.wrapper) != null ? _ref.addClass(containerClass) : void 0;
|
5015
5827
|
});
|
5016
|
-
if (Luca.
|
5828
|
+
if (Luca.config.enableBoostrap) this.table.addClass('table');
|
5017
5829
|
return _((_ref = this.tableStyle) != null ? _ref.split(" ") : void 0).each(function(style) {
|
5018
5830
|
return _this.table.addClass("table-" + style);
|
5019
5831
|
});
|
@@ -5178,15 +5990,15 @@
|
|
5178
5990
|
(function() {
|
5179
5991
|
var multiView, propagateCollectionComponents, validateComponent;
|
5180
5992
|
|
5181
|
-
multiView = Luca.
|
5993
|
+
multiView = Luca.register("Luca.components.MultiCollectionView");
|
5182
5994
|
|
5183
5995
|
multiView["extends"]("Luca.containers.CardView");
|
5184
5996
|
|
5185
|
-
multiView.
|
5997
|
+
multiView.mixesIn("QueryCollectionBindings", "LoadMaskable", "Filterable", "Paginatable");
|
5186
5998
|
|
5187
5999
|
multiView.triggers("before:refresh", "after:refresh", "refresh", "empty:results");
|
5188
6000
|
|
5189
|
-
multiView.
|
6001
|
+
multiView.defines({
|
5190
6002
|
version: 1,
|
5191
6003
|
stateful: true,
|
5192
6004
|
defaultState: {
|
@@ -5202,11 +6014,10 @@
|
|
5202
6014
|
view = _ref[_i];
|
5203
6015
|
validateComponent(view);
|
5204
6016
|
}
|
6017
|
+
Luca.containers.CardView.prototype.initialize.apply(this, arguments);
|
5205
6018
|
this.on("refresh", this.refresh, this);
|
5206
6019
|
this.on("after:card:switch", this.refresh, this);
|
5207
|
-
this.on("after:components", propagateCollectionComponents, this);
|
5208
|
-
this.debug("multi collection , proto initialize");
|
5209
|
-
return Luca.containers.CardView.prototype.initialize.apply(this, arguments);
|
6020
|
+
return this.on("after:components", propagateCollectionComponents, this);
|
5210
6021
|
},
|
5211
6022
|
relayAfterRefresh: function(models, query, options) {
|
5212
6023
|
return this.trigger("after:refresh", models, query, options);
|
@@ -5214,38 +6025,6 @@
|
|
5214
6025
|
refresh: function() {
|
5215
6026
|
var _ref;
|
5216
6027
|
return (_ref = this.activeComponent()) != null ? _ref.trigger("refresh") : void 0;
|
5217
|
-
},
|
5218
|
-
getCollection: function() {
|
5219
|
-
return this.collection;
|
5220
|
-
},
|
5221
|
-
applyQuery: function(query, queryOptions) {
|
5222
|
-
if (query == null) query = {};
|
5223
|
-
if (queryOptions == null) queryOptions = {};
|
5224
|
-
this.query = query;
|
5225
|
-
this.queryOptions = queryOptions;
|
5226
|
-
return this;
|
5227
|
-
},
|
5228
|
-
getQuery: function() {
|
5229
|
-
var query, querySource, _i, _len, _ref;
|
5230
|
-
this.debug("Get Query");
|
5231
|
-
query = this.query || (this.query = {});
|
5232
|
-
_ref = this.querySources;
|
5233
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
5234
|
-
querySource = _ref[_i];
|
5235
|
-
query = _.extend(query, querySource() || {});
|
5236
|
-
}
|
5237
|
-
return query;
|
5238
|
-
},
|
5239
|
-
getQueryOptions: function() {
|
5240
|
-
var optionSource, options, _i, _len, _ref;
|
5241
|
-
this.debug("Get Query Options");
|
5242
|
-
options = this.queryOptions || (this.queryOptions = {});
|
5243
|
-
_ref = this.optionsSources;
|
5244
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
5245
|
-
optionSource = _ref[_i];
|
5246
|
-
options = _.extend(options, optionSource() || {});
|
5247
|
-
}
|
5248
|
-
return options;
|
5249
6028
|
}
|
5250
6029
|
});
|
5251
6030
|
|
@@ -5335,11 +6114,12 @@
|
|
5335
6114
|
"click a.prev": "previousPage"
|
5336
6115
|
},
|
5337
6116
|
afterInitialize: function() {
|
5338
|
-
var
|
6117
|
+
var _ref,
|
6118
|
+
_this = this;
|
5339
6119
|
_.bindAll(this, "updateWithPageCount");
|
5340
|
-
return this.state.on("change", function(state, numberOfPages) {
|
6120
|
+
return (_ref = this.state) != null ? _ref.on("change", function(state, numberOfPages) {
|
5341
6121
|
return _this.updateWithPageCount(state.get('numberOfPages'));
|
5342
|
-
});
|
6122
|
+
}) : void 0;
|
5343
6123
|
},
|
5344
6124
|
limit: function() {
|
5345
6125
|
var _ref;
|
@@ -5398,7 +6178,6 @@
|
|
5398
6178
|
this.pageCount = pageCount;
|
5399
6179
|
if (models == null) models = [];
|
5400
6180
|
modelCount = models.length;
|
5401
|
-
console.log("Update With Page Count", this.pageCount, modelCount);
|
5402
6181
|
this.pageButtonContainer().empty();
|
5403
6182
|
_(this.pageCount).times(function(index) {
|
5404
6183
|
var button, page;
|
@@ -5655,15 +6434,17 @@
|
|
5655
6434
|
"": "default"
|
5656
6435
|
},
|
5657
6436
|
initialize: function(options) {
|
5658
|
-
var
|
6437
|
+
var _ref,
|
6438
|
+
_this = this;
|
5659
6439
|
this.options = options;
|
5660
6440
|
_.extend(this, this.options);
|
5661
6441
|
this.routeHandlers = _(this.routes).values();
|
5662
|
-
|
6442
|
+
_(this.routeHandlers).each(function(route_id) {
|
5663
6443
|
return _this.bind("route:" + route_id, function() {
|
5664
6444
|
return _this.trigger.apply(_this, ["change:navigation", route_id].concat(_(arguments).flatten()));
|
5665
6445
|
});
|
5666
6446
|
});
|
6447
|
+
return (_ref = Backbone.Router.initialize) != null ? _ref.apply(this, arguments) : void 0;
|
5667
6448
|
},
|
5668
6449
|
navigate: function(route, triggerRoute) {
|
5669
6450
|
if (triggerRoute == null) triggerRoute = false;
|
@@ -5696,22 +6477,25 @@
|
|
5696
6477
|
itemTagName: "tr",
|
5697
6478
|
stateful: true,
|
5698
6479
|
observeChanges: true,
|
6480
|
+
widths: [],
|
5699
6481
|
columns: [],
|
5700
6482
|
emptyText: "There are no results to display",
|
5701
6483
|
itemRenderer: function(item, model) {
|
5702
6484
|
return Luca.components.TableView.rowRenderer.call(this, item, model);
|
5703
6485
|
},
|
5704
6486
|
initialize: function(options) {
|
5705
|
-
var column,
|
6487
|
+
var column, index, width,
|
5706
6488
|
_this = this;
|
5707
6489
|
this.options = options != null ? options : {};
|
5708
6490
|
Luca.components.CollectionView.prototype.initialize.apply(this, arguments);
|
6491
|
+
index = 0;
|
5709
6492
|
this.columns = (function() {
|
5710
6493
|
var _i, _len, _ref, _results;
|
5711
6494
|
_ref = this.columns;
|
5712
6495
|
_results = [];
|
5713
6496
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
5714
6497
|
column = _ref[_i];
|
6498
|
+
if (width = this.widths[index]) column.width = width;
|
5715
6499
|
if (_.isString(column)) {
|
5716
6500
|
column = {
|
5717
6501
|
reader: column
|
@@ -5720,6 +6504,7 @@
|
|
5720
6504
|
if (!(column.header != null)) {
|
5721
6505
|
column.header = _.str.titleize(_.str.humanize(column.reader));
|
5722
6506
|
}
|
6507
|
+
index++;
|
5723
6508
|
_results.push(column);
|
5724
6509
|
}
|
5725
6510
|
return _results;
|