effective_bootstrap 0.13.5 → 0.13.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/effective_bootstrap/forms.scss +4 -12
- data/app/models/effective/table_builder.rb +9 -1
- data/app/models/effective/table_row.rb +4 -0
- data/app/models/effective/table_rows/belongs_to.rb +39 -0
- data/app/models/effective/table_rows/text_area.rb +1 -1
- data/lib/effective_bootstrap/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c5e32c885457e504f462b7e7c02400b36e7959687f4723f33d34684d0a1fcbb
|
4
|
+
data.tar.gz: 7e8336c8d3d5765af675158959c315dab44d87d9994575a5983dd77f48106a2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ca1da843fae5b7ba017ba36766640ce333e31b43cfb54d632591b31bb9dd1b29ec237af8b7a0d8187840f145e3255c3e00f25f645140b395c818bfed436ffb0
|
7
|
+
data.tar.gz: e0aacbffacd46f180fad9bc9ee98c933a542119b8fb39e06fea153c14338acfc213aed3762f30c8de75dfe0aeed52414eadc47c15b78f2d1b6beb8ad3a38c52e
|
@@ -72,27 +72,19 @@ div.form-group > label + .btn-group { display: block; }
|
|
72
72
|
.form-control-file { border: none !important; }
|
73
73
|
|
74
74
|
// Radios
|
75
|
-
form fieldset.effective-radios {
|
76
|
-
margin-top: 0;
|
77
|
-
margin-bottom: 0;
|
78
|
-
}
|
79
|
-
|
80
|
-
form fieldset.effective-checks {
|
81
|
-
margin-top: 0;
|
82
|
-
margin-bottom: 0;
|
83
|
-
}
|
84
|
-
|
85
75
|
form fieldset.effective-radios legend {
|
86
76
|
font-size: 1rem;
|
87
|
-
font-weight: inherit;
|
88
77
|
margin-top: 0.5rem;
|
89
78
|
margin-bottom: 1rem;
|
90
79
|
}
|
91
80
|
|
81
|
+
form fieldset.effective-radios {
|
82
|
+
> label { margin-bottom: 0.5rem; }
|
83
|
+
}
|
84
|
+
|
92
85
|
// Checks
|
93
86
|
form fieldset.effective-checks > label {
|
94
87
|
font-size: 1rem;
|
95
|
-
font-weight: inherit;
|
96
88
|
margin-top: 0.5rem;
|
97
89
|
margin-bottom: 1rem;
|
98
90
|
}
|
@@ -54,8 +54,12 @@ module Effective
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def build_resource_rows
|
57
|
-
Effective::Resource.new(object).
|
57
|
+
Effective::Resource.new(object).resource_attributes.each do |name, options|
|
58
58
|
case options.first
|
59
|
+
when :belongs_to
|
60
|
+
belongs_to(name)
|
61
|
+
when :effective_address
|
62
|
+
effective_address(name)
|
59
63
|
when :boolean
|
60
64
|
boolean_row(name)
|
61
65
|
when :text
|
@@ -109,6 +113,10 @@ module Effective
|
|
109
113
|
alias_method :checks, :collection_row
|
110
114
|
alias_method :radios, :collection_row
|
111
115
|
|
116
|
+
def belongs_to(name, options = {})
|
117
|
+
rows[name] = TableRows::BelongsTo.new(name, options, builder: self).to_html
|
118
|
+
end
|
119
|
+
|
112
120
|
def email_field(name, options = {})
|
113
121
|
rows[name] = TableRows::EmailField.new(name, options, builder: self).to_html
|
114
122
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Effective
|
4
|
+
module TableRows
|
5
|
+
class BelongsTo < Effective::TableRow
|
6
|
+
|
7
|
+
def content
|
8
|
+
if value.present?
|
9
|
+
content_tag(:div) { link_to_edit || link_to_show || value.to_s }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def effective_resource
|
16
|
+
@effective_resource ||= Effective::Resource.new(value, namespace: controller_namespace)
|
17
|
+
end
|
18
|
+
|
19
|
+
def link_to_edit
|
20
|
+
return unless EffectiveResources.authorized?(template, :edit, value)
|
21
|
+
|
22
|
+
path = effective_resource.action_path(:edit, value)
|
23
|
+
return unless path.present?
|
24
|
+
|
25
|
+
link_to(value.to_s, path, title: value.to_s, target: '_blank')
|
26
|
+
end
|
27
|
+
|
28
|
+
def link_to_show
|
29
|
+
return unless EffectiveResources.authorized?(template, :show, value)
|
30
|
+
|
31
|
+
path = effective_resource.action_path(:show, value)
|
32
|
+
return unless path.present?
|
33
|
+
|
34
|
+
link_to(value.to_s, path, title: value.to_s, target: '_blank')
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
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.13.
|
4
|
+
version: 0.13.6
|
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-
|
11
|
+
date: 2023-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -696,6 +696,7 @@ files:
|
|
696
696
|
- app/models/effective/form_logics/show_if_any.rb
|
697
697
|
- app/models/effective/table_builder.rb
|
698
698
|
- app/models/effective/table_row.rb
|
699
|
+
- app/models/effective/table_rows/belongs_to.rb
|
699
700
|
- app/models/effective/table_rows/boolean.rb
|
700
701
|
- app/models/effective/table_rows/collection.rb
|
701
702
|
- app/models/effective/table_rows/content_for.rb
|