pg_rails 7.0.7 → 7.0.8.pre.alpha.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/pg_associable/app/assets/{css → stylesheets}/pg_associable.scss +40 -41
- data/pg_associable/app/helpers/pg_associable/form_builder_methods.rb +36 -9
- data/pg_associable/app/helpers/pg_associable/helpers.rb +6 -3
- data/pg_associable/app/inputs/pg_associable_input.rb +53 -0
- data/pg_associable/app/javascript/asociable_controller.tsx +247 -0
- data/pg_associable/app/javascript/modal_controller.js +29 -0
- data/pg_associable/app/views/pg_associable/_resultados_inline.html.slim +9 -8
- data/pg_associable/app/views/pg_engine/base/_pg_associable_modal.html.slim +5 -32
- data/pg_associable/index.js +2 -4
- data/pg_associable/lib/pg_associable/engine.rb +0 -4
- data/pg_engine/app/assets/stylesheets/pg_rails_b5.scss +49 -41
- data/pg_engine/app/controllers/pg_engine/resource_helper.rb +6 -2
- data/pg_engine/app/decorators/pg_engine/base_decorator.rb +2 -2
- data/pg_engine/app/helpers/pg_engine/flash_helper.rb +2 -2
- data/pg_engine/app/helpers/pg_engine/form_helper.rb +70 -0
- data/pg_engine/app/helpers/pg_engine/route_helper.rb +14 -6
- data/pg_engine/app/views/admin/accounts/_form.html.slim +1 -1
- data/pg_engine/app/views/admin/user_accounts/_form.html.slim +3 -3
- data/pg_engine/app/views/admin/users/_form.html.slim +1 -1
- data/pg_engine/app/views/pg_engine/base/index.html.slim +3 -3
- data/pg_engine/config/initializers/active_admin.rb +1 -4
- data/pg_engine/config/simple_form/simple_form_bootstrap.rb +17 -9
- data/pg_engine/db/migrate/20240222115722_create_active_storage_tables.active_storage.rb +57 -0
- data/pg_engine/db/seeds.rb +7 -4
- data/pg_engine/lib/pg_engine/engine.rb +1 -1
- data/pg_engine/lib/pg_engine/route_helpers.rb +1 -0
- data/pg_engine/lib/pg_engine/utils/pdf_preview_generator.rb +50 -0
- data/pg_engine/lib/pg_engine.rb +3 -0
- data/pg_engine/lib/tasks/auto_anotar_modelos.rake +1 -1
- data/pg_engine/spec/fixtures/test.pdf +0 -0
- data/pg_engine/spec/pg_engine/pdf_preview_generator_spec.rb +12 -0
- data/pg_layout/app/assets/stylesheets/sidebar.scss +10 -2
- data/pg_layout/app/javascript/nested_controller.js +48 -0
- data/pg_layout/app/javascript/pg_form_controller.js +13 -0
- data/pg_layout/app/javascript/utils.ts +34 -0
- data/pg_layout/app/views/layouts/pg_layout/devise.html.slim +1 -1
- data/pg_layout/app/views/layouts/pg_layout/layout.html.slim +14 -10
- data/pg_layout/app/views/pg_layout/_flash.html.slim +2 -2
- data/pg_layout/app/views/pg_layout/_navbar.html.erb +10 -0
- data/pg_layout/app/views/pg_layout/_sidebar.html.erb +3 -3
- data/pg_layout/index.js +4 -0
- data/pg_rails/lib/version.rb +1 -1
- data/pg_rails/scss/pg_rails.scss +1 -1
- data/pg_scaffold/lib/generators/pg_slim/templates/_form.html.slim +3 -3
- metadata +15 -13
- data/pg_associable/app/assets/js/asociable_controller.js +0 -58
- data/pg_associable/app/assets/js/asociable_inline_controller.js +0 -142
- data/pg_associable/app/assets/js/modal_controller.js +0 -117
- data/pg_associable/app/inputs/pg_associable/pg_associable_inline_input.rb +0 -39
- data/pg_associable/app/inputs/pg_associable/pg_associable_input.rb +0 -41
- data/pg_associable/app/views/pg_associable/_resultados.html.slim +0 -9
- data/pg_associable/lib/pg_associable/simple_form_initializer.rb +0 -34
- data/pg_associable/lib/tasks/pg_associable_tasks.rake +0 -4
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module PgAssociable
|
4
|
-
class PgAssociableInput < SimpleForm::Inputs::StringInput
|
5
|
-
include ActionView::Helpers::FormTagHelper
|
6
|
-
|
7
|
-
def hidden_input(wrapper_options = {})
|
8
|
-
merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
|
9
|
-
# merged_input_options = merge_wrapper_options(merged_input_options, { class: 'oculto' })
|
10
|
-
@builder.hidden_field(attribute_name, merged_input_options)
|
11
|
-
end
|
12
|
-
|
13
|
-
def input(wrapper_options = nil)
|
14
|
-
unless string?
|
15
|
-
input_html_classes.unshift('string')
|
16
|
-
# input_html_options[:type] ||= input_type if html5?
|
17
|
-
end
|
18
|
-
input_html_options[:type] = 'text'
|
19
|
-
|
20
|
-
merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
|
21
|
-
merged_input_options = merge_wrapper_options(merged_input_options, { class: 'keep-disabled' })
|
22
|
-
|
23
|
-
text_field_tag(nil, object.send(reflection.name).to_s, merged_input_options)
|
24
|
-
end
|
25
|
-
|
26
|
-
def modal_link(_wrapper_options = nil)
|
27
|
-
"<a href=\"#{options[:url_modal]}\" class=\"modal-link d-inline-block\" data-turbo-stream style=\"position:absolute; left:0; right:0; top:0; bottom:0;\"></a>".html_safe
|
28
|
-
end
|
29
|
-
|
30
|
-
def limpiar(_wrapper_options = nil)
|
31
|
-
content_tag('a', href: 'javascript:void(0)', class: 'limpiar', title: 'Limpiar', tabindex: '0',
|
32
|
-
data: { action: 'asociable#selectItem' }) do
|
33
|
-
'<i class="bi bi-x-lg"></i>'.html_safe
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def pencil(_wrapper_options = nil)
|
38
|
-
'<i tabindex="-1" class="bi bi-pencil pencil"></i>'.html_safe
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
.resultados tabindex="-1"
|
2
|
-
- if collection.any?
|
3
|
-
.list-group.list-group-flush
|
4
|
-
- collection.each do |object|
|
5
|
-
= link_to object.to_s, 'javascript:void(0)',
|
6
|
-
class: 'list-group-item', data: { action: 'modal#selectItem', id: object.id }
|
7
|
-
- else
|
8
|
-
ul.list-group.list-group-flush
|
9
|
-
li.list-group-item No hay resultados para "#{params[:query]}"
|
@@ -1,34 +0,0 @@
|
|
1
|
-
SimpleForm.setup do |config|
|
2
|
-
config.wrappers :pg_associable, tag: 'div', class: 'pg_associable mb-3', html: { data: { controller: 'asociable', 'asociable-modal-outlet': '.modal' } },
|
3
|
-
error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
|
4
|
-
b.use :html5
|
5
|
-
b.optional :readonly
|
6
|
-
b.use :label, class: 'form-label'
|
7
|
-
b.use :hidden_input
|
8
|
-
b.wrapper tag: 'div', class: 'position-relative' do |ba|
|
9
|
-
ba.use :input, class: 'form-control', disabled: true, placeholder: 'Clic para seleccionar...',
|
10
|
-
error_class: 'is-invalid'
|
11
|
-
ba.use :pencil
|
12
|
-
ba.use :modal_link
|
13
|
-
ba.use :limpiar
|
14
|
-
end
|
15
|
-
b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
|
16
|
-
b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
|
17
|
-
end
|
18
|
-
|
19
|
-
config.wrappers :pg_associable_inline, tag: 'div', class: 'pg_associable_inline mb-3', html: { data: { controller: 'asociable_inline' } },
|
20
|
-
error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
|
21
|
-
b.use :html5
|
22
|
-
b.optional :readonly
|
23
|
-
b.use :label, class: 'form-label'
|
24
|
-
b.use :hidden_input
|
25
|
-
b.wrapper tag: 'div', class: 'search-box position-relative' do |ba|
|
26
|
-
ba.use :search_form, error_class: 'is-invalid'
|
27
|
-
ba.use :limpiar
|
28
|
-
ba.use :pencil
|
29
|
-
# ba.use :input, class: 'form-control', placeholder: 'Buscar...'
|
30
|
-
end
|
31
|
-
b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
|
32
|
-
b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
|
33
|
-
end
|
34
|
-
end
|