pg_rails 7.6.5 → 7.6.7
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_associable/app/helpers/pg_associable/form_builder_methods.rb +3 -1
- data/pg_associable/app/helpers/pg_associable/helpers.rb +2 -1
- data/pg_associable/app/javascript/asociable_controller.tsx +4 -0
- data/pg_engine/app/assets/stylesheets/pg_rails_b5.scss +0 -15
- data/pg_engine/app/components/inline_edit/inline_edit_component.html.slim +6 -2
- data/pg_engine/app/components/inline_edit/inline_edit_component.rb +1 -0
- data/pg_engine/app/components/inline_edit/inline_show_component.html.slim +4 -1
- data/pg_engine/app/components/modal_content_component.rb +3 -2
- data/pg_engine/app/decorators/pg_engine/base_record_decorator.rb +6 -1
- data/pg_engine/app/helpers/pg_engine/print_helper.rb +6 -0
- data/pg_engine/app/policies/account_policy.rb +5 -0
- data/pg_engine/app/policies/pg_engine/base_policy.rb +4 -0
- data/pg_engine/app/policies/user_policy.rb +4 -0
- data/pg_engine/app/views/pg_engine/base/index.html.slim +2 -2
- data/pg_engine/config/simple_form/simple_form_bootstrap.rb +10 -0
- data/pg_engine/spec/system/modal_windows_spec.rb +2 -1
- data/pg_rails/lib/version.rb +1 -1
- data/pg_rails/scss/pg_rails.scss +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0c1496f0173c6ee43cc92f45a5ed539ad58b308533f9fb4fe0f04621882d6de
|
4
|
+
data.tar.gz: 6cc98c258ec0b585e705162da82386cb10f0726800641eafac229bad90759af4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6638f89154fb33f4f840cee25e54d4fc7a544a3f7d65505c779e70d1830b360722ddba32b3e4b3b29e027fa04b76c06740ba687411eb95f055d049f9196dedb8
|
7
|
+
data.tar.gz: d2c19217475e137c8e2a8177a2325e3ac184d634740b580972bdd2be777c8e0ac6b48b2462cd6b7f5ca21c14828d9bb4d8263fe4eedd24421079bc205ecabc8c
|
@@ -39,7 +39,7 @@ module PgAssociable
|
|
39
39
|
def collection_pc(atributo, _options)
|
40
40
|
klass = clase_asociacion(atributo)
|
41
41
|
user = Current.user
|
42
|
-
puede_crear =
|
42
|
+
puede_crear = Pundit::PolicyFinder.new(klass).policy.new(user, klass).new_from_associable?
|
43
43
|
collection = Pundit::PolicyFinder.new(klass).scope.new(user, klass).resolve
|
44
44
|
collection = collection.kept if collection.respond_to?(:kept)
|
45
45
|
[collection, puede_crear]
|
@@ -61,6 +61,8 @@ module PgAssociable
|
|
61
61
|
|
62
62
|
def select_comun(atributo, options, collection)
|
63
63
|
options[:collection] = collection
|
64
|
+
options[:include_blank] = 'Ninguno'
|
65
|
+
options[:prompt] = nil
|
64
66
|
association atributo, options
|
65
67
|
end
|
66
68
|
|
@@ -4,7 +4,8 @@ module PgAssociable
|
|
4
4
|
|
5
5
|
def pg_respond_abrir_modal
|
6
6
|
src = clase_modelo.new.decorate.new_object_url
|
7
|
-
|
7
|
+
turbo_frame_id = "modal_content_#{params[:id]}"
|
8
|
+
content = ModalContentComponent.new(src:, turbo_frame_id:).render_in(view_context)
|
8
9
|
modal = AsociableModalComponent.new(modal_id: params[:id]).with_content(content)
|
9
10
|
render turbo_stream: turbo_stream.append_all('body', modal)
|
10
11
|
end
|
@@ -311,6 +311,10 @@ export default class extends Controller {
|
|
311
311
|
this.element.dataset.object = object
|
312
312
|
const event = new CustomEvent('pg_associable:changed', { detail: object })
|
313
313
|
this.element.dispatchEvent(event)
|
314
|
+
const inlineEdit = this.element.closest('.inline-edit')
|
315
|
+
if (inlineEdit) {
|
316
|
+
inlineEdit.querySelector('button[type=submit]').click()
|
317
|
+
}
|
314
318
|
} else {
|
315
319
|
hiddenField.value = null
|
316
320
|
textField.value = null
|
@@ -250,18 +250,3 @@ input[type=datetime-local], input[type=datetime] {
|
|
250
250
|
width: initial;
|
251
251
|
}
|
252
252
|
}
|
253
|
-
|
254
|
-
// WIP, inline rich text en listados
|
255
|
-
.listado {
|
256
|
-
.inline-edit {
|
257
|
-
display: flex!important;
|
258
|
-
align-items: center;
|
259
|
-
gap: 0.25em;
|
260
|
-
|
261
|
-
&:has(.trix-content) .edit-link {
|
262
|
-
margin-bottom: 0;
|
263
|
-
display: inline;
|
264
|
-
border-bottom: none;
|
265
|
-
}
|
266
|
-
}
|
267
|
-
}
|
@@ -2,8 +2,12 @@
|
|
2
2
|
= helpers.pg_form_for(@model, render_errors: false, wrapper_mappings: @wrapper_mappings) do |f|
|
3
3
|
= hidden_field_tag :inline_attribute, @attribute
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
/ html5 solo aplica a datetime
|
6
|
+
/ date_selector solo aplica a date
|
7
|
+
/ ignore_date y prompt solo aplica a time
|
8
|
+
/ cada caso es inocuo para el resto de los types
|
9
|
+
= f.field @unsuffixed_attribute, label: false, date_selector: true, minute_step: 15,
|
10
|
+
ignore_date: true, prompt: { hour: 'hh', minute: 'mm' }
|
7
11
|
.actions.d-flex.gap-1
|
8
12
|
= button_tag class: 'btn btn-sm btn-primary',
|
9
13
|
data: { controller: 'tooltip', 'bs-title': 'Guardar' } do
|
@@ -1,7 +1,10 @@
|
|
1
1
|
- if @model.class.inline_editable?(@unsuffixed_attribute) && helpers.policy(@model).edit?
|
2
2
|
= helpers.turbo_frame_tag(@frame_id, class: 'inline-edit')
|
3
3
|
= link_to users_inline_edit_path(model: @model.to_gid, attribute: @attribute),
|
4
|
-
|
4
|
+
data: { \
|
5
|
+
controller: :tooltip,
|
6
|
+
'bs-title': "Modificar #{@model.class.human_attribute_name(@attribute).downcase}" },
|
7
|
+
class: 'text-body-tertiary edit-link', style: 'font-size: 0.8em' do
|
5
8
|
i.bi.bi-pencil
|
6
9
|
span = @model.decorate.send(@attribute)
|
7
10
|
- else
|
@@ -1,5 +1,6 @@
|
|
1
1
|
class ModalContentComponent < ViewComponent::Base
|
2
|
-
def initialize(src: nil)
|
2
|
+
def initialize(src: nil, turbo_frame_id: :modal_content)
|
3
|
+
@turbo_frame_id = turbo_frame_id
|
3
4
|
@src = src
|
4
5
|
with_content(loading_html) if @src.present?
|
5
6
|
|
@@ -20,7 +21,7 @@ class ModalContentComponent < ViewComponent::Base
|
|
20
21
|
<div class="flash position-relative w-100 d-flex justify-content-center">
|
21
22
|
</div>
|
22
23
|
</div>
|
23
|
-
<%= helpers.turbo_frame_tag
|
24
|
+
<%= helpers.turbo_frame_tag @turbo_frame_id,
|
24
25
|
**{ src: @src, refresh: :morph }.compact do %>
|
25
26
|
<%= content %>
|
26
27
|
<% end %>
|
@@ -34,7 +34,12 @@ module PgEngine
|
|
34
34
|
if valor.instance_of?(Date)
|
35
35
|
dmy(valor)
|
36
36
|
elsif valor.instance_of?(ActiveSupport::TimeWithZone)
|
37
|
-
|
37
|
+
column = object.class.columns.find { |c| c.name == method_name.to_s }
|
38
|
+
if column.present? && column.type == :time
|
39
|
+
hhmm(valor)
|
40
|
+
else
|
41
|
+
dmy_time(valor)
|
42
|
+
end
|
38
43
|
else
|
39
44
|
super
|
40
45
|
end
|
@@ -28,6 +28,11 @@ class AccountPolicy < ApplicationPolicy
|
|
28
28
|
# def acceso_total?
|
29
29
|
# user.developer?
|
30
30
|
# end
|
31
|
+
|
32
|
+
def new_from_associable?
|
33
|
+
false
|
34
|
+
end
|
35
|
+
|
31
36
|
def base_access_to_record?
|
32
37
|
ActsAsTenant.unscoped? ||
|
33
38
|
record.user_accounts.pluck(:user_id).include?(user.id)
|
@@ -14,9 +14,9 @@
|
|
14
14
|
- if @filtros.present?
|
15
15
|
= render SearchBarComponent.new(@q, @filtros)
|
16
16
|
|
17
|
-
|
17
|
+
.table-responsive style="padding-bottom: 15em"
|
18
18
|
- if @collection.any?
|
19
|
-
.
|
19
|
+
.xtable-responsive
|
20
20
|
table.table.table-sm.listado.xpg-revert-width.xborder-end
|
21
21
|
caption.ps-3 = page_entries_info @collection
|
22
22
|
thead.table-light
|
@@ -141,6 +141,16 @@ SimpleForm.setup do |config|
|
|
141
141
|
b.use :hint, wrap_with: { class: 'form-text' }
|
142
142
|
end
|
143
143
|
|
144
|
+
config.wrappers :inline_multi_select, class: '' do |b|
|
145
|
+
b.use :html5
|
146
|
+
b.optional :readonly
|
147
|
+
b.wrapper class: 'd-flex flex-row justify-content-between align-items-center' do |ba|
|
148
|
+
ba.use :input, class: 'form-select form-select-sm mx-1', error_class: 'is-invalid'
|
149
|
+
end
|
150
|
+
b.use :error, wrap_with: { class: 'invalid-feedback d-block' }
|
151
|
+
b.use :hint, wrap_with: { class: 'form-text' }
|
152
|
+
end
|
153
|
+
|
144
154
|
# vertical range input
|
145
155
|
config.wrappers :vertical_range, class: 'mb-3' do |b|
|
146
156
|
b.use :html5
|
@@ -24,7 +24,8 @@ describe 'Modal windows' do
|
|
24
24
|
visitar
|
25
25
|
click_on 'Cargar coso'
|
26
26
|
select 'Completar', from: 'cosa_tipo'
|
27
|
-
|
27
|
+
find("input[placeholder='el placeholder'").click
|
28
|
+
click_on categoria_de_cosa.to_s
|
28
29
|
find('.modal input[type=submit]').click
|
29
30
|
expect(page).to have_text 'Por favor, revisá los campos obligatorios'
|
30
31
|
fill_in 'cosa_nombre', with: 'bla'
|
data/pg_rails/lib/version.rb
CHANGED
data/pg_rails/scss/pg_rails.scss
CHANGED
@@ -76,6 +76,13 @@ $values: 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100;
|
|
76
76
|
text-overflow: ellipsis;
|
77
77
|
white-space: nowrap;
|
78
78
|
min-width: 30em * $value * 0.01;
|
79
|
+
|
80
|
+
// FIXME: con css grid esto se debería poder hacer mejor
|
81
|
+
// además, el pg_asociable directamente se rompe
|
82
|
+
&:has(form) {
|
83
|
+
min-width: 28em;
|
84
|
+
overflow: initial;
|
85
|
+
}
|
79
86
|
}
|
80
87
|
}
|
81
88
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martín Rosso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|