abstracted 0.4.16 → 0.4.17
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3768a2fd0bc32496836612516717cd03550edb9a
|
4
|
+
data.tar.gz: a57bc2f9df972dc31cc87d696a111c36c6d67cf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8b7ed7d8e12fdd28b00ff5a8067b2847a751e4faf81e71c6e6207b4521031901108027d2c46b8d881abf6b47ca49ed956d1a4780b3a49302f64338c5d46bed6
|
7
|
+
data.tar.gz: 07263ffc2f2fa4eb11733b12aa89ec48fbbb27ac3a665c407c365c102a3548bd0173da12645623db33724abae22f047a98d40bbf0aa34de53b5beaba44a683ea
|
@@ -229,7 +229,9 @@ class AbstractResourcesController < ApplicationController
|
|
229
229
|
|
230
230
|
|
231
231
|
def scoop_from_error e
|
232
|
+
|
232
233
|
raise e if %w{ test development }.include? Rails.env
|
234
|
+
|
233
235
|
logger.debug "AbstractResourcesController##{params[:action]}: #{e.class}"
|
234
236
|
a_url = root_path
|
235
237
|
|
@@ -317,4 +319,9 @@ class AbstractResourcesController < ApplicationController
|
|
317
319
|
|
318
320
|
end
|
319
321
|
|
322
|
+
def error_counter
|
323
|
+
@error_counter ||= 0
|
324
|
+
@error_counter = @error_counter + 1
|
325
|
+
end
|
326
|
+
|
320
327
|
end
|
@@ -70,13 +70,27 @@ module AbstractResourcesHelper
|
|
70
70
|
#
|
71
71
|
# resource_url returns the current entity's url
|
72
72
|
def resource_url options={}
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
73
|
+
r=request.path
|
74
|
+
id=params[:id]
|
75
|
+
options = case params[:action]
|
76
|
+
when 'create','update','delete','destroy'; ""
|
77
|
+
else resource_options(options)
|
78
|
+
end
|
79
|
+
return "%s%s" % [r,options] if r.match "\/#{resource.class.to_s.tableize}\/#{id}(|\/#{params[:action]})$"
|
80
|
+
"%s%s" % [ r.split("/#{params[:action]}")[0], options]
|
81
|
+
|
82
|
+
# opt = {}
|
83
|
+
# opt[:id] = options.id if options.class.ancestors.include? ActiveRecord::Base # edit_resource_url(@post)
|
84
|
+
# opt.merge!(options) if options.class==Hash
|
85
|
+
# opt[:action] ||= 'show'
|
86
|
+
# opt[:id] ||= resource.id
|
87
|
+
# opt[:controller] ||= resource_class.table_name
|
88
|
+
# url_for opt
|
89
|
+
end
|
90
|
+
|
91
|
+
def resource_options options={}
|
92
|
+
options.merge! params.except( "id", "controller", "action", "utf8", "_method", "authenticity_token" )
|
93
|
+
options.empty? ? "" : "?" + options.collect{ |k,v| "#{k}=#{v}" }.join("&")
|
80
94
|
end
|
81
95
|
|
82
96
|
#
|
@@ -93,8 +107,12 @@ module AbstractResourcesHelper
|
|
93
107
|
# edit_resource_url returns the current entity's url for editing
|
94
108
|
def edit_resource_url(options={})
|
95
109
|
opt = {}
|
96
|
-
|
97
|
-
|
110
|
+
if options.class.ancestors.include? ActiveRecord::Base # edit_resource_url(@post)
|
111
|
+
return '' if options.id.nil? # raise "'id' value nil - cannot build edit_resource_url"
|
112
|
+
opt[:id] = options.id
|
113
|
+
else
|
114
|
+
opt.merge!(options) if options.class==Hash
|
115
|
+
end
|
98
116
|
opt[:action] = :edit
|
99
117
|
resource_url opt
|
100
118
|
# opt[:id] ||= @resource.id
|
@@ -34,7 +34,6 @@ LISTEND
|
|
34
34
|
lst = []
|
35
35
|
# if items are empty - dream them up
|
36
36
|
options[:items] ||= {}
|
37
|
-
|
38
37
|
options[:items].merge!( list: { ajax: 'get', icon: 'list', class: 'blue', url: resources_url(resources, controller: params[:controller]), oxremote: 'false' }){ |key, v1, v2| v1 }
|
39
38
|
|
40
39
|
case options[:action]
|
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.17
|
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-02-
|
11
|
+
date: 2017-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|