lanes 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +0 -1
  3. data/client/lanes/{screens/Instance.coffee → Boot.coffee} +5 -5
  4. data/client/lanes/Config.coffee +2 -0
  5. data/client/lanes/components/multi-select/MultiSelect.coffee +20 -6
  6. data/client/lanes/components/popover/PopOver.coffee +5 -2
  7. data/client/lanes/components/record-finder/RecordFinder.coffee +12 -7
  8. data/client/lanes/components/record-finder/config.json +1 -1
  9. data/client/lanes/components/select-field/SelectField.coffee +8 -8
  10. data/client/lanes/index.js +1 -0
  11. data/client/lanes/index.scss.erb +1 -1
  12. data/client/lanes/lib/MakeBaseClass.coffee +12 -0
  13. data/client/lanes/lib/loader.coffee +3 -1
  14. data/client/lanes/lib/namespace.coffee +1 -1
  15. data/client/lanes/lib/utilFunctions.coffee +13 -1
  16. data/client/lanes/models/{ModelAssociations.coffee → AssociationMap.coffee} +12 -9
  17. data/client/lanes/models/Base.coffee +40 -14
  18. data/client/lanes/models/Collection.coffee +6 -2
  19. data/client/lanes/models/EnumMap.coffee +25 -0
  20. data/client/lanes/models/PubSub.coffee +2 -2
  21. data/client/lanes/models/Query.coffee +1 -1
  22. data/client/lanes/models/ServerCache.coffee +63 -0
  23. data/client/lanes/models/Sync.coffee +11 -13
  24. data/client/lanes/models/index.js +3 -1
  25. data/client/lanes/screens/Base.coffee +1 -1
  26. data/client/lanes/screens/Definitions.coffee +1 -1
  27. data/client/lanes/screens/index.js +1 -1
  28. data/client/lanes/screens/mixins/Editing.coffee +38 -0
  29. data/client/lanes/screens/mixins/index.js +1 -0
  30. data/client/lanes/styles/plugins/overlay.scss +7 -0
  31. data/client/lanes/testing/BeforeEach.coffee +62 -0
  32. data/client/lanes/testing/ModelSaver.coffee +5 -6
  33. data/client/lanes/testing/TestModels.coffee +23 -0
  34. data/client/lanes/testing/index.js +3 -1
  35. data/client/lanes/vendor/packaged.js +5860 -26
  36. data/client/lanes/views/Base.coffee +20 -20
  37. data/client/lanes/views/FormBindings.coffee +4 -2
  38. data/client/lanes/views/RenderContext.coffee +2 -2
  39. data/client/lanes/workspace/Layout.coffee +6 -2
  40. data/client/lanes/workspace/Navbar.coffee +1 -1
  41. data/client/lanes/workspace/Pages.coffee +1 -1
  42. data/client/lanes/workspace/navbar.html +3 -1
  43. data/client/lanes/workspace/styles/header.scss +3 -1
  44. data/lib/lanes/access/authentication_provider.rb +2 -2
  45. data/lib/lanes/access/config/routes.rb +1 -1
  46. data/lib/lanes/access/extension.rb +1 -4
  47. data/lib/lanes/access/role.rb +20 -15
  48. data/lib/lanes/access/test_fixture_extensions.rb +20 -0
  49. data/lib/lanes/access.rb +3 -3
  50. data/lib/lanes/api/request_wrapper.rb +3 -2
  51. data/lib/lanes/api/sprockets_extension.rb +1 -1
  52. data/lib/lanes/api/test_specs.rb +1 -1
  53. data/lib/lanes/capistrano.rb +18 -6
  54. data/lib/lanes/command/app.rb +1 -1
  55. data/lib/lanes/command/generate_model.rb +6 -0
  56. data/lib/lanes/command/generate_view.rb +7 -6
  57. data/lib/lanes/command/named_command.rb +1 -1
  58. data/lib/lanes/concerns/all.rb +1 -0
  59. data/lib/lanes/concerns/code_identifier.rb +43 -0
  60. data/lib/lanes/concerns/set_attribute_data.rb +0 -8
  61. data/lib/lanes/configuration.rb +1 -1
  62. data/lib/lanes/db.rb +11 -9
  63. data/lib/lanes/extension.rb +1 -0
  64. data/lib/lanes/guard_tasks.rb +1 -1
  65. data/lib/lanes/model.rb +1 -0
  66. data/lib/lanes/rake_tasks.rb +0 -2
  67. data/lib/lanes/screen.rb +1 -4
  68. data/lib/lanes/spec_helper.rb +5 -2
  69. data/lib/lanes/version.rb +1 -1
  70. data/npm-build/package.json +1 -0
  71. data/npm-build/template.js +1 -0
  72. data/spec/command-reference-files/initial/Gemfile +4 -1
  73. data/spec/command-reference-files/initial/client/appy-app/Extension.coffee +11 -1
  74. data/spec/command-reference-files/initial/config/lanes.rb +4 -1
  75. data/spec/command-reference-files/initial/lib/appy-app/extension.rb +12 -1
  76. data/spec/command-reference-files/initial/lib/appy-app.rb +0 -1
  77. data/spec/command-reference-files/model/lib/appy-app/model.rb +12 -0
  78. data/spec/command-reference-files/model/lib/appy-app.rb +11 -0
  79. data/spec/command-reference-files/view/client/appy-app/views/BigView.coffee +1 -0
  80. data/spec/lanes/helpers/lanes-helpers.coffee +0 -79
  81. data/spec/lanes/models/{ModelAssociationsSpec.coffee → AssociationMapSpec.coffee} +0 -0
  82. data/spec/lanes/models/BaseSpec.coffee +25 -12
  83. data/spec/lanes/models/CollectionSpec.coffee +20 -0
  84. data/spec/lanes/models/EnumMapSpec.coffee +26 -0
  85. data/spec/server/command_spec.rb +1 -1
  86. data/templates/Gemfile +4 -1
  87. data/templates/client/Extension.coffee +11 -1
  88. data/templates/client/views/View.coffee +2 -1
  89. data/templates/config/lanes.rb +4 -1
  90. data/templates/lib/namespace/extension.rb +12 -1
  91. data/templates/lib/namespace.rb +0 -1
  92. data/templates/spec/client/views/ViewSpec.coffee +1 -1
  93. metadata +16 -6
  94. data/spec/command-reference-files/initial/lib/appy-app/models/empty.rb +0 -0
