effective_bootstrap 1.14.1 → 1.14.2

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
  SHA256:
3
- metadata.gz: 7a86c836f07d4b63af508927ea609571c6c107588820c7e437ad962136fc14fe
4
- data.tar.gz: f5b0450942b4f101eadb2c4c22afc52985a25ad14ea783b2e2ed53990d7be553
3
+ metadata.gz: aed59c9600110db574cd48ae66e133ae62fc70a35a505dbebb4f616e6e4076cd
4
+ data.tar.gz: 68c1cc80c112c82f3c9581afbfaae2ea6a802f81b9858252b2d17bcd90968236
5
5
  SHA512:
6
- metadata.gz: 5749c016c72772157d0a7a7f5e48db293b82136ae73b7d22e25d7b0656007d42dec0b88e13feef1e31e9d6a705949a4bf23ea69459286897568f977905c4177d
7
- data.tar.gz: 56f254ddbaff26b3cb076259fd87ab04342a7e2a75b9a35a5149a7ee1461b91b86efa514211443460c59ea39f4ebfbf0c9d588391b1b4f66f7cf5175a86a79df
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, label) + content_tag(:td, content.presence || '-')
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)
@@ -6,7 +6,7 @@ module Effective
6
6
 
7
7
  def to_html(&block)
8
8
  content_tag(:tr) do
9
- content_tag(:td, label) + content_tag(:td, template.capture(&block))
9
+ content_tag(:td, label_content) + content_tag(:td, template.capture(&block))
10
10
  end
11
11
  end
12
12
 
@@ -5,7 +5,17 @@ module Effective
5
5
  class FileField < Effective::TableRow
6
6
 
7
7
  def content
8
- raise('todo')
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
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '1.14.1'.freeze
2
+ VERSION = '1.14.2'.freeze
3
3
  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.1
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-05-02 00:00:00.000000000 Z
11
+ date: 2023-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails