pg_rails 7.0.1 → 7.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -4
- data/pg_associable/app/assets/css/pg_associable.scss +99 -0
- data/pg_associable/app/assets/js/asociable_controller.js +59 -0
- data/pg_associable/app/assets/js/asociable_inline_controller.js +141 -0
- data/pg_associable/app/assets/js/modal_controller.js +130 -0
- data/pg_associable/app/helpers/pg_associable/form_builder_methods.rb +31 -0
- data/pg_associable/app/helpers/pg_associable/helpers.rb +19 -0
- data/pg_associable/app/inputs/pg_associable/pg_associable_inline_input.rb +39 -0
- data/pg_associable/app/inputs/pg_associable/pg_associable_input.rb +41 -0
- data/pg_associable/app/views/pg_associable/_resultados.html.slim +9 -0
- data/pg_associable/app/views/pg_associable/_resultados_inline.html.slim +12 -0
- data/pg_associable/app/views/pg_engine/base/_pg_associable_modal.html.slim +39 -0
- data/pg_associable/index.js +7 -0
- data/pg_associable/lib/pg_associable/engine.rb +12 -0
- data/pg_associable/lib/pg_associable/simple_form_initializer.rb +34 -0
- data/pg_associable/lib/pg_associable.rb +5 -0
- data/{lib/tasks/pg_rails_tasks.rake → pg_associable/lib/tasks/pg_associable_tasks.rake} +1 -2
- data/pg_engine/app/assets/stylesheets/pg_rails_b5.scss +74 -0
- data/pg_engine/app/controllers/pg_engine/base_controller.rb +365 -0
- data/pg_engine/app/controllers/pg_engine/devise_controller.rb +9 -0
- data/pg_engine/app/controllers/pg_engine/signed_in_controller.rb +7 -0
- data/{app/decorators/pg_rails → pg_engine/app/decorators/pg_engine}/base_decorator.rb +21 -23
- data/pg_engine/app/helpers/pg_engine/flash_helper.rb +26 -0
- data/pg_engine/app/helpers/pg_engine/form_helper.rb +33 -0
- data/pg_engine/app/helpers/pg_engine/index_helper.rb +42 -0
- data/{app/helpers/pg_rails → pg_engine/app/helpers/pg_engine}/postgres_helper.rb +1 -1
- data/{app/helpers/pg_rails → pg_engine/app/helpers/pg_engine}/print_helper.rb +15 -31
- data/pg_engine/app/helpers/pg_engine/route_helper.rb +41 -0
- data/pg_engine/app/inputs/pg_engine/fecha_input.rb +20 -0
- data/{app/lib/pg_rails → pg_engine/app/lib/pg_engine}/filtros_builder.rb +16 -17
- data/pg_engine/app/lib/pg_form_builder.rb +22 -0
- data/pg_engine/app/models/pg_engine/base_record.rb +63 -0
- data/{app/policies/pg_rails → pg_engine/app/policies/pg_engine}/application_policy.rb +2 -2
- data/pg_engine/app/views/pg_engine/base/download.xlsx.axlsx +14 -0
- data/pg_engine/app/views/pg_engine/base/index.html.slim +51 -0
- data/pg_engine/config/locales/es.yml +48 -0
- data/pg_engine/config/simple_form/simple_form.rb +178 -0
- data/pg_engine/config/simple_form/simple_form_bootstrap.rb +371 -0
- data/{lib/pg_rails → pg_engine/lib/pg_engine}/configuracion.rb +3 -1
- data/pg_engine/lib/pg_engine/engine.rb +53 -0
- data/{lib/pg_rails → pg_engine/lib/pg_engine}/utils/logueador.rb +8 -1
- data/pg_engine/lib/pg_engine.rb +35 -0
- data/{lib → pg_engine/lib}/tasks/auto_anotar_modelos.rake +1 -1
- data/pg_engine/lib/templates/activeadmin/audits.rb +53 -0
- data/pg_engine/lib/templates/activeadmin/users.rb +54 -0
- data/pg_layout/app/assets/stylesheets/sidebar.scss +106 -0
- data/pg_layout/app/javascript/cookies.js +23 -0
- data/pg_layout/app/javascript/navbar_controller.js +10 -0
- data/pg_layout/app/lib/navbar.rb +61 -0
- data/pg_layout/app/views/devise/confirmations/new.html.erb +20 -0
- data/pg_layout/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/pg_layout/app/views/devise/mailer/email_changed.html.erb +7 -0
- data/pg_layout/app/views/devise/mailer/password_change.html.erb +3 -0
- data/pg_layout/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/pg_layout/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/pg_layout/app/views/devise/passwords/edit.html.erb +27 -0
- data/pg_layout/app/views/devise/passwords/new.html.erb +18 -0
- data/pg_layout/app/views/devise/registrations/edit.html.erb +35 -0
- data/pg_layout/app/views/devise/registrations/new.html.erb +25 -0
- data/pg_layout/app/views/devise/sessions/new.html.erb +20 -0
- data/pg_layout/app/views/devise/shared/_error_messages.html.erb +15 -0
- data/pg_layout/app/views/devise/shared/_links.html.erb +25 -0
- data/pg_layout/app/views/devise/unlocks/new.html.erb +19 -0
- data/pg_layout/app/views/kaminari/_first_page.html.slim +3 -0
- data/pg_layout/app/views/kaminari/_gap.html.slim +2 -0
- data/pg_layout/app/views/kaminari/_last_page.html.slim +3 -0
- data/pg_layout/app/views/kaminari/_next_page.html.slim +3 -0
- data/pg_layout/app/views/kaminari/_page.html.slim +6 -0
- data/pg_layout/app/views/kaminari/_paginator.html.slim +12 -0
- data/pg_layout/app/views/kaminari/_prev_page.html.slim +3 -0
- data/pg_layout/app/views/layouts/pg_layout/devise.html.slim +24 -0
- data/pg_layout/app/views/layouts/pg_layout/layout.html.slim +30 -0
- data/pg_layout/app/views/pg_layout/_flash.html.slim +10 -0
- data/pg_layout/app/views/pg_layout/_navbar.html.erb +43 -0
- data/pg_layout/app/views/pg_layout/_sidebar.html.erb +42 -0
- data/pg_layout/index.js +35 -0
- data/pg_layout/lib/pg_layout/engine.rb +7 -0
- data/pg_layout/lib/pg_layout.rb +9 -0
- data/pg_rails/js/index.js +2 -0
- data/pg_rails/lib/pg_rails.rb +7 -0
- data/{lib/pg_rails → pg_rails/lib}/version.rb +1 -1
- data/pg_rails/scss/pg_rails.scss +3 -0
- data/pg_scaffold/lib/generators/pg_active_record/model/model_generator.rb +34 -0
- data/pg_scaffold/lib/generators/pg_active_record/model/templates/admin.rb +19 -0
- data/pg_scaffold/lib/generators/pg_active_record/model/templates/create_table_migration.rb.tt +46 -0
- data/pg_scaffold/lib/generators/pg_active_record/model/templates/migration.rb.tt +48 -0
- data/pg_scaffold/lib/generators/pg_active_record/model/templates/model.rb +47 -0
- data/pg_scaffold/lib/generators/pg_active_record/model/templates/module.rb +9 -0
- data/pg_scaffold/lib/generators/pg_decorator/USAGE +8 -0
- data/pg_scaffold/lib/generators/pg_decorator/pg_decorator_generator.rb +31 -0
- data/pg_scaffold/lib/generators/pg_decorator/templates/decorator.rb +22 -0
- data/pg_scaffold/lib/generators/pg_factory_bot/model/model_generator.rb +95 -0
- data/pg_scaffold/lib/generators/pg_factory_bot/model/templates/factories.erb +14 -0
- data/pg_scaffold/lib/generators/pg_pundit/USAGE +8 -0
- data/pg_scaffold/lib/generators/pg_pundit/pg_pundit_generator.rb +21 -0
- data/pg_scaffold/lib/generators/pg_pundit/templates/policy.rb +37 -0
- data/pg_scaffold/lib/generators/pg_rails/instalar/USAGE +8 -0
- data/pg_scaffold/lib/generators/pg_rails/instalar/instalar_generator.rb +17 -0
- data/pg_scaffold/lib/generators/pg_rails/instalar/templates/pg_rails.rb +10 -0
- data/pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb +27 -0
- data/pg_scaffold/lib/generators/pg_rspec/model/model_generator.rb +30 -0
- data/pg_scaffold/lib/generators/pg_rspec/model/templates/model_spec.rb +15 -0
- data/pg_scaffold/lib/generators/pg_rspec/scaffold/scaffold_generator.rb +43 -0
- data/pg_scaffold/lib/generators/pg_rspec/scaffold/templates/api_controller_spec.rb +167 -0
- data/pg_scaffold/lib/generators/pg_rspec/scaffold/templates/controller_spec.rb +269 -0
- data/pg_scaffold/lib/generators/pg_rspec/scaffold/templates/edit_spec.rb +34 -0
- data/pg_scaffold/lib/generators/pg_rspec/scaffold/templates/index_spec.rb +28 -0
- data/pg_scaffold/lib/generators/pg_rspec/scaffold/templates/new_spec.rb +34 -0
- data/pg_scaffold/lib/generators/pg_rspec/scaffold/templates/routing_spec.rb +50 -0
- data/pg_scaffold/lib/generators/pg_rspec/scaffold/templates/show_spec.rb +26 -0
- data/pg_scaffold/lib/generators/pg_scaffold/USAGE +8 -0
- data/pg_scaffold/lib/generators/pg_scaffold/pg_scaffold_generator.rb +87 -0
- data/pg_scaffold/lib/generators/pg_scaffold/templates/controller.rb +37 -0
- data/pg_scaffold/lib/generators/pg_slim/USAGE +8 -0
- data/pg_scaffold/lib/generators/pg_slim/pg_slim_generator.rb +31 -0
- data/pg_scaffold/lib/generators/pg_slim/templates/_form.html.slim +12 -0
- data/pg_scaffold/lib/generators/pg_slim/templates/download.xlsx.axlsx +14 -0
- data/pg_scaffold/lib/generators/pg_slim/templates/edit.html.slim +5 -0
- data/pg_scaffold/lib/generators/pg_slim/templates/index.html.slim +51 -0
- data/pg_scaffold/lib/generators/pg_slim/templates/new.html.slim +5 -0
- data/pg_scaffold/lib/generators/pg_slim/templates/partial.html.slim +1 -0
- data/pg_scaffold/lib/generators/pg_slim/templates/show.html.slim +38 -0
- data/pg_scaffold/lib/pg_scaffold/monkey_patches/mejoras_a_named_base.rb +37 -0
- data/pg_scaffold/lib/pg_scaffold/monkey_patches/mejoras_de_atributos.rb +116 -0
- data/pg_scaffold/lib/pg_scaffold/railtie.rb +16 -0
- data/pg_scaffold/lib/pg_scaffold.rb +4 -0
- metadata +134 -48
- data/Rakefile +0 -36
- data/app/assets/javascripts/pg_rails/asociacion_creable.js +0 -85
- data/app/assets/javascripts/pg_rails/best_in_place_datepicker.js +0 -58
- data/app/assets/javascripts/pg_rails/librerias.js +0 -13
- data/app/assets/javascripts/pg_rails/librerias_b3.js +0 -14
- data/app/assets/javascripts/pg_rails/validaciones.js +0 -44
- data/app/assets/javascripts/pg_rails.js +0 -318
- data/app/assets/stylesheets/pg_rails/librerias.scss +0 -5
- data/app/assets/stylesheets/pg_rails/pg_chosen.scss +0 -29
- data/app/assets/stylesheets/pg_rails/pg_rails.scss +0 -199
- data/app/assets/stylesheets/pg_rails_b3.scss +0 -10
- data/app/assets/stylesheets/pg_rails_b4.scss +0 -12
- data/app/assets/stylesheets/pg_rails_b5.scss +0 -1
- data/app/controllers/pg_rails/application_controller.rb +0 -316
- data/app/controllers/pg_rails/editar_en_lugar_controller.rb +0 -24
- data/app/helpers/pg_rails/editar_en_lugar_helper.rb +0 -106
- data/app/helpers/pg_rails/form_helper.rb +0 -25
- data/app/inputs/pg_rails/asociacion_creable_input.rb +0 -72
- data/app/inputs/pg_rails/fecha_input.rb +0 -20
- data/app/inputs/pg_rails/selects_dependientes_input.rb +0 -9
- data/app/lib/pg_form_builder.rb +0 -31
- data/app/models/pg_rails/application_record.rb +0 -51
- data/app/views/application/_abrir_modal.js.erb +0 -14
- data/app/views/application/_actualizar_smart_listing.html.slim +0 -3
- data/app/views/application/_cerrar_modal.js.erb +0 -8
- data/app/views/application/_modal_ajax_form.js.erb +0 -7
- data/config/brakeman.ignore +0 -42
- data/config/locales/es.yml +0 -17
- data/config/routes.rb +0 -3
- data/config/spring.rb +0 -1
- data/lib/pg_rails/engine.rb +0 -42
- data/lib/pg_rails/simple_form/initializer.rb +0 -583
- data/lib/pg_rails.rb +0 -23
- /data/{lib/pg_rails → pg_engine/lib/pg_engine}/core_ext.rb +0 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
ActiveAdmin.register Audited::Audit do
|
2
|
+
permit_params [:auditable_id, :auditable_type, :associated_id, :associated_type, :user_id,
|
3
|
+
:user_type, :username, :action, :audited_changes, :version, :comment,
|
4
|
+
:remote_address, :request_uuid, :created_at]
|
5
|
+
|
6
|
+
# :id
|
7
|
+
# :discarded_at, :fecha, :nombre, :tiempo, :tipo, :created_at, :updated_at, :actualizado_por_id, :creado_por_id
|
8
|
+
|
9
|
+
index do
|
10
|
+
selectable_column
|
11
|
+
id_column
|
12
|
+
column :auditable_id
|
13
|
+
column :auditable_type
|
14
|
+
# column :associated_id
|
15
|
+
# column :associated_type
|
16
|
+
column :user_id
|
17
|
+
# column :user_type
|
18
|
+
# column :username
|
19
|
+
column :action
|
20
|
+
# column :audited_changes
|
21
|
+
column :version
|
22
|
+
column :comment
|
23
|
+
column :remote_address
|
24
|
+
# column :request_uuid
|
25
|
+
column :created_at
|
26
|
+
actions
|
27
|
+
end
|
28
|
+
|
29
|
+
filter :auditable_id
|
30
|
+
filter :auditable_type
|
31
|
+
filter :associated_id
|
32
|
+
filter :associated_type
|
33
|
+
filter :user_id
|
34
|
+
filter :user_type
|
35
|
+
filter :username
|
36
|
+
filter :action
|
37
|
+
# filter :audited_changes
|
38
|
+
filter :version
|
39
|
+
filter :comment
|
40
|
+
filter :remote_address
|
41
|
+
filter :request_uuid
|
42
|
+
filter :created_at
|
43
|
+
|
44
|
+
# form do |f|
|
45
|
+
# f.inputs do
|
46
|
+
# f.input :nombre
|
47
|
+
# f.input :fecha
|
48
|
+
# f.input :tipo
|
49
|
+
# f.input :tiempo
|
50
|
+
# end
|
51
|
+
# f.actions
|
52
|
+
# end
|
53
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
ActiveAdmin.register User do
|
2
|
+
decorate_with UserDecorator
|
3
|
+
permit_params :email, :password, :password_confirmation, :confirmed_at, profiles: []
|
4
|
+
|
5
|
+
index do
|
6
|
+
selectable_column
|
7
|
+
id_column
|
8
|
+
column :email
|
9
|
+
column :current_sign_in_at
|
10
|
+
column :created_at
|
11
|
+
actions
|
12
|
+
end
|
13
|
+
filter :email
|
14
|
+
|
15
|
+
form do |f|
|
16
|
+
f.inputs do
|
17
|
+
if params[:change_password]
|
18
|
+
f.input :password
|
19
|
+
else
|
20
|
+
f.input :email
|
21
|
+
f.input :password unless f.object.persisted?
|
22
|
+
f.input :profiles, as: :select
|
23
|
+
end
|
24
|
+
end
|
25
|
+
f.actions
|
26
|
+
end
|
27
|
+
|
28
|
+
before_update(&:skip_reconfirmation!)
|
29
|
+
after_build do |user|
|
30
|
+
user.skip_confirmation! if action_name == 'create'
|
31
|
+
end
|
32
|
+
|
33
|
+
member_action :discard, method: :put do
|
34
|
+
resource.discard!
|
35
|
+
redirect_to resource_path, notice: 'Discarded!'
|
36
|
+
end
|
37
|
+
|
38
|
+
member_action :restore, method: :put do
|
39
|
+
resource.undiscard!
|
40
|
+
redirect_to resource_path, notice: 'Restored!'
|
41
|
+
end
|
42
|
+
|
43
|
+
action_item :view, only: :show do
|
44
|
+
link_to 'Discard', discard_active_admin_user_path(resource), method: :put if resource.kept?
|
45
|
+
end
|
46
|
+
|
47
|
+
action_item :view, only: :show do
|
48
|
+
link_to 'Restore', restore_active_admin_user_path(resource), method: :put if resource.discarded?
|
49
|
+
end
|
50
|
+
|
51
|
+
action_item :view, only: :show do
|
52
|
+
link_to 'Cambiar contraseña', edit_active_admin_user_path(resource, change_password: true)
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
.navbar {
|
2
|
+
--#{$prefix}navbar-toggler-border-color: #{$primary};
|
3
|
+
}
|
4
|
+
|
5
|
+
/* Style & Colors */
|
6
|
+
$text-color: $gray-300;
|
7
|
+
$text-hover-color: $gray-100;
|
8
|
+
$chevron-color: 200,200,200,.5;
|
9
|
+
|
10
|
+
.with-sidebar > :first-child {
|
11
|
+
@extend .bg-primary;
|
12
|
+
color: #{$text-color};
|
13
|
+
a {
|
14
|
+
--#{$prefix}link-color-rgb: #{$text-color};
|
15
|
+
--#{$prefix}link-hover-color-rgb: #{$text-hover-color};
|
16
|
+
}
|
17
|
+
}
|
18
|
+
.dropdown-toggle { outline: 0; }
|
19
|
+
|
20
|
+
.btn-toggle {
|
21
|
+
--#{$prefix}btn-color: #{$text-color};
|
22
|
+
--#{$prefix}btn-hover-color: #{$text-hover-color};
|
23
|
+
--#{$prefix}btn-active-color: #{$text-hover-color};
|
24
|
+
padding: .25rem .5rem;
|
25
|
+
font-weight: 600;
|
26
|
+
// color: rgba(0, 0, 0, .65);
|
27
|
+
background-color: transparent;
|
28
|
+
}
|
29
|
+
.btn-toggle:hover,
|
30
|
+
.btn-toggle:focus {
|
31
|
+
// color: rgba(0, 0, 0, .85);
|
32
|
+
// background-color: #d2f4ea;
|
33
|
+
}
|
34
|
+
|
35
|
+
.btn-toggle[aria-expanded="true"] {
|
36
|
+
// color: rgba(0, 0, 0, .85);
|
37
|
+
}
|
38
|
+
|
39
|
+
.btn-toggle-nav a {
|
40
|
+
padding: .1875rem .5rem;
|
41
|
+
margin-top: .125rem;
|
42
|
+
margin-left: 1.25rem;
|
43
|
+
}
|
44
|
+
.btn-toggle-nav a:hover,
|
45
|
+
.btn-toggle-nav a:focus {
|
46
|
+
// background-color: #d2f4ea;
|
47
|
+
}
|
48
|
+
|
49
|
+
#sidebar li a.active {
|
50
|
+
font-weight: bold;
|
51
|
+
--bs-link-color-rgb: white!important;
|
52
|
+
}
|
53
|
+
#sidebar {
|
54
|
+
&.opened {
|
55
|
+
.sidebar--small-items {
|
56
|
+
display: none;
|
57
|
+
}
|
58
|
+
.sidebar--large-items {
|
59
|
+
display: block;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
&:not(.opened) {
|
63
|
+
.sidebar--small-items {
|
64
|
+
display: block;
|
65
|
+
}
|
66
|
+
.sidebar--large-items {
|
67
|
+
display: none;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
/* Layout */
|
72
|
+
.with-sidebar {
|
73
|
+
display: flex;
|
74
|
+
flex-wrap: wrap;
|
75
|
+
gap: var(--s1);
|
76
|
+
height: 100%;
|
77
|
+
}
|
78
|
+
|
79
|
+
.with-sidebar > :first-child {
|
80
|
+
// display: none!important;
|
81
|
+
flex-basis: 0px;
|
82
|
+
transition: flex-basis 0.5s;
|
83
|
+
// flex-grow: 1;
|
84
|
+
|
85
|
+
&.opened {
|
86
|
+
// display: block!important;
|
87
|
+
flex-basis: 140px;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
.with-sidebar > :last-child {
|
92
|
+
flex-basis: 0;
|
93
|
+
flex-grow: 999;
|
94
|
+
min-inline-size: 50%;
|
95
|
+
}
|
96
|
+
|
97
|
+
.btn-toggle::before {
|
98
|
+
width: 1.25em;
|
99
|
+
line-height: 0;
|
100
|
+
content: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba%28#{$chevron-color}%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 14l6-6-6-6'/%3e%3c/svg%3e");
|
101
|
+
transition: transform .35s ease;
|
102
|
+
transform-origin: .5em 50%;
|
103
|
+
}
|
104
|
+
.btn-toggle[aria-expanded="true"]::before {
|
105
|
+
transform: rotate(90deg);
|
106
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
export default class {
|
2
|
+
setCookie (cname, cvalue, exdays) {
|
3
|
+
const d = new Date()
|
4
|
+
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000))
|
5
|
+
const expires = 'expires=' + d.toUTCString()
|
6
|
+
document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/'
|
7
|
+
}
|
8
|
+
|
9
|
+
getCookie (cname) {
|
10
|
+
const name = cname + '='
|
11
|
+
const ca = document.cookie.split(';')
|
12
|
+
for (let i = 0; i < ca.length; i++) {
|
13
|
+
let c = ca[i]
|
14
|
+
while (c.charAt(0) === ' ') {
|
15
|
+
c = c.substring(1)
|
16
|
+
}
|
17
|
+
if (c.indexOf(name) === 0) {
|
18
|
+
return c.substring(name.length, c.length)
|
19
|
+
}
|
20
|
+
}
|
21
|
+
return ''
|
22
|
+
}
|
23
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { Controller } from '@hotwired/stimulus'
|
2
|
+
import Cookies from './cookies'
|
3
|
+
|
4
|
+
export default class extends Controller {
|
5
|
+
expandNavbar (e) {
|
6
|
+
document.getElementById('sidebar').classList.toggle('opened')
|
7
|
+
const isOpened = document.getElementById('sidebar').classList.contains('opened')
|
8
|
+
new Cookies().setCookie('navbar_expand', isOpened, 30)
|
9
|
+
}
|
10
|
+
}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
class Navbar
|
2
|
+
include Rails.application.routes.url_helpers
|
3
|
+
|
4
|
+
def initialize(user)
|
5
|
+
@user = user
|
6
|
+
end
|
7
|
+
|
8
|
+
def sidebar
|
9
|
+
yaml_data = YAML.load_file("#{Rails.application.root}/config/pg_rails.yml")
|
10
|
+
sidebar = ActiveSupport::HashWithIndifferentAccess.new(yaml_data)['sidebar']
|
11
|
+
# rubocop:disable Security/Eval
|
12
|
+
sidebar.map do |item|
|
13
|
+
{
|
14
|
+
title: item['name'],
|
15
|
+
path: eval(item['path']),
|
16
|
+
show: true
|
17
|
+
}
|
18
|
+
end
|
19
|
+
# rubocop:enable Security/Eval
|
20
|
+
end
|
21
|
+
|
22
|
+
def all_children_hidden?(entry)
|
23
|
+
entry[:children].all? { |child| child[:show] == false }
|
24
|
+
end
|
25
|
+
|
26
|
+
def any_children_active?(entry, request)
|
27
|
+
entry[:children].any? { |child| active_entry?(child, request) }
|
28
|
+
true
|
29
|
+
# TODO: quitar
|
30
|
+
end
|
31
|
+
|
32
|
+
def hide_entry?(entry)
|
33
|
+
if entry[:children].present?
|
34
|
+
all_children_hidden?(entry)
|
35
|
+
else
|
36
|
+
entry[:show] == false
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def custom_current_page?(path, request)
|
41
|
+
current_route = Rails.application.routes.recognize_path(request.env['PATH_INFO'])
|
42
|
+
test_route = Rails.application.routes.recognize_path(path)
|
43
|
+
current_route[:controller] == test_route[:controller] && current_route[:action] == test_route[:action]
|
44
|
+
rescue ActionController::RoutingError
|
45
|
+
false
|
46
|
+
end
|
47
|
+
|
48
|
+
def active_entry?(entry, request)
|
49
|
+
if entry[:children].present?
|
50
|
+
any_children_active?(entry, request)
|
51
|
+
elsif entry[:path].present?
|
52
|
+
custom_current_page?(entry[:path], request)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def policy(clase)
|
59
|
+
Pundit.policy(@user, clase)
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<h2><%= t(".resend_confirmation_instructions") %></h2>
|
2
|
+
|
3
|
+
<%= pg_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
|
4
|
+
<%= f.error_notification %>
|
5
|
+
<%= f.full_error :confirmation_token %>
|
6
|
+
|
7
|
+
<div class="form-inputs">
|
8
|
+
<%= f.input :email,
|
9
|
+
required: true,
|
10
|
+
autofocus: true,
|
11
|
+
value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email),
|
12
|
+
input_html: { autocomplete: "email" } %>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="form-actions">
|
16
|
+
<%= f.button :submit, t(".resend_confirmation_instructions") %>
|
17
|
+
</div>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<%= render "devise/shared/links" %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<h2><%= t(".change_your_password") %></h2>
|
2
|
+
|
3
|
+
<%= pg_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
|
4
|
+
<%= f.error_notification %>
|
5
|
+
|
6
|
+
<%= f.input :reset_password_token, as: :hidden %>
|
7
|
+
<%= f.full_error :reset_password_token %>
|
8
|
+
|
9
|
+
<div class="form-inputs">
|
10
|
+
<%= f.input :password,
|
11
|
+
label: t(".new_password"),
|
12
|
+
required: true,
|
13
|
+
autofocus: true,
|
14
|
+
hint: (t('devise.shared.minimum_password_length', count: @minimum_password_length) if @minimum_password_length),
|
15
|
+
input_html: { autocomplete: "new-password" } %>
|
16
|
+
<%= f.input :password_confirmation,
|
17
|
+
label: t(".confirm_new_password"),
|
18
|
+
required: true,
|
19
|
+
input_html: { autocomplete: "new-password" } %>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<div class="form-actions">
|
23
|
+
<%= f.button :submit, t(".change_my_password") %>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
<%= render "devise/shared/links" %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<h2><%= t(".forgot_your_password") %></h2>
|
2
|
+
|
3
|
+
<%= pg_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
|
4
|
+
<%= f.error_notification %>
|
5
|
+
|
6
|
+
<div class="form-inputs">
|
7
|
+
<%= f.input :email,
|
8
|
+
required: true,
|
9
|
+
autofocus: true,
|
10
|
+
input_html: { autocomplete: "email" } %>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div class="form-actions">
|
14
|
+
<%= f.button :submit, t(".send_me_reset_password_instructions") %>
|
15
|
+
</div>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<%= render "devise/shared/links" %>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<h2><%= t(".title", resource: devise_i18n_fix_model_name_case(resource.model_name.human, i18n_key: "registrations.edit.title")) %></h2>
|
2
|
+
|
3
|
+
<%= pg_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
|
4
|
+
<%= f.error_notification %>
|
5
|
+
|
6
|
+
<div class="form-inputs">
|
7
|
+
<%= f.input :email, required: true, autofocus: true %>
|
8
|
+
|
9
|
+
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
10
|
+
<p><%= t(".currently_waiting_confirmation_for_email", email: resource.unconfirmed_email) %></p>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= f.input :password,
|
14
|
+
hint: t(".leave_blank_if_you_don_t_want_to_change_it"),
|
15
|
+
required: false,
|
16
|
+
input_html: { autocomplete: "new-password" } %>
|
17
|
+
<%= f.input :password_confirmation,
|
18
|
+
required: false,
|
19
|
+
input_html: { autocomplete: "new-password" } %>
|
20
|
+
<%= f.input :current_password,
|
21
|
+
hint: t(".we_need_your_current_password_to_confirm_your_changes"),
|
22
|
+
required: true,
|
23
|
+
input_html: { autocomplete: "current-password" } %>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<div class="form-actions">
|
27
|
+
<%= f.button :submit, t(".update") %>
|
28
|
+
</div>
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
<h3><%= t(".cancel_my_account") %></h3>
|
32
|
+
|
33
|
+
<div><%= t(".unhappy") %> <%= button_to t(".cancel_my_account"), registration_path(resource_name), data: { confirm: t(".are_you_sure"), turbo_confirm: t(".are_you_sure") }, method: :delete %></div>
|
34
|
+
|
35
|
+
<%= link_to t("devise.shared.links.back"), :back %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<h2><%= t(".sign_up") %></h2>
|
2
|
+
|
3
|
+
<%= pg_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
4
|
+
<%= f.error_notification %>
|
5
|
+
|
6
|
+
<div class="form-inputs">
|
7
|
+
<%= f.input :email,
|
8
|
+
required: true,
|
9
|
+
autofocus: true ,
|
10
|
+
input_html: { autocomplete: "email" }%>
|
11
|
+
<%= f.input :password,
|
12
|
+
required: true,
|
13
|
+
hint: (t('devise.shared.minimum_password_length', count: @minimum_password_length) if @minimum_password_length),
|
14
|
+
input_html: { autocomplete: "new-password" } %>
|
15
|
+
<%= f.input :password_confirmation,
|
16
|
+
required: true,
|
17
|
+
input_html: { autocomplete: "new-password" } %>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div class="form-actions">
|
21
|
+
<%= f.button :submit, t(".sign_up") %>
|
22
|
+
</div>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<%= render "devise/shared/links" %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<h2><%= t(".sign_in") %></h2>
|
2
|
+
|
3
|
+
<%= pg_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
4
|
+
<div class="form-inputs">
|
5
|
+
<%= f.input :email,
|
6
|
+
required: false,
|
7
|
+
autofocus: true,
|
8
|
+
input_html: { autocomplete: "email" } %>
|
9
|
+
<%= f.input :password,
|
10
|
+
required: false,
|
11
|
+
input_html: { autocomplete: "current-password" } %>
|
12
|
+
<%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="form-actions">
|
16
|
+
<%= f.button :submit, t(".sign_in") %>
|
17
|
+
</div>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<%= render "devise/shared/links" %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% if resource.errors.any? %>
|
2
|
+
<div id="error_explanation" data-turbo-cache="false">
|
3
|
+
<h2>
|
4
|
+
<%= I18n.t("errors.messages.not_saved",
|
5
|
+
count: resource.errors.count,
|
6
|
+
resource: devise_i18n_fix_model_name_case(resource.model_name.human, i18n_key: 'errors.messages.not_saved'))
|
7
|
+
%>
|
8
|
+
</h2>
|
9
|
+
<ul>
|
10
|
+
<% resource.errors.full_messages.each do |message| %>
|
11
|
+
<li><%= message %></li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%- if controller_name != 'sessions' %>
|
2
|
+
<%= link_to t(".sign_in"), new_session_path(resource_name) %><br />
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
6
|
+
<%= link_to t(".sign_up"), new_registration_path(resource_name) %><br />
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
10
|
+
<%= link_to t(".forgot_your_password"), new_password_path(resource_name) %><br />
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
14
|
+
<%= link_to t('.didn_t_receive_confirmation_instructions'), new_confirmation_path(resource_name) %><br />
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
18
|
+
<%= link_to t('.didn_t_receive_unlock_instructions'), new_unlock_path(resource_name) %><br />
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<%- if devise_mapping.omniauthable? %>
|
22
|
+
<%- resource_class.omniauth_providers.each do |provider| %>
|
23
|
+
<%= button_to t('.sign_in_with_provider', provider: OmniAuth::Utils.camelize(provider)), omniauth_authorize_path(resource_name, provider), data: { turbo: false } %><br />
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<h2><%= t(".resend_unlock_instructions") %></h2>
|
2
|
+
|
3
|
+
<%= pg_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
|
4
|
+
<%= f.error_notification %>
|
5
|
+
<%= f.full_error :unlock_token %>
|
6
|
+
|
7
|
+
<div class="form-inputs">
|
8
|
+
<%= f.input :email,
|
9
|
+
required: true,
|
10
|
+
autofocus: true,
|
11
|
+
input_html: { autocomplete: "email" } %>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div class="form-actions">
|
15
|
+
<%= f.button :submit, t(".resend_unlock_instructions") %>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<%= render "devise/shared/links" %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
= paginator.render do
|
2
|
+
nav
|
3
|
+
ul.pagination
|
4
|
+
== first_page_tag unless current_page.first?
|
5
|
+
== prev_page_tag unless current_page.first?
|
6
|
+
- each_page do |page|
|
7
|
+
- if page.left_outer? || page.right_outer? || page.inside_window?
|
8
|
+
== page_tag page
|
9
|
+
- elsif !page.was_truncated?
|
10
|
+
== gap_tag
|
11
|
+
== next_page_tag unless current_page.last?
|
12
|
+
== last_page_tag unless current_page.last?
|
@@ -0,0 +1,24 @@
|
|
1
|
+
doctype html
|
2
|
+
html
|
3
|
+
head
|
4
|
+
title#title PgRails
|
5
|
+
meta name="viewport" content="width=device-width,initial-scale=1"
|
6
|
+
= csrf_meta_tags
|
7
|
+
= csp_meta_tag
|
8
|
+
|
9
|
+
= stylesheet_link_tag 'application', 'data-turbo-track': 'reload'
|
10
|
+
= javascript_include_tag 'application', 'data-turbo-track': 'reload', type: 'module'
|
11
|
+
|
12
|
+
body
|
13
|
+
div
|
14
|
+
.text-center
|
15
|
+
#flash.flash.d-inline-block
|
16
|
+
= render partial: 'pg_layout/flash'
|
17
|
+
.container.text-center
|
18
|
+
= yield
|
19
|
+
= render_turbo_stream_title
|
20
|
+
css:
|
21
|
+
.pg-form {
|
22
|
+
max-width: 300px;
|
23
|
+
margin: auto;
|
24
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
doctype html
|
2
|
+
html
|
3
|
+
head
|
4
|
+
title PgRails
|
5
|
+
meta name="viewport" content="width=device-width,initial-scale=1"
|
6
|
+
= csrf_meta_tags
|
7
|
+
= csp_meta_tag
|
8
|
+
|
9
|
+
= stylesheet_link_tag 'application', 'data-turbo-track': 'reload'
|
10
|
+
= javascript_include_tag 'application', 'data-turbo-track': 'reload', type: 'module'
|
11
|
+
body
|
12
|
+
.with-sidebar
|
13
|
+
= render partial: 'pg_layout/sidebar'
|
14
|
+
div
|
15
|
+
= render partial: 'pg_layout/navbar'
|
16
|
+
div
|
17
|
+
.text-center
|
18
|
+
#flash.flash.d-inline-block
|
19
|
+
= render partial: 'pg_layout/flash'
|
20
|
+
- if user_signed_in?
|
21
|
+
.d-flex.px-3.align-items-center.justify-content-between.d-print-none
|
22
|
+
div
|
23
|
+
/ <!-- <h1 class="h3 mb-0 text-gray-800"><%= content_for(:title) %></h1> -->
|
24
|
+
nav aria-label="breadcrumb"
|
25
|
+
= render_breadcrumbs
|
26
|
+
/ = render_breadcrumbs builder: ::Bootstrap4BreadcrumbsBuilder
|
27
|
+
.btn-toolbar.py-2
|
28
|
+
= yield(:actions)
|
29
|
+
hr.my-0
|
30
|
+
= yield
|