abstracted 0.4.17 → 0.4.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28a297762d066864f6f4c3da7e4dc34996d046c7
|
4
|
+
data.tar.gz: 74259d425c5d4d14e5bd4636ddd8be149eef7a73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fd3299a894de29a3f0b23f0c0ef6c7e6de39e6e53f98275617ae895b7a543aafd16501d6b0a9a03031ffc384fd039c518a1918c64d55acedd6f8f7b2d6d4a27
|
7
|
+
data.tar.gz: afe97506115e9d7567bcd129bbc08556649b41c56145eeebf079f89b687c6d7248c80fdddd39eed784ebc0d363629d78837f577394bf6b55e7bf08c6d61f9242
|
@@ -226,7 +226,11 @@ class AbstractResourcesController < ApplicationController
|
|
226
226
|
@fab_button_options = opt
|
227
227
|
end
|
228
228
|
|
229
|
-
|
229
|
+
def caught_an_error_already?
|
230
|
+
result = @caught_an_error_already
|
231
|
+
@caught_an_error_already ||= true
|
232
|
+
result
|
233
|
+
end
|
230
234
|
|
231
235
|
def scoop_from_error e
|
232
236
|
|
@@ -240,6 +244,7 @@ class AbstractResourcesController < ApplicationController
|
|
240
244
|
flash.now[:error] = flash[:error] = "Access Problem: <br/><small>%s</small>" % e.message
|
241
245
|
result= false
|
242
246
|
status = 412
|
247
|
+
a_url = resources_url
|
243
248
|
|
244
249
|
when "ActiveRecord::RecordNotFound"
|
245
250
|
flash.now[:error] = flash[:error] = t('.fail.record_not_found')
|
@@ -251,15 +256,19 @@ class AbstractResourcesController < ApplicationController
|
|
251
256
|
flash.now[:error] = flash[:error] = t('.fail.authorized', resource: resource)
|
252
257
|
result = false
|
253
258
|
status = 401
|
259
|
+
a_url = resources_url
|
254
260
|
|
255
261
|
when "ActiveRecord::StatementInvalid" # Mysql2::Error
|
256
262
|
flash.now[:error] = flash[:error] = t('fail.mysql_error', mysql: e.to_s)
|
257
263
|
result= false
|
258
264
|
status = 409
|
265
|
+
a_url = resources_url
|
266
|
+
|
259
267
|
when "ActionView::Template::Error"
|
260
268
|
flash.now[:error] = flash[:error] = "A template error occured - please call ALCO with: <br/><small>%s</small>" % e.message
|
261
269
|
result= false
|
262
270
|
status = 301
|
271
|
+
a_url = resources_url
|
263
272
|
|
264
273
|
# when "PrintJobNotCreatedError"
|
265
274
|
#
|
@@ -280,12 +289,12 @@ class AbstractResourcesController < ApplicationController
|
|
280
289
|
raise e
|
281
290
|
# flash.now[:error] = flash[:error] = "An error occured - please refer to log for details!"
|
282
291
|
# render :error, layout: false, status: 412 and return
|
283
|
-
end
|
284
|
-
|
292
|
+
end unless caught_an_error_already?
|
293
|
+
|
285
294
|
respond_to do |format|
|
286
295
|
case params[:action]
|
287
296
|
when 'new'
|
288
|
-
format.html { flash.keep(:error) ; redirect_to
|
297
|
+
format.html { flash.keep(:error) ; redirect_to a_url }
|
289
298
|
format.js { render :error, layout: false, status: status, locals: { result: result} }
|
290
299
|
format.json { render json: resources, status: status }
|
291
300
|
when 'create'
|
@@ -293,11 +302,11 @@ class AbstractResourcesController < ApplicationController
|
|
293
302
|
format.js { render :error, layout: false, status: status, locals: { result: result} }
|
294
303
|
format.json { render json: resource.errors, status: status }
|
295
304
|
when 'show'
|
296
|
-
format.html { flash.keep(:error) ; redirect_to
|
305
|
+
format.html { flash.keep(:error) ; redirect_to a_url }
|
297
306
|
format.js { render :error, layout: false, status: status, locals: { result: result} }
|
298
307
|
format.json { render json: resources, status: status }
|
299
308
|
when 'edit'
|
300
|
-
format.html { flash.keep(:error) ; redirect_to
|
309
|
+
format.html { flash.keep(:error) ; redirect_to a_url }
|
301
310
|
format.js { render :error, layout: false, status: status, locals: { result: result} }
|
302
311
|
format.json { render json: resources, status: status }
|
303
312
|
when 'update'
|
@@ -95,7 +95,7 @@ module ResourceControl
|
|
95
95
|
when 'create','update','delete','destroy'; ""
|
96
96
|
else resource_options(options)
|
97
97
|
end
|
98
|
-
return "%s%s" % [r,options] if r.match "#{
|
98
|
+
return "%s%s" % [r,options] if r.match "#{resource_class.to_s.tableize}\/#{id}$"
|
99
99
|
"%s%s" % [ r.split("/#{params[:action]}")[0], options]
|
100
100
|
rescue Exception => e
|
101
101
|
scoop_from_error e
|
@@ -110,8 +110,8 @@ module ResourceControl
|
|
110
110
|
when 'create','update','delete','destroy'; ""
|
111
111
|
else resource_options(options)
|
112
112
|
end
|
113
|
-
return "%s%s" % [r,options] if r.match "#{
|
114
|
-
"%s%s%s" % [ r.split(
|
113
|
+
return "%s%s" % [r,options] if r.match "#{resource_class.to_s.tableize}$"
|
114
|
+
"%s%s%s" % [ r.split( resource_class.to_s.tableize)[0],resource_class.to_s.tableize, options]
|
115
115
|
rescue Exception => e
|
116
116
|
scoop_from_error e
|
117
117
|
end
|
data/lib/abstracted/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abstracted
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Walther H Diechmann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|