effective_bootstrap 0.13.5 → 0.13.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/effective_bootstrap/forms.scss +4 -12
- data/app/models/effective/table_builder.rb +14 -4
- 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: 284baa0c03bb5e8427d7e4ac3ce4fb6725e359ab3bea1f6f267e4c7d2b6b0e5e
|
4
|
+
data.tar.gz: bb1d75ae10d211fb2c145e7351be9a63b0610360e1c628a00dac1c73de7bbc78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fac47682801276341b664baae31f366030d80c16273bca7bf66c10a4983c6276e57c67431a3f4f12b7bb62f91b00a7ec44422642761bd9bc7f2ac0a2b40c85bd
|
7
|
+
data.tar.gz: b01e15de8b3d61360fc72c48e58b4557091c723fa73d8dc712e0c0f62db0969dfda9e01ff4baa81fe9986d6c7c781a31ef094592730d39aa91755ee2fa75f0f9
|
@@ -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
|
}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Effective
|
4
4
|
class TableBuilder
|
5
|
-
FILTER_PARAMETERS = [:password, :password_confirmation, :created_at, :updated_at]
|
5
|
+
FILTER_PARAMETERS = [:password, :password_confirmation, :status_steps, :wizard_steps, :token, :created_at, :updated_at]
|
6
6
|
|
7
7
|
attr_accessor :object, :template, :options
|
8
8
|
|
@@ -54,14 +54,20 @@ 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)
|
65
|
+
when :integer
|
66
|
+
name.to_s.end_with?('price') ? price_field(name) : text_field(name)
|
67
|
+
when :string
|
68
|
+
name.to_s.include?('email') ? email_field(name) : text_field(name)
|
61
69
|
when :text
|
62
70
|
text_area(name)
|
63
|
-
when :string
|
64
|
-
(name.to_s.include?('email') && value(name).to_s.include?('@')) ? email_field(name) : text_field(name)
|
65
71
|
else default_row(name)
|
66
72
|
end
|
67
73
|
end
|
@@ -109,6 +115,10 @@ module Effective
|
|
109
115
|
alias_method :checks, :collection_row
|
110
116
|
alias_method :radios, :collection_row
|
111
117
|
|
118
|
+
def belongs_to(name, options = {})
|
119
|
+
rows[name] = TableRows::BelongsTo.new(name, options, builder: self).to_html
|
120
|
+
end
|
121
|
+
|
112
122
|
def email_field(name, options = {})
|
113
123
|
rows[name] = TableRows::EmailField.new(name, options, builder: self).to_html
|
114
124
|
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.7
|
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
|