material_raingular 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assets/javascripts/material_raingular/directives/destroy/linkmodel.coffee +3 -2
- data/lib/assets/javascripts/material_raingular/directives/drag/directive.coffee +3 -0
- data/lib/assets/javascripts/material_raingular/directives/drag/linkmodel.coffee +16 -0
- data/lib/assets/javascripts/material_raingular/directives/drop/directive.coffee +3 -0
- data/lib/assets/javascripts/material_raingular/directives/drop/linkmodel.coffee +31 -0
- data/lib/assets/javascripts/material_raingular/directives/update/linkmodel.coffee +2 -1
- data/lib/material_raingular/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a938613a6207d86ccd6aaa6acc91a5d5a4bafabe
|
4
|
+
data.tar.gz: 150ff98174477fd964752a3dcea14a2c6e9b895b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68951c8c8818fd55df2af294d18aad621963d43a9b5bb117988784457ac7efe031604e79dd33a3e0a32c8891107777bcc27118de19a2712be10f1ccdb9cfa5b0
|
7
|
+
data.tar.gz: 062eff127d5023bcb6ea4327a80e1170f7db7e8a9f1dde9cafd4dc23bc588656042ca33a9eded3ce0924054445f114d5f3a2f40044876ef79b657252004684de
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# //= require material_raingular/directives/destroy/directive
|
2
2
|
class MrDestroyModel extends AngularLinkModel
|
3
|
+
REPEAT_TYPES: ['ng-repeat','ng-repeat-start','md-virtual-repeat']
|
3
4
|
REGEXP: /^\s*(.*?)\s+in\s+(.*?)(?:\s+track\s+by\s+([\s\S]+?))?$/
|
4
5
|
# 1: model name
|
5
6
|
# 2: collection name
|
@@ -26,10 +27,10 @@ class MrDestroyModel extends AngularLinkModel
|
|
26
27
|
_list: -> @_options().list || @$scope.$eval(@_matchedExpression()[2].split('|')[0])
|
27
28
|
_options: -> @$scope.$eval(@$attrs.mrOptions || '{}')
|
28
29
|
_matchedExpression: -> @_repeatStatement().match(@REGEXP)
|
29
|
-
_repeatStatement: -> @
|
30
|
+
_repeatStatement: -> (@REPEAT_TYPES.map (type) => @_repeatElement().getAttribute(type)).$inject('|')
|
30
31
|
_repeatElement: ->
|
31
32
|
repeatElement = @$element[0]
|
32
|
-
until
|
33
|
+
until (@REPEAT_TYPES.map (type) => repeatElement.hasAttribute(type)).$inject('|')
|
33
34
|
repeatElement = repeatElement.parentElement
|
34
35
|
break if !repeatElement
|
35
36
|
repeatElement
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class MrDragModel extends AngularLinkModel
|
2
|
+
initialize: ->
|
3
|
+
@_element().draggable = true
|
4
|
+
@_element().addEventListener 'dragstart', @_dragStart
|
5
|
+
@_element().addEventListener 'dragend', @_dragEnd
|
6
|
+
_element: -> @$element[0]
|
7
|
+
_dragStart: (event) =>
|
8
|
+
@$scope.$event = event
|
9
|
+
event.dataTransfer.setData('html',@_element())
|
10
|
+
@$element.addClass('drag')
|
11
|
+
@$scope.$eval(@$attrs.mrDrag)
|
12
|
+
_dragEnd: (event) =>
|
13
|
+
@$scope.$event = event
|
14
|
+
@$element.removeClass('drag')
|
15
|
+
@$scope.$eval(@$attrs.mrDragEnd) if @$attrs.mrDragEnd
|
16
|
+
@register(Directives.MrDrag)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class MrDropModel extends AngularLinkModel
|
2
|
+
initialize: ->
|
3
|
+
@_element().droppable = true
|
4
|
+
@_element().addEventListener 'drop', @_drop
|
5
|
+
@_element().addEventListener 'dragover', @_dragOver
|
6
|
+
@_element().addEventListener 'dragenter', @_dragEnter
|
7
|
+
@_element().addEventListener 'dragleave', @_dragLeave
|
8
|
+
|
9
|
+
_element: -> @$element[0]
|
10
|
+
_drop: (event) =>
|
11
|
+
@$scope.$event = event
|
12
|
+
event.stopPropagation?()
|
13
|
+
@$element.removeClass('over')
|
14
|
+
@$scope.$eval(@$attrs.mrDrop)
|
15
|
+
_dragOver: (event) =>
|
16
|
+
@$scope.$event = event
|
17
|
+
event.dataTransfer.dropEffect = 'move'
|
18
|
+
event.preventDefault()
|
19
|
+
@$element.addClass('over')
|
20
|
+
@$scope.$eval(@$attrs.mrDragOver) if @$scope.$eval(@$attrs.mrDragOver)
|
21
|
+
_dragEnter: (event) =>
|
22
|
+
@$scope.$event = event
|
23
|
+
event.preventDefault()
|
24
|
+
@$element.addClass('over')
|
25
|
+
@$scope.$eval(@$attrs.mrDragEnter) if @$scope.$eval(@$attrs.mrDragEnter)
|
26
|
+
_dragLeave: (event) =>
|
27
|
+
@$scope.$event = event
|
28
|
+
@$element.removeClass('over')
|
29
|
+
event.preventDefault()
|
30
|
+
@$scope.$eval(@$attrs.mrDragLeave) if @$scope.$eval(@$attrs.mrDragLeave)
|
31
|
+
@register(Directives.MrDrop)
|
@@ -6,7 +6,7 @@ class DirectiveModels.MrUpdateModel extends AngularLinkModel
|
|
6
6
|
)
|
7
7
|
initialize: ->
|
8
8
|
[@ngModelCtrl,@mrCallbackCtrl,@ngTrackByCtrl] = @$controller
|
9
|
-
@updater = @RailsUpdater.new(@$scope,@$controller,@$attrs.ngModel,@$attrs.ngOverride
|
9
|
+
@updater = @RailsUpdater.new(@$scope,@$controller,@$attrs.ngModel,@$attrs.ngOverride,@_options().factory)
|
10
10
|
@_bind()
|
11
11
|
|
12
12
|
@register(Directives.MrUpdate)
|
@@ -46,6 +46,7 @@ class DirectiveModels.MrUpdateModel extends AngularLinkModel
|
|
46
46
|
return if old == undefined
|
47
47
|
@updater.update(updated) unless updated == old
|
48
48
|
_specificTypes: ['radio','date','checkbox','hidden']
|
49
|
+
_options: -> @$scope.$eval(@$attrs.mrOptions || '{}')
|
49
50
|
_type: -> @$attrs.type
|
50
51
|
_tagName: -> @$element[0].tagName
|
51
52
|
_modelName: -> @$attrs.ngModel
|
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.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Moody
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -109,6 +109,10 @@ files:
|
|
109
109
|
- lib/assets/javascripts/material_raingular/directives/create/linkmodel.coffee
|
110
110
|
- lib/assets/javascripts/material_raingular/directives/destroy/directive.coffee
|
111
111
|
- lib/assets/javascripts/material_raingular/directives/destroy/linkmodel.coffee
|
112
|
+
- lib/assets/javascripts/material_raingular/directives/drag/directive.coffee
|
113
|
+
- lib/assets/javascripts/material_raingular/directives/drag/linkmodel.coffee
|
114
|
+
- lib/assets/javascripts/material_raingular/directives/drop/directive.coffee
|
115
|
+
- lib/assets/javascripts/material_raingular/directives/drop/linkmodel.coffee
|
112
116
|
- lib/assets/javascripts/material_raingular/directives/update/directive.coffee
|
113
117
|
- lib/assets/javascripts/material_raingular/directives/update/linkmodel.coffee
|
114
118
|
- lib/assets/javascripts/rails_updater.coffee
|