lanes 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/client/lanes/Config.coffee +1 -1
- data/client/lanes/access/LoginDialog.cjsx +1 -1
- data/client/lanes/access/Roles.coffee +1 -1
- data/client/lanes/access/User.coffee +2 -2
- data/client/lanes/access/screens/user-management/UserManagement.cjsx +1 -1
- data/client/lanes/components/calendar/styles.scss +1 -1
- data/client/lanes/components/grid/Body.cjsx +5 -2
- data/client/lanes/components/grid/EditingMixin.cjsx +3 -0
- data/client/lanes/components/grid/Editor.cjsx +3 -11
- data/client/lanes/components/grid/Grid.cjsx +22 -12
- data/client/lanes/components/grid/Selections.cjsx +4 -1
- data/client/lanes/components/grid/Toolbar.cjsx +1 -1
- data/client/lanes/components/record-finder/RecordFinder.cjsx +2 -2
- data/client/lanes/components/select-field/SelectField.cjsx +19 -16
- data/client/lanes/components/select-field/styles.scss +1 -1
- data/client/lanes/components/shared/FieldMixin.cjsx +2 -2
- data/client/lanes/components/shared/Input.cjsx +2 -13
- data/client/lanes/components/shared/InputFieldMixin.cjsx +15 -8
- data/client/lanes/components/shared/NetworkActivityOverlay.cjsx +1 -1
- data/client/lanes/components/shared/NumberInput.cjsx +4 -12
- data/client/lanes/components/shared/ToggleField.cjsx +0 -2
- data/client/lanes/components/shared/fields.scss +9 -0
- data/client/lanes/components/shared/styles.scss +2 -1
- data/client/lanes/components/toolbar/Toolbar.cjsx +1 -1
- data/client/lanes/lib/HotReload.coffee +2 -2
- data/client/lanes/lib/development.coffee +1 -1
- data/client/lanes/lib/loader.coffee +3 -3
- data/client/lanes/models/AssociationMap.coffee +1 -1
- data/client/lanes/models/AssociationProxy.coffee +1 -0
- data/client/lanes/models/Base.coffee +7 -10
- data/client/lanes/models/Collection.coffee +3 -6
- data/client/lanes/models/JobStatus.coffee +1 -1
- data/client/lanes/models/PubSub.coffee +51 -33
- data/client/lanes/models/Query.coffee +1 -1
- data/client/lanes/models/Sync.coffee +1 -1
- data/client/lanes/models/User.coffee +3 -3
- data/client/lanes/models/mixins/FileSupport.coffee +3 -3
- data/client/lanes/models/query/ArrayResult.coffee +3 -6
- data/client/lanes/models/query/CollectionResult.coffee +5 -3
- data/client/lanes/react/Component.coffee +2 -2
- data/client/lanes/react/DefaultComponentNotFound.cjsx +2 -2
- data/client/lanes/react/Screen.coffee +1 -1
- data/client/lanes/react/Viewport.coffee +1 -1
- data/client/lanes/react/mixins/Access.coffee +1 -1
- data/client/lanes/react/mixins/Data.coffee +9 -5
- data/client/lanes/screens/Commands.coffee +1 -1
- data/client/lanes/screens/UserPreferences.cjsx +1 -1
- data/client/lanes/testing/BeforeEach.coffee +7 -0
- data/client/lanes/vendor/base.js.erb +5 -0
- data/client/lanes/vendor/calendar.js.erb +5 -0
- data/client/lanes/vendor/commons.js.erb +5 -0
- data/client/lanes/vendor/{base.js → development/base.js} +37776 -40850
- data/client/lanes/vendor/development/calendar.js +1667 -0
- data/client/lanes/vendor/development/commons.js +39085 -0
- data/client/lanes/vendor/development/helpers.js +578 -0
- data/client/lanes/vendor/{toggle.js → development/toggle.js} +22 -82
- data/client/lanes/vendor/development/widgets.js +8975 -0
- data/client/lanes/vendor/production/base.js +63239 -0
- data/client/lanes/vendor/production/calendar.js +1667 -0
- data/client/lanes/vendor/production/commons.js +38505 -0
- data/client/lanes/vendor/production/toggle.js +285 -0
- data/client/lanes/vendor/production/widgets.js +8975 -0
- data/client/lanes/vendor/{calendar.scss → styles/calendar.scss} +6 -0
- data/client/lanes/vendor/{toggle.scss → styles/toggle.scss} +0 -0
- data/client/lanes/vendor/{widgets.scss → styles/widgets.scss} +2 -2
- data/client/lanes/vendor/toggle.js.erb +5 -0
- data/client/lanes/vendor/widgets.js.erb +5 -0
- data/lib/lanes/api/default_routes.rb +3 -3
- data/lib/lanes/api/routing.rb +1 -1
- data/lib/lanes/configuration.rb +8 -14
- data/lib/lanes/environment.rb +3 -0
- data/lib/lanes/extension/definition.rb +4 -0
- data/lib/lanes/system_settings.rb +21 -6
- data/lib/lanes/version.rb +1 -1
- data/npm-build/base.js +9 -4
- data/npm-build/build +9 -0
- data/npm-build/development.js +3 -1
- data/npm-build/package.json +34 -34
- data/npm-build/update-dayz +1 -1
- data/npm-build/webpack.config.js +36 -20
- data/spec/command-reference-files/initial/Gemfile +1 -1
- data/spec/command-reference-files/screen/config/screens.rb +1 -1
- data/spec/lanes/components/grid/RowEditorSpec.coffee +3 -1
- data/spec/lanes/components/select-field/SelectFieldSpec.coffee +33 -28
- data/spec/lanes/models/AssociationProxySpec.coffee +36 -37
- data/spec/lanes/models/BaseSpec.coffee +0 -32
- data/spec/lanes/models/CollectionSpec.coffee +0 -10
- data/spec/lanes/models/PubSubSpec.coffee +63 -13
- data/spec/lanes/screens/DefinitionsSpec.coffee +2 -2
- metadata +23 -20
- data/client/lanes/vendor/calendar.js +0 -17301
- data/client/lanes/vendor/commons.js +0 -19722
- data/client/lanes/vendor/development.js +0 -5471
- data/client/lanes/vendor/grid.js +0 -15384
- data/client/lanes/vendor/grid.scss +0 -928
- data/client/lanes/vendor/rw-widgets.eot +0 -0
- data/client/lanes/vendor/rw-widgets.svg +0 -18
- data/client/lanes/vendor/rw-widgets.ttf +0 -0
- data/client/lanes/vendor/rw-widgets.woff +0 -0
- data/client/lanes/vendor/widgets.js +0 -23204
- data/npm-build/compile.coffee +0 -19
- data/spec/lanes/models/ServerCacheSpec.coffee +0 -65
@@ -71,10 +71,7 @@ class ModelsCollection
|
|
71
71
|
# Fetch the a set of models for the collection, replacing all
|
72
72
|
# current models whith them when the call completes
|
73
73
|
fetch: (options = {}) ->
|
74
|
-
|
75
|
-
Lanes.Models.ServerCache.fetchCollection(this, options)
|
76
|
-
else
|
77
|
-
this.sync('read', this, options)
|
74
|
+
this.sync('read', this, options)
|
78
75
|
|
79
76
|
getOrFetch: (id, options) ->
|
80
77
|
@get(id) || @fetchId(id, options)
|
@@ -108,7 +105,7 @@ class ModelsCollection
|
|
108
105
|
setFromServer: (data, options, method) ->
|
109
106
|
@_isLoaded = true
|
110
107
|
if 'delete' == method
|
111
|
-
models = _.map(_.
|
108
|
+
models = _.map(_.map(options.originalData, 'id'), (id) =>
|
112
109
|
@get(id)
|
113
110
|
)
|
114
111
|
this.remove(models)
|
@@ -181,7 +178,7 @@ class SubCollection
|
|
181
178
|
Lanes.Models.SubCollection = Lanes.lib.MakeBaseClass( Lanes.Vendor.Ampersand.SubCollection, SubCollection )
|
182
179
|
|
183
180
|
Lanes.Models.BasicCollection = Lanes.lib.MakeBaseClass(
|
184
|
-
Lanes.Vendor.Ampersand.Collection.extend(Lanes.Vendor.Ampersand.
|
181
|
+
Lanes.Vendor.Ampersand.Collection.extend(Lanes.Vendor.Ampersand.LDCollection), BasicCollection
|
185
182
|
|
186
183
|
)
|
187
184
|
|
@@ -19,7 +19,7 @@ class Lanes.Models.JobStatus extends Lanes.Models.Base
|
|
19
19
|
deps: ['id'], fn: -> !@isNew()
|
20
20
|
isExecuting:
|
21
21
|
deps: ['state'], fn: ->
|
22
|
-
_.
|
22
|
+
_.includes(['unqueued', 'queued', 'started'], @state)
|
23
23
|
isActive:
|
24
24
|
deps: ['isSubmitted', 'isExecuting'], fn: ->
|
25
25
|
!(@isSubmitted or @isExecuting)
|
@@ -1,38 +1,58 @@
|
|
1
|
-
class
|
1
|
+
class ModelConfig
|
2
2
|
|
3
|
-
constructor: ->
|
4
|
-
|
5
|
-
@
|
6
|
-
|
7
|
-
|
8
|
-
id: 'string'
|
9
|
-
records: 'object'
|
10
|
-
|
11
|
-
subscribe: (config) ->
|
12
|
-
model = config.models[0]
|
13
|
-
channel = "/#{_.result(model, 'api_path')}/#{model.id}"
|
14
|
-
Lanes.log.info "Subscribe to: #{channel}"
|
15
|
-
Lanes.Models.PubSub.mb.subscribe(channel, (changes) ->
|
16
|
-
for model in config.models
|
17
|
-
model.addChangeSet(changes)
|
18
|
-
)
|
19
|
-
channel
|
3
|
+
constructor: (@type, model) ->
|
4
|
+
@id = model.getId()
|
5
|
+
@channel = "#{_.result(model, 'api_path')}/#{@id}"
|
6
|
+
@count = 0
|
7
|
+
@models = []
|
20
8
|
|
21
9
|
add: (model) ->
|
22
|
-
if
|
23
|
-
|
10
|
+
if @count is 0
|
11
|
+
Lanes.log.info "[pubsub] subscribe to: #{@channel}"
|
12
|
+
Lanes.Models.PubSub.mb.subscribe(@channel, @mbCallBack(@models))
|
13
|
+
@count += 1
|
14
|
+
config = @modelConfig(model)
|
15
|
+
config.count += 1
|
16
|
+
|
17
|
+
modelConfig: (model) ->
|
18
|
+
config = _.find(@models, {model: model})
|
19
|
+
unless config
|
20
|
+
config = {model: model, count: 0}
|
21
|
+
@models.push(config)
|
22
|
+
config
|
23
|
+
|
24
|
+
remove: (model) ->
|
25
|
+
config = _.find(@models, {model: model})
|
26
|
+
return unless config
|
27
|
+
@count -= 1
|
28
|
+
if @count is 0 # all removed, just unsubscribe
|
29
|
+
@unsubscribe()
|
24
30
|
else
|
25
|
-
config
|
26
|
-
config.
|
27
|
-
|
31
|
+
config.count -= 1
|
32
|
+
_.remove(@models, {model: model}) if config.count is 0
|
33
|
+
|
34
|
+
unsubscribe: ->
|
35
|
+
Lanes.log.info "[pubsub] unsubscribe from: #{@channel}"
|
36
|
+
Lanes.Models.PubSub.mb?.unsubscribe( @channel )
|
37
|
+
delete @type.records[@id]
|
38
|
+
|
39
|
+
mbCallBack: (models) ->
|
40
|
+
(changes) ->
|
41
|
+
config.model.addChangeSet(changes) for config in models
|
42
|
+
|
43
|
+
|
44
|
+
class ModelType
|
45
|
+
|
46
|
+
constructor: (attr) ->
|
47
|
+
_.extend(@, attr)
|
48
|
+
@records = {}
|
49
|
+
|
50
|
+
add: (model) ->
|
51
|
+
config = @records[model.id] ||= new ModelConfig(this, model)
|
52
|
+
config.add(model)
|
28
53
|
|
29
54
|
remove: (model) ->
|
30
|
-
|
31
|
-
_.remove(config.models, (m) -> m == model)
|
32
|
-
if _.isEmpty(config.models)
|
33
|
-
Lanes.log.info "Unsubscribe from: #{config.channel}"
|
34
|
-
Lanes.Models.PubSub.mb.unsubscribe( config.channel )
|
35
|
-
delete @records[model.id]
|
55
|
+
@records[model.id]?.remove(model)
|
36
56
|
|
37
57
|
|
38
58
|
class ModelTypesCollection extends Lanes.Models.BasicCollection
|
@@ -49,8 +69,6 @@ Lanes.Models.PubSub = {
|
|
49
69
|
|
50
70
|
types: new ModelTypesCollection
|
51
71
|
|
52
|
-
# forModel: (model) ->
|
53
|
-
|
54
72
|
add: (model) ->
|
55
73
|
return unless model.isPersistent?()
|
56
74
|
@types.forModel(model).add(model)
|
@@ -61,13 +79,13 @@ Lanes.Models.PubSub = {
|
|
61
79
|
|
62
80
|
instanceFor: ( model_klass, id ) ->
|
63
81
|
path = _.result(model_klass.prototype, 'api_path')
|
64
|
-
@types.get(path)?.records[id]?.models[0]
|
82
|
+
@types.get(path)?.records[id]?.models[0]?.model
|
65
83
|
|
66
84
|
clear: ->
|
67
85
|
@types = new ModelTypesCollection
|
68
86
|
|
69
87
|
initialize: ->
|
70
|
-
@mb
|
88
|
+
@mb ||= MessageBus.noConflict()
|
71
89
|
@mb.start()
|
72
90
|
@mb.subscribe("/file-change", (changes) ->
|
73
91
|
Lanes.lib.HotReload.initiate(changes)
|
@@ -81,7 +81,7 @@ class Operator extends Lanes.Models.Base
|
|
81
81
|
valid:
|
82
82
|
deps: ['types', 'field']
|
83
83
|
fn: ->
|
84
|
-
!this.types || ( this.field && _.
|
84
|
+
!this.types || ( this.field && _.includes(this.types, this.field.type) )
|
85
85
|
|
86
86
|
|
87
87
|
class Operators extends Lanes.Models.Collection
|
@@ -29,7 +29,7 @@ Lanes.Models.Sync = {
|
|
29
29
|
|
30
30
|
state: (method, model, options = {}) ->
|
31
31
|
options.url ||= _.result(model, "url")
|
32
|
-
if _.
|
32
|
+
if _.includes(['create', 'update', 'patch'], method)
|
33
33
|
isSave = true
|
34
34
|
options.json ||= model.dataForSave(options)
|
35
35
|
model.requestInProgress = options
|
@@ -13,7 +13,7 @@ unless Lanes.Models.User
|
|
13
13
|
super
|
14
14
|
this.access_data = access
|
15
15
|
|
16
|
-
api_path: -> 'users'
|
16
|
+
api_path: -> '/users'
|
17
17
|
|
18
18
|
derived:
|
19
19
|
roles:
|
@@ -32,7 +32,7 @@ unless Lanes.Models.User
|
|
32
32
|
role_names: 'array'
|
33
33
|
options: 'object'
|
34
34
|
password: 'string'
|
35
|
-
|
35
|
+
hasAccess: -> true
|
36
36
|
canRead: (model, field) -> true
|
37
37
|
canWrite: (model, field) -> true
|
38
38
|
canDelete: (model) -> true
|
@@ -45,7 +45,7 @@ Object.defineProperty(Lanes, 'current_user', {
|
|
45
45
|
events = null
|
46
46
|
if CURRENT_USER
|
47
47
|
events = CURRENT_USER._events
|
48
|
-
if _.
|
48
|
+
if _.some(events)
|
49
49
|
for key, callbacks of events
|
50
50
|
if user._events[key]
|
51
51
|
user._events[key] = user._events[key].concat(callbacks)
|
@@ -4,7 +4,7 @@ isFileDefinition = (def) ->
|
|
4
4
|
Lanes.Models.Mixins.FileSupport = {
|
5
5
|
|
6
6
|
included: (klass) ->
|
7
|
-
files = _.
|
7
|
+
files = _.pickBy klass::props, (def, name) -> isFileDefinition(def)
|
8
8
|
return if _.isEmpty(files)
|
9
9
|
session = {}
|
10
10
|
for name, def of files
|
@@ -37,7 +37,7 @@ Lanes.Models.Mixins.FileSupport = {
|
|
37
37
|
|
38
38
|
|
39
39
|
_uploadFileAfterSave: ->
|
40
|
-
files = _.
|
40
|
+
files = _.pickBy @_definition, (def, name) =>
|
41
41
|
isFileDefinition(def) and @["#{name}_file"]
|
42
42
|
return if _.isEmpty(files)
|
43
43
|
|
@@ -47,7 +47,7 @@ Lanes.Models.Mixins.FileSupport = {
|
|
47
47
|
form.append("type", @modelTypeIdentifier())
|
48
48
|
form.append("id", @getId())
|
49
49
|
form.append("extension_id", @FILE.extension.identifier)
|
50
|
-
url = Lanes.config.api_path + 'save-file-attribute'
|
50
|
+
url = Lanes.config.api_path + '/save-file-attribute'
|
51
51
|
|
52
52
|
Lanes.Vendor.xhr.post(url, {body: form}, (err, resp, body) =>
|
53
53
|
if err
|
@@ -12,8 +12,9 @@ class Page
|
|
12
12
|
format: 'array', total_count: 't'
|
13
13
|
start: @pageNum * @result.pageSize, limit: @result.pageSize,
|
14
14
|
query: query, url: @result.query.src::urlRoot(),
|
15
|
-
fields: _.
|
15
|
+
fields: _.map( @result.query.fields.where(query: true), 'id')
|
16
16
|
}
|
17
|
+
|
17
18
|
if @result.query.sortField
|
18
19
|
options.order = {}
|
19
20
|
{sortBy} = @result.query.sortField
|
@@ -48,12 +49,8 @@ class Page
|
|
48
49
|
|
49
50
|
rowAt: (index) ->
|
50
51
|
@_rowAt(index)
|
51
|
-
# row = @_rowAt(index)
|
52
|
-
# @result.query.fields.map (field) =>
|
53
|
-
# value = row[field.fetchIndex]
|
54
|
-
# field.format?(value, row, @result.query) or value
|
55
52
|
|
56
|
-
modelAt: (index) ->
|
53
|
+
modelAt: (index, options) ->
|
57
54
|
row = @_rowAt(index)
|
58
55
|
@modelCache ||= {}
|
59
56
|
id = @idForRow(row)
|
@@ -19,11 +19,13 @@ class Lanes.Models.Query.CollectionResult extends Lanes.Models.Query.Result
|
|
19
19
|
rows = (@rowAt(i, options) for i in [0...@length])
|
20
20
|
_.Promise.resolve(rows)
|
21
21
|
|
22
|
-
modelAt: (index) ->
|
23
|
-
@collection.at(index)
|
22
|
+
modelAt: (index, options = {}) ->
|
23
|
+
model = @collection.at(index)
|
24
|
+
if options.clone then model.clone() else model
|
24
25
|
|
25
26
|
saveModelChanges: (model, index) ->
|
26
27
|
old = @collection.at(index)
|
28
|
+
|
27
29
|
@collection.remove(old)
|
28
30
|
@collection.add(model, at:index)
|
29
31
|
@query.changeCount++
|
@@ -48,7 +50,7 @@ class Lanes.Models.Query.CollectionResult extends Lanes.Models.Query.Result
|
|
48
50
|
@modelAt(rowNum)
|
49
51
|
|
50
52
|
valueForField: (rowNum, field) ->
|
51
|
-
@
|
53
|
+
@collection.at(rowNum)[field.id]
|
52
54
|
|
53
55
|
fieldToSortValue:
|
54
56
|
any: (v) -> v
|
@@ -9,7 +9,7 @@ createHelper = (component, name) ->
|
|
9
9
|
|
10
10
|
extendComponent = (component) ->
|
11
11
|
names = _.keys(component.prototype.dataObjects).concat(['collection', 'model'])
|
12
|
-
for name in _.
|
12
|
+
for name in _.uniq(names)
|
13
13
|
createHelper(component, name)
|
14
14
|
|
15
15
|
Lanes.React.Component = {
|
@@ -22,7 +22,7 @@ Lanes.React.Component = {
|
|
22
22
|
|
23
23
|
extend: (klass, mixins = @defaultMixins) ->
|
24
24
|
klass::mixins ||= []
|
25
|
-
klass::mixins = _.
|
25
|
+
klass::mixins = _.uniq(klass::mixins.concat(mixins))
|
26
26
|
comp = React.createClass(klass.prototype)
|
27
27
|
extendComponent(comp)
|
28
28
|
return Lanes.lib.HotReload.remember(comp)
|
@@ -1,9 +1,9 @@
|
|
1
|
-
class Lanes.React.Root.
|
1
|
+
class Lanes.React.Root.DefaultComponentNotFound extends Lanes.React.Component
|
2
2
|
propTypes:
|
3
3
|
extension: React.PropTypes.object
|
4
4
|
|
5
5
|
render: ->
|
6
6
|
identifier = @props.extension?.identifier || "UnknownExtension"
|
7
7
|
<div className="fancy-header">
|
8
|
-
<h1>{_.classify(identifier)}.rootElement() did not return an element!</h1>
|
8
|
+
<h1>{_.classify(identifier)}.rootElement() did not return an element to render!</h1>
|
9
9
|
</div>
|
@@ -10,7 +10,7 @@ Lanes.React.Screen = {
|
|
10
10
|
|
11
11
|
extend: (klass) ->
|
12
12
|
comp = Lanes.React.Component.extend(klass, @defaultMixins)
|
13
|
-
klass::mixins.push _.
|
13
|
+
klass::mixins.push _.uniq(klass::mixins.concat(this.defaultMixins))
|
14
14
|
comp
|
15
15
|
|
16
16
|
}
|
@@ -59,6 +59,6 @@ class Lanes.React.Viewport extends Lanes.Models.State
|
|
59
59
|
component = cntrl?.rootComponent?(this) ||
|
60
60
|
Lanes.React.Root.DefaultComponentNotFound
|
61
61
|
root = React.createElement(Lanes.React.Root, {viewport: @},
|
62
|
-
React.createElement(component)
|
62
|
+
React.createElement(component, extension: cntrl)
|
63
63
|
)
|
64
64
|
@reactRoot = Lanes.Vendor.ReactDOM.render(root, @lanes)
|
@@ -30,7 +30,7 @@ class DataWrapper
|
|
30
30
|
|
31
31
|
if Lanes.u.isModel(state)
|
32
32
|
@listenToNetworkEvents(state) if @component.listenNetworkEvents
|
33
|
-
|
33
|
+
if @isStateUsingPubsub(name)
|
34
34
|
if !prevState? or prevState.getId() != state.getId()
|
35
35
|
Lanes.Models.PubSub.remove(prevState) if prevState
|
36
36
|
unless false == state.pubsub
|
@@ -102,14 +102,18 @@ class DataWrapper
|
|
102
102
|
@component.setState(state)
|
103
103
|
true
|
104
104
|
|
105
|
+
isStateUsingPubsub: (name) ->
|
106
|
+
not (false == @component.pubsub or false == @component.pubsub?[name])
|
107
|
+
|
105
108
|
destroy: (state, events, fn) ->
|
106
|
-
for name, state of @states
|
109
|
+
for name, state of @states when @isStateUsingPubsub(name)
|
107
110
|
Lanes.Models.PubSub.remove(state) if Lanes.u.isModel(state)
|
108
111
|
this.stopListening()
|
109
112
|
delete @component.data
|
110
113
|
|
111
114
|
|
112
|
-
|
115
|
+
Lanes.Vendor.Events.createEmitter(DataWrapper.prototype)
|
116
|
+
#_.extend(DataWrapper.prototype, Lanes.Vendor.BBEvents)
|
113
117
|
|
114
118
|
readDataObjects = (comp, newProps) ->
|
115
119
|
bound = _.clone _.result(comp, 'dataObjects') || {}
|
@@ -118,9 +122,9 @@ readDataObjects = (comp, newProps) ->
|
|
118
122
|
_.mapValues(bound, (value, name) ->
|
119
123
|
if _.isFunction(value)
|
120
124
|
if _.isEmpty(comp.data?.states[name]) then value.call(comp) else false
|
121
|
-
else if 'props' == value then newProps?[name] or
|
125
|
+
else if 'props' == value then newProps?[name] or comp.props[name]
|
122
126
|
else value
|
123
|
-
|
127
|
+
)
|
124
128
|
|
125
129
|
Lanes.React.Mixins.Data = {
|
126
130
|
# When the component gets the initial state, instance a `DataWrapper` to take
|
@@ -8,7 +8,7 @@ class Lanes.Screens.UserPreferences extends Lanes.React.Screen
|
|
8
8
|
commands: new Lanes.Screens.Commands(this, modelName: 'user')
|
9
9
|
|
10
10
|
setScreens: (screens) ->
|
11
|
-
@user.options = _.extend({}, @user.options, {initial_screens: _.
|
11
|
+
@user.options = _.extend({}, @user.options, {initial_screens: _.map(screens, 'id')})
|
12
12
|
|
13
13
|
getScreens: ->
|
14
14
|
_.map(@user.options?.initial_screens || [], (id) ->
|
@@ -10,6 +10,8 @@ Lanes.Test.syncRespondWith = (obj) ->
|
|
10
10
|
|
11
11
|
afterEach ->
|
12
12
|
Lanes.current_user._events = @__user_events
|
13
|
+
Lanes.Models.PubSub.types.reset()
|
14
|
+
Lanes.Models.PubSub.mb = @prevMB
|
13
15
|
|
14
16
|
beforeEach ->
|
15
17
|
@__user_events = Lanes.current_user._events
|
@@ -23,6 +25,11 @@ beforeEach ->
|
|
23
25
|
data: []
|
24
26
|
}
|
25
27
|
|
28
|
+
@prevMB = Lanes.Models.PubSub.mb
|
29
|
+
Lanes.Models.PubSub.mb = jasmine.createSpyObj('MessageBus', [
|
30
|
+
'subscribe', 'unsubscribe'
|
31
|
+
])
|
32
|
+
|
26
33
|
originalFn = Lanes.Models.Sync.perform
|
27
34
|
spyOn(Lanes.Models.Sync, 'perform').and.callFake( (method, options) ->
|
28
35
|
_.Promise.resolve(SYNC_RESPONSE)
|