angular-ujs 0.4.11 → 0.4.12

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: d437b16430ab5f7369d618281078727e1b55b81d
4
- data.tar.gz: 41cb2f9d3c2b276f79445d25b7ce56ea8e43c607
3
+ metadata.gz: f143a5b5970e7e6e8a43edaddcec51a862cccdb2
4
+ data.tar.gz: 71d0f5edea2a764ad2adfd507559b9b41963f56b
5
5
  SHA512:
6
- metadata.gz: 79331967c5999f2e2805c815d3cb2509696a71ae11690f74f5b417f37b9ba21238136ae4a6de06d7195260c827cb9dc4e58a212bed1e55036fb9ad72a20cbd4a
7
- data.tar.gz: f21be98ea92b3e38f50781581fcd56a3e0bc84b3c3a146dd87ad32c8084d3b32a392a7d196d3fdff940cb589e5cea800350095190a039315953844b66e10c2c9
6
+ metadata.gz: ec44eef948dfc055d3ea608c16796d093ccbc63881a3d499f6341bdee45860b262fe56cd26121e19828db0ce7a2d471e727711b527e260017ad6017b21ee21f1
7
+ data.tar.gz: 8c3dbb69a8f8f3a95e1fe8f71744811b505fe6ddd89aa60a780e904d4e192f8ce9e28a8666739a6a7e2cf44bce265850a3e2c03c238fddd87a2cfd7d4b7987bf
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angular-ujs",
3
- "version": "0.4.11",
3
+ "version": "0.4.12",
4
4
  "description": "Unobtrusive scripting for AngularJS ( without jQuery dependency )",
5
5
  "longDescription": "Ruby on Rails replacement for unobtrusive scripting library `jquery_ujs` implemented in AngularJS without jQuery dependency",
6
6
  "main": "angular-ujs.js",
@@ -1,4 +1,4 @@
1
- /*! angular-ujs - v 0.4.11 - Fri Mar 14 2014 12:16:13 GMT+0800 (CST)
1
+ /*! angular-ujs - v 0.4.12 - Fri Mar 14 2014 12:56:09 GMT+0800 (CST)
2
2
  * https://github.com/tomchentw/angular-ujs
3
3
  * Copyright (c) 2014 [tomchentw](https://github.com/tomchentw);
4
4
  * Licensed [MIT](http://tomchentw.mit-license.org)
@@ -6,6 +6,8 @@
6
6
  /*global angular:false*/
