material_raingular 0.0.2.6.3 → 0.0.2.6.4

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: e494464b3a9d6f7a0c44391145a24d6a78f228e3
4
- data.tar.gz: d206a0bc1b5b7f06a01df77489ee034607dccfd1
3
+ metadata.gz: 99e2764bb91cef98f71c86ee1e3ebb9a239e139a
4
+ data.tar.gz: 3917f56d7bfcdc2d8a34d64ea936e12566983b25
5
5
  SHA512:
6
- metadata.gz: a9152e81cf99869bbd1b00af8ad224ae221b746b70d7810e151a3192a547acf734c2696e59f5e25ec049975c973c148a8a3c5537d22e226e1d3ae1ad283bdb10
7
- data.tar.gz: 995c5a3b5d46bd9abc5482b91556d59c39a65cd632e491e77fdd4804f36cfcfe320df9ae64a7c5a24b13c9356b30481c96a39441d15c7beffbeed58a11abd8c6
6
+ metadata.gz: 117c42b8e76b631a1c02cd4b16d27ee4c6ab029fcfe4a0070d0c2b6d6acb2a47d07dd84ff7d6051ba2a1ddc600f358b73469de99d05289e3e8f3f2bfa24e571b
7
+ data.tar.gz: 0da0ba314d5ee2070f4fe0a96d0f8832797858ffcf8417ac945c37b82ae90772e7a8132c91eb87581e83d815b738929e4a4a5c4bc6722ce9d1d5e38a62538f98
@@ -1,32 +1,33 @@
1
1
  angular.module 'NgCreate', ['Factories', 'FactoryName']
2
2
 
3
- .directive 'ngCreate', ($timeout, $compile) ->
3
+ .directive 'ngCreate', ($injector, factoryName) ->
4
4
  restrict: 'A'
5
- link: (scope, element, attributes) ->
5
+ require: '?ngCallback'
6
+ link: (scope, element, attributes, ngCallbackCtrl) ->
6
7
  element.bind 'click', (event) ->
7
8
  [parentName, listName] = attributes.ngContext.split('.') if attributes.ngContext
8
9
  attr = scope.$eval('(' + attributes.ngAttributes + ')') || {}
9
- scope.create(attributes.ngCreate,parentName,listName,attr)
10
- controller: ($scope, $injector, factoryName, $element) ->
11
- $scope.create = (modelName,parentName,listName,attributes) ->
12
- addTo = $element[0].attributes['ng-add-to'].value if $element[0].attributes['ng-add-to']
10
+ create(attributes.ngCreate,parentName,listName,attr)
11
+ create = (modelName,parentName,listName,attributes) ->
12
+ addTo = element[0].attributes['ng-add-to'].value if element[0].attributes['ng-add-to']
13
13
  factory = factoryName(modelName)
14
14
  list = $injector.get(factory)
15
15
  object = {}
16
16
  object[modelName] = attributes
17
17
  if parentName
18
- object[modelName][parentName] = $scope[parentName] unless parentName.indexOf('_id') < 0
19
- object[modelName][parentName + '_id'] = $scope[parentName].id if parentName.indexOf('_id') < 0
20
- object[parentName] = $scope[parentName] unless parentName.indexOf('_id') < 0
21
- object[parentName + '_id'] = $scope[parentName].id if parentName.indexOf('_id') < 0
18
+ object[modelName][parentName] = scope[parentName] unless parentName.indexOf('_id') < 0
19
+ object[modelName][parentName + '_id'] = scope[parentName].id if parentName.indexOf('_id') < 0
20
+ object[parentName] = scope[parentName] unless parentName.indexOf('_id') < 0
21
+ object[parentName + '_id'] = scope[parentName].id if parentName.indexOf('_id') < 0
22
22
  list.create object, (returnData) ->
23
23
  if addTo
24
- $scope[addTo].push(returnData)
24
+ scope[addTo].push(returnData)
25
25
  if listName
26
- scope = if $scope[parentName] then $scope else $scope.$parent
26
+ scope = if scope[parentName] then scope else scope.$parent
27
27
  scope[parentName] = {} unless scope[parentName]
28
28
  scope[parentName][listName] = [] unless scope[parentName][listName]
29
29
  scope[parentName][listName].push(returnData)
30
30
  else
31
- $scope[factory] = [] unless $scope[factory]
32
- $scope[factory].push(returnData)
31
+ scope[factory] = [] unless scope[factory]
32
+ scope[factory].push(returnData)
33
+ ngCallbackCtrl.evaluate(returnData) if !!ngCallbackCtrl
@@ -1,24 +1,21 @@
1
1
  angular.module 'NgDestroy', ['Factories']
2
2
 
3
- .directive 'ngDestroy', ($timeout, $compile) ->
3
+ .directive 'ngDestroy', ($injector, factoryName) ->
4
4
  restrict: 'A'
5
- link: (scope, element, attributes) ->
5
+ require: '?ngCallback'
6
+ link: (scope, element, attributes, ngCallbackCtrl) ->
6
7
  element.bind 'click', (event) ->
7
- scope.destroy(attributes.ngDestroy,attributes.ngContext)
8
- controller: ($scope, $injector) ->
9
- $scope.destroy = (modelName,listName) ->
10
- raw_factory = modelName.split('_')
11
- factory=[]
12
- for word in raw_factory
13
- factory.push(word.charAt(0).toUpperCase() + word.slice(1))
14
- factory = factory.join('')
8
+ destroy(attributes.ngDestroy,attributes.ngContext)
9
+ destroy = (modelName,listName) ->
10
+ factory = factoryName(modelName)
15
11
  if listName
16
- list = $scope
12
+ list = scope
17
13
  for scope in listName.split('.')
18
14
  list = list[scope]
19
15
  else
20
- list = $scope[factory]
21
- list.splice(list.indexOf($scope[modelName]),1)
16
+ list = scope[factory]
17
+ list.drop(scope[modelName])
22
18
  list = $injector.get(factory)
23
- object = {id: $scope[modelName].id}
24
- list.delete object
19
+ object = {id: scope[modelName].id}
20
+ list.delete object, (returnData)->
21
+ ngCallbackCtrl.evaluate(returnData) if !!ngCallbackCtrl
@@ -1,3 +1,3 @@
1
1
  module MaterialRaingular
2
- VERSION = "0.0.2.6.3"
2
+ VERSION = "0.0.2.6.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: material_raingular
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2.6.3
4
+ version: 0.0.2.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Moody