material_raingular 0.0.2.6.1 → 0.0.2.6.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 468d18ce9be1d806963f1119aa95a54b9e8eaec8
|
4
|
+
data.tar.gz: a0dbf01d2104f1caa0062ec2a461ea27a29f70e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d34413546f8441664e0890842abd0f5e7d62b8d08081306bd6a086c8283a908aa6e6568a6c5bf8edf41fc2fc426ae6e584897394d8f69b377aafd0ba58815e4
|
7
|
+
data.tar.gz: b2070e84dee9b3784dee597a79d159ab07479a34556190981454db72aa438c6cada01cc26dabb36147c0ccdfe867708d42735732fc0a80c899a1658f1ad39df2
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class ElementUpdate
|
2
|
-
constructor: (scope,element,attributes,controllers,RailsUpdater) ->
|
2
|
+
constructor: (scope,element,attributes,controllers,RailsUpdater,timeout) ->
|
3
3
|
[@ngModelCtrl,@ngCallbackCtrl,@ngTrackByCtrl] = controllers
|
4
4
|
@updater = RailsUpdater.new(scope,controllers,attributes.ngModel,attributes.ngOverride)
|
5
5
|
@type = attributes.type
|
@@ -9,6 +9,7 @@ class ElementUpdate
|
|
9
9
|
@scope = scope
|
10
10
|
@element = element
|
11
11
|
@placeholder = attributes.placeholder
|
12
|
+
@timeout = timeout
|
12
13
|
@bindInput() if @isInput
|
13
14
|
@bindElement() unless @isInput
|
14
15
|
@setPlaceholder() unless @placeholder
|
@@ -21,31 +22,32 @@ class ElementUpdate
|
|
21
22
|
if @type == 'radio' || @type == 'date'
|
22
23
|
@element.bind 'input', (event) ->
|
23
24
|
return unless eu.ngModelCtrl.$valid
|
24
|
-
eu.updater.update(element.val())
|
25
|
+
eu.updater.update(eu.element.val())
|
25
26
|
else if @type == 'hidden'
|
26
27
|
@watcher()
|
27
28
|
else if @type == 'checkbox'
|
28
29
|
@element.bind 'click', (event) ->
|
29
|
-
eu.updater.update(element.val())
|
30
|
+
eu.updater.update(eu.element.val())
|
30
31
|
else
|
31
32
|
oldValue = null
|
32
33
|
@element.bind 'focus', ->
|
33
34
|
eu.scope.$apply ->
|
34
35
|
oldValue = eu.element.val()
|
35
36
|
@element.bind 'blur', (event) ->
|
36
|
-
delay = if
|
37
|
-
|
38
|
-
|
37
|
+
delay = if eu.element.hasClass('autocomplete') then 300 else 0
|
38
|
+
eu.timeout ->
|
39
|
+
eu.scope.$apply ->
|
39
40
|
newValue = @element.val()
|
40
41
|
@updater.update(newValue) if (newValue != oldValue)
|
41
42
|
, delay
|
42
43
|
|
43
44
|
bindElement: ->
|
45
|
+
eu = @
|
44
46
|
if @tagName == 'TEXTAREA'
|
45
47
|
@element.bind 'keyup', ->
|
46
|
-
|
47
|
-
|
48
|
-
eu.updater.update(element.val())
|
48
|
+
eu.timeout.cancel(eu.debounce)
|
49
|
+
eu.debounce = eu.timeout ->
|
50
|
+
eu.updater.update(eu.element.val())
|
49
51
|
,750
|
50
52
|
else
|
51
53
|
@watcher()
|
@@ -61,4 +63,4 @@ angular.module 'MdUpdate', ['Factories', 'FactoryName','RailsUpdater']
|
|
61
63
|
require: ['ngModel','?ngCallback','?ngTrackBy']
|
62
64
|
|
63
65
|
link: (scope, element, attributes, ngControllers) ->
|
64
|
-
new ElementUpdate(scope,element,attributes,ngControllers, RailsUpdater)
|
66
|
+
new ElementUpdate(scope,element,attributes,ngControllers, RailsUpdater,$timeout)
|
@@ -7,7 +7,6 @@ class RailsUpdate
|
|
7
7
|
@atomName = (override || model).split('.')[1]
|
8
8
|
@override = !!override
|
9
9
|
@factory = @injector.get(@factoryName(@modelName))
|
10
|
-
@object = {id: scope[@modelName].id}
|
11
10
|
@ngModelCtrl = controllers.shift()
|
12
11
|
@controllers = controllers
|
13
12
|
return @
|
@@ -16,12 +15,13 @@ class RailsUpdate
|
|
16
15
|
return true if (!!left && !!right) == false
|
17
16
|
false
|
18
17
|
update: (value) ->
|
19
|
-
@value
|
20
|
-
|
18
|
+
@value = if @override then scope.$eval(@atomName) else value
|
19
|
+
object = {id: @scope.$eval(@modelName).id}
|
20
|
+
object[@atomName] = value
|
21
21
|
unless @scope[@modelName].currently_updating
|
22
22
|
@scope[@modelName].currently_updating = true
|
23
23
|
up = @
|
24
|
-
@factory.update
|
24
|
+
@factory.update object, (returnData) ->
|
25
25
|
up.scope[up.modelName].currently_updating = false
|
26
26
|
unless up.equiv(up.ngModelCtrl.$viewValue,returnData[up.atomName])
|
27
27
|
up.ngModelCtrl.$setModelValue = returnData[up.atomName]
|
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.2.6.
|
4
|
+
version: 0.0.2.6.2
|
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-09-
|
11
|
+
date: 2015-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|