pg_rails 7.6.5 → 7.6.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d093a397aa4021d053313ee524475eb24295290e56974623fdf03b0ab14691ee
4
- data.tar.gz: b0ae6c35558a26ff88d59e4949341a2d1046bd0ff81ff83279961b70d20813dd
3
+ metadata.gz: 365f1740542a5fbba1bce8e40441e42581235cd67e68a7890292f512a63535d7
4
+ data.tar.gz: dfc9376def176892e05dc733c8a0df12a97f4b3da8c2fd0a31b1f7f5fc9b77a5
5
5
  SHA512:
6
- metadata.gz: 2c1d7f92c914bf3ca632cfcb04cdcb9a52870e69a057085df1b68bc7e402a4831f7ce1b008f9aa3a6e50bd3436ce192225f795f52841b939bb0733024c4c98fa
7
- data.tar.gz: 87b8d08575eca14e090029038176c1dcf352047a340f41b3f908bfaf21b06614e952d5543a595e02503f25bb47d0dd45cb5ba86d74c089f0d4c35cde4b23db96
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 = !template.using_modal? && Pundit::PolicyFinder.new(klass).policy.new(user, klass).new?
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
- content = ModalContentComponent.new(src:).render_in(view_context)
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
@@ -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
- }
@@ -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 :modal_content,
24
+ <%= helpers.turbo_frame_tag @turbo_frame_id,
24
25
  **{ src: @src, refresh: :morph }.compact do %>
25
26
  <%= content %>
26
27
  <% 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)
@@ -25,6 +25,10 @@ module PgEngine
25
25
  create?
26
26
  end
27
27
 
28
+ def new_from_associable?
29
+ new?
30
+ end
31
+
28
32
  def update?
29
33
  puede_editar? && !objeto_borrado?
30
34
  end
@@ -18,6 +18,10 @@ class UserPolicy < ApplicationPolicy
18
18
  # acceso_total? && !record.readonly?
19
19
  # end
20
20
 
21
+ def new_from_associable?
22
+ false
23
+ end
24
+
21
25
  def base_access_to_record?
22
26
  user.developer? || user == record
23
27
  end
@@ -14,9 +14,9 @@
14
14
  - if @filtros.present?
15
15
  = render SearchBarComponent.new(@q, @filtros)
16
16
 
17
- div
17
+ .table-responsive style="padding-bottom: 15em"
18
18
  - if @collection.any?
19
- .table-responsive
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
- select categoria_de_cosa.to_s, from: 'cosa_categoria_de_cosa_id'
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'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.6.5'
4
+ VERSION = '7.6.6'
5
5
  end
@@ -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
 
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.5
4
+ version: 7.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martín Rosso