rows_controller 3.0.1 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/lib/rows/engine.rb +2 -0
- data/lib/rows/model.rb +2 -2
- data/lib/rows/resources.rb +8 -8
- data/lib/rows/utils.rb +8 -5
- data/lib/rows/version.rb +6 -2
- data/lib/rows/version.rb.bak +9 -5
- data/lib/rows_controller.rb +2 -0
- metadata +19 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ea282f99f4fadad36a5d7973f85373cde5d0a99bd4693b73ba4bb7022966d74
|
4
|
+
data.tar.gz: bff51320262e2bcc2853abf0825a4887177755af61d32340e07c38cd321f1a93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fc50f5cedbd36b6fc06c3bb71e489543629b0c9cc88b7fc7044d111d74d2f612189b0f6f686047975ecb8006a4acb4eb7e41a2cb77d01409e656d0b8eb1118f
|
7
|
+
data.tar.gz: 265a469734b8be2a4b6e1087470e0cdbc284b3d32de4591ee229c9ee0993fbe27487512ff10be84d52c76b35279bd80f37f0e512ebd47dd0f7370246a3f0ad17
|
data/MIT-LICENSE
CHANGED
data/lib/rows/engine.rb
CHANGED
data/lib/rows/model.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
+
module Rows::Model
|
3
4
|
def model_class
|
4
5
|
@_model_class ||= self.class.model_class ||
|
5
6
|
params[:controller].singularize.camelize.constantize
|
@@ -26,5 +27,4 @@ module Rows::Model
|
|
26
27
|
def model_symbol_plural
|
27
28
|
@_model_symbol_plural ||= model_symbol.pluralize
|
28
29
|
end
|
29
|
-
|
30
30
|
end
|
data/lib/rows/resources.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
+
module Rows::Resources
|
3
4
|
def set_resources(rows = nil)
|
4
5
|
rows ||= model_class.all
|
5
6
|
instance_variable_set("@#{model_symbol_plural}", rows)
|
@@ -21,8 +22,8 @@ module Rows::Resources
|
|
21
22
|
end
|
22
23
|
|
23
24
|
private
|
24
|
-
# low level resource methods
|
25
|
-
# can be monkey patched
|
25
|
+
# low level resource methods
|
26
|
+
# can be monkey patched
|
26
27
|
def resource_new
|
27
28
|
if params[model_symbol]
|
28
29
|
set_resource model_class.new(resource_params)
|
@@ -38,7 +39,7 @@ module Rows::Resources
|
|
38
39
|
|
39
40
|
def resource_update
|
40
41
|
if Rails::VERSION::MAJOR >= 4
|
41
|
-
# return true unless params[model_symbol]
|
42
|
+
# return true unless params[model_symbol]
|
42
43
|
resource.update(resource_params)
|
43
44
|
else
|
44
45
|
resource.update_attributes(resource_params)
|
@@ -50,8 +51,8 @@ module Rows::Resources
|
|
50
51
|
end
|
51
52
|
|
52
53
|
def resource_columns
|
53
|
-
return model_class.column_headers
|
54
|
-
return ['to_s']
|
54
|
+
return model_class.column_headers if model_class.respond_to?(:column_headers)
|
55
|
+
return ['to_s'] unless model_class.respond_to?(:content_columns)
|
55
56
|
|
56
57
|
['id'] + model_class.content_columns.collect(&:name)
|
57
58
|
end
|
@@ -70,7 +71,7 @@ module Rows::Resources
|
|
70
71
|
pars = params[model_symbol] || {}
|
71
72
|
pars.keys.each { |x|
|
72
73
|
x = x.to_sym
|
73
|
-
unless permits.include?(x) || permits.include?({
|
74
|
+
unless permits.include?(x) || permits.include?({x => []})
|
74
75
|
pars.delete(x)
|
75
76
|
p "** WARNING: model <#{model_name}> dropping params <#{x}>"
|
76
77
|
end
|
@@ -78,5 +79,4 @@ module Rows::Resources
|
|
78
79
|
pars
|
79
80
|
end
|
80
81
|
end
|
81
|
-
|
82
82
|
end
|
data/lib/rows/utils.rb
CHANGED
@@ -1,14 +1,17 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# rubocop: disable all
|
2
3
|
|
3
|
-
|
4
|
+
module Rows::Utils
|
5
|
+
# formatting
|
4
6
|
def resource_format(x)
|
5
7
|
return '--'.html_safe if x.nil?
|
6
8
|
|
7
9
|
bool = x.class == Time || x.class == Date || x.class == DateTime ||
|
8
10
|
x.class == ActiveSupport::TimeWithZone
|
9
|
-
return x.strftime('%d.%m.%Y').html_safe
|
10
|
-
|
11
|
-
#
|
11
|
+
return x.strftime('%d.%m.%Y').html_safe if bool
|
12
|
+
|
13
|
+
# return I18n.l(x) if bool
|
14
|
+
# return x.to_s.html_safe if x.class == Fixnum
|
12
15
|
return x.to_s.html_safe if x.is_a?(Integer)
|
13
16
|
return 'X'.html_safe if x.class == TrueClass
|
14
17
|
return ' '.html_safe if x.class == FalseClass
|
data/lib/rows/version.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
# rubocop: disable all
|
2
|
+
|
1
3
|
module Rows
|
2
|
-
VERSION = '3.0.
|
3
|
-
# VERSION = '3.0.
|
4
|
+
VERSION = '3.0.3' # 2020-07-14
|
5
|
+
# VERSION = '3.0.2' # 2020-04-27
|
6
|
+
# VERSION = '3.0.1' # 2020-03-01
|
7
|
+
# VERSION = '3.0.0' # 2019-10-03
|
4
8
|
# VERSION = '2.2.3' # 2019-10-03
|
5
9
|
# VERSION = '2.2.2' # 2019-05-06
|
6
10
|
# VERSION = '2.2.1' # 2019-02-18
|
data/lib/rows/version.rb.bak
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
+
# rubocop: disable all
|
2
|
+
|
1
3
|
module Rows
|
2
|
-
VERSION = '3.0.
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
4
|
+
VERSION = '3.0.2' # 2020-04-27
|
5
|
+
# VERSION = '3.0.1' # 2020-03-01
|
6
|
+
# VERSION = '3.0.0' # 2019-10-03
|
7
|
+
# VERSION = '2.2.3' # 2019-10-03
|
8
|
+
# VERSION = '2.2.2' # 2019-05-06
|
9
|
+
# VERSION = '2.2.1' # 2019-02-18
|
10
|
+
# VERSION = '2.2.0'
|
7
11
|
end
|
data/lib/rows_controller.rb
CHANGED
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rows_controller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dittmar Krall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: appraisal
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,30 +70,30 @@ dependencies:
|
|
70
70
|
name: minitest
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '5'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '5'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: sqlite3
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '1'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '1'
|
97
97
|
description: YourController < RowsController ( < ApplicationController).
|
98
98
|
email:
|
99
99
|
- dittmar.krall@matique.de
|