pg_rails 7.0.8.pre.alpha.17 → 7.0.8.pre.alpha.19

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: 18d8056112424185b1f7faf69c28580c76cb3882d198d0d4e915e97b647e837e
4
- data.tar.gz: 8e02025ed64d0b6c109c13e3a0e17a19e220123a9c5c8fc5db46e6be62f0c435
3
+ metadata.gz: a72200e2e6949c04a272d651064a3a69130d65844bda01f62e61e90765d7df1a
4
+ data.tar.gz: fbd00f4f53a6b637e79314ffc7cf1cd1aab2bc8ca0637aa80720e56d2115334e
5
5
  SHA512:
6
- metadata.gz: 53f56c08781a0352a614c4c144a39df6b3f8d8a11fe203c5cce05316dc63be47b80c243ad08937d8e6561be20288098ccd8fb46c18c8413883fe5918aeba8ea0
7
- data.tar.gz: 87ce2df9587b07594bde19563671cf585540031a320bfe5229702ab6bc7dbe79b0bc8f4b0f3016c5863759ee4517ea747d708f8222842bcfc68b971ccecd55c1
6
+ metadata.gz: e0275e61f1134103afad1ba6ca86f2c6e03bdc5342affe492b582cc6dca3f520e6a9fe37666849248dda4bbac703c26d72ac3cbb6462417dc171360bc811e73e
7
+ data.tar.gz: 50f2e304328af6da2894eca1c8767f82e355228812fea38ebcff0ccfba09a422d08eebf43a9f8c231663fc95441296d6fbd1d29a08e92f42c038aca52ec507bb
@@ -1,5 +1,9 @@
1
1
  import AsociableController from './app/javascript/asociable_controller'
2
2
  import ModalController from './app/javascript/modal_controller'
3
3
 
4
- window.Stimulus.register('asociable', AsociableController)
5
- window.Stimulus.register('modal', ModalController)
4
+ if (window.Stimulus) {
5
+ window.Stimulus.register('asociable', AsociableController)
6
+ window.Stimulus.register('modal', ModalController)
7
+ } else {
8
+ console.error('window.Stimulus must be set')
9
+ }
@@ -31,58 +31,62 @@ module PgEngine
31
31
  end
32
32
  # rubocop:enable Style/MissingRespondToMissing
33
33
 
34
- def destroy_link(message = '¿Estás seguro?')
34
+ def destroy_link(confirm_text: '¿Estás seguro?', klass: 'btn-light')
35
35
  return unless Pundit.policy!(helpers.send(PgEngine.configuracion.current_user_method), object).destroy?
36
36
 
37
37
  helpers.content_tag :span, rel: :tooltip, title: 'Eliminar' do
38
- helpers.link_to object_url, data: { 'turbo-confirm': message, 'turbo-method': :delete },
39
- class: "btn #{_config.clase_botones_chicos} btn-#{_config.boton_destroy}" do
40
- helpers.content_tag :span, nil, class: clase_icono(_config.icono_destroy).to_s
38
+ helpers.link_to object_url, data: { 'turbo-confirm': confirm_text, 'turbo-method': :delete },
39
+ class: "btn btn-sm #{klass}" do
40
+ helpers.content_tag :span, nil, class: clase_icono('trash-fill')
41
41
  end
42
42
  end
43
43
  end
44
44
 
45
- def edit_link(texto = '')
45
+ def edit_link(text: '', klass: 'btn-light')
46
46
  return unless Pundit.policy!(helpers.send(PgEngine.configuracion.current_user_method), object).edit?
47
47
 
48
48
  helpers.content_tag :span, rel: :tooltip, title: 'Editar' do
49
49
  helpers.link_to edit_object_url, data: { turbo_frame: :main },
50
- class: "btn #{_config.clase_botones_chicos} btn-#{_config.boton_edit}" do
51
- helpers.content_tag(:span, nil, class: clase_icono(_config.icono_edit).to_s) + texto
50
+ class: "btn btn-sm #{klass}" do
51
+ helpers.content_tag(:span, nil, class: clase_icono('pencil')) + text
52
52
  end
53
53
  end
54
54
  end
55
55
 
56
- def show_link(texto = '')
56
+ def show_link(text: '', klass: 'btn-light')
57
57
  return unless Pundit.policy!(helpers.send(PgEngine.configuracion.current_user_method), object).show?
58
58
 
59
59
  helpers.content_tag :span, rel: :tooltip, title: 'Ver' do
60
60
  helpers.link_to object_url, data: { turbo_frame: :main },
61
- class: "btn #{_config.clase_botones_chicos} btn-#{_config.boton_show}" do
62
- helpers.content_tag(:span, nil, class: clase_icono(_config.icono_show).to_s) + texto
61
+ class: "btn btn-sm #{klass}" do
62
+ helpers.content_tag(:span, nil, class: clase_icono('eye-fill')) + text
63
63
  end
64
64
  end
65
65
  end
66
66
 
67
- def export_link(url, texto = '')
68
- return unless Pundit.policy!(helpers.send(PgEngine.configuracion.current_user_method), object).export?
67
+ def export_link(url, text: '', klass: 'btn-info')
68
+ return unless Pundit.policy!(helpers.current_user, object).export?
69
69
 
70
- helpers.content_tag :span, rel: :tooltip, title: 'Exportar' do
70
+ helpers.content_tag :span, rel: :tooltip, title: 'Exportar en excel' do
71
71
  helpers.content_tag :a, target: '_blank',
72
- class: "btn #{_config.clase_botones_chicos} btn-#{_config.boton_export}", href: url_change_format(url, 'xlsx') do
73
- "#{helpers.content_tag(:span, nil, class: clase_icono('file-earmark-excel-fill'))} #{texto}".html_safe
72
+ class: "btn btn-sm #{klass}", href: url_change_format(url, 'xlsx') do
73
+ "#{helpers.content_tag(:span, nil, class: clase_icono('file-earmark-excel-fill'))} #{text}".html_safe
74
74
  end
75
75
  end
76
76
  end
77
77
 
78
- def new_link(options = {})
78
+ def new_link(remote: nil, klass: 'btn-warning')
79
79
  return unless Pundit.policy!(helpers.send(PgEngine.configuracion.current_user_method), object).new?
80
80
 
81
- helpers.content_tag :span, rel: :tooltip, title: 'Crear' do
82
- helpers.link_to new_object_url, class: "btn #{_config.clase_botones_chicos} btn-primary",
83
- remote: options[:remote] do
81
+ word_to_create = I18n.t("form.#{object.class.nombre_singular.downcase}.create", default: :'form.create')
82
+
83
+ full_text = "#{word_to_create} #{object.class.nombre_singular.downcase}"
84
+
85
+ helpers.content_tag :span, rel: :tooltip, title: word_to_create do
86
+ helpers.link_to(new_object_url, class: "btn btn-sm #{klass}",
87
+ remote:) do
84
88
  helpers.content_tag(:span, nil,
85
- class: clase_icono('plus').to_s) + "<span class='d-none d-sm-inline'> Crear #{object.class.nombre_singular.downcase}</span>".html_safe
89
+ class: clase_icono('plus').to_s) + "<span class='d-none d-sm-inline'> #{full_text}</span>".html_safe
86
90
  end
87
91
  end
88
92
  end
@@ -109,12 +113,8 @@ module PgEngine
109
113
 
110
114
  private
111
115
 
112
- def _config
113
- PgEngine.configuracion
114
- end
115
-
116
116
  def clase_icono(icono)
117
- "#{_config.sistema_iconos} #{_config.sistema_iconos}-#{icono}"
117
+ "bi bi-#{icono}"
118
118
  end
119
119
  end
120
120
  end
@@ -1,14 +1,13 @@
1
1
  - content_for(:title, @clase_modelo.nombre_plural)
2
2
  - content_for :actions do
3
- button.btn.btn-sm.btn-primary[type="button" data-bs-toggle="collapse"
3
+ button.btn.btn-sm.btn-outline-primary[type="button" data-bs-toggle="collapse"
4
4
  data-bs-target="#filtros" aria-expanded="false"
5
5
  aria-controls="filtros"]
6
6
  span.bi.bi-funnel-fill
7
7
  span.d-none.d-sm-inline Filtrar
8
8
  .ms-1
9
9
  = @clase_modelo.new.decorate.new_link
10
- .ms-1
11
- = @clase_modelo.new.decorate.export_link(request.url)
10
+
12
11
  .collapse.border-bottom#filtros class="#{ 'show' if any_filter? }"
13
12
  .d-flex.align-items-center.p-2
14
13
  .px-2.d-none.d-sm-inline-block
@@ -33,7 +32,7 @@ div
33
32
  tr
34
33
  - atributos_para_listar.each do |att|
35
34
  th = encabezado att, ordenable: true
36
- th
35
+ th.text-end = @clase_modelo.new.decorate.export_link(request.url)
37
36
  tbody
38
37
  - @collection.each do |object|
39
38
  - object = object.decorate
@@ -1,6 +1,4 @@
1
1
  # frozen_string_literal: true
2
- Dotenv.load
3
-
4
2
  CableReady.configure do |config|
5
3
  # Enable/disable exiting / warning when the sanity checks fail options:
6
4
  # `:exit` or `:warn` or `:ignore`
@@ -5,6 +5,8 @@ es:
5
5
  discarded_at: Fecha de borrado
6
6
  actualizado_por: Actualizado por
7
7
  creado_por: Creado por
8
+ form:
9
+ create: Crear
8
10
  ancestry:
9
11
  exclude_self: No puede ser hijx de si mismx
10
12
  simple_form:
@@ -11,6 +11,12 @@ describe PgEngine::PgLogger do
11
11
  end
12
12
  end
13
13
 
14
+ around do |example|
15
+ described_class.raise_errors = false
16
+ example.run
17
+ described_class.raise_errors = true
18
+ end
19
+
14
20
  shared_examples 'logger' do |type|
15
21
  it do
16
22
  expect(Rails.logger).to have_received(type).twice
@@ -1,4 +1,7 @@
1
- // TODO: si no existe la aplicacion mostrar error
1
+ if (!window.Stimulus) {
2
+ console.error('window.Stimulus must be set')
3
+ }
4
+
2
5
  const application = window.Stimulus
3
6
 
4
7
  export { application }
@@ -0,0 +1 @@
1
+ Dotenv.load('.env.test.local', '.env.test', '.env')
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.0.8-alpha.17'
4
+ VERSION = '7.0.8-alpha.19'
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.0.8.pre.alpha.17
4
+ version: 7.0.8.pre.alpha.19
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-03-27 00:00:00.000000000 Z
11
+ date: 2024-03-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rails goodies.
14
14
  email:
@@ -185,6 +185,7 @@ files:
185
185
  - pg_rails/js/index.js
186
186
  - pg_rails/lib/pg_rails.rb
187
187
  - pg_rails/lib/pg_rails/capybara_support.rb
188
+ - pg_rails/lib/pg_rails/dotenv_support.rb
188
189
  - pg_rails/lib/pg_rails/vcr_support.rb
189
190
  - pg_rails/lib/version.rb
190
191
  - pg_rails/scss/pg_rails.scss