pg_rails 7.1.0 → 7.1.1.pre.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 22051324268199a76c6b3bc928fe0391326c16951b65586d4e1d492e6705735c
4
- data.tar.gz: 3f48621a08c26bdf19b07673a70bac70cf46035a98fb95063c710bcc1673a840
3
+ metadata.gz: f1a5b2d45d523d85b889cb132876fecfa47dcb5ec2215745a8a5f52f65cb64d1
4
+ data.tar.gz: 2d3a6033834156a52fd1b2732fa5807da7c543a0ebac232ce1e588e2b8264595
5
5
  SHA512:
6
- metadata.gz: 89c635b554cdd4aa4b7e809c747be08d501fae9ca78e5c4c54da16d630a0858893034e424d13c3d28b6eaf221175f520db66150abf6e6d151115dd219ed79429
7
- data.tar.gz: d75744f9d5d3b020e54f63dbf8c289049795d9f2f95e8a56c4c657ca701e171a6077097de5db1155ca104b2b02ff242052803866b458a4d67a7946e59df29dfd
6
+ metadata.gz: e8307c9947ada0096c2c631c688fa6b5117c48473bd263786af090814aed41641535a5a205d9bfbfceef9ced876b8814b09e7dbcb6176730dc339f4499921e48
7
+ data.tar.gz: 5dff3bd33e3eb3adfe4f1ce205c34f6099ae1446cf58288aa411c863511531bab2aa40d476c04c6e41a2d5b8df72ff53bc9857f3fc6f6b311b4d620e1de6df12
@@ -9,6 +9,14 @@ export default class extends Controller {
9
9
 
10
10
  connect (e) {
11
11
  this.modalPuntero = new bootstrap.Modal(this.element)
12
+ if (this.element.dataset.removeOnHide) {
13
+ this.element.addEventListener('hidden.bs.modal', (e) => {
14
+ this.element.remove()
15
+ window.Stimulus.controllers.map((c) => { return c.calendar })
16
+ .filter((e) => { return e })
17
+ .forEach((c) => { c.refetchEvents() })
18
+ })
19
+ }
12
20
  this.modalPuntero.show()
13
21
  document.addEventListener('turbo:before-cache', () => {
14
22
  this.element.remove()
@@ -146,7 +146,8 @@ input[type=datetime-local], input[type=datetime] {
146
146
  }
147
147
  .fc-multimonth {
148
148
  .fc-daygrid-day-events {
149
- display: none;
149
+ xdisplay: none;
150
+ visibility: hidden;
150
151
  }
151
152
  .fc-daygrid-day-top {
152
153
  display: inline-block;
@@ -4,7 +4,6 @@ class AlertComponent < ViewComponent::Base
4
4
  def initialize(type:, toast: false, dismissible: true)
5
5
  @type = type.to_s
6
6
 
7
- # rubocop:disable Style/IfUnlessModifier
8
7
  unless @type.in? ApplicationController._flash_types.map(&:to_s)
9
8
  raise PgEngine::Error, 'el type no es válido'
10
9
  end
@@ -22,6 +22,7 @@ module Admin
22
22
  def create
23
23
  saved = false
24
24
  ActiveRecord::Base.transaction do
25
+ # FIXME: acá la transaction jode porque el ActiveJob no puede deserializar el Email
25
26
  if (saved = @email.save)
26
27
  PgEngine::AdminMailer.with(email_object: @email).admin_mail.deliver_later
27
28
  end
@@ -89,6 +89,7 @@ module PgEngine
89
89
  object = instancia_modelo
90
90
  respond_to do |format|
91
91
  if (@saved = object.save)
92
+ # TODO: 'asociable' lo cambiaría por 'in_modal' o algo así
92
93
  if params[:asociable]
93
94
  format.turbo_stream do
94
95
  render turbo_stream:
@@ -96,7 +97,8 @@ module PgEngine
96
97
  <div data-modal-target="response" data-response='#{object.decorate.to_json}'></div>
97
98
  HTML
98
99
  )
99
- # rubocop:enable Rails/SkipsModelValidations
100
+ # FIXME: handlear json
101
+ # render json: object.decorate, content_type: 'application/json'
100
102
  end
101
103
  end
102
104
  format.html do
@@ -113,10 +115,9 @@ module PgEngine
113
115
  # self.instancia_modelo = instancia_modelo.decorate
114
116
  if params[:asociable]
115
117
  format.turbo_stream do
116
- # rubocop:disable Rails/SkipsModelValidations
118
+ # FIXME: agregar , status: :unprocessable_entity
117
119
  render turbo_stream:
118
120
  turbo_stream.update_all('.modal.show .pg-associable-form', partial: 'form', locals: { asociable: true })
119
- # rubocop:enable Rails/SkipsModelValidations
120
121
  end
121
122
  end
122
123
  format.html { render :new, status: :unprocessable_entity }
@@ -138,9 +139,14 @@ module PgEngine
138
139
  end
139
140
 
140
141
  def pg_respond_show(object = nil)
141
- respond_to do |format|
142
- format.json { render json: object || instancia_modelo }
143
- format.html
142
+ object ||= instancia_modelo
143
+ if params[:modal].present?
144
+ render turbo_stream: turbo_stream.append_all('body', partial: 'pg_layout/modal_show', locals: { object: })
145
+ else
146
+ respond_to do |format|
147
+ format.json { render json: object }
148
+ format.html
149
+ end
144
150
  end
145
151
  end
146
152
 
@@ -17,10 +17,10 @@ module PgEngine
17
17
  end
18
18
  cgi['order_by'] = campo
19
19
  cgi['order_direction'] =
20
- if field.to_s == campo.to_s && direction.to_s == 'asc'
21
- 'desc'
22
- else
20
+ if field.to_s == campo.to_s && direction.to_s == 'desc'
23
21
  'asc'
22
+ else
23
+ 'desc'
24
24
  end
25
25
 
26
26
  symbol = if field.to_s == campo.to_s
@@ -72,13 +72,21 @@ module PgEngine
72
72
  raise 'filtro de asociacion no soportado'
73
73
  end
74
74
  elsif tipo(campo).in?(%i[string text])
75
- match_vector = parametros[campo].split.map { |a| "#{a}:*" }.join(' & ')
76
- match_like = "%#{parametros[campo]}%"
75
+ columna = @clase_modelo.columns.find { |c| c.name == campo.to_s }
77
76
  campo_tabla = "#{@clase_modelo.table_name}.#{campo}"
78
- condicion = "to_tsvector(coalesce(unaccent(#{campo_tabla}), '')) @@ to_tsquery( unaccent(?) )"
79
- condicion += " OR unaccent(CONCAT(#{campo_tabla})) ILIKE unaccent(?)"
80
- query = query.where(condicion, I18n.transliterate(match_vector).to_s,
81
- I18n.transliterate(match_like).to_s)
77
+ match_like = "%#{parametros[campo]}%"
78
+ query =
79
+ if columna&.array
80
+ # FIXME: testear
81
+ # El CONCAT no sé para qué sirve, pero lo dejo
82
+ query.where("unaccent(CONCAT(array_to_string(#{campo_tabla}, ' '))) ILIKE unaccent(?)", I18n.transliterate(match_like).to_s)
83
+ else
84
+ match_vector = parametros[campo].split.map { |a| "#{a}:*" }.join(' & ')
85
+ condicion = "to_tsvector(coalesce(unaccent(#{campo_tabla}), '')) @@ to_tsquery( unaccent(?) )"
86
+ condicion += " OR unaccent(CONCAT(#{campo_tabla})) ILIKE unaccent(?)"
87
+ query = query.where(condicion, I18n.transliterate(match_vector).to_s,
88
+ I18n.transliterate(match_like).to_s)
89
+ end
82
90
  elsif tipo(campo) == :boolean
83
91
  if campo.to_s == 'discarded'
84
92
  # Si el nombre del campo es 'discarded' entonces no es un campo
@@ -5,6 +5,9 @@ es:
5
5
  empty: 'No hay %{model} aún'
6
6
  empty_but_filtered: 'No hay %{model} para los filtros aplicados'
7
7
  attributes:
8
+ external_labels: Etiquetas externas
9
+ external_source: Fuente externa
10
+ external_id: ID externo
8
11
  created_at: Fecha de creación
9
12
  updated_at: Fecha de actualización
10
13
  discarded_at: Fecha de borrado
@@ -0,0 +1,9 @@
1
+ .modal.modal-lg.modal-asociable[tabindex="-1" data-controller="modal" data-remove-on-hide="true"]
2
+ .modal-dialog
3
+ .modal-content
4
+ .modal-header
5
+ .modal-title
6
+ h3 Item
7
+ a.btn-close[type="button" data-bs-dismiss="modal" aria-label="Close"]
8
+ .modal-body
9
+ = render object
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.1.0'
4
+ VERSION = '7.1.1-2'
5
5
  end
@@ -7,7 +7,8 @@ $danger-bg-subtle: tint-color($danger, 98%);
7
7
  // $info-border-subtle: tint-color($info, 60%);
8
8
  $warning-border-subtle: tint-color($warning, 20%);
9
9
  // $danger-border-subtle: tint-color($danger, 60%);
10
-
11
10
  $secondary-bg-subtle: tint-color($secondary, 92%);
11
+ $warning-bg-subtle: tint-color($warning, 40%);
12
+
12
13
 
13
14
  $btn-close-focus-shadow: none;
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.1.0
4
+ version: 7.1.1.pre.2
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-07-15 00:00:00.000000000 Z
11
+ date: 2024-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -848,6 +848,7 @@ files:
848
848
  - pg_layout/app/views/layouts/pg_layout/mailer.html.slim
849
849
  - pg_layout/app/views/layouts/pg_layout/mailer.text.erb
850
850
  - pg_layout/app/views/pg_layout/_flash.html.slim
851
+ - pg_layout/app/views/pg_layout/_modal_show.html.slim
851
852
  - pg_layout/app/views/pg_layout/_navbar.html.erb
852
853
  - pg_layout/app/views/pg_layout/_sidebar.html.erb
853
854
  - pg_layout/app/views/pg_layout/_sidebar_mobile.html.erb