lanes 0.3.0 → 0.4.0

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.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/client/lanes/Config.coffee +1 -1
  4. data/client/lanes/access/LoginDialog.cjsx +1 -1
  5. data/client/lanes/access/Roles.coffee +1 -1
  6. data/client/lanes/access/User.coffee +2 -2
  7. data/client/lanes/access/screens/user-management/UserManagement.cjsx +1 -1
  8. data/client/lanes/components/calendar/styles.scss +1 -1
  9. data/client/lanes/components/grid/Body.cjsx +5 -2
  10. data/client/lanes/components/grid/EditingMixin.cjsx +3 -0
  11. data/client/lanes/components/grid/Editor.cjsx +3 -11
  12. data/client/lanes/components/grid/Grid.cjsx +22 -12
  13. data/client/lanes/components/grid/Selections.cjsx +4 -1
  14. data/client/lanes/components/grid/Toolbar.cjsx +1 -1
  15. data/client/lanes/components/record-finder/RecordFinder.cjsx +2 -2
  16. data/client/lanes/components/select-field/SelectField.cjsx +19 -16
  17. data/client/lanes/components/select-field/styles.scss +1 -1
  18. data/client/lanes/components/shared/FieldMixin.cjsx +2 -2
  19. data/client/lanes/components/shared/Input.cjsx +2 -13
  20. data/client/lanes/components/shared/InputFieldMixin.cjsx +15 -8
  21. data/client/lanes/components/shared/NetworkActivityOverlay.cjsx +1 -1
  22. data/client/lanes/components/shared/NumberInput.cjsx +4 -12
  23. data/client/lanes/components/shared/ToggleField.cjsx +0 -2
  24. data/client/lanes/components/shared/fields.scss +9 -0
  25. data/client/lanes/components/shared/styles.scss +2 -1
  26. data/client/lanes/components/toolbar/Toolbar.cjsx +1 -1
  27. data/client/lanes/lib/HotReload.coffee +2 -2
  28. data/client/lanes/lib/development.coffee +1 -1
  29. data/client/lanes/lib/loader.coffee +3 -3
  30. data/client/lanes/models/AssociationMap.coffee +1 -1
  31. data/client/lanes/models/AssociationProxy.coffee +1 -0
  32. data/client/lanes/models/Base.coffee +7 -10
  33. data/client/lanes/models/Collection.coffee +3 -6
  34. data/client/lanes/models/JobStatus.coffee +1 -1
  35. data/client/lanes/models/PubSub.coffee +51 -33
  36. data/client/lanes/models/Query.coffee +1 -1
  37. data/client/lanes/models/Sync.coffee +1 -1
  38. data/client/lanes/models/User.coffee +3 -3
  39. data/client/lanes/models/mixins/FileSupport.coffee +3 -3
  40. data/client/lanes/models/query/ArrayResult.coffee +3 -6
  41. data/client/lanes/models/query/CollectionResult.coffee +5 -3
  42. data/client/lanes/react/Component.coffee +2 -2
  43. data/client/lanes/react/DefaultComponentNotFound.cjsx +2 -2
  44. data/client/lanes/react/Screen.coffee +1 -1
  45. data/client/lanes/react/Viewport.coffee +1 -1
  46. data/client/lanes/react/mixins/Access.coffee +1 -1
  47. data/client/lanes/react/mixins/Data.coffee +9 -5
  48. data/client/lanes/screens/Commands.coffee +1 -1
  49. data/client/lanes/screens/UserPreferences.cjsx +1 -1
  50. data/client/lanes/testing/BeforeEach.coffee +7 -0
  51. data/client/lanes/vendor/base.js.erb +5 -0
  52. data/client/lanes/vendor/calendar.js.erb +5 -0
  53. data/client/lanes/vendor/commons.js.erb +5 -0
  54. data/client/lanes/vendor/{base.js → development/base.js} +37776 -40850
  55. data/client/lanes/vendor/development/calendar.js +1667 -0
  56. data/client/lanes/vendor/development/commons.js +39085 -0
  57. data/client/lanes/vendor/development/helpers.js +578 -0
  58. data/client/lanes/vendor/{toggle.js → development/toggle.js} +22 -82
  59. data/client/lanes/vendor/development/widgets.js +8975 -0
  60. data/client/lanes/vendor/production/base.js +63239 -0
  61. data/client/lanes/vendor/production/calendar.js +1667 -0
  62. data/client/lanes/vendor/production/commons.js +38505 -0
  63. data/client/lanes/vendor/production/toggle.js +285 -0
  64. data/client/lanes/vendor/production/widgets.js +8975 -0
  65. data/client/lanes/vendor/{calendar.scss → styles/calendar.scss} +6 -0
  66. data/client/lanes/vendor/{toggle.scss → styles/toggle.scss} +0 -0
  67. data/client/lanes/vendor/{widgets.scss → styles/widgets.scss} +2 -2
  68. data/client/lanes/vendor/toggle.js.erb +5 -0
  69. data/client/lanes/vendor/widgets.js.erb +5 -0
  70. data/lib/lanes/api/default_routes.rb +3 -3
  71. data/lib/lanes/api/routing.rb +1 -1
  72. data/lib/lanes/configuration.rb +8 -14
  73. data/lib/lanes/environment.rb +3 -0
  74. data/lib/lanes/extension/definition.rb +4 -0
  75. data/lib/lanes/system_settings.rb +21 -6
  76. data/lib/lanes/version.rb +1 -1
  77. data/npm-build/base.js +9 -4
  78. data/npm-build/build +9 -0
  79. data/npm-build/development.js +3 -1
  80. data/npm-build/package.json +34 -34
  81. data/npm-build/update-dayz +1 -1
  82. data/npm-build/webpack.config.js +36 -20
  83. data/spec/command-reference-files/initial/Gemfile +1 -1
  84. data/spec/command-reference-files/screen/config/screens.rb +1 -1
  85. data/spec/lanes/components/grid/RowEditorSpec.coffee +3 -1
  86. data/spec/lanes/components/select-field/SelectFieldSpec.coffee +33 -28
  87. data/spec/lanes/models/AssociationProxySpec.coffee +36 -37
  88. data/spec/lanes/models/BaseSpec.coffee +0 -32
  89. data/spec/lanes/models/CollectionSpec.coffee +0 -10
  90. data/spec/lanes/models/PubSubSpec.coffee +63 -13
  91. data/spec/lanes/screens/DefinitionsSpec.coffee +2 -2
  92. metadata +23 -20
  93. data/client/lanes/vendor/calendar.js +0 -17301
  94. data/client/lanes/vendor/commons.js +0 -19722
  95. data/client/lanes/vendor/development.js +0 -5471
  96. data/client/lanes/vendor/grid.js +0 -15384
  97. data/client/lanes/vendor/grid.scss +0 -928
  98. data/client/lanes/vendor/rw-widgets.eot +0 -0
  99. data/client/lanes/vendor/rw-widgets.svg +0 -18
  100. data/client/lanes/vendor/rw-widgets.ttf +0 -0
  101. data/client/lanes/vendor/rw-widgets.woff +0 -0
  102. data/client/lanes/vendor/widgets.js +0 -23204
  103. data/npm-build/compile.coffee +0 -19
  104. 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