7
7
  (function(){
8
8
  'use strict';
9
+ var bind;
10
+ bind = angular.bind;
9
11
  function denyDefaultAction(event){
10
12
  event.preventDefault();
11
13
  event.stopPropagation();
@@ -21,40 +23,47 @@
21
23
  }
22
24
  return metas;
23
25
  };
24
- })).controller('noopRailsConfirmCtrl', function(){
25
- this.allowAction = function(){
26
+ })).controller('noopRailsConfirmCtrl', (function(){
27
+ var prototype = constructor.prototype;
28
+ prototype.allowAction = function(){
26
29
  return true;
27
30
  };
28
- this.denyDefaultAction = denyDefaultAction;
29
- }).controller('RailsConfirmCtrl', ['$window', '$attrs'].concat(function($window, $attrs){
30
- this.allowAction = function(){
31
+ prototype.denyDefaultAction = denyDefaultAction;
32
+ function constructor(){}
33
+ return constructor;
34
+ }())).controller('RailsConfirmCtrl', (function(){
35
+ var prototype = constructor.prototype;
36
+ prototype.allowAction = function(){
31
37
  var message;
32
- message = $attrs.confirm;
33
- return angular.isDefined(message) && $window.confirm(message);
38
+ message = this.$attrs.confirm;
39
+ return angular.isDefined(message) && this.$window.confirm(message);
34
40
  };
35
- this.denyDefaultAction = denyDefaultAction;
36
- })).controller('noopRailsRemoteFormCtrl', function(){
37
- this.submit = function($form){
41
+ prototype.denyDefaultAction = denyDefaultAction;
42
+ constructor.$inject = ['$window', '$attrs'];
43
+ function constructor($window, $attrs){
44
+ this.$window = $window;
45
+ this.$attrs = $attrs;
46
+ }
47
+ return constructor;
48
+ }())).controller('noopRailsRemoteFormCtrl', (function(){
49
+ var prototype = constructor.prototype;
50
+ prototype.submit = function($form){
38
51
  $form[0].submit();
39
52
  return {
40
53
  then: angular.noop
41
54
  };
42
55
  };
43
- }).controller('RailsRemoteFormCtrl', ['$scope', '$attrs', '$parse', '$http'].concat(function($scope, $attrs, $parse, $http){
44
- var successCallback, errorCallback;
45
- successCallback = function(response){
46
- $scope.$emit('rails:remote:success', response);
47
- };
48
- errorCallback = function(response){
49
- $scope.$emit('rails:remote:error', response);
50
- };
51
- this.submit = function($form){
56
+ function constructor(){}
57
+ return constructor;
58
+ }())).controller('RailsRemoteFormCtrl', (function(){
59
+ var prototype = constructor.prototype;
60
+ prototype.submit = function($form){
52
61
  var targetScope, modelName, data, key, value, config, METHOD, own$ = {}.hasOwnProperty;
53
62
  targetScope = $form.scope();
54
- modelName = $attrs.remote;
63
+ modelName = this.$attrs.remote;
55
64
  data = {};
56
65
  if (modelName + "" !== 'true') {
57
- $parse(modelName).assign(data, targetScope.$eval(modelName));
66
+ this.$parse(modelName).assign(data, targetScope.$eval(modelName));
58
67
  } else {
59
68
  for (key in targetScope) if (own$.call(targetScope, key)) {
60
69
  value = targetScope[key];
@@ -75,9 +84,25 @@
75
84
  'X-Http-Method-Override': METHOD
76
85
  };
77
86
  }
78
- return $http(config).then(successCallback, errorCallback);
87
+ return this.$http(config).then(this.successCallback, this.errorCallback);
79
88
  };
80
- })).directive('confirm', function(){
89
+ prototype.successCallback = function(response){
90
+ this.$scope.$emit('rails:remote:success', response);
91
+ };
92
+ prototype.errorCallback = function(response){
93
+ this.$scope.$emit('rails:remote:error', response);
94
+ };
95
+ constructor.$inject = ['$scope', '$attrs', '$parse', '$http'];
96
+ function constructor($scope, $attrs, $parse, $http){
97
+ this.$scope = $scope;
98
+ this.$attrs = $attrs;
99
+ this.$parse = $parse;
100
+ this.$http = $http;
101
+ this.successCallback = bind(this, this.successCallback);
102
+ this.errorCallback = bind(this, this.errorCallback);
103
+ }
104
+ return constructor;
105
+ }())).directive('confirm', function(){
81
106
  function onClickHandler(confirmCtrl, event){
82
107
  if (!confirmCtrl.allowAction()) {
83
108
  confirmCtrl.denyDefaultAction(event);
@@ -85,7 +110,7 @@
85
110
  }
86
111
  function postLinkFn($scope, $element, $attrs, $ctrls){
87
112
  var callback;
88
- callback = angular.bind(void 8, onClickHandler, $ctrls[0]);
113
+ callback = bind(void 8, onClickHandler, $ctrls[0]);
89
114
  $element.on('click', callback);
90
115
  $scope.$on('$destroy', function(){
91
116
  $element.off('click', callback);
@@ -118,7 +143,7 @@
118
143
  $scope: $scope
119
144
  });
120
145
  }
121
- callback = angular.bind(void 8, onSubmitHandler, $element, $ctrls);
146
+ callback = bind(void 8, onSubmitHandler, $element, $ctrls);
122
147
  $element.on('submit', callback);
123
148
  $scope.$on('$destroy', function(){
124
149
  $element.off('submit', callback);
@@ -165,7 +190,7 @@
165
190
  if (!$ctrls[1]) {
166
191
  $ctrls[1] = $controller('noopRailsRemoteFormCtrl', controllerArgs);
167
192
  }
168
- callback = angular.bind($ctrls, onClickHandler, $scope, $attrs, $ctrls);
193
+ callback = bind($ctrls, onClickHandler, $scope, $attrs, $ctrls);
169
194
  $element.on('click', callback);
170
195
  $scope.$on('$destroy', function(){
171
196
  $element.off('click', callback);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angular-ujs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.11
4
+ version: 0.4.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - tomchentw