luca 0.9.6 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -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-
|
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-
|
10
|
+
.luca-form-view .luca-ui-field {
|
11
11
|
margin: 5px;
|
12
12
|
padding: 5px; }
|
13
|
-
.luca-
|
13
|
+
.luca-form-view .luca-ui-field .helper-text {
|
14
14
|
font-size: 0.75em;
|
15
15
|
font-color: #ccc; }
|
16
16
|
|
17
|
-
.luca-
|
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-
|
21
|
+
.luca-form-view.column-layout .luca-ui-field {
|
22
22
|
float: left; }
|
23
23
|
|
24
|
-
.luca-
|
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-
|
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-
|
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-
|
161
|
+
.luca-tab-view.tabs-left .tab-selector-container {
|
162
162
|
float: left; }
|
163
|
-
.luca-
|
163
|
+
.luca-tab-view.tabs-left .tab-selector-container ul.nav-tabs {
|
164
164
|
padding: 0px; }
|
165
|
-
.luca-
|
165
|
+
.luca-tab-view.tabs-left .tab-content {
|
166
166
|
float: left; }
|
167
167
|
|
168
|
-
.luca-
|
168
|
+
.luca-tab-view.tabs-right .tab-selector-container {
|
169
169
|
float: right; }
|
170
|
-
.luca-
|
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.
|
4
|
+
version: 0.9.7
|
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-
|
12
|
+
date: 2012-11-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
@@ -251,9 +251,16 @@ files:
|
|
251
251
|
- spec/components/form_view_spec.coffee
|
252
252
|
- spec/components/grid_view_spec.coffee
|
253
253
|
- spec/components/multi_collection_view_spec.coffee
|
254
|
+
- spec/components/pagination_control_spec.coffee
|
254
255
|
- spec/components/record_manager_spec.coffee
|
255
256
|
- spec/components/table_view_spec.coffee
|
256
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
|
257
264
|
- spec/containers/card_view_spec.coffee
|
258
265
|
- spec/containers/column_view_spec.coffee
|
259
266
|
- spec/containers/modal_view_spec.coffee
|
@@ -272,7 +279,7 @@ files:
|
|
272
279
|
- spec/helper.coffee
|
273
280
|
- spec/managers/collection_manager_spec.coffee
|
274
281
|
- spec/managers/socket_manager_spec.coffee
|
275
|
-
- spec/
|
282
|
+
- spec/util_spec.coffee
|
276
283
|
- src/components/application.coffee
|
277
284
|
- src/components/base_toolbar.coffee
|
278
285
|
- src/components/collection_loader_view.coffee
|
@@ -302,6 +309,21 @@ files:
|
|
302
309
|
- src/components/table_view.coffee
|
303
310
|
- src/components/template.coffee
|
304
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/state_model.coffee
|
326
|
+
- src/concerns/templating.coffee
|
305
327
|
- src/containers/card_view.coffee
|
306
328
|
- src/containers/column_view.coffee
|
307
329
|
- src/containers/modal_view.coffee
|
@@ -315,6 +337,7 @@ files:
|
|
315
337
|
- src/core/container.coffee
|
316
338
|
- src/core/core.coffee
|
317
339
|
- src/core/field.coffee
|
340
|
+
- src/core/meta_data.coffee
|
318
341
|
- src/core/model.coffee
|
319
342
|
- src/core/observer.coffee
|
320
343
|
- src/core/panel.coffee
|
@@ -326,19 +349,6 @@ files:
|
|
326
349
|
- src/index.coffee
|
327
350
|
- src/managers/collection_manager.coffee
|
328
351
|
- src/managers/socket_manager.coffee
|
329
|
-
- src/modules/application_event_bindings.coffee
|
330
|
-
- src/modules/collection_event_bindings.coffee
|
331
|
-
- src/modules/deferrable.coffee
|
332
|
-
- src/modules/dom_helpers.coffee
|
333
|
-
- src/modules/enhanced_properties.coffee
|
334
|
-
- src/modules/filterable.coffee
|
335
|
-
- src/modules/grid_layout.coffee
|
336
|
-
- src/modules/loadmaskable.coffee
|
337
|
-
- src/modules/local_storage.coffee
|
338
|
-
- src/modules/modal_view.coffee
|
339
|
-
- src/modules/paginatable.coffee
|
340
|
-
- src/modules/state_model.coffee
|
341
|
-
- src/modules/templating.coffee
|
342
352
|
- src/plugins/development_tool_helpers.coffee
|
343
353
|
- src/plugins/events.coffee
|
344
354
|
- src/samples/definition.coffee
|
@@ -500,7 +510,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
500
510
|
version: '0'
|
501
511
|
segments:
|
502
512
|
- 0
|
503
|
-
hash: -
|
513
|
+
hash: -1023452771417874938
|
504
514
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
505
515
|
none: false
|
506
516
|
requirements:
|
data/spec/mixin_spec.coffee
DELETED
@@ -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")
|
@@ -1,60 +0,0 @@
|
|
1
|
-
Luca.modules.Filterable =
|
2
|
-
__included: (component, module)->
|
3
|
-
_.extend(Luca.Collection::, __filters:{})
|
4
|
-
|
5
|
-
__initializer: (component, module)->
|
6
|
-
return if @filterable is false or not Luca.isBackboneCollection(@collection)
|
7
|
-
|
8
|
-
@getCollection ||= ()-> @collection
|
9
|
-
|
10
|
-
filter = @getFilterState()
|
11
|
-
|
12
|
-
filter.on "change", (state)=>
|
13
|
-
@trigger "collection:change:filter", state, @getCollection()
|
14
|
-
@trigger "refresh"
|
15
|
-
|
16
|
-
if @getQuery?
|
17
|
-
@getQuery = _.compose @getQuery, (query={})->
|
18
|
-
obj = _.clone(query)
|
19
|
-
_.extend(obj, filter.toQuery() )
|
20
|
-
else
|
21
|
-
@getQuery = ()=>
|
22
|
-
filter.toQuery()
|
23
|
-
|
24
|
-
if @getQueryOptions?
|
25
|
-
@getQueryOptions = _.compose @getQueryOptions, (options={})->
|
26
|
-
obj = _.clone(options)
|
27
|
-
_.extend(obj, filter.toOptions() )
|
28
|
-
else
|
29
|
-
@getQueryOptions = ()-> filter.toOptions()
|
30
|
-
|
31
|
-
getFilterState: ()->
|
32
|
-
@collection.__filters[ @cid ] ||= new FilterModel(@filterable)
|
33
|
-
|
34
|
-
setSortBy: (sortBy, options={})->
|
35
|
-
@getFilterState().setOption('sortBy', sortBy, options)
|
36
|
-
|
37
|
-
applyFilter: (query={}, options={})->
|
38
|
-
options = _.defaults(options, @getQueryOptions())
|
39
|
-
query = _.defaults(query, @getQuery())
|
40
|
-
|
41
|
-
silent = _( options ).delete('silent') is true
|
42
|
-
|
43
|
-
@getFilterState().set({query,options}, silent: silent)
|
44
|
-
|
45
|
-
class FilterModel extends Backbone.Model
|
46
|
-
setOption: (option, value, options)->
|
47
|
-
payload = {}
|
48
|
-
payload[option] = value
|
49
|
-
@set 'options', _.extend(@toOptions(), payload), options
|
50
|
-
|
51
|
-
setQueryOption: (option, value, options)->
|
52
|
-
payload = {}
|
53
|
-
payload[option] = value
|
54
|
-
@set 'query', _.extend(@toQuery(), payload), options
|
55
|
-
|
56
|
-
toOptions: ()->
|
57
|
-
@toJSON().options
|
58
|
-
|
59
|
-
toQuery: ()->
|
60
|
-
@toJSON().query
|
@@ -1,79 +0,0 @@
|
|
1
|
-
Luca.modules.Paginatable =
|
2
|
-
paginatorViewClass: 'Luca.components.PaginationControl'
|
3
|
-
paginationSelector: ".toolbar.bottom"
|
4
|
-
|
5
|
-
__included: ()->
|
6
|
-
_.extend(Luca.Collection::, __paginators: {})
|
7
|
-
|
8
|
-
__initializer:()->
|
9
|
-
return if @paginatable is false or not Luca.isBackboneCollection(@collection)
|
10
|
-
|
11
|
-
_.bindAll @, "paginationControl"
|
12
|
-
|
13
|
-
@getCollection ||= ()-> @collection
|
14
|
-
|
15
|
-
collection = @getCollection()
|
16
|
-
|
17
|
-
paginationState = @getPaginationState()
|
18
|
-
|
19
|
-
paginationState.on "change", (state)=>
|
20
|
-
@trigger "collection:change:pagination", state, collection
|
21
|
-
@trigger "refresh"
|
22
|
-
|
23
|
-
@on "after:refresh", (models, query, options)=>
|
24
|
-
_.defer ()=>
|
25
|
-
@updatePagination.call(@, models, query, options)
|
26
|
-
|
27
|
-
@on "after:render", ()=>
|
28
|
-
@paginationControl().refresh()
|
29
|
-
|
30
|
-
if old = @getQueryOptions
|
31
|
-
@getQueryOptions = ()->
|
32
|
-
_.extend( old(), paginationState.toJSON() )
|
33
|
-
else
|
34
|
-
@getQueryOptions = ()-> paginationState.toJSON()
|
35
|
-
|
36
|
-
getPaginationState: ()->
|
37
|
-
@collection.__paginators[ @cid ] ||= @paginationControl().state
|
38
|
-
|
39
|
-
paginationContainer: ()->
|
40
|
-
@$(">#{ @paginationSelector }")
|
41
|
-
|
42
|
-
setCurrentPage: (page=1, options={})->
|
43
|
-
@getPaginationState().set('page', page, options)
|
44
|
-
|
45
|
-
setLimit: (limit=0,options={})->
|
46
|
-
@getPaginationState().set('limit', limit, options)
|
47
|
-
|
48
|
-
updatePagination: (models=[], query={}, options={})->
|
49
|
-
_.defaults(options, @getQueryOptions(), limit: 0 )
|
50
|
-
|
51
|
-
paginator = @paginationControl()
|
52
|
-
|
53
|
-
itemCount = models?.length || 0
|
54
|
-
totalCount = @getCollection()?.length
|
55
|
-
|
56
|
-
if itemCount is 0 or totalCount <= options.limit
|
57
|
-
paginator.$el.hide()
|
58
|
-
else
|
59
|
-
paginator.$el.show()
|
60
|
-
|
61
|
-
paginator.state.set(page: options.page, limit: options.limit)
|
62
|
-
|
63
|
-
paginationControl: ()->
|
64
|
-
return @paginator if @paginator?
|
65
|
-
|
66
|
-
_.defaults(@paginatable ||= {}, page: 1, limit: 20)
|
67
|
-
|
68
|
-
@paginator = Luca.util.lazyComponent
|
69
|
-
type: "pagination_control"
|
70
|
-
collection: @getCollection()
|
71
|
-
defaultState: @paginatable
|
72
|
-
|
73
|
-
@paginator
|
74
|
-
|
75
|
-
renderPaginationControl: ()->
|
76
|
-
@paginationControl()
|
77
|
-
@paginationContainer().append @paginationControl().render().$el
|
78
|
-
|
79
|
-
|