pg_rails 7.0.8.pre.alpha.17 → 7.0.8.pre.alpha.18

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: fe2517c50a77409c6c90dc4378588e7b5bfc8cfa227859bdd7a163979c1b8e0d
4
+ data.tar.gz: dd5da55fffc24abb9bbb4942a2e6de0a7e52184cca97e54ec16500afb556f043
5
5
  SHA512:
6
- metadata.gz: 53f56c08781a0352a614c4c144a39df6b3f8d8a11fe203c5cce05316dc63be47b80c243ad08937d8e6561be20288098ccd8fb46c18c8413883fe5918aeba8ea0
7
- data.tar.gz: 87ce2df9587b07594bde19563671cf585540031a320bfe5229702ab6bc7dbe79b0bc8f4b0f3016c5863759ee4517ea747d708f8222842bcfc68b971ccecd55c1
6
+ metadata.gz: c3d214ad9f2a591590582d92b8c409a593ef5d5a6b0a3bc207aca5dc37944ab0be4f72ad785d119beb1c56fc954ef74c43d7da8418b06a45688330127ff4c6ff
7
+ data.tar.gz: be03f50c19c74783a6c2bce2d371ed9b58a41eefa87addeecfddbb79e5999906a9e6456017b1a318e8d2c4f492d1b488e9f6d9aba9215f0a3eb9b31d4c183e38
@@ -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
@@ -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 }
@@ -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.18'
5
5
  end
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.0.8.pre.alpha.17
4
+ version: 7.0.8.pre.alpha.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martín Rosso