kea-rails 2.0.0.pre.alpha12 → 2.0.0.pre.alpha13

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: f0afa075fd7d495cfcff98e7f4f87cb758b07983
4
- data.tar.gz: a4515d68e13f502bce2b9417ef2c73f90cab4b56
3
+ metadata.gz: 6886571c018d6e246ac3e9b8a94859681d3001bd
4
+ data.tar.gz: 9a8c42dce4ef676a32bac317225460bdd6129d69
5
5
  SHA512:
6
- metadata.gz: e0b39991f86689a25daaa11e5195554f9a3a2f7bb7efb492f28612110594811684d0f94d2f44742e33965d3b58dccce53a3b773d7b22568fc2e5012e40c5c543
7
- data.tar.gz: cf8887145351e64fbfe0db2302cae8e53b34c0544951bd9f9b3cc7f143212bd029eb4b840b93bbf8a7b5b55f1055a5f8318552741cd65f5f112fde125c8feb75
6
+ metadata.gz: 80cf62e387467cd98958c334ef02a8dfb3f46937188aad6d7f2b9b41633118de2fda568884a68c6862bb5c6f6f4d36dfe77673c488cf4a4d060aef8e0c37eb0e
7
+ data.tar.gz: b7c1dd6dc6098287711ee1c97da65a6fa7654ec936d3c3bc48c3dd203a51951a5899781dead70374d67e5ddf6f91839c67d0510ed93eeee4a6c7d78c781a93c2
@@ -47,7 +47,7 @@
47
47
 
48
48
  } else if (jqXHR.status === 403) {
49
49
  kea.notify("Das geht nun wirklich nicht! <p><small>Diese Aktion ist nicht erlaubt</small></p>", 'error');
50
-
50
+
51
51
  }
52
52
 
53
53
  };
@@ -57,7 +57,7 @@
57
57
  kea.notify(jqXHR.responseText, 'error');
58
58
  }
59
59
  };
60
-
60
+
61
61
  failure423Handler = function failure423Handler(jqXHR, textStatus) {
62
62
  if (jqXHR.status === 423) {
63
63
  kea.notify(jqXHR.responseText, 'error');
@@ -71,28 +71,30 @@
71
71
 
72
72
  return name.toLowerCase();
73
73
  };
74
-
74
+
75
75
  _resourcePathForAction = function _resourcePathForAction(action, modelObject) {
76
76
  var pathMethod = action + 'Path';
77
-
77
+
78
78
  if (typeof modelObject[pathMethod] === 'function') {
79
79
  return modelObject[action + 'Path']();
80
-
80
+
81
81
  } else if (modelObject.service() && typeof modelObject.service()[pathMethod] === 'function') {
82
82
  return modelObject.service()[pathMethod]();
83
-
83
+
84
84
  } else {
85
85
  return modelObject.resource_path;
86
86
  }
87
87
  };
88
88
 
89
- get = function get(modelName, path, params, cache_key) {
89
+ get = function get(modelName, path, params, cache_key, use_failurehandler) {
90
90
  var responseProcessor,
91
91
  deferred,
92
92
  cachedResult;
93
93
 
94
94
  params = params || {};
95
95
 
96
+ use_failurehandler = typeof use_failurehandler !== 'undefined' ? use_failurehandler : true;
97
+
96
98
  if (cache_key === true) {
97
99
  cache_key = new URI(path).query(params).toString();
98
100
  }
@@ -114,17 +116,24 @@
114
116
  cachedResult = _lookupCache(cache_key);
115
117
  }
116
118
 
117
- return (cachedResult || _request('GET', path, params))
118
- .then(responseProcessor)
119
- .fail(_defaultFailureHandler);
119
+ if (use_failurehandler) {
120
+ return (cachedResult || _request('GET', path, params))
121
+ .then(responseProcessor)
122
+ .fail(_defaultFailureHandler);
123
+ } else {
124
+ return (cachedResult || _request('GET', path, params))
125
+ .then(responseProcessor);
126
+ }
120
127
  };
121
-
122
- refresh = function refresh(modelName, modelObject, params, path) {
128
+
129
+ refresh = function refresh(modelName, modelObject, params, path, use_failurehandler) {
123
130
  var responseProcessor,
124
131
  deferred;
125
132
 
126
133
  params = params || {};
127
134
 
135
+ use_failurehandler = typeof use_failurehandler !== 'undefined' ? use_failurehandler : true;
136
+
128
137
  responseProcessor = function responseProcessor(data) {
129
138
  if (DEBUG) { console.debug("received resource %s for refresh: %o", modelName, data); }
130
139
 
@@ -132,21 +141,26 @@
132
141
  if (DEBUG) { console.error("received multiple resources when trying to refresh %s : %o", modelName, data); }
133
142
 
134
143
  } else {
135
-
144
+
136
145
  if (typeof modelObject.refreshFromJS === 'function') {
137
146
  modelObject.refresh(data);
138
-
147
+
139
148
  } else {
140
149
  modelObject.deserialize(data);
141
150
  }
142
-
151
+
143
152
  return modelObject;
144
153
  }
145
154
  };
146
155
 
147
- return _request('GET', path, params)
148
- .then(responseProcessor)
149
- .fail(_defaultFailureHandler);
156
+ if (use_failurehandler) {
157
+ return _request('GET', path, params)
158
+ .then(responseProcessor)
159
+ .fail(_defaultFailureHandler);
160
+ } else {
161
+ return _request('GET', path, params)
162
+ .then(responseProcessor);
163
+ }
150
164
  };
151
165
 
152
166
  create = function create(modelName, modelObject, path) {
@@ -200,7 +214,7 @@
200
214
  };
201
215
 
202
216
  destroy = function destroy(modelName, modelObject, path) {
203
-
217
+
204
218
  if (!path) {
205
219
  path = _resourcePathForAction('destroy', modelObject);
206
220
  }
@@ -1,3 +1,3 @@
1
1
  module Kea
2
- VERSION = "2.0.0-alpha12"
2
+ VERSION = "2.0.0-alpha13"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kea-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.alpha12
4
+ version: 2.0.0.pre.alpha13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan-Christian Foeh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-27 00:00:00.000000000 Z
11
+ date: 2015-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails