simple_model_view 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -1
- data/Gemfile.lock +1 -1
- data/lib/simple_model_view/action_view_helper_builder.rb +1 -1
- data/lib/simple_model_view/builder_helpers.rb +3 -3
- data/lib/simple_model_view/resource_table_builder.rb +11 -0
- data/lib/simple_model_view/value_formatter.rb +1 -1
- data/lib/simple_model_view/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c7265a5e0bc784320a9469265f3bef9eff3689487a3c86429c3ad756c5ea7f0
|
4
|
+
data.tar.gz: 6d2a7097ccc116fd0603d56a9314eb8636a1a6331677854298fa4ee91076b63f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c72b316023ff2dadaa80907ccbc96f7942f3be8519cc31d26f3955b99c541c6c0eb17278d485aec04b8688d1c3790cb505d22fb191e98a272160d307e487d359
|
7
|
+
data.tar.gz: 73a1089d4ac63bed31b7e9fd3918f61765b3d78114227c881f98fe38617887bd90406977c876c31ae43ab7add17d90a73eb384413ebb423d90475170494367f1
|
data/.rubocop.yml
CHANGED
@@ -77,13 +77,16 @@ Metrics/BlockLength: {Enabled: false}
|
|
77
77
|
Metrics/ClassLength:
|
78
78
|
CountComments: false
|
79
79
|
Max: 250
|
80
|
-
Metrics/CyclomaticComplexity: {Max:
|
80
|
+
Metrics/CyclomaticComplexity: {Max: 11}
|
81
81
|
Metrics/LineLength: {Max: 130}
|
82
82
|
Metrics/MethodLength:
|
83
83
|
Max: 30
|
84
84
|
Exclude:
|
85
85
|
- db/migrate/*
|
86
|
+
Metrics/ModuleLength:
|
87
|
+
Max: 200
|
86
88
|
Metrics/ParameterLists: {CountKeywordArgs: false}
|
89
|
+
Metrics/PerceivedComplexity: {Max: 11}
|
87
90
|
|
88
91
|
Naming/VariableNumber: {EnforcedStyle: snake_case}
|
89
92
|
Naming/MemoizedInstanceVariableName: {EnforcedStyleForLeadingUnderscores: optional}
|
data/Gemfile.lock
CHANGED
@@ -20,7 +20,7 @@ module SimpleModelView
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
def collection_table(collection, *args
|
23
|
+
def collection_table(collection, *args)
|
24
24
|
builder = SimpleModelView::CollectionTableBuilder.new template, collection, *args
|
25
25
|
|
26
26
|
template.content_tag :table, class: :table do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module SimpleModelView
|
3
|
+
module SimpleModelView # rubocop:disable
|
4
4
|
module BuilderHelpers
|
5
5
|
def format(value, type, **options)
|
6
6
|
return if value.nil?
|
@@ -10,7 +10,7 @@ module SimpleModelView
|
|
10
10
|
|
11
11
|
private
|
12
12
|
|
13
|
-
def add_type_specific_class(value, type)
|
13
|
+
def add_type_specific_class(value, type)
|
14
14
|
return if value.nil?
|
15
15
|
|
16
16
|
case type
|
@@ -49,7 +49,7 @@ module SimpleModelView
|
|
49
49
|
end.keys.join(' ')
|
50
50
|
end
|
51
51
|
|
52
|
-
def autodetect_value_type(value)
|
52
|
+
def autodetect_value_type(value)
|
53
53
|
case value
|
54
54
|
when Float
|
55
55
|
:float
|
@@ -57,6 +57,17 @@ module SimpleModelView
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
+
def actions(*_args, **options)
|
61
|
+
template.content_tag(:tr) do
|
62
|
+
template.concat template.content_tag(:th, options[:title])
|
63
|
+
block_concat do
|
64
|
+
template.content_tag(:td) do
|
65
|
+
yield object if block_given?
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
60
71
|
private
|
61
72
|
|
62
73
|
attr_reader :template
|