effective_bootstrap 1.14.0 → 1.14.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/effective/table_row.rb +15 -1
- data/app/models/effective/table_rows/collection.rb +11 -0
- data/app/models/effective/table_rows/content_for.rb +1 -1
- data/app/models/effective/table_rows/file_field.rb +11 -1
- data/lib/effective_bootstrap/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aed59c9600110db574cd48ae66e133ae62fc70a35a505dbebb4f616e6e4076cd
|
4
|
+
data.tar.gz: 68c1cc80c112c82f3c9581afbfaae2ea6a802f81b9858252b2d17bcd90968236
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ecdba3a4550958031f5022db5a98afce4cbae662ac0724e1364e8295df162c3de544041ee85c8b88a90c1e19fb9cd3f10b1178babd966774f140d55e5dbe956
|
7
|
+
data.tar.gz: 123bd9f3aca61d8cd390dbbab1af836933c3413cf61bf9d8b0a2c5c1e7b0a330e240a7be94b1bf363c988424ebf89f9bfb89623efb1f15f97d27c1ca2ae4e752
|
@@ -28,10 +28,15 @@ module Effective
|
|
28
28
|
# Render method
|
29
29
|
def to_html(&block)
|
30
30
|
content_tag(:tr) do
|
31
|
-
content_tag(:td,
|
31
|
+
content_tag(:td, label_content) + content_tag(:td, content.presence || '-')
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
def label_content
|
36
|
+
hint = self.hint
|
37
|
+
(hint.present? ? "#{label}#{hint}" : label).html_safe
|
38
|
+
end
|
39
|
+
|
35
40
|
# Humanized label or the label from form
|
36
41
|
def label
|
37
42
|
text = options[:label] || builder.human_attribute_name(name)
|
@@ -40,6 +45,15 @@ module Effective
|
|
40
45
|
[*prefix, text].join(': ')
|
41
46
|
end
|
42
47
|
|
48
|
+
def hint
|
49
|
+
text = options[:hint]
|
50
|
+
return if text.blank?
|
51
|
+
|
52
|
+
content_tag(:div) do
|
53
|
+
content_tag(:small, text.html_safe, class: 'text-muted')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
43
57
|
# Value from resource
|
44
58
|
def value
|
45
59
|
options[:value] || builder.value(name)
|
@@ -9,6 +9,17 @@ module Effective
|
|
9
9
|
super(name, options, builder: builder)
|
10
10
|
end
|
11
11
|
|
12
|
+
def content
|
13
|
+
values = Array(value) - [nil, '']
|
14
|
+
|
15
|
+
if values.length > 1
|
16
|
+
values.map { |v| content_tag(:div, v) }.join.html_safe
|
17
|
+
elsif values.length == 1
|
18
|
+
values.first
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
12
23
|
end
|
13
24
|
end
|
14
25
|
end
|
@@ -5,7 +5,17 @@ module Effective
|
|
5
5
|
class FileField < Effective::TableRow
|
6
6
|
|
7
7
|
def content
|
8
|
-
|
8
|
+
values = Array(value) - [nil, '']
|
9
|
+
|
10
|
+
if values.length > 1
|
11
|
+
values.map { |file| content_tag(:div, link_to_file(file)) }.join.html_safe
|
12
|
+
elsif values.length == 1
|
13
|
+
link_to_file(values.first)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def link_to_file(file)
|
18
|
+
link_to(file.filename, template.url_for(file), target: '_blank')
|
9
19
|
end
|
10
20
|
|
11
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.14.
|
4
|
+
version: 1.14.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|