pg_rails 7.1.1.pre.1 → 7.1.1.pre.3

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: 26619042e1d28565472f7c5dd99e31b4a75668c3efd5e0c299ad6f3a5e6f71cd
4
- data.tar.gz: 1f306defd53cda0f8567ac4f17465b99aaed1d1293565b08b08176b853301713
3
+ metadata.gz: '08c5ab91e5c32e537c33112965e6be68eb7d5992e236f27752a182af7cf584ff'
4
+ data.tar.gz: 32461e729fa13575fbd61f9c02e5907e06e6b8acabd18068db0c049483a83536
5
5
  SHA512:
6
- metadata.gz: a338901f4520b0a9dd9b7dfb363951ddd884f20ad87b9bcd5fea6591d908383c22a942ff9be7e6f914a7788e18e8233b58a541cb5b37d27f889665025bdede16
7
- data.tar.gz: e21ec84cfa1a7191fdc5776524cfa1e67468f38720080ceb6299dd9305f16d7f57cc155314f72d9eaa79a6ed0a2c7d9834d7781f80eeb0e0d7d53f6827557230
6
+ metadata.gz: 1b0caab961e097ce6a9b770fecbc02c179013987d20fdd016f44f2675084555b44ff700f94abe07f748fb4a55466614ef44c28758420881c096781936edbb9bb
7
+ data.tar.gz: 6652961ad489a6a699819874c79c69356f6a9f8882f1c4ed195556b16d8836c440886db77bee3f2a60f2fda6c07e9a68f525c2c91ceba9748c01caf89449e421
@@ -14,8 +14,8 @@ export default class extends Controller {
14
14
  this.element.remove()
15
15
  window.Stimulus.controllers.map((c) => { return c.calendar })
16
16
  .filter((e) => { return e })
17
- .map((c) => { c.refetchEvents() })
18
- })
17
+ .forEach((c) => { c.refetchEvents() })
18
+ })
19
19
  }
20
20
  this.modalPuntero.show()
21
21
  document.addEventListener('turbo:before-cache', () => {
@@ -65,6 +65,7 @@ input[type=datetime-local], input[type=datetime] {
65
65
  }
66
66
  }
67
67
  .listado td:has(.btn) {
68
+ // FIXME: rompe porque es una tabla y tiene que tener su propio display
68
69
  display: flex;
69
70
  justify-content: flex-end;
70
71
  gap: 4px;
@@ -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
@@ -139,7 +139,7 @@ module PgEngine
139
139
  end
140
140
 
141
141
  def pg_respond_show(object = nil)
142
- object = object || instancia_modelo
142
+ object ||= instancia_modelo
143
143
  if params[:modal].present?
144
144
  render turbo_stream: turbo_stream.append_all('body', partial: 'pg_layout/modal_show', locals: { object: })
145
145
  else
@@ -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
@@ -2,12 +2,15 @@
2
2
 
3
3
  wb = xlsx_package.workbook
4
4
  wb.add_worksheet(name: @clase_modelo.nombre_plural) do |sheet|
5
- sheet.add_row(atributos_para_listar.map { |a| @clase_modelo.human_attribute_name(a) })
5
+ headers = atributos_para_listar.map { |a| @clase_modelo.human_attribute_name(a) }
6
+ headers.prepend 'ID interno'
7
+ sheet.add_row(headers)
6
8
 
7
9
  @collection.decorate.each do |object|
8
10
  array = atributos_para_listar.map do |att|
9
11
  object.send(att)
10
12
  end
13
+ array.prepend object.to_key
11
14
  sheet.add_row array
12
15
  end
13
16
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.1.1-1'
4
+ VERSION = '7.1.1-3'
5
5
  end
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.1.pre.1
4
+ version: 7.1.1.pre.3
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