pg_rails 7.6.3 → 7.6.4
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/pg_engine/app/assets/stylesheets/pg_rails_b5.scss +7 -0
- data/pg_engine/app/components/inline_edit/inline_component.rb +27 -0
- data/pg_engine/app/components/inline_edit/inline_edit_component.html.slim +1 -1
- data/pg_engine/app/components/inline_edit/inline_edit_component.rb +3 -13
- data/pg_engine/app/components/inline_edit/inline_show_component.html.slim +3 -3
- data/pg_engine/app/components/inline_edit/inline_show_component.rb +1 -14
- data/pg_engine/config/simple_form/simple_form_bootstrap.rb +15 -0
- data/pg_rails/lib/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 558b69c5a93797c069002f3477d6ccc34b63b98fa4f1a37ddedcc4ab6010ef3b
|
4
|
+
data.tar.gz: a3cc4d53326372aaa5e7155b2d50cfdee3fc3d0814a81eee53ec3701814c3e23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 259c3f0cc7c935f4a5b9569a2cd33cb1cc60e71a1c5cc85118fb3190415ebad4d78065c641bbe0bdaf479639df1be0ef93ded0ad589313f7dd23011ecfa618d8
|
7
|
+
data.tar.gz: b0e0ad29958f836916d4469d43bd5f3c8797eb9e00a981694034c025158083f28a0ea32bce7057a957bd2d2898d75daf7905fc9e0facd2ec78677f0de06c3389
|
@@ -207,6 +207,8 @@ input[type=datetime-local], input[type=datetime] {
|
|
207
207
|
// text-decoration: underline;
|
208
208
|
// text-decoration-style: dotted;
|
209
209
|
// text-decoration-color: #262626;
|
210
|
+
border-bottom: 1px dotted #333;
|
211
|
+
padding-bottom: 1px;
|
210
212
|
|
211
213
|
a:hover {
|
212
214
|
i {
|
@@ -217,4 +219,9 @@ input[type=datetime-local], input[type=datetime] {
|
|
217
219
|
input[type=text] {
|
218
220
|
min-width: 22em;
|
219
221
|
}
|
222
|
+
|
223
|
+
// To display correctly in tables with fixed witdh columns
|
224
|
+
.form-select {
|
225
|
+
width: initial;
|
226
|
+
}
|
220
227
|
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class InlineComponent < ViewComponent::Base
|
2
|
+
def initialize(model, attribute)
|
3
|
+
@model = model
|
4
|
+
@attribute = attribute
|
5
|
+
@unsuffixed_attribute = unsuffixed(attribute)
|
6
|
+
@frame_id = dom_id(model, "#{attribute}_inline_edit")
|
7
|
+
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def before_render
|
12
|
+
return unless controller.in_modal?
|
13
|
+
|
14
|
+
controller.instance_variable_set(:@using_modal, true)
|
15
|
+
end
|
16
|
+
|
17
|
+
SUFIJOS = %i[f text].freeze
|
18
|
+
def unsuffixed(attribute)
|
19
|
+
ret = attribute.to_s.dup
|
20
|
+
|
21
|
+
SUFIJOS.each do |sufijo|
|
22
|
+
ret.gsub!(/_#{sufijo}$/, '')
|
23
|
+
end
|
24
|
+
|
25
|
+
ret
|
26
|
+
end
|
27
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
html: { class: 'd-flex align-items-start gap-1' }) do |f|
|
4
4
|
= hidden_field_tag :inline_attribute, @attribute
|
5
5
|
|
6
|
-
= f.field @
|
6
|
+
= f.field @unsuffixed_attribute, label: false, html5: true
|
7
7
|
|
8
8
|
= button_tag class: 'btn btn-sm btn-primary',
|
9
9
|
data: { controller: 'tooltip', 'bs-title': 'Guardar' } do
|
@@ -1,11 +1,7 @@
|
|
1
|
-
class InlineEditComponent <
|
2
|
-
def initialize(
|
3
|
-
@model = model
|
4
|
-
@attribute = attribute
|
5
|
-
@frame_id = dom_id(model, "#{attribute}_inline_edit")
|
6
|
-
|
1
|
+
class InlineEditComponent < InlineComponent
|
2
|
+
def initialize(*)
|
7
3
|
@wrapper_mappings = {
|
8
|
-
string: :
|
4
|
+
string: :inline_form_grow,
|
9
5
|
pg_associable: :inline_form_control,
|
10
6
|
date: :inline_form_control,
|
11
7
|
datetime: :inline_form_control,
|
@@ -14,10 +10,4 @@ class InlineEditComponent < ViewComponent::Base
|
|
14
10
|
|
15
11
|
super
|
16
12
|
end
|
17
|
-
|
18
|
-
def before_render
|
19
|
-
return unless controller.in_modal?
|
20
|
-
|
21
|
-
controller.instance_variable_set(:@using_modal, true)
|
22
|
-
end
|
23
13
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
- if @model.class.inline_editable?(@
|
1
|
+
- if @model.class.inline_editable?(@unsuffixed_attribute) && helpers.policy(@model).edit?
|
2
2
|
= helpers.turbo_frame_tag(@frame_id, class: 'inline-edit')
|
3
|
-
span = @model.decorate.send(@attribute)
|
4
3
|
= link_to users_inline_edit_path(model: @model.to_gid, attribute: @attribute),
|
5
|
-
class: 'text-body-tertiary
|
4
|
+
class: 'text-body-tertiary', style: 'font-size: 0.8em' do
|
6
5
|
i.bi.bi-pencil
|
6
|
+
span.ms-1 = @model.decorate.send(@attribute)
|
7
7
|
- else
|
8
8
|
= @model.decorate.send(@attribute)
|
@@ -1,15 +1,2 @@
|
|
1
|
-
class InlineShowComponent <
|
2
|
-
def initialize(model, attribute)
|
3
|
-
@model = model
|
4
|
-
@attribute = attribute
|
5
|
-
@frame_id = dom_id(model, "#{attribute}_inline_edit")
|
6
|
-
|
7
|
-
super
|
8
|
-
end
|
9
|
-
|
10
|
-
def before_render
|
11
|
-
return unless controller.in_modal?
|
12
|
-
|
13
|
-
controller.instance_variable_set(:@using_modal, true)
|
14
|
-
end
|
1
|
+
class InlineShowComponent < InlineComponent
|
15
2
|
end
|
@@ -270,6 +270,21 @@ SimpleForm.setup do |config|
|
|
270
270
|
# inline forms
|
271
271
|
#
|
272
272
|
# inline default_wrapper
|
273
|
+
config.wrappers :inline_form_grow, class: 'flex-grow-1' do |b|
|
274
|
+
b.use :html5
|
275
|
+
b.use :placeholder
|
276
|
+
b.optional :maxlength
|
277
|
+
b.optional :minlength
|
278
|
+
b.optional :pattern
|
279
|
+
b.optional :min_max
|
280
|
+
b.optional :readonly
|
281
|
+
b.use :label, class: 'visually-hidden'
|
282
|
+
|
283
|
+
b.use :input, class: 'form-control form-control-sm', error_class: 'is-invalid'
|
284
|
+
b.use :error, wrap_with: { class: 'invalid-feedback' }
|
285
|
+
b.optional :hint, wrap_with: { class: 'form-text' }
|
286
|
+
end
|
287
|
+
|
273
288
|
config.wrappers :inline_form_control, class: '' do |b|
|
274
289
|
b.use :html5
|
275
290
|
b.use :placeholder
|
data/pg_rails/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.6.
|
4
|
+
version: 7.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martín Rosso
|
@@ -674,6 +674,7 @@ files:
|
|
674
674
|
- pg_engine/app/components/date_selector_component.html.slim
|
675
675
|
- pg_engine/app/components/date_selector_component.rb
|
676
676
|
- pg_engine/app/components/flash_container_component.rb
|
677
|
+
- pg_engine/app/components/inline_edit/inline_component.rb
|
677
678
|
- pg_engine/app/components/inline_edit/inline_edit_component.html.slim
|
678
679
|
- pg_engine/app/components/inline_edit/inline_edit_component.rb
|
679
680
|
- pg_engine/app/components/inline_edit/inline_show_component.html.slim
|