luca 0.9.42 → 0.9.65

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/CHANGELOG +50 -9
  2. data/Gemfile +1 -0
  3. data/Gemfile.lock +2 -0
  4. data/README.md +5 -0
  5. data/assets/javascripts/dependencies/underscore-min.js +5 -31
  6. data/lib/generators/luca/application/application_generator.rb +71 -0
  7. data/lib/generators/luca/application/templates/controller.rb +6 -0
  8. data/lib/generators/luca/application/templates/index.html.erb +7 -0
  9. data/lib/generators/luca/application/templates/index.html.haml +6 -0
  10. data/lib/generators/luca/application/templates/javascripts/application.js +28 -0
  11. data/lib/generators/luca/application/templates/javascripts/application.js.coffee +20 -0
  12. data/lib/generators/luca/application/templates/javascripts/config.js +15 -0
  13. data/lib/generators/luca/application/templates/javascripts/config.js.coffee +9 -0
  14. data/lib/generators/luca/application/templates/javascripts/dependencies.js +5 -0
  15. data/lib/generators/luca/application/templates/javascripts/dependencies.js.coffee +5 -0
  16. data/lib/generators/luca/application/templates/javascripts/index.js +9 -0
  17. data/lib/generators/luca/application/templates/javascripts/index.js.coffee +9 -0
  18. data/lib/generators/luca/application/templates/javascripts/main.js +8 -0
  19. data/lib/generators/luca/application/templates/javascripts/main.js.coffee +3 -0
  20. data/lib/generators/luca/application/templates/javascripts/main.jst.ejs +1 -0
  21. data/lib/generators/luca/application/templates/javascripts/router.js +12 -0
  22. data/lib/generators/luca/application/templates/javascripts/router.js.coffee +7 -0
  23. data/lib/luca/rails/version.rb +1 -1
  24. data/spec/components/collection_view_spec.coffee +59 -0
  25. data/spec/components/multi_collection_view_spec.coffee +5 -0
  26. data/{src/templates/components/form_alert → spec/components/pagination_control_spec.coffee} +0 -0
  27. data/spec/components/table_view_spec.coffee +17 -0
  28. data/spec/core/container_spec.coffee +127 -5
  29. data/spec/core/model_spec.coffee +21 -3
  30. data/spec/define_spec.coffee +19 -0
  31. data/spec/mixin_spec.coffee +49 -0
  32. data/spec/modules/filterable_spec.coffee +25 -0
  33. data/spec/modules/paginatable_spec.coffee +0 -0
  34. data/spec/modules/state_model_spec.coffee +0 -0
  35. data/src/components/application.coffee +52 -38
  36. data/src/components/collection_view.coffee +118 -45
  37. data/src/components/fields/checkbox_field.coffee +2 -2
  38. data/src/components/fields/file_upload_field.coffee +0 -3
  39. data/src/components/fields/hidden_field.coffee +0 -3
  40. data/src/components/fields/label_field.coffee +1 -4
  41. data/src/components/fields/select_field.coffee +6 -6
  42. data/src/components/fields/text_area_field.coffee +1 -0
  43. data/src/components/fields/text_field.coffee +4 -0
  44. data/src/components/fields/type_ahead_field.coffee +5 -9
  45. data/src/components/form_view.coffee +28 -23
  46. data/src/components/multi_collection_view.coffee +121 -0
  47. data/src/components/pagination_control.coffee +106 -0
  48. data/src/components/table_view.coffee +22 -13
  49. data/src/containers/card_view.coffee +44 -11
  50. data/src/containers/panel_toolbar.coffee +88 -82
  51. data/src/containers/tab_view.coffee +3 -3
  52. data/src/core/collection.coffee +11 -4
  53. data/src/core/container.coffee +206 -122
  54. data/src/core/field.coffee +13 -10
  55. data/src/core/model.coffee +23 -27
  56. data/src/core/registry.coffee +42 -29
  57. data/src/core/view.coffee +63 -149
  58. data/src/define.coffee +91 -19
  59. data/src/framework.coffee +11 -9
  60. data/src/managers/collection_manager.coffee +24 -8
  61. data/src/modules/application_event_bindings.coffee +19 -0
  62. data/src/modules/collection_event_bindings.coffee +26 -0
  63. data/src/modules/deferrable.coffee +3 -1
  64. data/src/modules/dom_helpers.coffee +49 -0
  65. data/src/modules/enhanced_properties.coffee +23 -0
  66. data/src/modules/filterable.coffee +82 -0
  67. data/src/modules/grid_layout.coffee +13 -1
  68. data/src/modules/{load_mask.coffee → loadmaskable.coffee} +10 -4
  69. data/src/modules/modal_view.coffee +38 -0
  70. data/src/modules/paginatable.coffee +87 -0
  71. data/src/modules/state_model.coffee +16 -0
  72. data/src/modules/templating.coffee +8 -0
  73. data/src/plugins/events.coffee +30 -2
  74. data/src/templates/components/bootstrap_form_controls.jst.ejs +10 -0
  75. data/src/templates/components/collection_loader_view.jst.ejs +6 -0
  76. data/src/templates/components/form_alert.jst.ejs +4 -0
  77. data/src/templates/components/grid_view.jst.ejs +11 -0
  78. data/src/templates/components/grid_view_empty_text.jst.ejs +3 -0
  79. data/src/templates/components/load_mask.jst.ejs +5 -0
  80. data/src/templates/components/nav_bar.jst.ejs +4 -0
  81. data/src/templates/components/pagination.jst.ejs +10 -0
  82. data/src/templates/containers/basic.jst.ejs +1 -0
  83. data/src/templates/containers/tab_selector_container.jst.ejs +12 -0
  84. data/src/templates/containers/tab_view.jst.ejs +2 -0
  85. data/src/templates/containers/toolbar_wrapper.jst.ejs +1 -0
  86. data/src/templates/fields/button_field.jst.ejs +2 -0
  87. data/src/templates/fields/button_field_link.jst.ejs +6 -0
  88. data/src/templates/fields/checkbox_array.jst.ejs +4 -0
  89. data/src/templates/fields/checkbox_array_item.jst.ejs +3 -0
  90. data/src/templates/fields/checkbox_field.jst.ejs +10 -0
  91. data/src/templates/fields/file_upload_field.jst.ejs +10 -0
  92. data/src/templates/fields/hidden_field.jst.ejs +1 -0
  93. data/src/templates/fields/select_field.jst.ejs +11 -0
  94. data/src/templates/fields/text_area_field.jst.ejs +11 -0
  95. data/src/templates/fields/text_field.jst.ejs +16 -0
  96. data/src/templates/table_view.jst.ejs +4 -0
  97. data/src/tools/console.coffee +51 -21
  98. data/src/util.coffee +17 -4
  99. data/vendor/assets/javascripts/luca-ui-base.js +5304 -0
  100. data/vendor/assets/javascripts/luca-ui-bootstrap.js +9 -0
  101. data/vendor/assets/javascripts/luca-ui-development-tools.js +52 -24
  102. data/vendor/assets/javascripts/luca-ui-development-tools.min.js +1 -1
  103. data/vendor/assets/javascripts/luca-ui-full.js +1700 -595
  104. data/vendor/assets/javascripts/luca-ui-full.min.js +7 -6
  105. data/vendor/assets/javascripts/luca-ui-spec.js +6815 -0
  106. data/vendor/assets/javascripts/luca-ui-templates.js +92 -24
  107. data/vendor/assets/javascripts/luca-ui.js +1695 -564
  108. data/vendor/assets/javascripts/luca-ui.min.js +4 -4
  109. metadata +69 -28
  110. data/src/templates/components/bootstrap_form_controls.luca +0 -7
  111. data/src/templates/components/collection_loader_view.luca +0 -5
  112. data/src/templates/components/form_alert.luca +0 -3
  113. data/src/templates/components/grid_view.luca +0 -7
  114. data/src/templates/components/grid_view_empty_text.luca +0 -3
  115. data/src/templates/components/load_mask.luca +0 -3
  116. data/src/templates/components/nav_bar.luca +0 -2
  117. data/src/templates/containers/basic.luca +0 -1
  118. data/src/templates/containers/tab_selector_container.luca +0 -8
  119. data/src/templates/containers/tab_view.luca +0 -2
  120. data/src/templates/containers/toolbar_wrapper.luca +0 -1
  121. data/src/templates/fields/button_field.luca +0 -2
  122. data/src/templates/fields/button_field_link.luca +0 -5
  123. data/src/templates/fields/checkbox_array.luca +0 -4
  124. data/src/templates/fields/checkbox_array_item.luca +0 -4
  125. data/src/templates/fields/checkbox_field.luca +0 -9
  126. data/src/templates/fields/file_upload_field.luca +0 -8
  127. data/src/templates/fields/hidden_field.luca +0 -1
  128. data/src/templates/fields/select_field.luca +0 -8
  129. data/src/templates/fields/text_area_field.luca +0 -8
  130. data/src/templates/fields/text_field.luca +0 -17
  131. data/src/templates/sample/contents.luca +0 -1
  132. data/src/templates/sample/welcome.luca +0 -1
  133. data/src/templates/table_view.luca +0 -4
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Bootstrap.js by @fat & @mdo
3
+ * plugins: bootstrap-transition.js, bootstrap-modal.js, bootstrap-dropdown.js, bootstrap-tooltip.js, bootstrap-popover.js, bootstrap-alert.js, bootstrap-button.js, bootstrap-collapse.js, bootstrap-typeahead.js
4
+ * Copyright 2012 Twitter, Inc.
5
+ * http://www.apache.org/licenses/LICENSE-2.0.txt
6
+ */
7
+
8
+ !function(a){a(function(){a.support.transition=function(){var a=function(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd",transition:"transitionend"},c;for(c in b)if(a.style[c]!==undefined)return b[c]}();return a&&{end:a}}()})}(window.jQuery),!function(a){function c(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),d.call(b)},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),d.call(b)})}function d(a){this.$element.hide().trigger("hidden"),e.call(this)}function e(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(a.proxy(this.hide,this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),e?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,a.proxy(f,this)):f.call(this)):b&&b()}function f(){this.$backdrop.remove(),this.$backdrop=null}function g(){var b=this;this.isShown&&this.options.keyboard?a(document).on("keyup.dismiss.modal",function(a){a.which==27&&b.hide()}):this.isShown||a(document).off("keyup.dismiss.modal")}var b=function(b,c){this.options=c,this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this))};b.prototype={constructor:b,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this,c=a.Event("show");this.$element.trigger(c);if(this.isShown||c.isDefaultPrevented())return;a("body").addClass("modal-open"),this.isShown=!0,g.call(this),e.call(this,function(){var c=a.support.transition&&b.$element.hasClass("fade");b.$element.parent().length||b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in"),c?b.$element.one(a.support.transition.end,function(){b.$element.trigger("shown")}):b.$element.trigger("shown")})},hide:function(b){b&&b.preventDefault();var e=this;b=a.Event("hide"),this.$element.trigger(b);if(!this.isShown||b.isDefaultPrevented())return;this.isShown=!1,a("body").removeClass("modal-open"),g.call(this),this.$element.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?c.call(this):d.call(this)}},a.fn.modal=function(c){return this.each(function(){var d=a(this),e=d.data("modal"),f=a.extend({},a.fn.modal.defaults,d.data(),typeof c=="object"&&c);e||d.data("modal",e=new b(this,f)),typeof c=="string"?e[c]():f.show&&e.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},a.fn.modal.Constructor=b,a(function(){a("body").on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({},e.data(),c.data());b.preventDefault(),e.modal(f)})})}(window.jQuery),!function(a){function d(){a(b).parent().removeClass("open")}var b='[data-toggle="dropdown"]',c=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};c.prototype={constructor:c,toggle:function(b){var c=a(this),e,f,g;if(c.is(".disabled, :disabled"))return;return f=c.attr("data-target"),f||(f=c.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,"")),e=a(f),e.length||(e=c.parent()),g=e.hasClass("open"),d(),g||e.toggleClass("open"),!1}},a.fn.dropdown=function(b){return this.each(function(){var d=a(this),e=d.data("dropdown");e||d.data("dropdown",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.dropdown.Constructor=c,a(function(){a("html").on("click.dropdown.data-api",d),a("body").on("click.dropdown",".dropdown form",function(a){a.stopPropagation()}).on("click.dropdown.data-api",b,c.prototype.toggle)})}(window.jQuery),!function(a){var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,this.options.trigger!="manual"&&(e=this.options.trigger=="hover"?"mouseenter":"focus",f=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(e,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.show)return c.show();clearTimeout(this.timeout),c.hoverState="in",this.timeout=setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show)},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.hide)return c.hide();clearTimeout(this.timeout),c.hoverState="out",this.timeout=setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide)},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f=typeof this.options.placement=="function"?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.remove().css({top:0,left:0,display:"block"}).appendTo(b?this.$element:document.body),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight;switch(b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.css(g).addClass(f).addClass("in")}},isHTML:function(a){return typeof a!="string"||a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3||/^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(a)},setContent:function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.isHTML(b)?"html":"text"](b),a.removeClass("fade in top bottom left right")},hide:function(){function d(){var b=setTimeout(function(){c.off(a.support.transition.end).remove()},500);c.one(a.support.transition.end,function(){clearTimeout(b),c.remove()})}var b=this,c=this.tip();c.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d():c.remove()},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(b){return a.extend({},b?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a},tip:function(){return this.$tip=this.$tip||a(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()}},a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("tooltip"),f=typeof c=="object"&&c;e||d.data("tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover",title:"",delay:0}}(window.jQuery),!function(a){var b=function(a,b){this.init("popover",a,b)};b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype,{constructor:b,setContent:function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.isHTML(b)?"html":"text"](b),a.find(".popover-content > *")[this.isHTML(c)?"html":"text"](c),a.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-content")||(typeof c.content=="function"?c.content.call(b[0]):c.content),a},tip:function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip}}),a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("popover"),f=typeof c=="object"&&c;e||d.data("popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.defaults=a.extend({},a.fn.tooltip.defaults,{placement:"right",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'})}(window.jQuery),!function(a){var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function f(){e.trigger("closed").remove()}var c=a(this),d=c.attr("data-target"),e;d||(d=c.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),e=a(d),b&&b.preventDefault(),e.length||(e=c.hasClass("alert")?c:c.parent()),e.trigger(b=a.Event("close"));if(b.isDefaultPrevented())return;e.removeClass("in"),a.support.transition&&e.hasClass("fade")?e.on(a.support.transition.end,f):f()},a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("alert");e||d.data("alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a(function(){a("body").on("click.alert.data-api",b,c.prototype.close)})}(window.jQuery),!function(a){var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.parent('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")},a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("button"),f=typeof c=="object"&&c;e||d.data("button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a(function(){a("body").on("click.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle")})})}(window.jQuery),!function(a){var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b,c,d,e;if(this.transitioning)return;b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find("> .accordion-group > .in");if(d&&d.length){e=d.data("collapse");if(e&&e.transitioning)return;d.collapse("hide"),e||d.data("collapse",null)}this.$element[b](0),this.transition("addClass",a.Event("show"),"shown"),this.$element[b](this.$element[0][c])},hide:function(){var b;if(this.transitioning)return;b=this.dimension(),this.reset(this.$element[b]()),this.transition("removeClass",a.Event("hide"),"hidden"),this.$element[b](0)},reset:function(a){var b=this.dimension();return this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element[a!==null?"addClass":"removeClass"]("collapse"),this},transition:function(b,c,d){var e=this,f=function(){c.type=="show"&&e.reset(),e.transitioning=0,e.$element.trigger(d)};this.$element.trigger(c);if(c.isDefaultPrevented())return;this.transitioning=1,this.$element[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("collapse"),f=typeof c=="object"&&c;e||d.data("collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a(function(){a("body").on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":c.data();a(e).collapse(f)})})}(window.jQuery),!function(a){var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.typeahead.defaults,c),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.$menu=a(this.options.menu).appendTo("body"),this.source=this.options.source,this.shown=!1,this.listen()};b.prototype={constructor:b,select:function(){var a=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(a)).change(),this.hide()},updater:function(a){return a},show:function(){var b=a.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:b.top+b.height,left:b.left}),this.$menu.show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(b){var c=this,d,e;return this.query=this.$element.val(),this.query?(d=a.grep(this.source,function(a){return c.matcher(a)}),d=this.sorter(d),d.length?this.render(d.slice(0,this.options.items)).show():this.shown?this.hide():this):this.shown?this.hide():this},matcher:function(a){return~a.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(a){var b=[],c=[],d=[],e;while(e=a.shift())e.toLowerCase().indexOf(this.query.toLowerCase())?~e.indexOf(this.query)?c.push(e):d.push(e):b.push(e);return b.concat(c,d)},highlighter:function(a){var b=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return a.replace(new RegExp("("+b+")","ig"),function(a,b){return"<strong>"+b+"</strong>"})},render:function(b){var c=this;return b=a(b).map(function(b,d){return b=a(c.options.item).attr("data-value",d),b.find("a").html(c.highlighter(d)),b[0]}),b.first().addClass("active"),this.$menu.html(b),this},next:function(b){var c=this.$menu.find(".active").removeClass("active"),d=c.next();d.length||(d=a(this.$menu.find("li")[0])),d.addClass("active")},prev:function(a){var b=this.$menu.find(".active").removeClass("active"),c=b.prev();c.length||(c=this.$menu.find("li").last()),c.addClass("active")},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),(a.browser.webkit||a.browser.msie)&&this.$element.on("keydown",a.proxy(this.keypress,this)),this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this))},keyup:function(a){switch(a.keyCode){case 40:case 38:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}a.stopPropagation(),a.preventDefault()},keypress:function(a){if(!this.shown)return;switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:if(a.type!="keydown")break;a.preventDefault(),this.prev();break;case 40:if(a.type!="keydown")break;a.preventDefault(),this.next()}a.stopPropagation()},blur:function(a){var b=this;setTimeout(function(){b.hide()},150)},click:function(a){a.stopPropagation(),a.preventDefault(),this.select()},mouseenter:function(b){this.$menu.find(".active").removeClass("active"),a(b.currentTarget).addClass("active")}},a.fn.typeahead=function(c){return this.each(function(){var d=a(this),e=d.data("typeahead"),f=typeof c=="object"&&c;e||d.data("typeahead",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>'},a.fn.typeahead.Constructor=b,a(function(){a("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(b){var c=a(this);if(c.data("typeahead"))return;b.preventDefault(),c.typeahead(c.data())})})}(window.jQuery)
9
+ ;
@@ -18295,31 +18295,30 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
18295
18295
 
18296
18296
  }).call(this);
18297
18297
  (function() {
18298
- var codeMirrorOptions, _base;
18298
+ var developmentConsole, _base;
18299
18299
 
18300
- codeMirrorOptions = {
18301
- readOnly: true,
18302
- autoFocus: false,
18303
- theme: "monokai",
18304
- mode: "javascript"
18305
- };
18300
+ developmentConsole = Luca.register("Luca.tools.DevelopmentConsole");
18301
+
18302
+ developmentConsole["extends"]("Luca.core.Container");
18306
18303
 
18307
- Luca.define("Luca.tools.DevelopmentConsole")["extends"]("Luca.core.Container")["with"]({
18304
+ developmentConsole.defines({
18308
18305
  className: "luca-ui-console",
18309
18306
  name: "console",
18310
18307
  history: [],
18311
18308
  historyIndex: 0,
18309
+ width: 1000,
18312
18310
  componentEvents: {
18313
- "code_input key:keyup": "historyUp",
18314
- "code_input key:keydown": "historyDown",
18315
- "code_input key:enter": "runCommand"
18311
+ "input key:keyup": "historyUp",
18312
+ "input key:keydown": "historyDown",
18313
+ "input key:enter": "runCommand"
18316
18314
  },
18317
18315
  compileOptions: {
18318
18316
  bare: true
18319
18317
  },
18320
18318
  components: [
18321
18319
  {
18322
- ctype: "code_mirror_field",
18320
+ type: "code_mirror_field",
18321
+ role: "code_mirror",
18323
18322
  additionalClassNames: "clearfix",
18324
18323
  name: "code_output",
18325
18324
  readOnly: true,
@@ -18328,8 +18327,9 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
18328
18327
  lineWrapping: true,
18329
18328
  gutter: false
18330
18329
  }, {
18331
- ctype: "text_field",
18330
+ type: "text_field",
18332
18331
  name: "code_input",
18332
+ role: "input",
18333
18333
  lineNumbers: false,
18334
18334
  height: '30px',
18335
18335
  maxHeight: '30px',
@@ -18358,10 +18358,14 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
18358
18358
  }
18359
18359
  ],
18360
18360
  afterRender: function() {
18361
+ var marginLeft;
18361
18362
  this.$container().modal({
18362
18363
  backdrop: false
18363
18364
  });
18364
- return this.$container.css;
18365
+ if (this.width != null) {
18366
+ marginLeft = parseInt(this.width) * 0.5 * -1;
18367
+ return this.$container().css("width", this.width).css('margin-left', parseInt(marginLeft));
18368
+ }
18365
18369
  },
18366
18370
  show: function(options) {
18367
18371
  if (options == null) options = {};
@@ -18385,8 +18389,8 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
18385
18389
  var currentValue;
18386
18390
  this.historyIndex -= 1;
18387
18391
  if (this.historyIndex < 0) this.historyIndex = 0;
18388
- currentValue = Luca("code_input").getValue();
18389
- return Luca("code_input").setValue(this.history[this.historyIndex] || currentValue);
18392
+ currentValue = this.getInput().getValue();
18393
+ return this.getInput().setValue(this.history[this.historyIndex] || currentValue);
18390
18394
  },
18391
18395
  historyDown: function() {
18392
18396
  var currentValue;
@@ -18394,13 +18398,13 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
18394
18398
  if (this.historyIndex > this.history.length - 1) {
18395
18399
  this.historyIndex = this.history.length - 1;
18396
18400
  }
18397
- currentValue = Luca("code_input").getValue();
18398
- return Luca("code_input").setValue(this.history[this.historyIndex] || currentValue);
18401
+ currentValue = this.getInput().getValue();
18402
+ return this.getInput().setValue(this.history[this.historyIndex] || currentValue);
18399
18403
  },
18400
18404
  append: function(code, result, skipFormatting) {
18401
18405
  var current, output, payload, source;
18402
18406
  if (skipFormatting == null) skipFormatting = false;
18403
- output = Luca("code_output");
18407
+ output = this.getCodeMirror();
18404
18408
  current = output.getValue();
18405
18409
  if (code != null) source = "// " + code;
18406
18410
  payload = skipFormatting || code.match(/^console\.log/) ? [current, result] : [current, source, result];
@@ -18410,7 +18414,10 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
18410
18414
  onSuccess: function(result, js, coffee) {
18411
18415
  var dump;
18412
18416
  this.saveHistory(coffee);
18413
- dump = JSON.stringify(result, null, "\t");
18417
+ dump = "";
18418
+ if (_.isArray(result) || _.isObject(result) || _.isString(result) || _.isNumber(result)) {
18419
+ dump = JSON.stringify(result, null, "\t");
18420
+ }
18414
18421
  dump || (dump = typeof result.toString === "function" ? result.toString() : void 0);
18415
18422
  return this.append(js, dump || "undefined");
18416
18423
  },
@@ -18421,7 +18428,7 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
18421
18428
  var dev, evaluator, output, result;
18422
18429
  if (!((code != null ? code.length : void 0) > 0)) return;
18423
18430
  raw = _.string.strip(raw);
18424
- output = Luca("code_output");
18431
+ output = this.getCodeMirror();
18425
18432
  dev = this;
18426
18433
  evaluator = function() {
18427
18434
  var console, log, old_console, result;
@@ -18449,6 +18456,11 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
18449
18456
  };
18450
18457
  try {
18451
18458
  result = evaluator.call(this.getContext());
18459
+ if (Luca.isComponent(result)) {
18460
+ result = Luca.util.inspectComponent(result);
18461
+ } else if (Luca.isComponentPrototype(result)) {
18462
+ result = Luca.util.inspectComponentPrototype(result);
18463
+ }
18452
18464
  if (!raw.match(/^console\.log/)) return this.onSuccess(result, code, raw);
18453
18465
  } catch (error) {
18454
18466
  return this.onError(error, code, raw);
@@ -18458,7 +18470,7 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
18458
18470
  var compile, compiled, dev, raw;
18459
18471
  dev = this;
18460
18472
  compile = _.bind(Luca.tools.CoffeeEditor.prototype.compile, this);
18461
- raw = Luca("code_input").getValue();
18473
+ raw = this.getInput().getValue();
18462
18474
  return compiled = compile(raw, function(compiled) {
18463
18475
  return dev.evaluateCode(compiled, raw);
18464
18476
  });
@@ -18467,6 +18479,21 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
18467
18479
 
18468
18480
  (_base = Luca.util).launchers || (_base.launchers = {});
18469
18481
 
18482
+ Luca.util.inspectComponentPrototype = function(componentPrototype) {
18483
+ var liveInstances;
18484
+ return liveInstances = Luca.registry.findInstancesByClass(componentPrototype);
18485
+ };
18486
+
18487
+ Luca.util.inspectComponent = function(component) {
18488
+ if (_.isString(component)) component = Luca(component);
18489
+ return {
18490
+ name: component.name,
18491
+ instanceOf: component.displayName,
18492
+ subclassOf: component._superClass().prototype.displayName,
18493
+ inheritsFrom: Luca.parentClasses(component)
18494
+ };
18495
+ };
18496
+
18470
18497
  Luca.util.launchers.developmentConsole = function(name) {
18471
18498
  var _this = this;
18472
18499
  if (name == null) name = "luca-development-console";
@@ -18474,13 +18501,14 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
18474
18501
  var console;
18475
18502
  _this.$el.append(Backbone.View.prototype.make("div", {
18476
18503
  id: "" + name + "-wrapper",
18477
- "class": "modal fade"
18504
+ "class": "modal fade large"
18478
18505
  }));
18479
18506
  console = new Luca.tools.DevelopmentConsole({
18480
18507
  name: name,
18481
18508
  container: "#" + name + "-wrapper"
18482
18509
  });
18483
- return console.render();
18510
+ console.render();
18511
+ return console.getCodeMirror().setHeight(602);
18484
18512
  });
18485
18513
  return this._lucaDevConsole.show();
18486
18514
  };