lanes 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +0 -1
- data/client/lanes/{screens/Instance.coffee → Boot.coffee} +5 -5
- data/client/lanes/Config.coffee +2 -0
- data/client/lanes/components/multi-select/MultiSelect.coffee +20 -6
- data/client/lanes/components/popover/PopOver.coffee +5 -2
- data/client/lanes/components/record-finder/RecordFinder.coffee +12 -7
- data/client/lanes/components/record-finder/config.json +1 -1
- data/client/lanes/components/select-field/SelectField.coffee +8 -8
- data/client/lanes/index.js +1 -0
- data/client/lanes/index.scss.erb +1 -1
- data/client/lanes/lib/MakeBaseClass.coffee +12 -0
- data/client/lanes/lib/loader.coffee +3 -1
- data/client/lanes/lib/namespace.coffee +1 -1
- data/client/lanes/lib/utilFunctions.coffee +13 -1
- data/client/lanes/models/{ModelAssociations.coffee → AssociationMap.coffee} +12 -9
- data/client/lanes/models/Base.coffee +40 -14
- data/client/lanes/models/Collection.coffee +6 -2
- data/client/lanes/models/EnumMap.coffee +25 -0
- data/client/lanes/models/PubSub.coffee +2 -2
- data/client/lanes/models/Query.coffee +1 -1
- data/client/lanes/models/ServerCache.coffee +63 -0
- data/client/lanes/models/Sync.coffee +11 -13
- data/client/lanes/models/index.js +3 -1
- data/client/lanes/screens/Base.coffee +1 -1
- data/client/lanes/screens/Definitions.coffee +1 -1
- data/client/lanes/screens/index.js +1 -1
- data/client/lanes/screens/mixins/Editing.coffee +38 -0
- data/client/lanes/screens/mixins/index.js +1 -0
- data/client/lanes/styles/plugins/overlay.scss +7 -0
- data/client/lanes/testing/BeforeEach.coffee +62 -0
- data/client/lanes/testing/ModelSaver.coffee +5 -6
- data/client/lanes/testing/TestModels.coffee +23 -0
- data/client/lanes/testing/index.js +3 -1
- data/client/lanes/vendor/packaged.js +5860 -26
- data/client/lanes/views/Base.coffee +20 -20
- data/client/lanes/views/FormBindings.coffee +4 -2
- data/client/lanes/views/RenderContext.coffee +2 -2
- data/client/lanes/workspace/Layout.coffee +6 -2
- data/client/lanes/workspace/Navbar.coffee +1 -1
- data/client/lanes/workspace/Pages.coffee +1 -1
- data/client/lanes/workspace/navbar.html +3 -1
- data/client/lanes/workspace/styles/header.scss +3 -1
- data/lib/lanes/access/authentication_provider.rb +2 -2
- data/lib/lanes/access/config/routes.rb +1 -1
- data/lib/lanes/access/extension.rb +1 -4
- data/lib/lanes/access/role.rb +20 -15
- data/lib/lanes/access/test_fixture_extensions.rb +20 -0
- data/lib/lanes/access.rb +3 -3
- data/lib/lanes/api/request_wrapper.rb +3 -2
- data/lib/lanes/api/sprockets_extension.rb +1 -1
- data/lib/lanes/api/test_specs.rb +1 -1
- data/lib/lanes/capistrano.rb +18 -6
- data/lib/lanes/command/app.rb +1 -1
- data/lib/lanes/command/generate_model.rb +6 -0
- data/lib/lanes/command/generate_view.rb +7 -6
- data/lib/lanes/command/named_command.rb +1 -1
- data/lib/lanes/concerns/all.rb +1 -0
- data/lib/lanes/concerns/code_identifier.rb +43 -0
- data/lib/lanes/concerns/set_attribute_data.rb +0 -8
- data/lib/lanes/configuration.rb +1 -1
- data/lib/lanes/db.rb +11 -9
- data/lib/lanes/extension.rb +1 -0
- data/lib/lanes/guard_tasks.rb +1 -1
- data/lib/lanes/model.rb +1 -0
- data/lib/lanes/rake_tasks.rb +0 -2
- data/lib/lanes/screen.rb +1 -4
- data/lib/lanes/spec_helper.rb +5 -2
- data/lib/lanes/version.rb +1 -1
- data/npm-build/package.json +1 -0
- data/npm-build/template.js +1 -0
- data/spec/command-reference-files/initial/Gemfile +4 -1
- data/spec/command-reference-files/initial/client/appy-app/Extension.coffee +11 -1
- data/spec/command-reference-files/initial/config/lanes.rb +4 -1
- data/spec/command-reference-files/initial/lib/appy-app/extension.rb +12 -1
- data/spec/command-reference-files/initial/lib/appy-app.rb +0 -1
- data/spec/command-reference-files/model/lib/appy-app/model.rb +12 -0
- data/spec/command-reference-files/model/lib/appy-app.rb +11 -0
- data/spec/command-reference-files/view/client/appy-app/views/BigView.coffee +1 -0
- data/spec/lanes/helpers/lanes-helpers.coffee +0 -79
- data/spec/lanes/models/{ModelAssociationsSpec.coffee → AssociationMapSpec.coffee} +0 -0
- data/spec/lanes/models/BaseSpec.coffee +25 -12
- data/spec/lanes/models/CollectionSpec.coffee +20 -0
- data/spec/lanes/models/EnumMapSpec.coffee +26 -0
- data/spec/server/command_spec.rb +1 -1
- data/templates/Gemfile +4 -1
- data/templates/client/Extension.coffee +11 -1
- data/templates/client/views/View.coffee +2 -1
- data/templates/config/lanes.rb +4 -1
- data/templates/lib/namespace/extension.rb +12 -1
- data/templates/lib/namespace.rb +0 -1
- data/templates/spec/client/views/ViewSpec.coffee +1 -1
- metadata +16 -6
- data/spec/command-reference-files/initial/lib/appy-app/models/empty.rb +0 -0
@@ -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.
|
1
|
+
class Lanes.Test.ModelSaver
|
2
2
|
|
3
3
|
@setUser: (login)->
|
4
|
-
Lanes.
|
4
|
+
Lanes.Test.ModelSaver::headers['X_TESTING_USER']= login
|
5
5
|
|
6
6
|
@perform: (model,completion)->
|
7
|
-
saver = new Lanes.
|
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
|
-
|
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;
|