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.
Files changed (162) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -4
  3. data/pg_associable/app/assets/css/pg_associable.scss +99 -0
  4. data/pg_associable/app/assets/js/asociable_controller.js +59 -0
  5. data/pg_associable/app/assets/js/asociable_inline_controller.js +141 -0
  6. data/pg_associable/app/assets/js/modal_controller.js +130 -0
  7. data/pg_associable/app/helpers/pg_associable/form_builder_methods.rb +31 -0
  8. data/pg_associable/app/helpers/pg_associable/helpers.rb +19 -0
  9. data/pg_associable/app/inputs/pg_associable/pg_associable_inline_input.rb +39 -0
  10. data/pg_associable/app/inputs/pg_associable/pg_associable_input.rb +41 -0
  11. data/pg_associable/app/views/pg_associable/_resultados.html.slim +9 -0
  12. data/pg_associable/app/views/pg_associable/_resultados_inline.html.slim +12 -0
  13. data/pg_associable/app/views/pg_engine/base/_pg_associable_modal.html.slim +39 -0
  14. data/pg_associable/index.js +7 -0
  15. data/pg_associable/lib/pg_associable/engine.rb +12 -0
  16. data/pg_associable/lib/pg_associable/simple_form_initializer.rb +34 -0
  17. data/pg_associable/lib/pg_associable.rb +5 -0
  18. data/{lib/tasks/pg_rails_tasks.rake → pg_associable/lib/tasks/pg_associable_tasks.rake} +1 -2
  19. data/pg_engine/app/assets/stylesheets/pg_rails_b5.scss +74 -0
  20. data/pg_engine/app/controllers/pg_engine/base_controller.rb +365 -0
  21. data/pg_engine/app/controllers/pg_engine/devise_controller.rb +9 -0
  22. data/pg_engine/app/controllers/pg_engine/signed_in_controller.rb +7 -0
  23. data/{app/decorators/pg_rails → pg_engine/app/decorators/pg_engine}/base_decorator.rb +21 -23
  24. data/pg_engine/app/helpers/pg_engine/flash_helper.rb +26 -0
  25. data/pg_engine/app/helpers/pg_engine/form_helper.rb +33 -0
  26. data/pg_engine/app/helpers/pg_engine/index_helper.rb +42 -0
  27. data/{app/helpers/pg_rails → pg_engine/app/helpers/pg_engine}/postgres_helper.rb +1 -1
  28. data/{app/helpers/pg_rails → pg_engine/app/helpers/pg_engine}/print_helper.rb +15 -31
  29. data/pg_engine/app/helpers/pg_engine/route_helper.rb +41 -0
  30. data/pg_engine/app/inputs/pg_engine/fecha_input.rb +20 -0
  31. data/{app/lib/pg_rails → pg_engine/app/lib/pg_engine}/filtros_builder.rb +16 -17
  32. data/pg_engine/app/lib/pg_form_builder.rb +22 -0
  33. data/pg_engine/app/models/pg_engine/base_record.rb +63 -0
  34. data/{app/policies/pg_rails → pg_engine/app/policies/pg_engine}/application_policy.rb +2 -2
  35. data/pg_engine/app/views/pg_engine/base/download.xlsx.axlsx +14 -0
  36. data/pg_engine/app/views/pg_engine/base/index.html.slim +51 -0
  37. data/pg_engine/config/locales/es.yml +48 -0
  38. data/pg_engine/config/simple_form/simple_form.rb +178 -0
  39. data/pg_engine/config/simple_form/simple_form_bootstrap.rb +371 -0
  40. data/{lib/pg_rails → pg_engine/lib/pg_engine}/configuracion.rb +3 -1
  41. data/pg_engine/lib/pg_engine/engine.rb +53 -0
  42. data/{lib/pg_rails → pg_engine/lib/pg_engine}/utils/logueador.rb +8 -1
  43. data/pg_engine/lib/pg_engine.rb +35 -0
  44. data/{lib → pg_engine/lib}/tasks/auto_anotar_modelos.rake +1 -1
  45. data/pg_engine/lib/templates/activeadmin/audits.rb +53 -0
  46. data/pg_engine/lib/templates/activeadmin/users.rb +54 -0
  47. data/pg_layout/app/assets/stylesheets/sidebar.scss +106 -0
  48. data/pg_layout/app/javascript/cookies.js +23 -0
  49. data/pg_layout/app/javascript/navbar_controller.js +10 -0
  50. data/pg_layout/app/lib/navbar.rb +61 -0
  51. data/pg_layout/app/views/devise/confirmations/new.html.erb +20 -0
  52. data/pg_layout/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  53. data/pg_layout/app/views/devise/mailer/email_changed.html.erb +7 -0
  54. data/pg_layout/app/views/devise/mailer/password_change.html.erb +3 -0
  55. data/pg_layout/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  56. data/pg_layout/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  57. data/pg_layout/app/views/devise/passwords/edit.html.erb +27 -0
  58. data/pg_layout/app/views/devise/passwords/new.html.erb +18 -0
  59. data/pg_layout/app/views/devise/registrations/edit.html.erb +35 -0
  60. data/pg_layout/app/views/devise/registrations/new.html.erb +25 -0
  61. data/pg_layout/app/views/devise/sessions/new.html.erb +20 -0
  62. data/pg_layout/app/views/devise/shared/_error_messages.html.erb +15 -0
  63. data/pg_layout/app/views/devise/shared/_links.html.erb +25 -0
  64. data/pg_layout/app/views/devise/unlocks/new.html.erb +19 -0
  65. data/pg_layout/app/views/kaminari/_first_page.html.slim +3 -0
  66. data/pg_layout/app/views/kaminari/_gap.html.slim +2 -0
  67. data/pg_layout/app/views/kaminari/_last_page.html.slim +3 -0
  68. data/pg_layout/app/views/kaminari/_next_page.html.slim +3 -0
  69. data/pg_layout/app/views/kaminari/_page.html.slim +6 -0
  70. data/pg_layout/app/views/kaminari/_paginator.html.slim +12 -0
  71. data/pg_layout/app/views/kaminari/_prev_page.html.slim +3 -0
  72. data/pg_layout/app/views/layouts/pg_layout/devise.html.slim +24 -0
  73. data/pg_layout/app/views/layouts/pg_layout/layout.html.slim +30 -0
  74. data/pg_layout/app/views/pg_layout/_flash.html.slim +10 -0
  75. data/pg_layout/app/views/pg_layout/_navbar.html.erb +43 -0
  76. data/pg_layout/app/views/pg_layout/_sidebar.html.erb +42 -0
  77. data/pg_layout/index.js +35 -0
  78. data/pg_layout/lib/pg_layout/engine.rb +7 -0
  79. data/pg_layout/lib/pg_layout.rb +9 -0
  80. data/pg_rails/js/index.js +2 -0
  81. data/pg_rails/lib/pg_rails.rb +7 -0
  82. data/{lib/pg_rails → pg_rails/lib}/version.rb +1 -1
  83. data/pg_rails/scss/pg_rails.scss +3 -0
  84. data/pg_scaffold/lib/generators/pg_active_record/model/model_generator.rb +34 -0
  85. data/pg_scaffold/lib/generators/pg_active_record/model/templates/admin.rb +19 -0
  86. data/pg_scaffold/lib/generators/pg_active_record/model/templates/create_table_migration.rb.tt +46 -0
  87. data/pg_scaffold/lib/generators/pg_active_record/model/templates/migration.rb.tt +48 -0
  88. data/pg_scaffold/lib/generators/pg_active_record/model/templates/model.rb +47 -0
  89. data/pg_scaffold/lib/generators/pg_active_record/model/templates/module.rb +9 -0
  90. data/pg_scaffold/lib/generators/pg_decorator/USAGE +8 -0
  91. data/pg_scaffold/lib/generators/pg_decorator/pg_decorator_generator.rb +31 -0
  92. data/pg_scaffold/lib/generators/pg_decorator/templates/decorator.rb +22 -0
  93. data/pg_scaffold/lib/generators/pg_factory_bot/model/model_generator.rb +95 -0
  94. data/pg_scaffold/lib/generators/pg_factory_bot/model/templates/factories.erb +14 -0
  95. data/pg_scaffold/lib/generators/pg_pundit/USAGE +8 -0
  96. data/pg_scaffold/lib/generators/pg_pundit/pg_pundit_generator.rb +21 -0
  97. data/pg_scaffold/lib/generators/pg_pundit/templates/policy.rb +37 -0
  98. data/pg_scaffold/lib/generators/pg_rails/instalar/USAGE +8 -0
  99. data/pg_scaffold/lib/generators/pg_rails/instalar/instalar_generator.rb +17 -0
  100. data/pg_scaffold/lib/generators/pg_rails/instalar/templates/pg_rails.rb +10 -0
  101. data/pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb +27 -0
  102. data/pg_scaffold/lib/generators/pg_rspec/model/model_generator.rb +30 -0
  103. data/pg_scaffold/lib/generators/pg_rspec/model/templates/model_spec.rb +15 -0
  104. data/pg_scaffold/lib/generators/pg_rspec/scaffold/scaffold_generator.rb +43 -0
  105. data/pg_scaffold/lib/generators/pg_rspec/scaffold/templates/api_controller_spec.rb +167 -0
  106. data/pg_scaffold/lib/generators/pg_rspec/scaffold/templates/controller_spec.rb +269 -0
  107. data/pg_scaffold/lib/generators/pg_rspec/scaffold/templates/edit_spec.rb +34 -0
  108. data/pg_scaffold/lib/generators/pg_rspec/scaffold/templates/index_spec.rb +28 -0
  109. data/pg_scaffold/lib/generators/pg_rspec/scaffold/templates/new_spec.rb +34 -0
  110. data/pg_scaffold/lib/generators/pg_rspec/scaffold/templates/routing_spec.rb +50 -0
  111. data/pg_scaffold/lib/generators/pg_rspec/scaffold/templates/show_spec.rb +26 -0
  112. data/pg_scaffold/lib/generators/pg_scaffold/USAGE +8 -0
  113. data/pg_scaffold/lib/generators/pg_scaffold/pg_scaffold_generator.rb +87 -0
  114. data/pg_scaffold/lib/generators/pg_scaffold/templates/controller.rb +37 -0
  115. data/pg_scaffold/lib/generators/pg_slim/USAGE +8 -0
  116. data/pg_scaffold/lib/generators/pg_slim/pg_slim_generator.rb +31 -0
  117. data/pg_scaffold/lib/generators/pg_slim/templates/_form.html.slim +12 -0
  118. data/pg_scaffold/lib/generators/pg_slim/templates/download.xlsx.axlsx +14 -0
  119. data/pg_scaffold/lib/generators/pg_slim/templates/edit.html.slim +5 -0
  120. data/pg_scaffold/lib/generators/pg_slim/templates/index.html.slim +51 -0
  121. data/pg_scaffold/lib/generators/pg_slim/templates/new.html.slim +5 -0
  122. data/pg_scaffold/lib/generators/pg_slim/templates/partial.html.slim +1 -0
  123. data/pg_scaffold/lib/generators/pg_slim/templates/show.html.slim +38 -0
  124. data/pg_scaffold/lib/pg_scaffold/monkey_patches/mejoras_a_named_base.rb +37 -0
  125. data/pg_scaffold/lib/pg_scaffold/monkey_patches/mejoras_de_atributos.rb +116 -0
  126. data/pg_scaffold/lib/pg_scaffold/railtie.rb +16 -0
  127. data/pg_scaffold/lib/pg_scaffold.rb +4 -0
  128. metadata +134 -48
  129. data/Rakefile +0 -36
  130. data/app/assets/javascripts/pg_rails/asociacion_creable.js +0 -85
  131. data/app/assets/javascripts/pg_rails/best_in_place_datepicker.js +0 -58
  132. data/app/assets/javascripts/pg_rails/librerias.js +0 -13
  133. data/app/assets/javascripts/pg_rails/librerias_b3.js +0 -14
  134. data/app/assets/javascripts/pg_rails/validaciones.js +0 -44
  135. data/app/assets/javascripts/pg_rails.js +0 -318
  136. data/app/assets/stylesheets/pg_rails/librerias.scss +0 -5
  137. data/app/assets/stylesheets/pg_rails/pg_chosen.scss +0 -29
  138. data/app/assets/stylesheets/pg_rails/pg_rails.scss +0 -199
  139. data/app/assets/stylesheets/pg_rails_b3.scss +0 -10
  140. data/app/assets/stylesheets/pg_rails_b4.scss +0 -12
  141. data/app/assets/stylesheets/pg_rails_b5.scss +0 -1
  142. data/app/controllers/pg_rails/application_controller.rb +0 -316
  143. data/app/controllers/pg_rails/editar_en_lugar_controller.rb +0 -24
  144. data/app/helpers/pg_rails/editar_en_lugar_helper.rb +0 -106
  145. data/app/helpers/pg_rails/form_helper.rb +0 -25
  146. data/app/inputs/pg_rails/asociacion_creable_input.rb +0 -72
  147. data/app/inputs/pg_rails/fecha_input.rb +0 -20
  148. data/app/inputs/pg_rails/selects_dependientes_input.rb +0 -9
  149. data/app/lib/pg_form_builder.rb +0 -31
  150. data/app/models/pg_rails/application_record.rb +0 -51
  151. data/app/views/application/_abrir_modal.js.erb +0 -14
  152. data/app/views/application/_actualizar_smart_listing.html.slim +0 -3
  153. data/app/views/application/_cerrar_modal.js.erb +0 -8
  154. data/app/views/application/_modal_ajax_form.js.erb +0 -7
  155. data/config/brakeman.ignore +0 -42
  156. data/config/locales/es.yml +0 -17
  157. data/config/routes.rb +0 -3
  158. data/config/spring.rb +0 -1
  159. data/lib/pg_rails/engine.rb +0 -42
  160. data/lib/pg_rails/simple_form/initializer.rb +0 -583
  161. data/lib/pg_rails.rb +0 -23
  162. /data/{lib/pg_rails → pg_engine/lib/pg_engine}/core_ext.rb +0 -0
