luca 0.9.6 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +37 -14
- data/lib/luca/rails/version.rb +1 -1
- data/spec/components/collection_view_spec.coffee +24 -2
- data/spec/components/pagination_control_spec.coffee +0 -0
- data/spec/concerns/dom_helpers_spec.coffee +16 -0
- data/spec/concerns/filterable_spec.coffee +25 -0
- data/spec/concerns/model_presenter_spec.coffee +31 -0
- data/spec/concerns/paginatable_spec.coffee +0 -0
- data/spec/concerns/state_model_spec.coffee +0 -0
- data/spec/concerns_spec.coffee +88 -0
- data/spec/core/container_spec.coffee +74 -12
- data/spec/core/model_spec.coffee +6 -1
- data/spec/define_spec.coffee +0 -6
- data/spec/util_spec.coffee +24 -0
- data/src/components/application.coffee +32 -30
- data/src/components/base_toolbar.coffee +6 -4
- data/src/components/collection_loader_view.coffee +3 -1
- data/src/components/collection_view.coffee +42 -21
- data/src/components/controller.coffee +3 -1
- data/src/components/fields/button_field.coffee +19 -12
- data/src/components/fields/checkbox_array.coffee +8 -2
- data/src/components/fields/checkbox_field.coffee +18 -9
- data/src/components/fields/file_upload_field.coffee +5 -1
- data/src/components/fields/hidden_field.coffee +3 -1
- data/src/components/fields/label_field.coffee +4 -3
- data/src/components/fields/select_field.coffee +7 -8
- data/src/components/fields/text_field.coffee +3 -1
- data/src/components/fields/type_ahead_field.coffee +4 -2
- data/src/components/form_button_toolbar.coffee +4 -1
- data/src/components/form_view.coffee +49 -44
- data/src/components/grid_view.coffee +1 -1
- data/src/components/multi_collection_view.coffee +49 -22
- data/src/components/pagination_control.coffee +17 -13
- data/src/{modules → concerns}/application_event_bindings.coffee +1 -1
- data/src/{modules → concerns}/collection_event_bindings.coffee +1 -1
- data/src/{modules → concerns}/deferrable.coffee +1 -1
- data/src/{modules → concerns}/dom_helpers.coffee +11 -2
- data/src/{modules → concerns}/enhanced_properties.coffee +1 -1
- data/src/concerns/filterable.coffee +82 -0
- data/src/{modules → concerns}/grid_layout.coffee +1 -1
- data/src/{modules → concerns}/loadmaskable.coffee +1 -1
- data/src/{modules → concerns}/local_storage.coffee +0 -0
- data/src/{modules → concerns}/modal_view.coffee +1 -1
- data/src/concerns/model_presenter.coffee +23 -0
- data/src/concerns/paginatable.coffee +87 -0
- data/src/{modules → concerns}/state_model.coffee +1 -1
- data/src/{modules → concerns}/templating.coffee +1 -1
- data/src/concerns.coffee +70 -0
- data/src/containers/tab_view.coffee +7 -10
- data/src/core/collection.coffee +17 -1
- data/src/core/container.coffee +56 -31
- data/src/core/field.coffee +39 -38
- data/src/core/meta_data.coffee +37 -0
- data/src/core/model.coffee +18 -1
- data/src/core/view.coffee +25 -29
- data/src/define.coffee +54 -66
- data/src/framework.coffee +23 -18
- data/src/index.coffee +3 -1
- data/src/stylesheets/components/checkbox_array.scss +1 -1
- data/src/stylesheets/components/form_view.scss +5 -5
- data/src/stylesheets/components/viewport.scss +2 -1
- data/src/stylesheets/containers/container.scss +0 -5
- data/src/stylesheets/containers/tab_view.scss +5 -5
- data/src/tools/console.coffee +5 -5
- data/src/util.coffee +47 -0
- data/vendor/assets/javascripts/luca-ui-development-tools.js +5 -5
- data/vendor/assets/javascripts/luca-ui-development-tools.min.js +1 -1
- data/vendor/assets/javascripts/luca-ui-full.js +905 -416
- data/vendor/assets/javascripts/luca-ui-full.min.js +5 -5
- data/vendor/assets/javascripts/luca-ui.js +905 -416
- data/vendor/assets/javascripts/luca-ui.min.js +5 -4
- data/vendor/assets/stylesheets/luca-ui.css +15 -15
- metadata +27 -17
- data/spec/mixin_spec.coffee +0 -49
- data/src/modules/filterable.coffee +0 -60
- data/src/modules/paginatable.coffee +0 -79
data/src/define.coffee
CHANGED
@@ -13,6 +13,7 @@
|
|
13
13
|
# _.def("MyView").extends("Luca.View").with the_custom:"shit"
|
14
14
|
_.mixin
|
15
15
|
def: Luca.component = Luca.define = Luca.register = (componentName)-> new DefineProxy(componentName)
|
16
|
+
register: Luca.register
|
16
17
|
|
17
18
|
# The define proxy chain sets up a call to Luca.extend, which is a wrapper around Luca and Backbone component class' extend function.
|
18
19
|
class DefineProxy
|
@@ -20,6 +21,7 @@ class DefineProxy
|
|
20
21
|
@namespace = Luca.util.namespace()
|
21
22
|
@componentId = @componentName = componentName
|
22
23
|
@superClassName = 'Luca.View'
|
24
|
+
@properties ||= {}
|
23
25
|
|
24
26
|
if componentName.match(/\./)
|
25
27
|
@namespaced = true
|
@@ -30,6 +32,14 @@ class DefineProxy
|
|
30
32
|
# automatically add the namespace to the namespace registry
|
31
33
|
Luca.registry.addNamespace( parts.join('.') )
|
32
34
|
|
35
|
+
meta: (key, value)->
|
36
|
+
metaKey = @namespace + '.' + @componentId
|
37
|
+
metaKey = metaKey.replace(/^\./,'')
|
38
|
+
data = Luca.registry.addMetaData(metaKey, key, value)
|
39
|
+
|
40
|
+
@properties.componentMetaData = ()->
|
41
|
+
Luca.registry.getMetaDataFor(metaKey)
|
42
|
+
|
33
43
|
# allow for specifying the namespace
|
34
44
|
in: (@namespace)-> @
|
35
45
|
|
@@ -43,6 +53,7 @@ class DefineProxy
|
|
43
53
|
for hook in hooks
|
44
54
|
@properties.hooks.push(hook)
|
45
55
|
@properties.hooks = _.uniq(@properties.hooks)
|
56
|
+
@meta("hooks", @properties.hooks)
|
46
57
|
@
|
47
58
|
|
48
59
|
includes: (includes...)->
|
@@ -50,16 +61,35 @@ class DefineProxy
|
|
50
61
|
for include in includes
|
51
62
|
@properties.include.push(include)
|
52
63
|
@properties.include = _.uniq(@properties.include)
|
64
|
+
@meta("includes", @properties.include)
|
53
65
|
@
|
54
66
|
|
55
|
-
mixesIn: (
|
56
|
-
_.defaults(@properties ||= {},
|
57
|
-
for
|
58
|
-
@properties.
|
59
|
-
@properties.
|
67
|
+
mixesIn: (concerns...)->
|
68
|
+
_.defaults(@properties ||= {}, concerns: [])
|
69
|
+
for concern in concerns
|
70
|
+
@properties.concerns.push(concern)
|
71
|
+
@properties.concerns = _.uniq(@properties.concerns)
|
72
|
+
|
73
|
+
@meta("concerns", @properties.concerns)
|
60
74
|
@
|
61
75
|
|
62
|
-
|
76
|
+
publicConfiguration: (properties={})->
|
77
|
+
@meta("public configuration", _.keys(properties) )
|
78
|
+
_.defaults((@properties||={}), properties)
|
79
|
+
|
80
|
+
privateConfiguration: (properties={})->
|
81
|
+
@meta("private configuration", _.keys(properties) )
|
82
|
+
_.defaults((@properties||={}), properties)
|
83
|
+
|
84
|
+
publicInterface: (properties={})->
|
85
|
+
@meta("public interface", _.keys(properties) )
|
86
|
+
_.defaults((@properties||={}), properties)
|
87
|
+
|
88
|
+
privateInterface: (properties={})->
|
89
|
+
@meta("private interface", _.keys(properties) )
|
90
|
+
_.defaults((@properties||={}), properties)
|
91
|
+
|
92
|
+
definePrototype: (properties={})->
|
63
93
|
_.defaults((@properties||={}), properties)
|
64
94
|
|
65
95
|
at = if @namespaced
|
@@ -72,29 +102,37 @@ class DefineProxy
|
|
72
102
|
eval("(window||global).#{ @namespace } = {}")
|
73
103
|
at = Luca.util.resolve(@namespace,(window || global))
|
74
104
|
|
75
|
-
|
105
|
+
@meta("super class name", @superClassName )
|
106
|
+
@meta("display name", @componentName)
|
107
|
+
|
108
|
+
@properties.displayName = @componentName
|
109
|
+
|
110
|
+
@properties.componentMetaData = ()->
|
111
|
+
Luca.registry.getMetaDataFor(@displayName)
|
112
|
+
|
113
|
+
definition = at[@componentId] = Luca.extend(@superClassName,@componentName, @properties)
|
76
114
|
|
77
|
-
if Luca.autoRegister is true
|
78
|
-
componentType = "view" if Luca.isViewPrototype(
|
115
|
+
if Luca.config.autoRegister is true
|
116
|
+
componentType = "view" if Luca.isViewPrototype( definition )
|
79
117
|
|
80
|
-
if Luca.isCollectionPrototype(
|
118
|
+
if Luca.isCollectionPrototype( definition )
|
81
119
|
Luca.Collection.namespaces ||= []
|
82
120
|
Luca.Collection.namespaces.push( @namespace )
|
83
121
|
componentType = "collection"
|
84
122
|
|
85
|
-
componentType = "model" if Luca.isModelPrototype(
|
123
|
+
componentType = "model" if Luca.isModelPrototype( definition )
|
86
124
|
|
87
125
|
# automatically register this with the component registry
|
88
126
|
Luca.registerComponent( _.string.underscored(@componentId), @componentName, componentType)
|
89
127
|
|
90
|
-
|
128
|
+
definition
|
91
129
|
|
92
130
|
# Aliases for the mixin definition
|
93
|
-
DefineProxy::behavesAs = DefineProxy::uses = DefineProxy::mixesIn
|
131
|
+
DefineProxy::concerns = DefineProxy::behavesAs = DefineProxy::uses = DefineProxy::mixesIn
|
94
132
|
|
95
133
|
# Aliases for the final call on the define proxy
|
96
|
-
DefineProxy::defines = DefineProxy::defaults = DefineProxy::exports = DefineProxy::defaultProperties
|
97
|
-
DefineProxy::defaultsTo = DefineProxy::enhance = DefineProxy::with = DefineProxy::
|
134
|
+
DefineProxy::defines = DefineProxy::defaults = DefineProxy::exports = DefineProxy::defaultProperties = DefineProxy::definePrototype
|
135
|
+
DefineProxy::defaultsTo = DefineProxy::enhance = DefineProxy::with = DefineProxy::definePrototype
|
98
136
|
|
99
137
|
# The last method of the DefineProxy chain is always going to result in
|
100
138
|
# a call to Luca.extend. Luca.extend wraps the call to Luca.View.extend,
|
@@ -105,8 +143,6 @@ DefineProxy::defaultsTo = DefineProxy::enhance = DefineProxy::with = DefineProxy
|
|
105
143
|
Luca.extend = (superClassName, childName, properties={})->
|
106
144
|
superClass = Luca.util.resolve( superClassName, (window || global) )
|
107
145
|
|
108
|
-
superClass.__initializers ||= []
|
109
|
-
|
110
146
|
unless _.isFunction(superClass?.extend)
|
111
147
|
throw "Error defining #{ childName }. #{ superClassName } is not a valid component to extend from"
|
112
148
|
|
@@ -117,9 +153,8 @@ Luca.extend = (superClassName, childName, properties={})->
|
|
117
153
|
superClass
|
118
154
|
|
119
155
|
properties._super = (method, context=@, args=[])->
|
120
|
-
# protect against a stack too deep error in weird cases
|
121
156
|
# TODO: debug this better
|
122
|
-
|
157
|
+
# protect against a stack too deep error in weird cases
|
123
158
|
@_superClass().prototype[method]?.apply(context, args)
|
124
159
|
|
125
160
|
definition = superClass.extend(properties)
|
@@ -133,50 +168,3 @@ Luca.extend = (superClassName, childName, properties={})->
|
|
133
168
|
|
134
169
|
definition
|
135
170
|
|
136
|
-
|
137
|
-
Luca.mixin = (mixinName)->
|
138
|
-
namespace = _( Luca.mixin.namespaces ).detect (space)->
|
139
|
-
Luca.util.resolve(space)?[ mixinName ]?
|
140
|
-
|
141
|
-
namespace ||= "Luca.modules"
|
142
|
-
|
143
|
-
resolved = Luca.util.resolve(namespace)[ mixinName ]
|
144
|
-
|
145
|
-
console.log "Could not find #{ mixinName } in ", Luca.mixin.namespaces unless resolved?
|
146
|
-
|
147
|
-
resolved
|
148
|
-
|
149
|
-
Luca.mixin.namespaces = [
|
150
|
-
"Luca.modules"
|
151
|
-
]
|
152
|
-
|
153
|
-
Luca.mixin.namespace = (namespace)->
|
154
|
-
Luca.mixin.namespaces.push(namespace)
|
155
|
-
Luca.mixin.namespaces = _( Luca.mixin.namespaces ).uniq()
|
156
|
-
|
157
|
-
# Luca.decorate('Luca.View').with('Luca.modules.MyCustomMixin')
|
158
|
-
Luca.decorate = (componentPrototype)->
|
159
|
-
componentPrototype = Luca.util.resolve(componentPrototype).prototype if _.isString(componentPrototype)
|
160
|
-
|
161
|
-
return with: (mixin)->
|
162
|
-
mixinDefinition = Luca.mixin(mixin)
|
163
|
-
|
164
|
-
mixinPrivates = _( mixinDefinition ).chain().keys().select (key)->
|
165
|
-
"#{ key }".match(/^__/)
|
166
|
-
|
167
|
-
sanitized = _( mixinDefinition ).omit( mixinPrivates.value() )
|
168
|
-
|
169
|
-
_.extend(componentPrototype, sanitized)
|
170
|
-
|
171
|
-
# When a mixin is included, we may want to do things
|
172
|
-
mixinDefinition?.__included?.call(mixinDefinition, mixin)
|
173
|
-
|
174
|
-
superclassMixins = componentPrototype._superClass()::mixins
|
175
|
-
|
176
|
-
componentPrototype.mixins ||= []
|
177
|
-
componentPrototype.mixins.push( mixin )
|
178
|
-
componentPrototype.mixins = componentPrototype.mixins.concat( superclassMixins )
|
179
|
-
|
180
|
-
componentPrototype.mixins = _( componentPrototype.mixins ).chain().uniq().compact().value()
|
181
|
-
|
182
|
-
componentPrototype
|
data/src/framework.coffee
CHANGED
@@ -19,11 +19,13 @@
|
|
19
19
|
return fallback()
|
20
20
|
|
21
21
|
_.extend Luca,
|
22
|
-
VERSION: "0.9.
|
22
|
+
VERSION: "0.9.7"
|
23
23
|
core: {}
|
24
|
+
collections: {}
|
24
25
|
containers: {}
|
25
26
|
components: {}
|
26
|
-
|
27
|
+
models: {}
|
28
|
+
concerns: {}
|
27
29
|
util: {}
|
28
30
|
fields: {}
|
29
31
|
registry:{}
|
@@ -33,6 +35,10 @@ _.extend Luca,
|
|
33
35
|
# for triggering / binding to component definitions
|
34
36
|
_.extend Luca, Backbone.Events
|
35
37
|
|
38
|
+
Luca.config.maintainStyleHierarchy = true
|
39
|
+
Luca.config.maintainClassHierarchy = true
|
40
|
+
Luca.config.autoApplyClassHierarchyAsCssClasses = true
|
41
|
+
|
36
42
|
# When using Luca.define() should we automatically register
|
37
43
|
# the component with the registry?
|
38
44
|
Luca.autoRegister = Luca.config.autoRegister = true
|
@@ -106,34 +112,30 @@ Luca.isCollectionPrototype = (obj)->
|
|
106
112
|
obj? and obj::? and !Luca.isModelPrototype(obj) and obj::reset? and obj::select? and obj::reject?
|
107
113
|
|
108
114
|
Luca.inheritanceChain = (obj)->
|
109
|
-
|
110
|
-
|
115
|
+
Luca.parentClasses(obj)
|
116
|
+
|
111
117
|
Luca.parentClasses = (obj)->
|
112
118
|
list = []
|
113
119
|
|
114
120
|
if _.isString(obj)
|
115
121
|
obj = Luca.util.resolve(obj)
|
116
122
|
|
117
|
-
|
118
|
-
|
119
|
-
classes = until not Luca.parentClass(obj)?
|
120
|
-
obj = Luca.parentClass(obj)
|
121
|
-
|
122
|
-
list = list.concat(classes)
|
123
|
+
metaData = obj.componentMetaData?()
|
124
|
+
metaData ||= obj::componentMetaData?()
|
123
125
|
|
124
|
-
|
125
|
-
|
126
|
-
Luca.parentClass = (obj)->
|
127
|
-
list = []
|
126
|
+
list = metaData?.classHierarchy() || [obj.displayName || obj::displayName]
|
128
127
|
|
128
|
+
Luca.parentClass = (obj, resolve=true)->
|
129
129
|
if _.isString( obj )
|
130
130
|
obj = Luca.util.resolve(obj)
|
131
131
|
|
132
|
-
|
133
|
-
|
132
|
+
parent = obj.componentMetaData?()?.meta["super class name"]
|
133
|
+
parent ||= obj::componentMetaData?()?.meta["super class name"]
|
134
|
+
|
135
|
+
parent || obj.displayName || obj.prototype?.displayName
|
136
|
+
|
137
|
+
if resolve then Luca.util.resolve(parent) else parent
|
134
138
|
|
135
|
-
else if Luca.isComponentPrototype(obj)
|
136
|
-
obj::_superClass?()?.displayName
|
137
139
|
|
138
140
|
# This is a convenience method for accessing the templates
|
139
141
|
# available to the client side app, either the ones which ship with Luca
|
@@ -191,6 +193,9 @@ UnderscoreExtensions =
|
|
191
193
|
# this function will ensure a function gets called at least once
|
192
194
|
# afrer x delay. by setting defaults, we can use this on backbone
|
193
195
|
# view definitions
|
196
|
+
#
|
197
|
+
# Note: I am not sure if this is the same as _.debounce or not. I will need
|
198
|
+
# to look into it
|
194
199
|
idle: (code, delay=1000)->
|
195
200
|
delay = 0 if window.DISABLE_IDLE
|
196
201
|
handle = undefined
|
data/src/index.coffee
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
#= require ./util
|
2
2
|
#= require_tree ./plugins
|
3
|
+
#= require ./concerns
|
3
4
|
#= require ./define
|
4
5
|
|
5
|
-
#= require_tree ./
|
6
|
+
#= require_tree ./concerns
|
6
7
|
|
7
8
|
#= require ./core/registry
|
9
|
+
#= require ./core/meta_data
|
8
10
|
#= require ./core/observer
|
9
11
|
#= require ./core/view
|
10
12
|
#= require ./core/model
|
@@ -1,4 +1,4 @@
|
|
1
|
-
.luca-
|
1
|
+
.luca-form-view {
|
2
2
|
width: 100%;
|
3
3
|
float: left;
|
4
4
|
display: block;
|
@@ -7,7 +7,7 @@
|
|
7
7
|
}
|
8
8
|
|
9
9
|
|
10
|
-
.luca-
|
10
|
+
.luca-form-view {
|
11
11
|
.luca-ui-field {
|
12
12
|
margin: 5px;
|
13
13
|
padding: 5px;
|
@@ -19,7 +19,7 @@
|
|
19
19
|
}
|
20
20
|
}
|
21
21
|
|
22
|
-
.luca-
|
22
|
+
.luca-form-view.label-align-top {
|
23
23
|
.luca-ui-field {
|
24
24
|
label, input, select, textarea {
|
25
25
|
margin: 5px 0px;
|
@@ -28,13 +28,13 @@
|
|
28
28
|
}
|
29
29
|
}
|
30
30
|
|
31
|
-
.luca-
|
31
|
+
.luca-form-view.column-layout {
|
32
32
|
.luca-ui-field {
|
33
33
|
float: left;
|
34
34
|
}
|
35
35
|
}
|
36
36
|
|
37
|
-
.luca-
|
37
|
+
.luca-form-view {
|
38
38
|
.toolbar-container {
|
39
39
|
padding-right: 12px;
|
40
40
|
}
|
@@ -6,7 +6,8 @@ html.luca-ui-fullscreen, body.luca-ui-fullscreen {
|
|
6
6
|
.fluid-viewport-wrapper {
|
7
7
|
padding-top:40px;
|
8
8
|
}
|
9
|
-
|
9
|
+
|
10
|
+
.luca-viewport, .luca-ui-viewport, .fullscreen-container {
|
10
11
|
min-height: 100%;
|
11
12
|
height: auto !important;
|
12
13
|
height: 100%;
|
@@ -1,19 +1,19 @@
|
|
1
|
-
.luca-
|
1
|
+
.luca-tab-view {
|
2
2
|
.luca-ui-card {
|
3
|
-
.luca-ui-grid-view, .luca-
|
3
|
+
.luca-ui-grid-view, .luca-form-view, .luca-ui-card {
|
4
4
|
overflow: hidden;
|
5
5
|
}
|
6
6
|
}
|
7
7
|
}
|
8
8
|
|
9
|
-
.luca-
|
9
|
+
.luca-tab-view.tabs-below, .luca-tab-view.tabs-right {
|
10
10
|
.tab-selector-container {
|
11
11
|
display: block;
|
12
12
|
clear: both;
|
13
13
|
}
|
14
14
|
}
|
15
15
|
|
16
|
-
.luca-
|
16
|
+
.luca-tab-view.tabs-left {
|
17
17
|
.tab-selector-container {
|
18
18
|
ul.nav-tabs {
|
19
19
|
padding: 0px;
|
@@ -26,7 +26,7 @@
|
|
26
26
|
}
|
27
27
|
}
|
28
28
|
|
29
|
-
.luca-
|
29
|
+
.luca-tab-view.tabs-right {
|
30
30
|
.tab-selector-container {
|
31
31
|
float: right;
|
32
32
|
}
|
data/src/tools/console.coffee
CHANGED
@@ -10,16 +10,16 @@ developmentConsole.defines
|
|
10
10
|
width: 1000
|
11
11
|
|
12
12
|
componentEvents:
|
13
|
-
"
|
14
|
-
"
|
15
|
-
"
|
13
|
+
"input key:keyup" : "historyUp"
|
14
|
+
"input key:keydown" : "historyDown"
|
15
|
+
"input key:enter" : "runCommand"
|
16
16
|
|
17
17
|
compileOptions:
|
18
18
|
bare: true
|
19
19
|
|
20
20
|
components:[
|
21
21
|
type: "code_mirror_field"
|
22
|
-
|
22
|
+
role: "code_mirror"
|
23
23
|
additionalClassNames: "clearfix"
|
24
24
|
name: "code_output"
|
25
25
|
readOnly: true
|
@@ -30,7 +30,7 @@ developmentConsole.defines
|
|
30
30
|
,
|
31
31
|
type: "text_field"
|
32
32
|
name: "code_input"
|
33
|
-
|
33
|
+
role: "input"
|
34
34
|
lineNumbers: false
|
35
35
|
height: '30px'
|
36
36
|
maxHeight: '30px'
|
data/src/util.coffee
CHANGED
@@ -36,6 +36,16 @@ Luca.util.hook = (eventId="")->
|
|
36
36
|
parts = _( parts ).map (p)-> _.string.capitalize(p)
|
37
37
|
fn = prefix + parts.join('')
|
38
38
|
|
39
|
+
Luca.util.toCssClass = (componentName, exclusions...)->
|
40
|
+
parts = componentName.split('.')
|
41
|
+
|
42
|
+
transformed = for part in parts when _( exclusions ).indexOf(part) is -1
|
43
|
+
part = _.str.underscored(part)
|
44
|
+
part = part.replace(/_/g,'-')
|
45
|
+
part
|
46
|
+
|
47
|
+
transformed.join '-'
|
48
|
+
|
39
49
|
Luca.util.isIE = ()->
|
40
50
|
try
|
41
51
|
Object.defineProperty({}, '', {})
|
@@ -118,3 +128,40 @@ Luca.util.badge = (contents="", type, baseClass="badge")->
|
|
118
128
|
cssClass += " #{ baseClass }-#{ type }" if type?
|
119
129
|
Luca.util.make("span",{class:cssClass},contents)
|
120
130
|
|
131
|
+
Luca.util.setupHooks = (set)->
|
132
|
+
set ||= @hooks
|
133
|
+
|
134
|
+
_(set).each (eventId)=>
|
135
|
+
fn = Luca.util.hook( eventId )
|
136
|
+
|
137
|
+
callback = ()->
|
138
|
+
@[fn]?.apply @, arguments
|
139
|
+
|
140
|
+
callback = _.once(callback) if eventId?.match(/once:/)
|
141
|
+
|
142
|
+
@on eventId, callback, @
|
143
|
+
|
144
|
+
Luca.util.setupHooksAdvanced = (set)->
|
145
|
+
set ||= @hooks
|
146
|
+
|
147
|
+
_(set).each (eventId)=>
|
148
|
+
hookSetup = @[ Luca.util.hook( eventId ) ]
|
149
|
+
|
150
|
+
unless _.isArray(hookSetup)
|
151
|
+
hookSetup = [hookSetup]
|
152
|
+
|
153
|
+
for entry in hookSetup
|
154
|
+
fn = if _.isString(entry)
|
155
|
+
@[ entry ]
|
156
|
+
|
157
|
+
if _.isFunction(entry)
|
158
|
+
fn = entry
|
159
|
+
|
160
|
+
callback = ()->
|
161
|
+
@[fn]?.apply @, arguments
|
162
|
+
|
163
|
+
if eventId?.match(/once:/)
|
164
|
+
callback = _.once(callback)
|
165
|
+
|
166
|
+
@on eventId, callback, @
|
167
|
+
|
@@ -18308,9 +18308,9 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
18308
18308
|
historyIndex: 0,
|
18309
18309
|
width: 1000,
|
18310
18310
|
componentEvents: {
|
18311
|
-
"
|
18312
|
-
"
|
18313
|
-
"
|
18311
|
+
"input key:keyup": "historyUp",
|
18312
|
+
"input key:keydown": "historyDown",
|
18313
|
+
"input key:enter": "runCommand"
|
18314
18314
|
},
|
18315
18315
|
compileOptions: {
|
18316
18316
|
bare: true
|
@@ -18318,7 +18318,7 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
18318
18318
|
components: [
|
18319
18319
|
{
|
18320
18320
|
type: "code_mirror_field",
|
18321
|
-
|
18321
|
+
role: "code_mirror",
|
18322
18322
|
additionalClassNames: "clearfix",
|
18323
18323
|
name: "code_output",
|
18324
18324
|
readOnly: true,
|
@@ -18329,7 +18329,7 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
18329
18329
|
}, {
|
18330
18330
|
type: "text_field",
|
18331
18331
|
name: "code_input",
|
18332
|
-
|
18332
|
+
role: "input",
|
18333
18333
|
lineNumbers: false,
|
18334
18334
|
height: '30px',
|
18335
18335
|
maxHeight: '30px',
|