@@ -1,6 +1,6 @@
1
1
  //= require ./ChangeListener
2
2
  //= require ./Base
3
3
  //= require ./Router
4
- //= require ./Instance
5
4
  //= require ./Definitions
6
5
  //= require ./register
6
+ //= require ./mixins
@@ -0,0 +1,38 @@
1
+ Lanes.Screens.Mixins.Editing = {
2
+
3
+ included: (klass)->
4
+ klass::domEvents ||= {}
5
+ _.extend(klass::domEvents,{
6
+ 'click .btn.save': 'saveRecord'
7
+ 'click .btn.reset': 'resetRecord'
8
+ 'display-record': 'onRecordTrigger'
9
+ })
10
+
11
+ klass::subviews ||= {}
12
+ _.extend(klass::subviews,{
13
+ finder: {
14
+ component: 'RecordFinder'
15
+ options: 'finderOptions'
16
+ model: 'model'
17
+ }
18
+ })
19
+
20
+ onRecordTrigger: (ev, model)->
21
+ this.model = model
22
+
23
+ resetRecord: ->
24
+ options = _.result(this,'finderOptions')
25
+ if options?.modelClass?
26
+ this.model = new options.modelClass
27
+
28
+ saveRecord: ->
29
+ finder_options = _.result(this,'finderOptions')
30
+ this.persistChanges?()
31
+ options={}
32
+ if finder_options?.withAssociations
33
+ options.include = finder_options?.withAssociations
34
+ Lanes.Views.SaveNotify(this,options)
35
+
36
+ initialize: ->
37
+ this.resetRecord()
38
+ }
@@ -0,0 +1 @@
1
+ //=require ./Editing
@@ -1,3 +1,10 @@
1
+ $gray-light: lightGrey !default;
2
+ $well-border: darkGrey !default;
3
+ $border-radius-large: 8px !default;
4
+ $body-bg: white !default;
5
+ $font-size-large: 15px !default;
6
+ $gray-darker: lighten(#000, 13.5%) !default;
7
+
1
8
  .overlay {
2
9
  position: absolute;
3
10
  z-index: 31;
@@ -0,0 +1,62 @@
1
+ window.syncSucceedWith = (data)->
2
+ syncReply.success = true
3
+ syncReply.data = data
4
+
5
+
6
+ syncResponse = (method, model, options)->
7
+ _.defer ->
8
+ if options.success && syncReply.success
9
+ options.success(syncReply, "success", {})
10
+ if options.failure && !syncReply.success
11
+ options.failure(syncReply, "failure", {})
12
+ _.Promise.resolve(model, options)
13
+
14
+ syncReply = {}
15
+
16
+ View = undefined
17
+ Model = undefined
18
+ Collection = undefined
19
+
20
+ Lanes.Test.makeModel = (props={}, args={})->
21
+ _.extend(Model.prototype, props)
22
+ Lanes.Models.Base.extend(Model)
23
+ return new Model(args)
24
+
25
+ Lanes.Test.makeView = (props={}, args={})->
26
+ _.extend(View.prototype, props)
27
+ Lanes.Views.Base.extend(View)
28
+ return new View(args)
29
+
30
+ beforeEach ->
31
+ Lanes.Models.ServerCache.CACHE = {};
32
+
33
+ class TestModel
34
+ constructor: -> super
35
+ Model = TestModel
36
+ class TestCollection
37
+ constructor: -> super
38
+ Collection = TestCollection
39
+ class TestView
40
+ constructor: -> super
41
+ View = TestView
42
+
43
+ syncReply = {
44
+ success: true
45
+ message: ''
46
+ data: {}
47
+ }
48
+
49
+ # Lanes.Test.syncSpy = jasmine.createSpy('sync').and.callFake(syncResponse)
50
+ # Lanes.Test.syncSpy.lastOptions = ->
51
+ # this.calls.mostRecent().args[2]
52
+ originalFn=Lanes.Models.Sync.perform
53
+ spyOn(Lanes.Models.Sync, 'perform').and.callFake(syncResponse)
54
+ Lanes.Models.Sync.perform.lastOptions = ->
55
+ this.calls.mostRecent().args[2]
56
+ Lanes.Models.Sync.callOriginal = (fn)->
57
+ spy=Lanes.Models.Sync.perform
58
+ Lanes.Models.Sync.perform = originalFn
59
+ try
60
+ fn()
61
+ finally
62
+ Lanes.Models.Sync.perform=spy
@@ -1,10 +1,10 @@
1
- class Lanes.Testing.ModelSaver
1
+ class Lanes.Test.ModelSaver
2
2
 
3
3
  @setUser: (login)->
4
- Lanes.Testing.ModelSaver::headers['X_TESTING_USER']= login
4
+ Lanes.Test.ModelSaver::headers['X_TESTING_USER']= login
5
5
 
6
6
  @perform: (model,completion)->
7
- saver = new Lanes.Testing.ModelSaver(completion)
7
+ saver = new Lanes.Test.ModelSaver(completion)
8
8
  saver.save(model)
9
9
 
10
10
  headers:
@@ -15,7 +15,6 @@ class Lanes.Testing.ModelSaver
15
15
  spyOn(this, 'success').and.callThrough()
16
16
  spyOn(this, 'error').and.callThrough()
17
17
 
18
-
19
18
  success: ->
20
19
  this.notification.resolve(this)
21
20
  _.defer(@completion) if @completion
@@ -25,10 +24,10 @@ class Lanes.Testing.ModelSaver
25
24
  _.defer(@completion) if @completion
26
25
 
27
26
  save: (model)->
28
- model.save(this.toOptions()).then(Lanes.emptyFn, Lanes.emptyFn)
27
+ Lanes.Models.Sync.callOriginal =>
28
+ model.save(@toOptions()).then(Lanes.emptyFn, Lanes.emptyFn)
29
29
  this.notification = new _.DeferredPromise
30
30
  this.notification.promise
31
31
 
32
-
33
32
  toOptions: ->
34
33
  _.pick(this,'headers','success','error')
@@ -0,0 +1,23 @@
1
+ class Lanes.Test.DummyView extends Lanes.Views.Base
2
+ formBindings:true
3
+ template: "<p>hi</p"
4
+ events: { "click #mylink": 'onClick' }
5
+ onClick: Lanes.emptyFn
6
+
7
+ class Lanes.Test.DummyModel extends Lanes.Models.Base
8
+ api_path: -> "test"
9
+ props:
10
+ id: 'number',
11
+ name: ['string', true],
12
+ html: 'string',
13
+ url: 'string',
14
+ something: 'string',
15
+ fireDanger: 'string'
16
+
17
+ session:
18
+ active: 'boolean'
19
+
20
+ derived:
21
+ classes:
22
+ deps: ['something', 'fireDanger', 'active'],
23
+ fn: -> this.something + this.active;
@@ -1,4 +1,6 @@
1
1
  //=require_self
2
+ //=require ./TestModels
2
3
  //=require ./ModelSaver
4
+ //=require ./BeforeEach
3
5
 
4
- Lanes.Testing = ( Lanes.Testing || {} )
6
+ Lanes.Test = ( Lanes.Test || {} );