material_raingular 0.0.3.2 → 0.0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c13a776b583ba81f26556b74cab7995e179bc50
4
- data.tar.gz: 6e1cfe31dee8a8c2e599cb3b7d118a0b9c70ccc2
3
+ metadata.gz: 75e35311a439a311e15be760517961b55996f0fb
4
+ data.tar.gz: 3fffeed340c6884dba3e83126d4cfa3ef77e9cc3
5
5
  SHA512:
6
- metadata.gz: e8fa834ab52932e40591fba4931f8ccd52a1342dce52ac2a95b26e45eb6565e9a97e9210f4b3da923c676c5f2c8cf705b05a8f5ee3db7d9ff45c8c37d579f60b
7
- data.tar.gz: df42bd0c6272fe6124752593afb94a571ca5fbb0890f6df32c0c026528e7c7fb4cbfc19b3420c5993674b3ea53c910e9343d6f14dc55f4c917b340ad816b565d
6
+ metadata.gz: 8a06280b078376d593a0c8ff714c5ed12b3457b474c03548508b7688707d2195df517a6e749cb870dfe947c2ae96d1bb394342663fb7d2c3214a303c61a0a170
7
+ data.tar.gz: 7dafa13ef461765d2153174a04eb079fb5c116aa3f3c69b4f7b64aafda3efd42a61aeb65554174f1b11fe7cceb2f75ba490d6c8a2928b1da5dabf35ae7f75cd9
@@ -1,7 +1,7 @@
1
1
  class ElementUpdate
2
2
  constructor: (scope,element,attributes,controllers,RailsUpdater,timeout,parse) ->
3
3
  [@ngModelCtrl,@ngCallbackCtrl,@ngTrackByCtrl] = controllers
4
- @updater = RailsUpdater.new(scope,controllers,attributes.ngModel,attributes.ngOverride)
4
+ @updater = RailsUpdater.new(scope,controllers,attributes.ngModel,attributes.ngOverride,attributes.ngFactory)
5
5
  @type = attributes.type
6
6
  @tagName = element[0].tagName
7
7
  @modelName = attributes.ngModel
@@ -1,5 +1,5 @@
1
1
  class RailsUpdate
2
- constructor: ($injector,$parse,factoryName,scope,controllers,model,override)->
2
+ constructor: ($injector,$parse,factoryName,scope,controllers,model,override,ngFactory)->
3
3
  @injector = $injector
4
4
  @factoryName = factoryName
5
5
  @scope = scope
@@ -10,9 +10,10 @@ class RailsUpdate
10
10
  else
11
11
  [@modelName,@atomName] = modelName.split('.')
12
12
  @override = !!override
13
- @factory = @injector.get(@factoryName(@modelName))
13
+ @factory = @injector.get(@factoryName(ngFactory || @modelName))
14
14
  @controllers = controllers.slice(0)
15
15
  @ngModelCtrl = @controllers.shift()
16
+ @railsName = ngFactory || @modelName
16
17
  return @
17
18
  equiv: (left,right) ->
18
19
  return true if left == right
@@ -20,21 +21,20 @@ class RailsUpdate
20
21
  false
21
22
  update: (value) ->
22
23
  atomName = if typeof @atomName == 'function' then @atomName(@scope) else @atomName
23
- @value = if @override then scope.$eval(atomName) else value
24
+ @value = if @override then @scope.$eval(atomName) else value
24
25
  object = {id: @scope.$eval(@modelName).id}
25
- object[@modelName] = {}
26
- object[@modelName][atomName] = value
26
+ object[@railsName] = {}
27
+ object[@railsName][atomName] = value
27
28
  unless @scope[@modelName].currently_updating
28
29
  @scope[@modelName].currently_updating = true
29
- up = @
30
- @factory.update object, (returnData) ->
31
- up.scope[up.modelName].currently_updating = false
32
- unless up.equiv(up.ngModelCtrl.$viewValue,returnData[up.atomName])
33
- up.ngModelCtrl.$setModelValue = returnData[up.atomName]
34
- up.ngModelCtrl.$render()
35
- for controller in up.controllers
30
+ @factory.update object, (returnData) =>
31
+ @scope[@modelName].currently_updating = false
32
+ unless @equiv(@ngModelCtrl.$viewValue,returnData[@atomName])
33
+ @ngModelCtrl.$setModelValue = returnData[@atomName]
34
+ @ngModelCtrl.$render()
35
+ for controller in @controllers
36
36
  controller.evaluate(returnData) if !!controller
37
37
  angular.module 'RailsUpdater', ['Factories', 'FactoryName']
38
38
  .factory 'RailsUpdater', ($injector,factoryName,$parse) ->
39
- new: (scope,controllers,model,override)->
40
- return new RailsUpdate($injector,$parse,factoryName,scope,controllers,model,override)
39
+ new: (scope,controllers,model,override,ngFactory)->
40
+ return new RailsUpdate($injector,$parse,factoryName,scope,controllers,model,override,ngFactory)
@@ -1,3 +1,3 @@
1
1
  module MaterialRaingular
2
- VERSION = "0.0.3.2"
2
+ VERSION = "0.0.3.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: material_raingular
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3.2
4
+ version: 0.0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Moody
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-28 00:00:00.000000000 Z
11
+ date: 2015-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler