pg_rails 7.0.8.pre.alpha.109 → 7.0.8.pre.alpha.111

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: 0ea0a25a34ed115022c43283c50cd8678d9ebde034abbfcd65f149fa486d2004
4
- data.tar.gz: 6ad0a841b8d2b3c73513c8890a7f2642598c78341ef1b79567a9e049b5cd8882
3
+ metadata.gz: 633b510e33807a5146da15616442bc144c78a7abd86bd617c2234362745c9251
4
+ data.tar.gz: a2d2830fedd674a54b8b527d4397c7035cec9be7dbeaf87dd2419a57b3b9103a
5
5
  SHA512:
6
- metadata.gz: 7b24cbce39c6cce5ec0ed5d21dc45c61de0cb6986c40bcc04c5495ae2a5fa7cb12934a3609eec80d0008b860ed69a67c6f45df3969771907da4381258a26ac6f
7
- data.tar.gz: e59deaa85466ff3e49dae7effe311fe77025b9bbdfc97c9667ce97f3ff48efdd20e6428d4e830993e895f0633b0144d6c6a73505a072f92f297972a2cd898b15
6
+ metadata.gz: 6f4e654ad40febd8919fc9bac6886242590e6b591d9e412b03043199a37536ce5a11c10ed540fb46c0e26f21efb3f0b77cacbb0bc74b4f79acd90b235b11637a
7
+ data.tar.gz: 6c91a9c7ff63cee85b00f041f9cbfa953c6ba49eae5eb447f90c2c45f4e43222ba54b2c4425407dab02b72d750b2d5da434861abb07d22f1dee50abfd144f3ee
@@ -290,14 +290,20 @@ export default class extends Controller {
290
290
  }
291
291
 
292
292
  completarCampo (target) {
293
- // FIXME: savedInputState = null
293
+ this.savedInputState = null
294
294
  const textField = this.element.querySelector('input[type=text]')
295
295
  const hiddenField = this.element.querySelector('input[type=hidden]')
296
296
 
297
- if (target && target.dataset.fieldName) { hiddenField.name = target.dataset.fieldName }
298
-
299
297
  if (target) {
300
- const object = JSON.parse(target.dataset.object)
298
+ let object = null
299
+ if (target.dataset) {
300
+ // cuando se selecciona un objeto existente
301
+ if (target.dataset.fieldName) { hiddenField.name = target.dataset.fieldName }
302
+ object = JSON.parse(target.dataset.object)
303
+ } else {
304
+ // cuando se crea un objeto desde el modal
305
+ object = target
306
+ }
301
307
  hiddenField.value = object.id
302
308
  textField.value = object.to_s
303
309
  textField.setAttribute('readonly', 'true')
@@ -0,0 +1,24 @@
1
+ require 'rails_helper'
2
+
3
+ describe 'Associable' do
4
+ let(:user) { create :user, :developer }
5
+
6
+ before do
7
+ login_as user
8
+ driven_by :selenium
9
+ visit '/admin/cosas/new'
10
+ fill_in 'cosa_nombre', with: 'La cosa'
11
+ select 'Los', from: 'cosa_tipo'
12
+ find('.cosa_categoria_de_cosa input[type=text]').click
13
+ end
14
+
15
+ it do
16
+ expect(page).to have_text :all, 'Nuevo'
17
+ find('.cosa_categoria_de_cosa .list-group-item').click
18
+ fill_in 'categoria_de_cosa_nombre', with: 'la categoría'
19
+ select 'Completar', from: 'categoria_de_cosa_tipo'
20
+ click_on 'Crear Categoría de cosa'
21
+ click_on 'Crear Coso'
22
+ expect(page).to have_text 'Creado por'
23
+ end
24
+ end
@@ -322,7 +322,7 @@ module PgEngine
322
322
  def filtro_fecha(campo, placeholder = '')
323
323
  content_tag :div, class: 'col-auto' do
324
324
  content_tag :div, class: 'filter' do
325
- label_tag(nil, placeholder, class: 'text-body-secondary') + \
325
+ label_tag(nil, placeholder, class: 'text-body-secondary') +
326
326
  date_field_tag(
327
327
  campo, parametros_controller[campo], class: 'form-control form-control-sm d-inline-block w-auto ms-1', placeholder:, autocomplete: 'off'
328
328
  )
@@ -23,7 +23,7 @@ class PgFormBuilder < SimpleForm::FormBuilder
23
23
  def input(attribute_name, options = {}, &)
24
24
  options[:error_prefix] ||= default_prefix(attribute_name)
25
25
 
26
- super(attribute_name, options, &)
26
+ super
27
27
  end
28
28
 
29
29
  def mensajes_de_error
@@ -28,7 +28,7 @@ module PgEngine
28
28
  protected
29
29
 
30
30
  def mail(*args)
31
- super(*args).tap do |message|
31
+ super.tap do |message|
32
32
  # message.mailgun_options = {
33
33
  # 'tag' => email.tags,
34
34
  # 'tracking-opens' => true
@@ -3,10 +3,15 @@ module PgEngine
3
3
  # default delivery_method: :smtp
4
4
 
5
5
  def notification
6
- recipient = params[:notification].recipient
7
- @html = params[:message].html_safe
8
- @text = params[:message_text]
9
- mail(to: recipient.email, subject: params[:subject])
6
+ @recipient = params[:notification].recipient
7
+ @html = replace_user(params[:message]).html_safe
8
+ @text = replace_user(params[:message_text])
9
+ mail(to: @recipient.email, subject: params[:subject])
10
+ end
11
+
12
+ def replace_user(input)
13
+ # reemplaza todas las ocurrencias de: %{user}
14
+ format(input, user: @recipient.nombre)
10
15
  end
11
16
  end
12
17
  end
@@ -23,6 +23,9 @@ class Account < ApplicationRecord
23
23
  audited
24
24
  include Discard::Model
25
25
 
26
+ has_many :user_accounts
27
+ has_many :users, through: :user_accounts
28
+
26
29
  belongs_to :creado_por, optional: true, class_name: 'User'
27
30
  belongs_to :actualizado_por, optional: true, class_name: 'User'
28
31
 
@@ -43,7 +43,7 @@ module PgEngine
43
43
  # Si es un decorated method
44
44
  super(attribute[0..-3], options)
45
45
  else
46
- super(attribute, options)
46
+ super
47
47
  end
48
48
  end
49
49
 
@@ -5,9 +5,8 @@ wb.add_worksheet(name: @clase_modelo.nombre_plural) do |sheet|
5
5
  sheet.add_row(atributos_para_listar.map { |a| @clase_modelo.human_attribute_name(a) })
6
6
 
7
7
  @collection.decorate.each do |object|
8
- array = []
9
- atributos_para_listar.each do |att|
10
- array.push object.send(att)
8
+ array = atributos_para_listar.map do |att|
9
+ object.send(att)
11
10
  end
12
11
  sheet.add_row array
13
12
  end
@@ -11,7 +11,7 @@ es:
11
11
  confirmed_at: Fecha de confirmación
12
12
  actualizado_por: Actualizado por
13
13
  creado_por: Creado por
14
- accept_terms: Acepto los <a href="/terminos_y_condiciones" target="_blank">Términos y condiciones</a>
14
+ accept_terms: Acepto los <a href="/terminos_y_condiciones" target="_blank">Términos y condiciones</a> y la <a href="/privacidad" target="_blank">Política de privacidad</a>
15
15
  enumerize:
16
16
  email:
17
17
  status:
@@ -7,6 +7,8 @@ Rails.application.routes.draw do
7
7
  get '500', to: 'application#internal_error'
8
8
  get 'internal_error_but_with_status200', to: 'application#internal_error_but_with_status200'
9
9
 
10
+ get 'contacto', to: 'public/mensaje_contactos#new'
11
+
10
12
  namespace :public, path: '' do
11
13
  pg_resource(:mensaje_contactos, only: [:new, :create], path: 'contacto')
12
14
  post 'webhook/mailgun', to: 'webhooks#mailgun'
@@ -20,7 +20,6 @@ class DummyBaseController < PgEngine::BaseController
20
20
  end
21
21
  end
22
22
 
23
- # rubocop:disable RSpec/FilePath
24
23
  # rubocop:disable RSpec/SpecFilePathFormat
25
24
  describe DummyBaseController do
26
25
  render_views
@@ -128,5 +127,4 @@ describe DummyBaseController do
128
127
  end
129
128
  end
130
129
  # rubocop:enable RSpec/MultipleExpectations
131
- # rubocop:enable RSpec/FilePath
132
130
  # rubocop:enable RSpec/SpecFilePathFormat
@@ -38,11 +38,6 @@ class Navbar
38
38
  path: eval(item['path']),
39
39
  show: item['policy'] ? eval(item['policy']) : true
40
40
  }
41
- rescue StandardError => e
42
- # FIXME: que rompa los tests
43
- # TODO!: testear
44
- pg_err e, item
45
- return []
46
41
  end
47
42
  # rubocop:enable Security/Eval
48
43
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.0.8-alpha.109'
4
+ VERSION = '7.0.8-alpha.111'
5
5
  end
@@ -18,7 +18,7 @@ describe 'Generators', type: :generator do
18
18
  run_generator(['Frontend/Modelo', 'bla:integer'])
19
19
 
20
20
  my_assert_file 'app/decorators/modelo_decorator.rb' do |content|
21
- assert_match(/delegate_all/, content)
21
+ expect(content).to match(/delegate_all/)
22
22
  end
23
23
  end
24
24
  end
@@ -33,8 +33,8 @@ describe 'Generators', type: :generator do
33
33
  run_generator(['Frontend/Modelo', 'bla:integer'])
34
34
 
35
35
  my_assert_file 'spec/controllers/frontend/modelos_controller_spec.rb' do |content|
36
- assert_match(/routing/, content)
37
- assert_match(/sign_in/, content)
36
+ expect(content).to match(/routing/)
37
+ expect(content).to match(/sign_in/)
38
38
  end
39
39
  end
40
40
  end
@@ -49,7 +49,7 @@ describe 'Generators', type: :generator do
49
49
  run_generator(['Frontend/Modelo', 'bla:integer', 'cosa:references', '--activeadmin'])
50
50
 
51
51
  my_assert_file 'app/admin/modelos.rb' do |content|
52
- assert_match(/permit_params.*cosa_id/, content)
52
+ expect(content).to match(/permit_params.*cosa_id/)
53
53
  end
54
54
  end
55
55
  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.0.8.pre.alpha.109
4
+ version: 7.0.8.pre.alpha.111
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-02 00:00:00.000000000 Z
11
+ date: 2024-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -702,42 +702,84 @@ dependencies:
702
702
  requirements:
703
703
  - - "~>"
704
704
  - !ruby/object:Gem::Version
705
- version: 1.60.2
705
+ version: '1.64'
706
706
  type: :development
707
707
  prerelease: false
708
708
  version_requirements: !ruby/object:Gem::Requirement
709
709
  requirements:
710
710
  - - "~>"
711
711
  - !ruby/object:Gem::Version
712
- version: 1.60.2
712
+ version: '1.64'
713
713
  - !ruby/object:Gem::Dependency
714
714
  name: rubocop-rails
715
715
  requirement: !ruby/object:Gem::Requirement
716
716
  requirements:
717
717
  - - "~>"
718
718
  - !ruby/object:Gem::Version
719
- version: 2.23.1
719
+ version: '2.25'
720
720
  type: :development
721
721
  prerelease: false
722
722
  version_requirements: !ruby/object:Gem::Requirement
723
723
  requirements:
724
724
  - - "~>"
725
725
  - !ruby/object:Gem::Version
726
- version: 2.23.1
726
+ version: '2.25'
727
727
  - !ruby/object:Gem::Dependency
728
728
  name: rubocop-rspec
729
729
  requirement: !ruby/object:Gem::Requirement
730
730
  requirements:
731
731
  - - "~>"
732
732
  - !ruby/object:Gem::Version
733
- version: 2.26.1
733
+ version: '3.0'
734
734
  type: :development
735
735
  prerelease: false
736
736
  version_requirements: !ruby/object:Gem::Requirement
737
737
  requirements:
738
738
  - - "~>"
739
739
  - !ruby/object:Gem::Version
740
- version: 2.26.1
740
+ version: '3.0'
741
+ - !ruby/object:Gem::Dependency
742
+ name: rubocop-capybara
743
+ requirement: !ruby/object:Gem::Requirement
744
+ requirements:
745
+ - - "~>"
746
+ - !ruby/object:Gem::Version
747
+ version: '2.21'
748
+ type: :development
749
+ prerelease: false
750
+ version_requirements: !ruby/object:Gem::Requirement
751
+ requirements:
752
+ - - "~>"
753
+ - !ruby/object:Gem::Version
754
+ version: '2.21'
755
+ - !ruby/object:Gem::Dependency
756
+ name: rubocop-factory_bot
757
+ requirement: !ruby/object:Gem::Requirement
758
+ requirements:
759
+ - - "~>"
760
+ - !ruby/object:Gem::Version
761
+ version: '2.26'
762
+ type: :development
763
+ prerelease: false
764
+ version_requirements: !ruby/object:Gem::Requirement
765
+ requirements:
766
+ - - "~>"
767
+ - !ruby/object:Gem::Version
768
+ version: '2.26'
769
+ - !ruby/object:Gem::Dependency
770
+ name: rubocop-rspec_rails
771
+ requirement: !ruby/object:Gem::Requirement
772
+ requirements:
773
+ - - "~>"
774
+ - !ruby/object:Gem::Version
775
+ version: '2.30'
776
+ type: :development
777
+ prerelease: false
778
+ version_requirements: !ruby/object:Gem::Requirement
779
+ requirements:
780
+ - - "~>"
781
+ - !ruby/object:Gem::Version
782
+ version: '2.30'
741
783
  - !ruby/object:Gem::Dependency
742
784
  name: slim_lint
743
785
  requirement: !ruby/object:Gem::Requirement
@@ -969,6 +1011,7 @@ files:
969
1011
  - pg_associable/lib/pg_associable.rb
970
1012
  - pg_associable/lib/pg_associable/engine.rb
971
1013
  - pg_associable/spec/pg_associable/helpers_spec.rb
1014
+ - pg_associable/spec/system/associable_spec.rb
972
1015
  - pg_engine/app/admin/accounts.rb
973
1016
  - pg_engine/app/admin/audits.rb
974
1017
  - pg_engine/app/admin/dashboard.rb