pg_rails 7.0.8.pre.alpha.74 → 7.0.8.pre.alpha.76
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/pg_associable/app/assets/stylesheets/pg_associable.scss +1 -1
- data/pg_associable/app/javascript/asociable_controller.tsx +4 -3
- data/pg_associable/app/views/pg_associable/_resultados_inline.html.slim +1 -1
- data/pg_engine/app/assets/stylesheets/pg_rails_b5.scss +10 -0
- data/pg_engine/app/helpers/pg_engine/print_helper.rb +14 -7
- data/pg_engine/app/lib/pg_engine/devise_failure_app.rb +0 -1
- data/pg_engine/app/lib/pg_form_builder.rb +1 -1
- data/pg_engine/app/views/pg_engine/base/index.html.slim +11 -4
- data/pg_engine/lib/pg_engine.rb +1 -0
- data/pg_engine/spec/helpers/pg_engine/print_helper_spec.rb +53 -0
- data/pg_layout/app/javascript/application.js +3 -0
- data/pg_layout/app/javascript/controllers/filtros_controller.js +22 -0
- data/pg_layout/app/javascript/controllers/index.js +4 -0
- data/pg_layout/app/javascript/controllers/switcher_controller.js +26 -0
- data/pg_layout/app/lib/navbar.rb +2 -2
- data/pg_layout/app/views/pg_layout/_error.html.erb +1 -1
- data/pg_layout/app/views/pg_layout/_flash_container.html.slim +1 -1
- data/pg_layout/app/views/pg_layout/_flash_inner.html.slim +1 -1
- data/pg_layout/app/views/pg_layout/error.html.erb +2 -2
- data/pg_rails/lib/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e72fb52c1042404baaf142d2b8a3e83eb75cd8034e4ba58ca7c862054cfe8d8
|
4
|
+
data.tar.gz: 7f2cf6cd1ae8089fdeba57501d7d990fe9c59fc7a713b21068a16772a0506c17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28be79030af6d2cf172da55d757d040b414e166cda53960fd66f982d3dd36f36b829c45e835d798425a50bd38609d3b2c1ca3ab5d0536983ffd3d3b3e38bd2d6
|
7
|
+
data.tar.gz: 6c88a919dafb6e96c03214d0a7d91d6e4293752e0323b6a5fec3e0c1d97750b541e6af8000ce8f21e3057dbfb0159d44fe4d5644076046992144207261aa31f6
|
@@ -45,7 +45,8 @@ export default class extends Controller {
|
|
45
45
|
|
46
46
|
const input = this.element.querySelector('input[type=text]')
|
47
47
|
this.originalPlaceholder = input.placeholder
|
48
|
-
|
48
|
+
const hiddenField = this.element.querySelector('input[type=hidden]')
|
49
|
+
if (hiddenField.value) {
|
49
50
|
this.element.classList.add('filled')
|
50
51
|
input.setAttribute('readonly', 'true')
|
51
52
|
}
|
@@ -64,7 +65,7 @@ export default class extends Controller {
|
|
64
65
|
}
|
65
66
|
const doSearchBounce = debounce((force) => {
|
66
67
|
this.doSearch(force)
|
67
|
-
},
|
68
|
+
}, 900)
|
68
69
|
|
69
70
|
this.input.addEventListener('blur', () => {
|
70
71
|
this.input.placeholder = this.originalPlaceholder
|
@@ -211,7 +212,7 @@ export default class extends Controller {
|
|
211
212
|
buscando () {
|
212
213
|
this.subWrapper.innerHTML = renderToStaticMarkup(
|
213
214
|
<div className="resultados" tabIndex={-1}>
|
214
|
-
<div className="fst-italic text-secondary">Buscando...</div>
|
215
|
+
<div className="fst-italic text-secondary px-3">Buscando...</div>
|
215
216
|
</div>
|
216
217
|
)
|
217
218
|
}
|
@@ -102,3 +102,13 @@ input[type=datetime-local], input[type=datetime] {
|
|
102
102
|
padding: 0.725rem $alert-padding-x;
|
103
103
|
}
|
104
104
|
}
|
105
|
+
|
106
|
+
// Switcher (ver switcher_controller.js)
|
107
|
+
.switcher > * {
|
108
|
+
display: none;
|
109
|
+
}
|
110
|
+
|
111
|
+
// Flash
|
112
|
+
#flash .alert {
|
113
|
+
box-shadow: 0px 9px 13px -3px rgba(0, 0, 0, 0.5);
|
114
|
+
}
|
@@ -32,10 +32,17 @@ module PgEngine
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def print_cuit(cuit_number)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
str = cuit_number.to_s.gsub(/[^\d]/, '')
|
36
|
+
if str.length == 11
|
37
|
+
"#{str[0..1]}-#{str[2..9]}-#{str[10]}"
|
38
|
+
else
|
39
|
+
cuit_number
|
40
|
+
end
|
41
|
+
rescue StandardError => e
|
42
|
+
# :nocov:
|
43
|
+
pg_err e
|
44
|
+
cuit_number
|
45
|
+
# :nocov:
|
39
46
|
end
|
40
47
|
|
41
48
|
def dmy_time(date)
|
@@ -93,10 +100,10 @@ module PgEngine
|
|
93
100
|
return if number.blank?
|
94
101
|
|
95
102
|
# TODO!: testear
|
96
|
-
precision ||= if (number %
|
97
|
-
3
|
103
|
+
precision ||= if (number % 1).positive?
|
104
|
+
(number * 100 % 1).positive? ? 3 : 2
|
98
105
|
else
|
99
|
-
|
106
|
+
0
|
100
107
|
end
|
101
108
|
|
102
109
|
"#{simbolo} #{number_with_precision(number, delimiter: '.', separator: ',',
|
@@ -27,7 +27,7 @@ class PgFormBuilder < SimpleForm::FormBuilder
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def mensajes_de_error
|
30
|
-
# TODO:
|
30
|
+
# TODO: quitar en before-cache?
|
31
31
|
title = error_notification(message: mensaje, class: 'text-danger mb-2 error-title') if mensaje
|
32
32
|
|
33
33
|
base_errors = object.errors[:base]
|
@@ -1,11 +1,15 @@
|
|
1
1
|
- content_for(:title, @clase_modelo.nombre_plural)
|
2
2
|
- content_for :actions do
|
3
3
|
- if @filtros.present?
|
4
|
-
button.btn.btn-sm.btn-outline-primary[
|
5
|
-
|
6
|
-
|
4
|
+
button.btn.btn-sm.btn-outline-primary[
|
5
|
+
type="button" data-bs-toggle="collapse"
|
6
|
+
data-bs-target="#filtros" aria-expanded="#{any_filter? ? 'true' : 'false'}"
|
7
|
+
aria-controls="filtros" data-controller="filtros" data-expanded-text="Ocultar filtros"
|
8
|
+
]
|
7
9
|
span.bi.bi-funnel-fill
|
8
|
-
span.d-none.d-sm-inline
|
10
|
+
span.d-none.d-sm-inline
|
11
|
+
|  
|
12
|
+
span.text Filtrar
|
9
13
|
.ms-1
|
10
14
|
= @clase_modelo.new.decorate.new_link
|
11
15
|
|
@@ -20,6 +24,9 @@
|
|
20
24
|
.col-auto
|
21
25
|
= button_tag class: 'btn btn-sm btn-primary col-auto' do
|
22
26
|
span.bi.bi-search
|
27
|
+
span.d-none.d-sm-inline
|
28
|
+
|  
|
29
|
+
span.text Buscar
|
23
30
|
.col-auto
|
24
31
|
= link_to namespaced_path(@clase_modelo, clean: true),
|
25
32
|
class: 'btn btn-sm btn-secondary col-auto' do
|
data/pg_engine/lib/pg_engine.rb
CHANGED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe PgEngine::PrintHelper do
|
4
|
+
describe '#print_cuit' do
|
5
|
+
subject { print_cuit(input) }
|
6
|
+
|
7
|
+
context 'cuando es nil' do
|
8
|
+
let(:input) { nil }
|
9
|
+
|
10
|
+
it { expect(subject).to be_nil }
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'cuando es un cuit válido' do
|
14
|
+
let(:input) { 20_351_404_478 }
|
15
|
+
|
16
|
+
it { expect(subject).to eq '20-35140447-8' }
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'cuando es un cuit válido mal formateado' do
|
20
|
+
let(:input) { '2035140447-8' }
|
21
|
+
|
22
|
+
it { expect(subject).to eq '20-35140447-8' }
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'cuando no es un cuit válido' do
|
26
|
+
let(:input) { 2035 }
|
27
|
+
|
28
|
+
it { expect(subject).to eq 2035 }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#print_currency' do
|
33
|
+
subject { print_currency(input) }
|
34
|
+
|
35
|
+
context 'cuando es un entero' do
|
36
|
+
let(:input) { 191_624 }
|
37
|
+
|
38
|
+
it { expect(subject).to eq '$ 191.624' }
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'cuando tiene 1 decimal' do
|
42
|
+
let(:input) { 123_456.1 }
|
43
|
+
|
44
|
+
it { expect(subject).to eq '$ 123.456,10' }
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'cuando tiene más de 3 decimales' do
|
48
|
+
let(:input) { 123_456.164234 }
|
49
|
+
|
50
|
+
it { expect(subject).to eq '$ 123.456,164' }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -37,6 +37,9 @@ document.addEventListener('turbo:load', bindAndObserveToasts)
|
|
37
37
|
document.addEventListener('turbo:render', bindAndObserveToasts)
|
38
38
|
|
39
39
|
document.addEventListener('turbo:before-cache', () => {
|
40
|
+
document.querySelectorAll('#flash .alert').forEach((el) => {
|
41
|
+
el.remove()
|
42
|
+
})
|
40
43
|
document.querySelectorAll('.offcanvas-backdrop').forEach((el) => {
|
41
44
|
el.remove()
|
42
45
|
})
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { Controller } from '@hotwired/stimulus'
|
2
|
+
|
3
|
+
// Connects to data-controller="switcher"
|
4
|
+
export default class extends Controller {
|
5
|
+
originalText = null
|
6
|
+
textEl = null
|
7
|
+
|
8
|
+
connect () {
|
9
|
+
this.textEl = this.element.querySelector('.text')
|
10
|
+
this.originalText = this.textEl.textContent
|
11
|
+
this.element.addEventListener('click', () => { this.cambiarTexto() })
|
12
|
+
this.cambiarTexto()
|
13
|
+
}
|
14
|
+
|
15
|
+
cambiarTexto () {
|
16
|
+
if (this.element.getAttribute('aria-expanded') === 'true') {
|
17
|
+
this.textEl.textContent = this.element.dataset.expandedText
|
18
|
+
} else {
|
19
|
+
this.textEl.textContent = this.originalText
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
@@ -5,9 +5,13 @@ import NestedController from './nested_controller'
|
|
5
5
|
import PgFormController from './pg_form_controller'
|
6
6
|
import FadeinOnloadController from './fadein_onload_controller'
|
7
7
|
import ClearTimeoutController from './clear_timeout_controller'
|
8
|
+
import SwitcherController from './switcher_controller'
|
9
|
+
import FiltrosController from './filtros_controller'
|
8
10
|
|
9
11
|
application.register('navbar', NavbarController)
|
10
12
|
application.register('nested', NestedController)
|
11
13
|
application.register('pg_form', PgFormController)
|
12
14
|
application.register('fadein_onload', FadeinOnloadController)
|
13
15
|
application.register('clear-timeout', ClearTimeoutController)
|
16
|
+
application.register('switcher', SwitcherController)
|
17
|
+
application.register('filtros', FiltrosController)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { Controller } from '@hotwired/stimulus'
|
2
|
+
|
3
|
+
// Connects to data-controller="switcher"
|
4
|
+
export default class extends Controller {
|
5
|
+
connect () {
|
6
|
+
if (this.element.checked) {
|
7
|
+
this.show()
|
8
|
+
}
|
9
|
+
this.element.setAttribute('data-action', `${this.element.getAttribute('data-action') || ''} switcher#show`)
|
10
|
+
}
|
11
|
+
|
12
|
+
show () {
|
13
|
+
const elemToShow = document.querySelector(this.element.dataset.target)
|
14
|
+
this.getSiblings(elemToShow).forEach((el) => {
|
15
|
+
el.classList.add('d-none')
|
16
|
+
el.classList.remove('d-block')
|
17
|
+
})
|
18
|
+
elemToShow.classList.remove('d-none')
|
19
|
+
elemToShow.classList.add('d-block')
|
20
|
+
}
|
21
|
+
|
22
|
+
getSiblings (el) {
|
23
|
+
const childrenArray = [...el.parentNode.children]
|
24
|
+
return childrenArray.filter(child => child !== el)
|
25
|
+
}
|
26
|
+
}
|
data/pg_layout/app/lib/navbar.rb
CHANGED
@@ -38,9 +38,9 @@ class Navbar
|
|
38
38
|
path: eval(item['path']),
|
39
39
|
show: item['policy'] ? eval(item['policy']) : true
|
40
40
|
}
|
41
|
-
rescue StandardError
|
41
|
+
rescue StandardError => e
|
42
42
|
# TODO!: testear
|
43
|
-
pg_err item
|
43
|
+
pg_err e, item
|
44
44
|
return []
|
45
45
|
end
|
46
46
|
# rubocop:enable Security/Eval
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%# locals: (error_msg: nil) %>
|
2
2
|
|
3
|
-
<div class="d-flex justify-content-around mt-2"
|
3
|
+
<div class="d-flex justify-content-around mt-2">
|
4
4
|
<div class="alert alert-danger d-flex align-items-center">
|
5
5
|
<div>
|
6
6
|
<span class="bi bi-emoji-dizzy fs-1 me-3"></span>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#flash-wrapper.d-flex.justify-content-around
|
1
|
+
#flash-wrapper.d-flex.justify-content-around.sticky-top
|
2
2
|
#flash.flash.position-relative.w-100.d-flex.justify-content-center
|
3
3
|
= render partial: 'pg_layout/flash'
|
4
4
|
/ TODO: si hay varios flashes toast, se superponen. habría que hacer un container
|
@@ -5,7 +5,7 @@
|
|
5
5
|
mt-2 d-flex align-items-center
|
6
6
|
alert-#{flash_type_to_class(flash_type)}
|
7
7
|
#{'position-absolute pg-toast' if toast}"
|
8
|
-
data-
|
8
|
+
data-bs-autohide="true"
|
9
9
|
aria-live="assertive" aria-atomic="true" role="alert"
|
10
10
|
]
|
11
11
|
- case flash_type
|
@@ -1,2 +1,2 @@
|
|
1
|
-
<%#
|
2
|
-
<%= render partial: 'pg_layout/error' %>
|
1
|
+
<%# Para usar como respuesta con layout en controllers %>
|
2
|
+
<%= render partial: 'pg_layout/error', locals: { error_msg: @error_msg } %>
|
data/pg_rails/lib/version.rb
CHANGED
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.
|
4
|
+
version: 7.0.8.pre.alpha.76
|
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-05-
|
11
|
+
date: 2024-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -1051,6 +1051,7 @@ files:
|
|
1051
1051
|
- pg_engine/spec/features/signup_spec.rb
|
1052
1052
|
- pg_engine/spec/fixtures/test.pdf
|
1053
1053
|
- pg_engine/spec/helpers/pg_engine/pg_rails_helper_spec.rb
|
1054
|
+
- pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
|
1054
1055
|
- pg_engine/spec/lib/pg_engine/error_helper_spec.rb
|
1055
1056
|
- pg_engine/spec/lib/pg_engine/mailgun/log_sync_spec.rb
|
1056
1057
|
- pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
|
@@ -1072,10 +1073,12 @@ files:
|
|
1072
1073
|
- pg_layout/app/javascript/controllers/application.js
|
1073
1074
|
- pg_layout/app/javascript/controllers/clear_timeout_controller.js
|
1074
1075
|
- pg_layout/app/javascript/controllers/fadein_onload_controller.js
|
1076
|
+
- pg_layout/app/javascript/controllers/filtros_controller.js
|
1075
1077
|
- pg_layout/app/javascript/controllers/index.js
|
1076
1078
|
- pg_layout/app/javascript/controllers/navbar_controller.js
|
1077
1079
|
- pg_layout/app/javascript/controllers/nested_controller.js
|
1078
1080
|
- pg_layout/app/javascript/controllers/pg_form_controller.js
|
1081
|
+
- pg_layout/app/javascript/controllers/switcher_controller.js
|
1079
1082
|
- pg_layout/app/javascript/utils/cookies.js
|
1080
1083
|
- pg_layout/app/javascript/utils/utils.ts
|
1081
1084
|
- pg_layout/app/lib/navbar.rb
|