effective_bootstrap 0.6.19 → 0.6.20

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: a5f1abf1a0b9a9f137504366c9fe3049e363f5adda7e745f5bf5d50b17b98df3
4
- data.tar.gz: 2ae0fa3dde907f0d2a962e920cf5f4d00e17b14f29011f1cdceed64552ade030
3
+ metadata.gz: 578bfc67fb28b0a18112611da75875d6628b5df216a010d637470fd4354a61fe
4
+ data.tar.gz: 49c5c9fa5b450a494a40edcecce184cadeada0878a60163c87fad93825f56ca7
5
5
  SHA512:
6
- metadata.gz: bbddbd6183904620b83cdf64f5d54fc1038570dd79b866a3fc3d88216252e09b79fa1afc56eed985ee5bd5948d9e4f8b401b80b30b033309a6a34e2664e68d31
7
- data.tar.gz: 2b8159b33077349384ef9ae67930baf8a2ce458e035af3a8a013b06e9a565310ab9f5cd9b9946e27e06d0868fada1e2c9716fbde564f47363c4cdb70d50811a7
6
+ metadata.gz: 006eb45abec052fe6cda79d7f33b1cd9dc1ffd500aa506276e7dc33700df0dfedc668227459ddcc29125c03a8ef492155b2c4de4d4586ca7d2c746febd861dd9
7
+ data.tar.gz: 9cc1353c447c384bdbc754645c2fb8179a4e7c62679c557edaf5d0ce674dd82d8db4d97227266f5323f5590ab2a914d8f3ef8a422c3b71e359ca5618d96f171d
@@ -8,7 +8,7 @@ module Effective
8
8
  build_attachments + build_uploads + super
9
9
  when :table, :ck_assets
10
10
  super + build_uploads + build_attachments
11
- else
11
+ else
12
12
  raise('unsupported attachments_style, try :card or :table')
13
13
  end
14
14
  end
@@ -27,6 +27,10 @@ module Effective
27
27
  name.to_s.pluralize == name.to_s
28
28
  end
29
29
 
30
+ def required_presence?(obj, name)
31
+ super(obj, name) && Array(object.public_send(name)).none? { |file| file.attached? }
32
+ end
33
+
30
34
  def build_attachments
31
35
  return ''.html_safe unless object.respond_to?(name) && object.send(name).respond_to?(:attached?) && object.send(name).attached?
32
36
 
@@ -37,7 +41,7 @@ module Effective
37
41
  build_card_attachments(attachments)
38
42
  when :table, :ck_assets
39
43
  build_table_attachments(attachments)
40
- else
44
+ else
41
45
  raise('unsupported attachments_style, try :card or :table')
42
46
  end
43
47
  end
@@ -51,7 +55,7 @@ module Effective
51
55
  content_tag(:th, 'Size') +
52
56
  content_tag(:th, '')
53
57
  end
54
- end +
58
+ end +
55
59
  content_tag(:tbody) do
56
60
  attachments.map { |attachment| content_tag(:tr, build_table_attachment(attachment)) }.join.html_safe
57
61
  end
@@ -62,7 +66,7 @@ module Effective
62
66
  url = (@template.url_for(attachment) rescue false)
63
67
  return unless url
64
68
 
65
- image_tag = content_tag(:img, '', class: '', src: url, alt: attachment.filename.to_s) if attachment.image?
69
+ image_tag = content_tag(:img, '', class: '', src: url, alt: attachment.filename.to_s) if attachment.image?
66
70
  link_tag = link_to(attachment.filename, url)
67
71
  size_tag = (attachment.content_type + '<br>' + @template.number_to_human_size(attachment.byte_size)).html_safe
68
72
 
@@ -71,7 +75,7 @@ module Effective
71
75
  content_tag(:td, size_tag) +
72
76
 
73
77
  content_tag(:td) do
74
- if attachments_style == :ck_assets
78
+ if attachments_style == :ck_assets
75
79
  link_to('Attach', url, class: 'btn btn-primary', 'data-insert-ck-asset': true, alt: attachment.filename.to_s)
76
80
  end
77
81
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.6.19'.freeze
2
+ VERSION = '0.6.20'.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: 0.6.19
4
+ version: 0.6.20
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: 2020-03-27 00:00:00.000000000 Z
11
+ date: 2020-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails