luca 0.9.65 → 0.9.76

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/CHANGELOG +30 -0
  2. data/Gemfile +1 -0
  3. data/Gemfile.lock +27 -0
  4. data/lib/luca/rails/version.rb +1 -1
  5. data/spec/components/controller_spec.coffee +58 -0
  6. data/spec/components/form_view_spec.coffee +4 -0
  7. data/spec/concerns/dom_helpers_spec.coffee +16 -0
  8. data/spec/{modules → concerns}/filterable_spec.coffee +0 -0
  9. data/spec/concerns/model_presenter_spec.coffee +31 -0
  10. data/spec/{modules → concerns}/paginatable_spec.coffee +0 -0
  11. data/spec/{modules → concerns}/state_model_spec.coffee +0 -0
  12. data/spec/concerns_spec.coffee +88 -0
  13. data/spec/core/container_spec.coffee +103 -6
  14. data/spec/core/field_spec.coffee +4 -0
  15. data/spec/core/model_spec.coffee +6 -1
  16. data/spec/define_spec.coffee +104 -7
  17. data/spec/framework_spec.coffee +30 -1
  18. data/spec/util_spec.coffee +24 -0
  19. data/src/components/application.coffee +62 -25
  20. data/src/components/base_toolbar.coffee +6 -4
  21. data/src/components/collection_loader_view.coffee +3 -1
  22. data/src/components/collection_view.coffee +36 -73
  23. data/src/components/controller.coffee +73 -35
  24. data/src/components/fields/button_field.coffee +20 -12
  25. data/src/components/fields/checkbox_array.coffee +8 -2
  26. data/src/components/fields/checkbox_field.coffee +18 -9
  27. data/src/components/fields/file_upload_field.coffee +5 -1
  28. data/src/components/fields/hidden_field.coffee +3 -1
  29. data/src/components/fields/label_field.coffee +4 -3
  30. data/src/components/fields/select_field.coffee +7 -8
  31. data/src/components/fields/text_area_field.coffee +3 -2
  32. data/src/components/fields/text_field.coffee +5 -4
  33. data/src/components/fields/type_ahead_field.coffee +4 -2
  34. data/src/components/form_button_toolbar.coffee +4 -1
  35. data/src/components/form_view.coffee +26 -24
  36. data/src/components/grid_view.coffee +3 -3
  37. data/src/components/multi_collection_view.coffee +6 -35
  38. data/src/components/pagination_control.coffee +1 -3
  39. data/src/components/router.coffee +2 -0
  40. data/src/components/table_view.coffee +7 -0
  41. data/src/concerns.coffee +70 -0
  42. data/src/{modules → concerns}/application_event_bindings.coffee +1 -1
  43. data/src/{modules → concerns}/collection_event_bindings.coffee +1 -1
  44. data/src/{modules → concerns}/deferrable.coffee +1 -1
  45. data/src/{modules → concerns}/dom_helpers.coffee +11 -2
  46. data/src/{modules → concerns}/enhanced_properties.coffee +1 -1
  47. data/src/{modules → concerns}/filterable.coffee +11 -11
  48. data/src/{modules → concerns}/grid_layout.coffee +1 -1
  49. data/src/{modules → concerns}/loadmaskable.coffee +1 -1
  50. data/src/{modules → concerns}/local_storage.coffee +0 -0
  51. data/src/{modules → concerns}/modal_view.coffee +1 -1
  52. data/src/concerns/model_presenter.coffee +23 -0
  53. data/src/{modules → concerns}/paginatable.coffee +9 -3
  54. data/src/concerns/query_collection_bindings.coffee +44 -0
  55. data/src/{modules → concerns}/state_model.coffee +1 -1
  56. data/src/{modules → concerns}/templating.coffee +1 -1
  57. data/src/containers/card_view.coffee +16 -9
  58. data/src/containers/tab_view.coffee +8 -11
  59. data/src/containers/viewport.coffee +3 -3
  60. data/src/core/collection.coffee +39 -28
  61. data/src/core/container.coffee +37 -15
  62. data/src/core/field.coffee +40 -39
  63. data/src/core/meta_data.coffee +93 -0
  64. data/src/core/model.coffee +18 -1
  65. data/src/core/registry.coffee +4 -3
  66. data/src/core/view.coffee +24 -30
  67. data/src/define.coffee +165 -79
  68. data/src/framework.coffee +97 -21
  69. data/src/index.coffee +4 -2
  70. data/src/managers/collection_manager.coffee +7 -3
  71. data/src/stylesheets/components/checkbox_array.scss +1 -1
  72. data/src/stylesheets/components/form_view.scss +5 -5
  73. data/src/stylesheets/components/viewport.scss +2 -1
  74. data/src/stylesheets/containers/container.scss +0 -5
  75. data/src/stylesheets/containers/tab_view.scss +5 -5
  76. data/src/templates/fields/text_area_field.jst.ejs +1 -1
  77. data/src/templates/fields/text_field.jst.ejs +1 -1
  78. data/src/util.coffee +47 -0
  79. data/vendor/assets/javascripts/luca-ui-full.js +1279 -494
  80. data/vendor/assets/javascripts/luca-ui-full.min.js +5 -5
  81. data/vendor/assets/javascripts/luca-ui-templates.js +2 -2
  82. data/vendor/assets/javascripts/luca-ui.js +1279 -494
  83. data/vendor/assets/javascripts/luca-ui.min.js +5 -4
  84. data/vendor/assets/stylesheets/luca-ui.css +15 -15
  85. metadata +27 -20
  86. data/spec/mixin_spec.coffee +0 -49
