pg_rails 7.6.4 → 7.6.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/pg_associable/app/helpers/pg_associable/form_builder_methods.rb +1 -1
- data/pg_associable/app/helpers/pg_associable/helpers.rb +2 -1
- data/pg_engine/app/assets/stylesheets/pg_rails_b5.scss +28 -3
- data/pg_engine/app/components/inline_edit/inline_edit_component.html.slim +9 -9
- data/pg_engine/app/components/inline_edit/inline_show_component.html.slim +2 -2
- data/pg_engine/app/components/modal_content_component.rb +3 -2
- data/pg_engine/app/lib/pg_form_builder.rb +2 -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/spec/system/modal_windows_spec.rb +2 -1
- data/pg_rails/lib/version.rb +1 -1
- data/pg_rails/scss/pg_rails.scss +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 365f1740542a5fbba1bce8e40441e42581235cd67e68a7890292f512a63535d7
|
4
|
+
data.tar.gz: dfc9376def176892e05dc733c8a0df12a97f4b3da8c2fd0a31b1f7f5fc9b77a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94fc43c2038e908511860200282138fc7fa4ca95d8536abbbaa1530e5a975ffcdc8e6d64243669511c7c8a9abe6dfea0922f27fc23eea91f71c455d92295851f
|
7
|
+
data.tar.gz: 9020921857f2ec5e1d7af48321a9655b2f34557c0496a55b92bebd557772e9873e921bb7f1a9b8133093759c2f388c9ccc395949b13c5ad06ee68d52ae1eee86
|
@@ -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]
|
@@ -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
|
@@ -204,22 +204,47 @@ input[type=datetime-local], input[type=datetime] {
|
|
204
204
|
// Inline edit
|
205
205
|
|
206
206
|
.inline-edit {
|
207
|
-
// text-decoration: underline;
|
208
|
-
// text-decoration-style: dotted;
|
209
|
-
// text-decoration-color: #262626;
|
210
207
|
border-bottom: 1px dotted #333;
|
211
208
|
padding-bottom: 1px;
|
212
209
|
|
210
|
+
&:not(:has(.trix-content)) .edit-link {
|
211
|
+
margin-right: 0.25em;
|
212
|
+
}
|
213
|
+
|
214
|
+
&:has(.trix-content) .edit-link {
|
215
|
+
margin-bottom: 0.55em;
|
216
|
+
display: inline-block;
|
217
|
+
border-bottom: 1px dotted #333;
|
218
|
+
}
|
219
|
+
|
213
220
|
a:hover {
|
214
221
|
i {
|
215
222
|
color: black;
|
216
223
|
}
|
217
224
|
}
|
218
225
|
|
226
|
+
form {
|
227
|
+
display: flex;
|
228
|
+
align-items: start;
|
229
|
+
gap: 0.25rem;
|
230
|
+
|
231
|
+
&:has(trix-editor) {
|
232
|
+
display: block;
|
233
|
+
|
234
|
+
.actions {
|
235
|
+
margin-top: 0.25rem;
|
236
|
+
}
|
237
|
+
}
|
238
|
+
}
|
239
|
+
|
219
240
|
input[type=text] {
|
220
241
|
min-width: 22em;
|
221
242
|
}
|
222
243
|
|
244
|
+
select {
|
245
|
+
max-width: 45em;
|
246
|
+
}
|
247
|
+
|
223
248
|
// To display correctly in tables with fixed witdh columns
|
224
249
|
.form-select {
|
225
250
|
width: initial;
|
@@ -1,14 +1,14 @@
|
|
1
1
|
= helpers.turbo_frame_tag(@frame_id, class: 'inline-edit')
|
2
|
-
= helpers.pg_form_for(@model, render_errors: false, wrapper_mappings: @wrapper_mappings
|
3
|
-
html: { class: 'd-flex align-items-start gap-1' }) do |f|
|
2
|
+
= helpers.pg_form_for(@model, render_errors: false, wrapper_mappings: @wrapper_mappings) do |f|
|
4
3
|
= hidden_field_tag :inline_attribute, @attribute
|
5
4
|
|
6
5
|
= f.field @unsuffixed_attribute, label: false, html5: true
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
.actions.d-flex.gap-1
|
8
|
+
= button_tag class: 'btn btn-sm btn-primary',
|
9
|
+
data: { controller: 'tooltip', 'bs-title': 'Guardar' } do
|
10
|
+
i.bi.bi-check-lg
|
11
|
+
= link_to users_inline_show_path(model: @model.to_gid, attribute: @attribute),
|
12
|
+
class: 'btn btn-sm btn-secondary',
|
13
|
+
data: { controller: 'tooltip', 'bs-title': 'Cancelar' } do
|
14
|
+
i.bi.bi-x-lg
|
@@ -1,8 +1,8 @@
|
|
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
|
-
class: 'text-body-tertiary', style: 'font-size: 0.8em' do
|
4
|
+
class: 'text-body-tertiary edit-link', style: 'font-size: 0.8em' do
|
5
5
|
i.bi.bi-pencil
|
6
|
-
span
|
6
|
+
span = @model.decorate.send(@attribute)
|
7
7
|
- else
|
8
8
|
= @model.decorate.send(@attribute)
|
@@ -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 %>
|
@@ -31,6 +31,8 @@ class PgFormBuilder < SimpleForm::FormBuilder
|
|
31
31
|
|
32
32
|
if find_on_all_associations(model.class, attribute_name).present?
|
33
33
|
pg_associable(attribute_name, options)
|
34
|
+
elsif model.respond_to?("rich_text_#{attribute_name}")
|
35
|
+
rich_text_area attribute_name
|
34
36
|
else
|
35
37
|
input(attribute_name, options, &)
|
36
38
|
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
|
@@ -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,11 @@ $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
|
+
// TODO: con css grid esto se debería poder hacer mejor
|
81
|
+
&:has(form) {
|
82
|
+
min-width: 28em;
|
83
|
+
}
|
79
84
|
}
|
80
85
|
}
|
81
86
|
|