pg_rails 7.0.5 → 7.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/pg_associable/lib/pg_associable/simple_form_initializer.rb +2 -2
- data/pg_engine/app/controllers/pg_engine/resource_helper.rb +9 -5
- data/pg_engine/app/decorators/pg_engine/base_decorator.rb +14 -12
- data/pg_engine/lib/pg_engine/core_ext.rb +14 -14
- data/pg_engine/lib/pg_engine/route_helpers.rb +2 -2
- data/pg_engine/lib/tasks/auto_anotar_modelos.rake +2 -2
- data/pg_rails/lib/version.rb +1 -1
- data/pg_scaffold/lib/generators/pg_slim/templates/show.html.slim +4 -4
- data/pg_scaffold/lib/pg_scaffold/monkey_patches/mejoras_de_atributos.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c4644fc0bcd9abce95b7cd8ac88f7779b7d8e6096590863d11fd1bbad1f1b7b
|
4
|
+
data.tar.gz: df1ffd480c688adc40f24613b9d00eb57fe45940067191a942bd18e9d53e1209
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9afa947ca3962f7e81973a798664900bccdc15ab6dd500c5b8573f5177212585cf35e78194c1219b6137f6dd3198d4e23ffd982702fdc2cac3cbf8ae1f2c8df
|
7
|
+
data.tar.gz: 4f26bb070447c9c07829628a2d99a7a8a0ec9a7ac8298ab2f4118444316cffa775ff3254577488d2c139d637468c995bc97c5b9d4adf561f17529cfe398d89c5
|
@@ -3,7 +3,7 @@ SimpleForm.setup do |config|
|
|
3
3
|
error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
|
4
4
|
b.use :html5
|
5
5
|
b.optional :readonly
|
6
|
-
b.use :label, class: 'form-
|
6
|
+
b.use :label, class: 'form-label'
|
7
7
|
b.use :hidden_input
|
8
8
|
b.wrapper tag: 'div', class: 'position-relative' do |ba|
|
9
9
|
ba.use :input, class: 'form-control', disabled: true, placeholder: 'Clic para seleccionar...',
|
@@ -20,7 +20,7 @@ SimpleForm.setup do |config|
|
|
20
20
|
error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
|
21
21
|
b.use :html5
|
22
22
|
b.optional :readonly
|
23
|
-
b.use :label, class: 'form-
|
23
|
+
b.use :label, class: 'form-label'
|
24
24
|
b.use :hidden_input
|
25
25
|
b.wrapper tag: 'div', class: 'search-box position-relative' do |ba|
|
26
26
|
ba.use :search_form, error_class: 'is-invalid'
|
@@ -30,7 +30,7 @@ module PgEngine
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def new
|
33
|
-
add_breadcrumb
|
33
|
+
add_breadcrumb 'Crear'
|
34
34
|
end
|
35
35
|
|
36
36
|
def edit
|
@@ -71,21 +71,23 @@ module PgEngine
|
|
71
71
|
session[:page_size].present? ? session[:page_size].to_i : 10
|
72
72
|
end
|
73
73
|
|
74
|
-
def pg_respond_update
|
75
|
-
object
|
74
|
+
def pg_respond_update
|
75
|
+
object = instancia_modelo
|
76
76
|
respond_to do |format|
|
77
77
|
if (@saved = object.save)
|
78
78
|
format.html { redirect_to object.decorate.target_object }
|
79
79
|
format.json { render json: object.decorate }
|
80
80
|
else
|
81
|
+
# TODO: esto solucionaría el problema?
|
82
|
+
# self.instancia_modelo = instancia_modelo.decorate
|
81
83
|
format.html { render :edit, status: :unprocessable_entity }
|
82
84
|
format.json { render json: object.errors, status: :unprocessable_entity }
|
83
85
|
end
|
84
86
|
end
|
85
87
|
end
|
86
88
|
|
87
|
-
def pg_respond_create
|
88
|
-
object
|
89
|
+
def pg_respond_create
|
90
|
+
object = instancia_modelo
|
89
91
|
respond_to do |format|
|
90
92
|
if (@saved = object.save)
|
91
93
|
if params[:asociable]
|
@@ -107,6 +109,8 @@ module PgEngine
|
|
107
109
|
end
|
108
110
|
format.json { render json: object.decorate }
|
109
111
|
else
|
112
|
+
# TODO: esto solucionaría el problema?
|
113
|
+
# self.instancia_modelo = instancia_modelo.decorate
|
110
114
|
if params[:asociable]
|
111
115
|
format.turbo_stream do
|
112
116
|
render turbo_stream:
|
@@ -16,18 +16,20 @@ module PgEngine
|
|
16
16
|
object.as_json.tap { |o| o[:to_s] = to_s }
|
17
17
|
end
|
18
18
|
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
19
|
+
# rubocop:disable Style/MissingRespondToMissing
|
20
|
+
def method_missing(method_name, *args, &)
|
21
|
+
valor = object.attributes[method_name.to_s]
|
22
|
+
return super if valor.blank?
|
23
|
+
|
24
|
+
if valor.instance_of?(Date)
|
25
|
+
dmy(valor)
|
26
|
+
elsif valor.instance_of?(ActiveSupport::TimeWithZone)
|
27
|
+
dmy_time(valor)
|
28
|
+
else
|
29
|
+
super
|
30
|
+
end
|
31
|
+
end
|
32
|
+
# rubocop:enable Style/MissingRespondToMissing
|
31
33
|
|
32
34
|
def destroy_link(message = '¿Estás seguro?')
|
33
35
|
return unless Pundit.policy!(helpers.send(PgEngine.configuracion.current_user_method), object).destroy?
|
@@ -1,17 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# require 'activesupport/time'
|
4
|
-
module ActiveSupport
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
4
|
+
# module ActiveSupport
|
5
|
+
# class TimeWithZone
|
6
|
+
# def to_s(format = :default)
|
7
|
+
# if format == :db
|
8
|
+
# utc.to_s(format)
|
9
|
+
# elsif formatter = ::Time::DATE_FORMATS[format]
|
10
|
+
# formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
|
11
|
+
# else
|
12
|
+
# # "#{time.strftime("%Y-%m-%d %H:%M:%S")} #{formatted_offset(false, 'UTC')}" # mimicking Ruby Time#to_s format
|
13
|
+
# time.strftime('%d/%m/%Y %H:%M')
|
14
|
+
# end
|
15
|
+
# end
|
16
|
+
# end
|
17
|
+
# end
|
@@ -27,7 +27,7 @@ if Rails.env.development?
|
|
27
27
|
'require' => '',
|
28
28
|
'exclude_tests' => 'true',
|
29
29
|
'exclude_fixtures' => 'true',
|
30
|
-
'exclude_factories' => '
|
30
|
+
'exclude_factories' => 'false',
|
31
31
|
'exclude_serializers' => 'true',
|
32
32
|
'exclude_scaffolds' => 'true',
|
33
33
|
'exclude_controllers' => 'true',
|
@@ -35,7 +35,7 @@ if Rails.env.development?
|
|
35
35
|
'exclude_sti_subclasses' => 'false',
|
36
36
|
'ignore_model_sub_dir' => 'false',
|
37
37
|
'ignore_columns' => nil,
|
38
|
-
'ignore_routes' =>
|
38
|
+
'ignore_routes' => 'rails|active_admin',
|
39
39
|
'ignore_unknown_models' => 'false',
|
40
40
|
# 'hide_limit_column_types' => '<%= AnnotateModels::NO_LIMIT_COL_TYPES.join(",") %>',
|
41
41
|
# 'hide_default_column_types' => '<%= AnnotateModels::NO_DEFAULT_COL_TYPES.join(",") %>',
|
data/pg_rails/lib/version.rb
CHANGED
@@ -17,7 +17,7 @@ table.table.table-borderless.table-sm.w-auto.mb-0.m-3
|
|
17
17
|
<%- end -%>
|
18
18
|
tr
|
19
19
|
th = t('attributes.created_at')
|
20
|
-
td =
|
20
|
+
td = @<%= singular_name %>.created_at
|
21
21
|
<%- if options[:trackeo_de_usuarios] -%>
|
22
22
|
tr
|
23
23
|
th = t('attributes.actualizado_por')
|
@@ -25,14 +25,14 @@ table.table.table-borderless.table-sm.w-auto.mb-0.m-3
|
|
25
25
|
<%- end -%>
|
26
26
|
tr
|
27
27
|
th = t('attributes.updated_at')
|
28
|
-
td =
|
28
|
+
td = @<%= singular_name %>.updated_at
|
29
29
|
<%- if options[:paranoia] -%>
|
30
30
|
tr
|
31
31
|
th = t('attributes.deleted_at')
|
32
|
-
td =
|
32
|
+
td = @<%= singular_name %>.deleted_at
|
33
33
|
<%- end -%>
|
34
34
|
<%- if options[:discard] -%>
|
35
35
|
tr
|
36
36
|
th = t('attributes.discarded_at')
|
37
|
-
td =
|
37
|
+
td = @<%= singular_name %>.discarded_at
|
38
38
|
<%- end -%>
|
@@ -12,9 +12,9 @@ module Rails
|
|
12
12
|
|
13
13
|
def parse_type_and_options(type)
|
14
14
|
case type
|
15
|
-
when /(string|text|binary|integer)\{(\d+)\}/
|
15
|
+
when /(string|text|binary|integer|decimal)\{(\d+)\}/
|
16
16
|
[Regexp.last_match(1), { limit: Regexp.last_match(2).to_i }]
|
17
|
-
when /(string|text|binary|float|integer|date|datetime)\{(.+)\}/
|
17
|
+
when /(string|text|binary|float|integer|date|datetime|boolean|json|decimal)\{(.+)\}/
|
18
18
|
type = Regexp.last_match(1)
|
19
19
|
provided_options = Regexp.last_match(2).split(/[,.-]/)
|
20
20
|
options = provided_options.to_h { |opt| [opt.to_sym, true] }
|