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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f8da9d602b129a7dfae6217312e4a562ceb575a067c84f0bcae7cb579a72c9f0
4
- data.tar.gz: 1a75b98322a64348fec79a6607547402e680fcd08caed84069d51db5f9ea9d05
3
+ metadata.gz: aed59c9600110db574cd48ae66e133ae62fc70a35a505dbebb4f616e6e4076cd
4
+ data.tar.gz: 68c1cc80c112c82f3c9581afbfaae2ea6a802f81b9858252b2d17bcd90968236
5
5
  SHA512:
6
- metadata.gz: '0740430614349c6e52cabd1bbefe7768eefa2f40a7446603784eda7cef146d042101109d5990f00e27a89812ab0dc3407a6d798e2f7df8b4dcd6aa46b8113533'
7
- data.tar.gz: e2aba93cb629022b3817a4d94be406bd825622ce044a037fd7fccd4dbd537bdcf37106f0a23df46c68e9f2efe48c61a91b5abd589cd35fd83515c44278fa7363
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)
@@ -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
@@ -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.0'.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.0
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-04-24 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