@@ -1,583 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Please do not make direct changes to this file!
4
- # This generator is maintained by the community around simple_form-bootstrap:
5
- # https://github.com/rafaelfranca/simple_form-bootstrap
6
- # All future development, tests, and organization should happen there.
7
- # Background history: https://github.com/plataformatec/simple_form/issues/1561
8
-
9
- # Uncomment this and change the path if necessary to include your own
10
- # components.
11
- # See https://github.com/plataformatec/simple_form#custom-components
12
- # to know more about custom components.
13
- # Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
14
-
15
- require 'simple_form'
16
- require "#{__dir__}/../../../app/inputs/pg_rails/fecha_input"
17
-
18
- module SimpleForm
19
- class FormBuilder < ActionView::Helpers::FormBuilder
20
- map_type :date, to: PgRails::FechaInput
21
-
22
- def submit_button(*args, &block)
23
- options = args.extract_options!.dup
24
- options[:class] = ['btn-primary', options[:class]].compact
25
- args << options
26
- send(:submit, *args, &block)
27
- end
28
- end
29
- end
30
-
31
- # Use this setup block to configure all options available in SimpleForm.
32
- SimpleForm.setup do |config|
33
- # Default class for buttons
34
- config.button_class = 'btn'
35
-
36
- # Define the default class of the input wrapper of the boolean input.
37
- config.boolean_label_class = 'form-check-label'
38
-
39
- # How the label text should be generated altogether with the required text.
40
- config.label_text = ->(label, required, _explicit_label) { "#{label} #{required}" }
41
-
42
- # Define the way to render check boxes / radio buttons with labels.
43
- config.boolean_style = :inline
44
-
45
- # You can wrap each item in a collection of radio/check boxes with a tag
46
- config.item_wrapper_tag = :div
47
-
48
- # Defines if the default input wrapper class should be included in radio
49
- # collection wrappers.
50
- config.include_default_input_wrapper_class = false
51
-
52
- # CSS class to add for error notification helper.
53
- config.error_notification_class = 'alert alert-danger'
54
-
55
- # Method used to tidy up errors. Specify any Rails Array method.
56
- # :first lists the first message for each field.
57
- # :to_sentence to list all errors for each field.
58
- config.error_method = :to_sentence
59
-
60
- # add validation classes to `input_field`
61
- config.input_field_error_class = 'is-invalid'
62
- config.input_field_valid_class = 'is-valid'
63
-
64
- # vertical forms
65
- #
66
- # vertical default_wrapper
67
- config.wrappers :vertical_form, tag: 'div', class: 'form-group',
68
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
69
- b.use :html5
70
- b.use :placeholder
71
- b.optional :maxlength
72
- b.optional :minlength
73
- b.optional :pattern
74
- b.optional :min_max
75
- b.optional :readonly
76
- b.use :label, class: 'form-control-label'
77
- b.use :input, class: 'form-control'
78
- # b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
79
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
80
- end
81
-
82
- # vertical input for boolean
83
- config.wrappers :vertical_boolean, tag: 'fieldset', class: 'form-group' do |b|
84
- b.use :html5
85
- b.optional :readonly
86
- b.wrapper :form_check_wrapper, tag: 'div', class: 'form-check' do |bb|
87
- bb.use :input, class: 'form-check-input'
88
- bb.use :label, class: 'form-check-label'
89
- bb.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
90
- bb.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
91
- end
92
- end
93
-
94
- # vertical input for radio buttons and check boxes
95
- config.wrappers :vertical_collection, item_wrapper_class: 'form-check', tag: 'fieldset',
96
- class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
97
- b.use :html5
98
- b.optional :readonly
99
- b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba|
100
- ba.use :label_text
101
- end
102
- b.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
103
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
104
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
105
- end
106
-
107
- # vertical input for inline radio buttons and check boxes
108
- config.wrappers :vertical_collection_inline, item_wrapper_class: 'form-check form-check-inline',
109
- tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
110
- b.use :html5
111
- b.optional :readonly
112
- b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba|
113
- ba.use :label_text
114
- end
115
- b.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
116
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
117
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
118
- end
119
-
120
- # vertical file input
121
- config.wrappers :vertical_file, tag: 'div', class: 'form-group',
122
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
123
- b.use :html5
124
- b.use :placeholder
125
- b.optional :maxlength
126
- b.optional :minlength
127
- b.optional :readonly
128
- b.use :label
129
- b.use :input, class: 'form-control-file', error_class: 'is-invalid', valid_class: 'is-valid'
130
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
131
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
132
- end
133
-
134
- # vertical multi select
135
- config.wrappers :vertical_multi_select, tag: 'div', class: 'form-group',
136
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
137
- b.use :html5
138
- b.optional :readonly
139
- b.use :label, class: 'form-control-label'
140
- b.wrapper tag: 'div',
141
- class: 'd-flex flex-row justify-content-between align-items-center' do |ba|
142
- ba.use :input, class: 'form-control mx-1', error_class: 'is-invalid', valid_class: 'is-valid'
143
- end
144
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
145
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
146
- end
147
- # vertical multi select
148
- config.wrappers :chosen_select, tag: 'div', class: 'form-group',
149
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
150
- b.use :html5
151
- b.optional :readonly
152
- b.use :label, class: 'form-control-label'
153
- b.wrapper tag: 'div',
154
- class: 'd-flex flex-row justify-content-between align-items-center' do |ba|
155
- ba.use :input, class: 'form-control chosen-select mx-1', error_class: 'is-invalid',
156
- valid_class: 'is-valid'
157
- end
158
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
159
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
160
- end
161
-
162
- # vertical multi select
163
- config.wrappers :select_7, tag: 'div', class: 'form-group',
164
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
165
- b.use :html5
166
- b.optional :readonly
167
- b.use :label, class: 'form-control-label'
168
- b.use :input, class: 'form-select'
169
- # b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
170
- # b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
171
- end
172
-
173
- if PgRails.config.bootstrap_version >= 4
174
- config.wrappers :asociacion_creable, tag: 'div', class: 'asociacion_creable form-group',
175
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
176
- b.use :html5
177
- b.optional :readonly
178
- b.use :label, class: 'form-control-label'
179
- b.wrapper tag: 'div', class: 'input-group' do |ba|
180
- ba.use :hidden_input
181
- ba.use :input, class: 'form-control', disabled: true
182
- ba.wrapper tag: 'div', class: 'input-group-append dropdown' do |append|
183
- append.use :boton, class: 'btn btn-outline-secondary dropdown-toggle', type: :button,
184
- data: { bs_toggle: :dropdown }
185
- append.wrapper class: 'dropdown-menu' do |dropdown|
186
- dropdown.use :seleccionar_asociado
187
- dropdown.optional :crear_asociado
188
- dropdown.use :borrar_seleccion
189
- end
190
- end
191
- end
192
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
193
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
194
- end
195
- else
196
- config.wrappers :asociacion_creable, tag: 'div', class: 'asociacion_creable form-group',
197
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
198
- b.use :html5
199
- b.optional :readonly
200
- b.use :label, class: 'form-control-label'
201
- b.wrapper tag: 'div', class: 'input-group' do |ba|
202
- ba.use :hidden_input
203
- ba.use :input, class: 'form-control', disabled: true, error_class: 'is-invalid',
204
- valid_class: 'is-valid'
205
- ba.wrapper tag: 'div', class: 'input-group-btn' do |append|
206
- append.use :boton, class: 'btn btn-default dropdown-toggle', type: :button,
207
- data: { toggle: :dropdown }
208
- append.wrapper class: 'dropdown-menu' do |dropdown|
209
- dropdown.use :seleccionar_asociado
210
- dropdown.optional :crear_asociado
211
- dropdown.use :borrar_seleccion
212
- end
213
- end
214
- end
215
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
216
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
217
- end
218
- end
219
-
220
- config.wrappers :selects_dependientes, tag: 'div', class: 'form-group dependent_fields',
221
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
222
- b.use :html5
223
- b.optional :readonly
224
- b.use :label, class: 'form-control-label'
225
- b.wrapper tag: 'div',
226
- class: 'd-flex flex-row justify-content-between align-items-center' do |ba|
227
- ba.use :input, class: 'form-control mx-1', error_class: 'is-invalid', valid_class: 'is-valid'
228
- end
229
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
230
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
231
- end
232
-
233
- # vertical range input
234
- config.wrappers :vertical_range, tag: 'div', class: 'form-group',
235
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
236
- b.use :html5
237
- b.use :placeholder
238
- b.optional :readonly
239
- b.optional :step
240
- b.use :label
241
- b.use :input, class: 'form-control-range', error_class: 'is-invalid', valid_class: 'is-valid'
242
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
243
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
244
- end
245
-
246
- # horizontal forms
247
- #
248
- # horizontal default_wrapper
249
- config.wrappers :horizontal_form, tag: 'div', class: 'form-group row',
250
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
251
- b.use :html5
252
- b.use :placeholder
253
- b.optional :maxlength
254
- b.optional :minlength
255
- b.optional :pattern
256
- b.optional :min_max
257
- b.optional :readonly
258
- b.use :label, class: 'col-sm-4 col-form-label text-truncate'
259
- b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-8' do |ba|
260
- ba.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
261
- ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
262
- ba.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
263
- end
264
- end
265
-
266
- # horizontal input for boolean
267
- config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group row',
268
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
269
- b.use :html5
270
- b.optional :readonly
271
- b.wrapper tag: 'label', class: 'col-sm-3' do |ba|
272
- ba.use :label_text
273
- end
274
- b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |wr|
275
- wr.wrapper :form_check_wrapper, tag: 'div', class: 'form-check' do |bb|
276
- bb.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
277
- bb.use :label, class: 'form-check-label'
278
- bb.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
279
- bb.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
280
- end
281
- end
282
- end
283
-
284
- # horizontal input for radio buttons and check boxes
285
- config.wrappers :horizontal_collection, item_wrapper_class: 'form-check', tag: 'div',
286
- class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
287
- b.use :html5
288
- b.optional :readonly
289
- b.use :label, class: 'col-sm-3 form-control-label'
290
- b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba|
291
- ba.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
292
- ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
293
- ba.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
294
- end
295
- end
296
-
297
- # horizontal input for inline radio buttons and check boxes
298
- config.wrappers :horizontal_collection_inline,
299
- item_wrapper_class: 'form-check form-check-inline', tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
300
- b.use :html5
301
- b.optional :readonly
302
- b.use :label, class: 'col-sm-3 form-control-label'
303
- b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba|
304
- ba.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
305
- ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
306
- ba.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
307
- end
308
- end
309
-
310
- # horizontal file input
311
- config.wrappers :horizontal_file, tag: 'div', class: 'form-group row',
312
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
313
- b.use :html5
314
- b.use :placeholder
315
- b.optional :maxlength
316
- b.optional :minlength
317
- b.optional :readonly
318
- b.use :label, class: 'col-sm-3 form-control-label'
319
- b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba|
320
- ba.use :input, error_class: 'is-invalid', valid_class: 'is-valid'
321
- ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
322
- ba.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
323
- end
324
- end
325
-
326
- # horizontal multi select
327
- config.wrappers :horizontal_multi_select, tag: 'div', class: 'form-group row',
328
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
329
- b.use :html5
330
- b.optional :readonly
331
- b.use :label, class: 'col-sm-3 control-label'
332
- b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba|
333
- ba.wrapper tag: 'div',
334
- class: 'd-flex flex-row justify-content-between align-items-center' do |bb|
335
- bb.use :input, class: 'form-control mx-1', error_class: 'is-invalid',
336
- valid_class: 'is-valid'
337
- end
338
- ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
339
- ba.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
340
- end
341
- end
342
-
343
- # horizontal range input
344
- config.wrappers :horizontal_range, tag: 'div', class: 'form-group row',
345
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
346
- b.use :html5
347
- b.use :placeholder
348
- b.optional :readonly
349
- b.optional :step
350
- b.use :label, class: 'col-sm-3 form-control-label'
351
- b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba|
352
- ba.use :input, class: 'form-control-range', error_class: 'is-invalid', valid_class: 'is-valid'
353
- ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
354
- ba.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
355
- end
356
- end
357
-
358
- # inline forms
359
- #
360
- # inline default_wrapper
361
- config.wrappers :inline_form, tag: 'span', error_class: 'form-group-invalid',
362
- valid_class: 'form-group-valid' do |b|
363
- b.use :html5
364
- b.use :placeholder
365
- b.optional :maxlength
366
- b.optional :minlength
367
- b.optional :pattern
368
- b.optional :min_max
369
- b.optional :readonly
370
- b.use :label, class: 'sr-only'
371
-
372
- b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
373
- b.use :error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
374
- b.optional :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
375
- end
376
-
377
- # inline input for boolean
378
- config.wrappers :inline_boolean, tag: 'span',
379
- class: 'form-check flex-wrap justify-content-start mr-sm-2', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
380
- b.use :html5
381
- b.optional :readonly
382
- b.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
383
- b.use :label, class: 'form-check-label'
384
- b.use :error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
385
- b.optional :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
386
- end
387
-
388
- # bootstrap custom forms
389
- #
390
- # custom input for boolean
391
- config.wrappers :custom_boolean, tag: 'fieldset', class: 'form-group',
392
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
393
- b.use :html5
394
- b.optional :readonly
395
- b.wrapper :form_check_wrapper, tag: 'div', class: 'custom-control custom-checkbox' do |bb|
396
- bb.use :input, class: 'custom-control-input', error_class: 'is-invalid',
397
- valid_class: 'is-valid'
398
- bb.use :label, class: 'custom-control-label'
399
- bb.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
400
- bb.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
401
- end
402
- end
403
-
404
- config.wrappers :custom_boolean_switch, tag: 'fieldset', class: 'form-group',
405
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
406
- b.use :html5
407
- b.optional :readonly
408
- b.wrapper :form_check_wrapper, tag: 'div',
409
- class: 'custom-control custom-checkbox-switch' do |bb|
410
- bb.use :input, class: 'custom-control-input', error_class: 'is-invalid',
411
- valid_class: 'is-valid'
412
- bb.use :label, class: 'custom-control-label'
413
- bb.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
414
- bb.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
415
- end
416
- end
417
-
418
- # custom input for radio buttons and check boxes
419
- config.wrappers :custom_collection, item_wrapper_class: 'custom-control', tag: 'fieldset',
420
- class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
421
- b.use :html5
422
- b.optional :readonly
423
- b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba|
424
- ba.use :label_text
425
- end
426
- b.use :input, class: 'custom-control-input', error_class: 'is-invalid', valid_class: 'is-valid'
427
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
428
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
429
- end
430
-
431
- # custom input for inline radio buttons and check boxes
432
- config.wrappers :custom_collection_inline,
433
- item_wrapper_class: 'custom-control custom-control-inline', tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
434
- b.use :html5
435
- b.optional :readonly
436
- b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba|
437
- ba.use :label_text
438
- end
439
- b.use :input, class: 'custom-control-input', error_class: 'is-invalid', valid_class: 'is-valid'
440
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
441
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
442
- end
443
-
444
- # custom file input
445
- config.wrappers :custom_file, tag: 'div', class: 'form-group',
446
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
447
- b.use :html5
448
- b.use :placeholder
449
- b.optional :maxlength
450
- b.optional :minlength
451
- b.optional :readonly
452
- b.use :label, class: 'form-control-label'
453
- b.wrapper :custom_file_wrapper, tag: 'div', class: 'custom-file' do |ba|
454
- ba.use :input, class: 'custom-file-input', error_class: 'is-invalid', valid_class: 'is-valid'
455
- ba.use :label, class: 'custom-file-label'
456
- ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
457
- end
458
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
459
- end
460
-
461
- # custom multi select
462
- config.wrappers :custom_multi_select, tag: 'div', class: 'form-group',
463
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
464
- b.use :html5
465
- b.optional :readonly
466
- b.use :label, class: 'form-control-label'
467
- b.wrapper tag: 'div',
468
- class: 'd-flex flex-row justify-content-between align-items-center' do |ba|
469
- ba.use :input, class: 'custom-select mx-1', error_class: 'is-invalid', valid_class: 'is-valid'
470
- end
471
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
472
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
473
- end
474
-
475
- # custom range input
476
- config.wrappers :custom_range, tag: 'div', class: 'form-group',
477
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
478
- b.use :html5
479
- b.use :placeholder
480
- b.optional :readonly
481
- b.optional :step
482
- b.use :label, class: 'form-control-label'
483
- b.use :input, class: 'custom-range', error_class: 'is-invalid', valid_class: 'is-valid'
484
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
485
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
486
- end
487
-
488
- # Input Group - custom component
489
- # see example app and config at https://github.com/rafaelfranca/simple_form-bootstrap
490
- # config.wrappers :input_group, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
491
- # b.use :html5
492
- # b.use :placeholder
493
- # b.optional :maxlength
494
- # b.optional :minlength
495
- # b.optional :pattern
496
- # b.optional :min_max
497
- # b.optional :readonly
498
- # b.use :label, class: 'form-control-label'
499
- # b.wrapper :input_group_tag, tag: 'div', class: 'input-group' do |ba|
500
- # ba.optional :prepend
501
- # ba.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
502
- # ba.optional :append
503
- # end
504
- # b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
505
- # b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
506
- # end
507
-
508
- # Floating Labels form
509
- #
510
- # floating labels default_wrapper
511
- config.wrappers :floating_labels_form, tag: 'div', class: 'form-label-group',
512
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
513
- b.use :html5
514
- b.use :placeholder
515
- b.optional :maxlength
516
- b.optional :minlength
517
- b.optional :pattern
518
- b.optional :min_max
519
- b.optional :readonly
520
- b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
521
- b.use :label, class: 'form-control-label'
522
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
523
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
524
- end
525
-
526
- # custom multi select
527
- config.wrappers :floating_labels_select, tag: 'div', class: 'form-label-group',
528
- error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
529
- b.use :html5
530
- b.optional :readonly
531
- b.use :input, class: 'custom-select custom-select-lg', error_class: 'is-invalid',
532
- valid_class: 'is-valid'
533
- b.use :label, class: 'form-control-label'
534
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
535
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
536
- end
537
-
538
- # The default wrapper to be used by the FormBuilder.
539
- config.default_wrapper = :vertical_form
540
-
541
- # Custom wrappers for input types. This should be a hash containing an input
542
- # type as key and the wrapper that will be used for all inputs with specified type.
543
- config.wrapper_mappings = {} if config.wrapper_mappings.nil?
544
- config.wrapper_mappings.merge!({
545
- boolean: :vertical_boolean,
546
- check_boxes: :vertical_collection,
547
- date: :vertical_form,
548
- datetime: :vertical_multi_select,
549
- file: :vertical_file,
550
- radio_buttons: :vertical_collection,
551
- range: :vertical_range,
552
- time: :vertical_multi_select,
553
- # select: :chosen_select,
554
- asociacion_creable: :asociacion_creable
555
- })
556
- config.wrapper_mappings.merge!({ 'pg_rails/asociacion_creable' => :asociacion_creable })
557
-
558
- # enable custom form wrappers
559
- # config.wrapper_mappings = {
560
- # boolean: :custom_boolean,
561
- # check_boxes: :custom_collection,
562
- # date: :custom_multi_select,
563
- # datetime: :custom_multi_select,
564
- # file: :custom_file,
565
- # radio_buttons: :custom_collection,
566
- # range: :custom_range,
567
- # time: :custom_multi_select
568
- # }
569
-
570
- config.browser_validations = true
571
-
572
- # Collection of methods to detect if a file type was given.
573
- # config.file_methods = [ :mounted_as, :file?, :public_filename, :attached? ]
574
-
575
- # Custom mappings for input types. This should be a hash containing a regexp
576
- # to match as key, and the input type that will be used when the field name
577
- # matches the regexp as value.
578
- # config.input_mappings = { /count/ => :integer }
579
- config.input_mappings = {
580
- /fecha/ => 'pg_rails/fecha',
581
- /date/ => 'pg_rails/fecha'
582
- }
583
- end
data/lib/pg_rails.rb DELETED
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'pg_rails/engine'
4
- require 'pg_rails/core_ext'
5
- require 'pg_rails/configuracion'
6
-
7
- module PgRails
8
- class << self
9
- attr_writer :configuracion
10
-
11
- def configuracion
12
- @configuracion ||= Configuracion.new
13
- end
14
-
15
- def config
16
- configuracion
17
- end
18
-
19
- def configurar
20
- yield(configuracion)
21
- end
22
- end
23
- end