- if this.cacheDuration
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(_.pluck(options.originalData, 'id'), (id) =>
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.USCollection), BasicCollection
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
- _.contains(['unqueued', 'queued', 'started'], @state)
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 ModelType extends Lanes.Models.State
1
+ class ModelConfig
2
2
 
3
- constructor: ->
4
- super
5
- @records = {}
6
-
7
- session:
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 (config = @records[model.id])
23
- config.models.push(model) unless _.include(config.models, model)
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 = { models: [model] }
26
- config.channel = this.subscribe(config)
27
- @records[model.id] = config
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
- if ( config = @records[model.id] )
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 = MessageBus.noConflict()
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 && _.contains(this.types, this.field.type) )
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 _.contains(['create', 'update', 'patch'], method)
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 _.any(events)
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 = _.pick klass::props, (def, name) -> isFileDefinition(def)
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 = _.pick @_definition, (def, name) =>
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: _.pluck( @result.query.fields.where(query: true), 'id')
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
- @modelAt(rowNum)[field.id]
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 _.unique(names)
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 = _.unique(klass::mixins.concat(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.DefaultComponentNotFOund extends Lanes.React.Component
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 _.unique(klass::mixins.concat(this.defaultMixins))
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)
@@ -24,7 +24,7 @@ Lanes.React.Mixins.Access = {
24
24
  !!@state.accessRight
25
25
 
26
26
  hasWriteAccess: ->
27
- _.include(['w', 'd'], @state.accessRight)
27
+ _.includes(['w', 'd'], @state.accessRight)
28
28
 
29
29
 
30
30
  }
@@ -30,7 +30,7 @@ class DataWrapper
30
30
 
31
31
  if Lanes.u.isModel(state)
32
32
  @listenToNetworkEvents(state) if @component.listenNetworkEvents
33
- unless false == @component.pubsub or false == @component?.pubsub?[name]
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
- _.extend(DataWrapper.prototype, Lanes.Vendor.BBEvents)
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 @props[name]
125
+ else if 'props' == value then newProps?[name] or comp.props[name]
122
126
  else value
123
- , comp)
127
+ )
124
128
 
125
129
  Lanes.React.Mixins.Data = {
126
130
  # When the component gets the initial state, instance a `DataWrapper` to take
@@ -2,7 +2,7 @@ class Lanes.Screens.Commands extends Lanes.Models.State
2
2
 
3
3
  constructor: (@screen, @options = {}) ->
4
4
  _.defaults(@options, modelName: 'model')
5
- _.bindAll(this, _.functions(this))
5
+ _.bindAll(this, _.functionsIn(this))
6
6
 
7
7
  resetModel: ->
8
8
  model = @getModel()
@@ -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: _.pluck(screens, 'id')})
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)
@@ -0,0 +1,5 @@
1
+ <% if Lanes.env.production?
2
+ require_asset "./production/base"
3
+ else
4
+ require_asset "./development/base"
5
+ end %>
@@ -0,0 +1,5 @@
1
+ <% if Lanes.env.production?
2
+ require_asset "./production/calendar"
3
+ else
4
+ require_asset "./development/calendar"
5
+ end %>
@@ -0,0 +1,5 @@
1
+ <% if Lanes.env.production?
2
+ require_asset "./production/commons"
3
+ else
4
+ require_asset "./development/commons"
5
+ end %>