@@ -1,4 +1,5 @@
1
- (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>&nbsp;</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){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
2
- ,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;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"
3
- ),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(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"
4
- ),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").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);
1
+ (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>&nbsp;</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 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
2
+ .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(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 _
3
+ (["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(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"?
4
+ 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("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)
5
+ ):(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);
@@ -1,27 +1,27 @@
1
- .luca-ui-checkbox-array input.array-checkbox {
1
+ .luca-ui-checkbox-array input.array-checkbox, .luca-checkbox-array input.array-checkbox {
2
2
  display: inline-block; }
3
- .luca-ui-form-view-wrapper {
3
+ .luca-form-view {
4
4
  width: 100%;
5
5
  float: left;
6
6
  display: block;
7
7
  clear: both;
8
8
  margin: 10px 0px; }
9
9
 
10
- .luca-ui-form-view .luca-ui-field {
10
+ .luca-form-view .luca-ui-field {
11
11
  margin: 5px;
12
12
  padding: 5px; }
13
- .luca-ui-form-view .luca-ui-field .helper-text {
13
+ .luca-form-view .luca-ui-field .helper-text {
14
14
  font-size: 0.75em;
15
15
  font-color: #ccc; }
16
16
 
17
- .luca-ui-form-view.label-align-top .luca-ui-field label, .luca-ui-form-view.label-align-top .luca-ui-field input, .luca-ui-form-view.label-align-top .luca-ui-field select, .luca-ui-form-view.label-align-top .luca-ui-field textarea {
17
+ .luca-form-view.label-align-top .luca-ui-field label, .luca-form-view.label-align-top .luca-ui-field input, .luca-form-view.label-align-top .luca-ui-field select, .luca-form-view.label-align-top .luca-ui-field textarea {
18
18
  margin: 5px 0px;
19
19
  display: block; }
20
20
 
21
- .luca-ui-form-view.column-layout .luca-ui-field {
21
+ .luca-form-view.column-layout .luca-ui-field {
22
22
  float: left; }
23
23
 
24
- .luca-ui-form-view .toolbar-container {
24
+ .luca-form-view .toolbar-container {
25
25
  padding-right: 12px; }
26
26
 
27
27
  /* support for older form view config */
@@ -124,7 +124,7 @@ html.luca-ui-fullscreen, body.luca-ui-fullscreen {
124
124
 
125
125
  .luca-ui-fullscreen .fluid-viewport-wrapper {
126
126
  padding-top: 40px; }
127
- .luca-ui-fullscreen .luca-ui-viewport, .luca-ui-fullscreen .fullscreen-container {
127
+ .luca-ui-fullscreen .luca-viewport, .luca-ui-fullscreen .luca-ui-viewport, .luca-ui-fullscreen .fullscreen-container {
128
128
  min-height: 100%;
129
129
  height: auto !important;
130
130
  height: 100%; }
@@ -151,23 +151,23 @@ html.luca-ui-fullscreen, body.luca-ui-fullscreen {
151
151
  .luca-ui-toolbar.toolbar-top {
152
152
  border-bottom-left-radius: 0px;
153
153
  border-bottom-right-radius: 0px; }
154
- .luca-ui-tab-view .luca-ui-card .luca-ui-grid-view, .luca-ui-tab-view .luca-ui-card .luca-ui-form-view, .luca-ui-tab-view .luca-ui-card .luca-ui-card {
154
+ .luca-tab-view .luca-ui-card .luca-ui-grid-view, .luca-tab-view .luca-ui-card .luca-form-view, .luca-tab-view .luca-ui-card .luca-ui-card {
155
155
  overflow: hidden; }
156
156
 
157
- .luca-ui-tab-view.tabs-below .tab-selector-container, .luca-ui-tab-view.tabs-right .tab-selector-container {
157
+ .luca-tab-view.tabs-below .tab-selector-container, .luca-tab-view.tabs-right .tab-selector-container {
158
158
  display: block;
159
159
  clear: both; }
160
160
 
161
- .luca-ui-tab-view.tabs-left .tab-selector-container {
161
+ .luca-tab-view.tabs-left .tab-selector-container {
162
162
  float: left; }
163
- .luca-ui-tab-view.tabs-left .tab-selector-container ul.nav-tabs {
163
+ .luca-tab-view.tabs-left .tab-selector-container ul.nav-tabs {
164
164
  padding: 0px; }
165
- .luca-ui-tab-view.tabs-left .tab-content {
165
+ .luca-tab-view.tabs-left .tab-content {
166
166
  float: left; }
167
167
 
168
- .luca-ui-tab-view.tabs-right .tab-selector-container {
168
+ .luca-tab-view.tabs-right .tab-selector-container {
169
169
  float: right; }
170
- .luca-ui-tab-view.tabs-right .tab-content {
170
+ .luca-tab-view.tabs-right .tab-content {
171
171
  float: left; }
172
172
  /* normalize.css 2011-11-04T15:38 UTC - http://github.com/necolas/normalize.css */
173
173
  /* =============================================================================
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: luca
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.65
4
+ version: 0.9.76
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-26 00:00:00.000000000 Z
12
+ date: 2012-12-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -255,6 +255,12 @@ files:
255
255
  - spec/components/record_manager_spec.coffee
256
256
  - spec/components/table_view_spec.coffee
257
257
  - spec/components/template_spec.coffee
258
+ - spec/concerns/dom_helpers_spec.coffee
259
+ - spec/concerns/filterable_spec.coffee
260
+ - spec/concerns/model_presenter_spec.coffee
261
+ - spec/concerns/paginatable_spec.coffee
262
+ - spec/concerns/state_model_spec.coffee
263
+ - spec/concerns_spec.coffee
258
264
  - spec/containers/card_view_spec.coffee
259
265
  - spec/containers/column_view_spec.coffee
260
266
  - spec/containers/modal_view_spec.coffee
@@ -273,10 +279,7 @@ files:
273
279
  - spec/helper.coffee
274
280
  - spec/managers/collection_manager_spec.coffee
275
281
  - spec/managers/socket_manager_spec.coffee
276
- - spec/mixin_spec.coffee
277
- - spec/modules/filterable_spec.coffee
278
- - spec/modules/paginatable_spec.coffee
279
- - spec/modules/state_model_spec.coffee
282
+ - spec/util_spec.coffee
280
283
  - src/components/application.coffee
281
284
  - src/components/base_toolbar.coffee
282
285
  - src/components/collection_loader_view.coffee
@@ -306,6 +309,22 @@ files:
306
309
  - src/components/table_view.coffee
307
310
  - src/components/template.coffee
308
311
  - src/components/toolbar_dialog.coffee
312
+ - src/concerns.coffee
313
+ - src/concerns/application_event_bindings.coffee
314
+ - src/concerns/collection_event_bindings.coffee
315
+ - src/concerns/deferrable.coffee
316
+ - src/concerns/dom_helpers.coffee
317
+ - src/concerns/enhanced_properties.coffee
318
+ - src/concerns/filterable.coffee
319
+ - src/concerns/grid_layout.coffee
320
+ - src/concerns/loadmaskable.coffee
321
+ - src/concerns/local_storage.coffee
322
+ - src/concerns/modal_view.coffee
323
+ - src/concerns/model_presenter.coffee
324
+ - src/concerns/paginatable.coffee
325
+ - src/concerns/query_collection_bindings.coffee
326
+ - src/concerns/state_model.coffee
327
+ - src/concerns/templating.coffee
309
328
  - src/containers/card_view.coffee
310
329
  - src/containers/column_view.coffee
311
330
  - src/containers/modal_view.coffee
@@ -319,6 +338,7 @@ files:
319
338
  - src/core/container.coffee
320
339
  - src/core/core.coffee
321
340
  - src/core/field.coffee
341
+ - src/core/meta_data.coffee
322
342
  - src/core/model.coffee
323
343
  - src/core/observer.coffee
324
344
  - src/core/panel.coffee
@@ -330,19 +350,6 @@ files:
330
350
  - src/index.coffee
331
351
  - src/managers/collection_manager.coffee
332
352
  - src/managers/socket_manager.coffee
333
- - src/modules/application_event_bindings.coffee
334
- - src/modules/collection_event_bindings.coffee
335
- - src/modules/deferrable.coffee
336
- - src/modules/dom_helpers.coffee
337
- - src/modules/enhanced_properties.coffee
338
- - src/modules/filterable.coffee
339
- - src/modules/grid_layout.coffee
340
- - src/modules/loadmaskable.coffee
341
- - src/modules/local_storage.coffee
342
- - src/modules/modal_view.coffee
343
- - src/modules/paginatable.coffee
344
- - src/modules/state_model.coffee
345
- - src/modules/templating.coffee
346
353
  - src/plugins/development_tool_helpers.coffee
347
354
  - src/plugins/events.coffee
348
355
  - src/samples/definition.coffee
@@ -504,7 +511,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
504
511
  version: '0'
505
512
  segments:
506
513
  - 0
507
- hash: 2087813978207561883
514
+ hash: 807756551929837435
508
515
  required_rubygems_version: !ruby/object:Gem::Requirement
509
516
  none: false
510
517
  requirements:
@@ -1,49 +0,0 @@
1
- describe 'The Mixin System', ->
2
-
3
- window.Luca ||= {}
4
-
5
- Luca.mixin.namespace 'Luca.test_modules'
6
-
7
- Luca.test_modules =
8
- SecondMixin:
9
- __included: ()->
10
- window.secondMixinIncluded = true
11
- __initializer: ()->
12
- @trigger "second:mixin"
13
- FirstMixin:
14
- __initializer: ()->
15
- @trigger "first:mixin"
16
- __privateMethod: ()->
17
- true
18
- publicMethod: ()->
19
- true
20
-
21
- sampleView = Luca.register('Luca.components.FirstView')
22
-
23
- sampleView.mixesIn 'FirstMixin'
24
-
25
- sampleView.defines
26
- sampleMethod: ()->
27
- "sample"
28
-
29
- secondView = Luca.register("Luca.components.SecondView")
30
- secondView.extends 'Luca.components.FirstView'
31
- secondView.mixesIn 'SecondMixin'
32
- secondView.defines
33
- version: 2
34
-
35
- it "should omit the private methods defined on the mixin", ->
36
- sampleView = new Luca.components.FirstView
37
- expect( sampleView.__privateMethod ).not.toBeDefined()
38
-
39
- it "should extend the prototype with the mixins normal methods", ->
40
- sampleView = new Luca.components.FirstView
41
- expect( sampleView.publicMethod ).toBeDefined()
42
-
43
- it "should call the initializer for that module on the instance", ->
44
- secondView = new Luca.components.SecondView
45
- expect( secondView ).toHaveTriggered("second:mixin")
46
-
47
- it "should call the initializers up the prototype chain", ->
48
- secondView = new Luca.components.SecondView
49
- expect( secondView ).toHaveTriggered("first:mixin")