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,178 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Uncomment this and change the path if necessary to include your own
|
5
|
+
# components.
|
6
|
+
# See https://github.com/heartcombo/simple_form#custom-components to know
|
7
|
+
# more about custom components.
|
8
|
+
# Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
|
9
|
+
#
|
10
|
+
# Use this setup block to configure all options available in SimpleForm.
|
11
|
+
SimpleForm.setup do |config|
|
12
|
+
# Wrappers are used by the form builder to generate a
|
13
|
+
# complete input. You can remove any component from the
|
14
|
+
# wrapper, change the order or even add your own to the
|
15
|
+
# stack. The options given below are used to wrap the
|
16
|
+
# whole input.
|
17
|
+
config.wrappers :default, class: :input,
|
18
|
+
hint_class: :field_with_hint, error_class: :field_with_errors,
|
19
|
+
valid_class: :field_without_errors do |b|
|
20
|
+
## Extensions enabled by default
|
21
|
+
# Any of these extensions can be disabled for a
|
22
|
+
# given input by passing: `f.input EXTENSION_NAME => false`.
|
23
|
+
# You can make any of these extensions optional by
|
24
|
+
# renaming `b.use` to `b.optional`.
|
25
|
+
|
26
|
+
# Determines whether to use HTML5 (:email, :url, ...)
|
27
|
+
# and required attributes
|
28
|
+
b.use :html5
|
29
|
+
|
30
|
+
# Calculates placeholders automatically from I18n
|
31
|
+
# You can also pass a string as f.input placeholder: "Placeholder"
|
32
|
+
b.use :placeholder
|
33
|
+
|
34
|
+
## Optional extensions
|
35
|
+
# They are disabled unless you pass `f.input EXTENSION_NAME => true`
|
36
|
+
# to the input. If so, they will retrieve the values from the model
|
37
|
+
# if any exists. If you want to enable any of those
|
38
|
+
# extensions by default, you can change `b.optional` to `b.use`.
|
39
|
+
|
40
|
+
# Calculates maxlength from length validations for string inputs
|
41
|
+
# and/or database column lengths
|
42
|
+
b.optional :maxlength
|
43
|
+
|
44
|
+
# Calculate minlength from length validations for string inputs
|
45
|
+
b.optional :minlength
|
46
|
+
|
47
|
+
# Calculates pattern from format validations for string inputs
|
48
|
+
b.optional :pattern
|
49
|
+
|
50
|
+
# Calculates min and max from length validations for numeric inputs
|
51
|
+
b.optional :min_max
|
52
|
+
|
53
|
+
# Calculates readonly automatically from readonly attributes
|
54
|
+
b.optional :readonly
|
55
|
+
|
56
|
+
## Inputs
|
57
|
+
# b.use :input, class: 'input', error_class: 'is-invalid', valid_class: 'is-valid'
|
58
|
+
b.use :label_input
|
59
|
+
b.use :hint, wrap_with: { tag: :span, class: :hint }
|
60
|
+
b.use :error, wrap_with: { tag: :span, class: :error }
|
61
|
+
|
62
|
+
## full_messages_for
|
63
|
+
# If you want to display the full error message for the attribute, you can
|
64
|
+
# use the component :full_error, like:
|
65
|
+
#
|
66
|
+
# b.use :full_error, wrap_with: { tag: :span, class: :error }
|
67
|
+
end
|
68
|
+
|
69
|
+
# The default wrapper to be used by the FormBuilder.
|
70
|
+
config.default_wrapper = :default
|
71
|
+
|
72
|
+
# Define the way to render check boxes / radio buttons with labels.
|
73
|
+
# Defaults to :nested for bootstrap config.
|
74
|
+
# inline: input + label
|
75
|
+
# nested: label > input
|
76
|
+
config.boolean_style = :nested
|
77
|
+
|
78
|
+
# Default class for buttons
|
79
|
+
config.button_class = 'btn'
|
80
|
+
|
81
|
+
# Method used to tidy up errors. Specify any Rails Array method.
|
82
|
+
# :first lists the first message for each field.
|
83
|
+
# Use :to_sentence to list all errors for each field.
|
84
|
+
# config.error_method = :first
|
85
|
+
|
86
|
+
# Default tag used for error notification helper.
|
87
|
+
config.error_notification_tag = :div
|
88
|
+
|
89
|
+
# CSS class to add for error notification helper.
|
90
|
+
config.error_notification_class = 'error_notification'
|
91
|
+
|
92
|
+
# Series of attempts to detect a default label method for collection.
|
93
|
+
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
|
94
|
+
|
95
|
+
# Series of attempts to detect a default value method for collection.
|
96
|
+
# config.collection_value_methods = [ :id, :to_s ]
|
97
|
+
|
98
|
+
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
|
99
|
+
# config.collection_wrapper_tag = nil
|
100
|
+
|
101
|
+
# You can define the class to use on all collection wrappers. Defaulting to none.
|
102
|
+
# config.collection_wrapper_class = nil
|
103
|
+
|
104
|
+
# You can wrap each item in a collection of radio/check boxes with a tag,
|
105
|
+
# defaulting to :span.
|
106
|
+
# config.item_wrapper_tag = :span
|
107
|
+
|
108
|
+
# You can define a class to use in all item wrappers. Defaulting to none.
|
109
|
+
# config.item_wrapper_class = nil
|
110
|
+
|
111
|
+
# How the label text should be generated altogether with the required text.
|
112
|
+
# config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
|
113
|
+
|
114
|
+
# You can define the class to use on all labels. Default is nil.
|
115
|
+
# config.label_class = nil
|
116
|
+
|
117
|
+
# You can define the default class to be used on forms. Can be overridden
|
118
|
+
# with `html: { :class }`. Defaulting to none.
|
119
|
+
# config.default_form_class = nil
|
120
|
+
|
121
|
+
# You can define which elements should obtain additional classes
|
122
|
+
# config.generate_additional_classes_for = [:wrapper, :label, :input]
|
123
|
+
|
124
|
+
# Whether attributes are required by default (or not). Default is true.
|
125
|
+
# config.required_by_default = true
|
126
|
+
|
127
|
+
# Tell browsers whether to use the native HTML5 validations (novalidate form option).
|
128
|
+
# These validations are enabled in SimpleForm's internal config but disabled by default
|
129
|
+
# in this configuration, which is recommended due to some quirks from different browsers.
|
130
|
+
# To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
|
131
|
+
# change this configuration to true.
|
132
|
+
config.browser_validations = false
|
133
|
+
|
134
|
+
# Custom mappings for input types. This should be a hash containing a regexp
|
135
|
+
# to match as key, and the input type that will be used when the field name
|
136
|
+
# matches the regexp as value.
|
137
|
+
# config.input_mappings = { /count/ => :integer }
|
138
|
+
|
139
|
+
# Custom wrappers for input types. This should be a hash containing an input
|
140
|
+
# type as key and the wrapper that will be used for all inputs with specified type.
|
141
|
+
# config.wrapper_mappings = { string: :prepend }
|
142
|
+
|
143
|
+
# Namespaces where SimpleForm should look for custom input classes that
|
144
|
+
# override default inputs.
|
145
|
+
# config.custom_inputs_namespaces << "CustomInputs"
|
146
|
+
|
147
|
+
# Default priority for time_zone inputs.
|
148
|
+
# config.time_zone_priority = nil
|
149
|
+
|
150
|
+
# Default priority for country inputs.
|
151
|
+
# config.country_priority = nil
|
152
|
+
|
153
|
+
# When false, do not use translations for labels.
|
154
|
+
# config.translate_labels = true
|
155
|
+
|
156
|
+
# Automatically discover new inputs in Rails' autoload path.
|
157
|
+
# config.inputs_discovery = true
|
158
|
+
|
159
|
+
# Cache SimpleForm inputs discovery
|
160
|
+
# config.cache_discovery = !Rails.env.development?
|
161
|
+
|
162
|
+
# Default class for inputs
|
163
|
+
# config.input_class = nil
|
164
|
+
|
165
|
+
# Define the default class of the input wrapper of the boolean input.
|
166
|
+
config.boolean_label_class = 'checkbox'
|
167
|
+
|
168
|
+
# Defines if the default input wrapper class should be included in radio
|
169
|
+
# collection wrappers.
|
170
|
+
# config.include_default_input_wrapper_class = true
|
171
|
+
|
172
|
+
# Defines which i18n scope will be used in Simple Form.
|
173
|
+
# config.i18n_scope = 'simple_form'
|
174
|
+
|
175
|
+
# Defines validation classes to the input_field. By default it's nil.
|
176
|
+
# config.input_field_valid_class = 'is-valid'
|
177
|
+
# config.input_field_error_class = 'is-invalid'
|
178
|
+
end
|
@@ -0,0 +1,371 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# These defaults are defined and maintained by the community at
|
4
|
+
# https://github.com/heartcombo/simple_form-bootstrap
|
5
|
+
# Please submit feedback, changes and tests only there.
|
6
|
+
|
7
|
+
# Uncomment this and change the path if necessary to include your own
|
8
|
+
# components.
|
9
|
+
# See https://github.com/heartcombo/simple_form#custom-components
|
10
|
+
# to know more about custom components.
|
11
|
+
# Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
|
12
|
+
|
13
|
+
# Use this setup block to configure all options available in SimpleForm.
|
14
|
+
SimpleForm.setup do |config|
|
15
|
+
# Default class for buttons
|
16
|
+
config.button_class = 'btn'
|
17
|
+
|
18
|
+
# Define the default class of the input wrapper of the boolean input.
|
19
|
+
config.boolean_label_class = 'form-check-label'
|
20
|
+
|
21
|
+
# How the label text should be generated altogether with the required text.
|
22
|
+
config.label_text = ->(label, required, _explicit_label) { "#{label} #{required}" }
|
23
|
+
|
24
|
+
# Define the way to render check boxes / radio buttons with labels.
|
25
|
+
config.boolean_style = :inline
|
26
|
+
|
27
|
+
# You can wrap each item in a collection of radio/check boxes with a tag
|
28
|
+
config.item_wrapper_tag = :div
|
29
|
+
|
30
|
+
# Defines if the default input wrapper class should be included in radio
|
31
|
+
# collection wrappers.
|
32
|
+
config.include_default_input_wrapper_class = false
|
33
|
+
|
34
|
+
# CSS class to add for error notification helper.
|
35
|
+
config.error_notification_class = 'alert alert-danger'
|
36
|
+
|
37
|
+
# Method used to tidy up errors. Specify any Rails Array method.
|
38
|
+
# :first lists the first message for each field.
|
39
|
+
# :to_sentence to list all errors for each field.
|
40
|
+
config.error_method = :to_sentence
|
41
|
+
|
42
|
+
# add validation classes to `input_field`
|
43
|
+
config.input_field_error_class = 'is-invalid'
|
44
|
+
config.input_field_valid_class = 'is-valid'
|
45
|
+
|
46
|
+
# vertical forms
|
47
|
+
#
|
48
|
+
# vertical default_wrapper
|
49
|
+
config.wrappers :vertical_form, class: 'mb-3' do |b|
|
50
|
+
b.use :html5
|
51
|
+
b.use :placeholder
|
52
|
+
b.optional :maxlength
|
53
|
+
b.optional :minlength
|
54
|
+
b.optional :pattern
|
55
|
+
b.optional :min_max
|
56
|
+
b.optional :readonly
|
57
|
+
b.use :label, class: 'form-label'
|
58
|
+
b.use :input, class: 'form-control', error_class: 'is-invalid'
|
59
|
+
b.use :full_error, wrap_with: { class: 'invalid-feedback' }
|
60
|
+
b.use :hint, wrap_with: { class: 'form-text' }
|
61
|
+
end
|
62
|
+
|
63
|
+
# vertical input for boolean
|
64
|
+
config.wrappers :vertical_boolean, tag: 'fieldset', class: 'mb-3' do |b|
|
65
|
+
b.use :html5
|
66
|
+
b.optional :readonly
|
67
|
+
b.wrapper :form_check_wrapper, class: 'form-check' do |bb|
|
68
|
+
bb.use :input, class: 'form-check-input', error_class: 'is-invalid'
|
69
|
+
bb.use :label, class: 'form-check-label'
|
70
|
+
bb.use :full_error, wrap_with: { class: 'invalid-feedback' }
|
71
|
+
bb.use :hint, wrap_with: { class: 'form-text' }
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# vertical input for radio buttons and check boxes
|
76
|
+
config.wrappers :vertical_collection, item_wrapper_class: 'form-check', item_label_class: 'form-check-label',
|
77
|
+
tag: 'fieldset', class: 'mb-3' do |b|
|
78
|
+
b.use :html5
|
79
|
+
b.optional :readonly
|
80
|
+
b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba|
|
81
|
+
ba.use :label_text
|
82
|
+
end
|
83
|
+
b.use :input, class: 'form-check-input', error_class: 'is-invalid'
|
84
|
+
b.use :full_error, wrap_with: { class: 'invalid-feedback d-block' }
|
85
|
+
b.use :hint, wrap_with: { class: 'form-text' }
|
86
|
+
end
|
87
|
+
|
88
|
+
# vertical input for inline radio buttons and check boxes
|
89
|
+
config.wrappers :vertical_collection_inline, item_wrapper_class: 'form-check form-check-inline',
|
90
|
+
item_label_class: 'form-check-label', tag: 'fieldset', class: 'mb-3' do |b|
|
91
|
+
b.use :html5
|
92
|
+
b.optional :readonly
|
93
|
+
b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba|
|
94
|
+
ba.use :label_text
|
95
|
+
end
|
96
|
+
b.use :input, class: 'form-check-input', error_class: 'is-invalid'
|
97
|
+
b.use :full_error, wrap_with: { class: 'invalid-feedback d-block' }
|
98
|
+
b.use :hint, wrap_with: { class: 'form-text' }
|
99
|
+
end
|
100
|
+
|
101
|
+
# vertical file input
|
102
|
+
config.wrappers :vertical_file, class: 'mb-3' do |b|
|
103
|
+
b.use :html5
|
104
|
+
b.use :placeholder
|
105
|
+
b.optional :maxlength
|
106
|
+
b.optional :minlength
|
107
|
+
b.optional :readonly
|
108
|
+
b.use :label, class: 'form-label'
|
109
|
+
b.use :input, class: 'form-control', error_class: 'is-invalid'
|
110
|
+
b.use :full_error, wrap_with: { class: 'invalid-feedback' }
|
111
|
+
b.use :hint, wrap_with: { class: 'form-text' }
|
112
|
+
end
|
113
|
+
|
114
|
+
# vertical select input
|
115
|
+
config.wrappers :vertical_select, class: 'mb-3' do |b|
|
116
|
+
b.use :html5
|
117
|
+
b.optional :readonly
|
118
|
+
b.use :label, class: 'form-label'
|
119
|
+
b.use :input, class: 'form-select', error_class: 'is-invalid'
|
120
|
+
b.use :full_error, wrap_with: { class: 'invalid-feedback' }
|
121
|
+
b.use :hint, wrap_with: { class: 'form-text' }
|
122
|
+
end
|
123
|
+
|
124
|
+
# vertical multi select
|
125
|
+
config.wrappers :vertical_multi_select, class: 'mb-3' do |b|
|
126
|
+
b.use :html5
|
127
|
+
b.optional :readonly
|
128
|
+
b.use :label, class: 'form-label'
|
129
|
+
b.wrapper class: 'd-flex flex-row justify-content-between align-items-center' do |ba|
|
130
|
+
ba.use :input, class: 'form-select mx-1', error_class: 'is-invalid'
|
131
|
+
end
|
132
|
+
b.use :full_error, wrap_with: { class: 'invalid-feedback d-block' }
|
133
|
+
b.use :hint, wrap_with: { class: 'form-text' }
|
134
|
+
end
|
135
|
+
|
136
|
+
# vertical range input
|
137
|
+
config.wrappers :vertical_range, class: 'mb-3' do |b|
|
138
|
+
b.use :html5
|
139
|
+
b.use :placeholder
|
140
|
+
b.optional :readonly
|
141
|
+
b.optional :step
|
142
|
+
b.use :label, class: 'form-label'
|
143
|
+
b.use :input, class: 'form-range', error_class: 'is-invalid'
|
144
|
+
b.use :full_error, wrap_with: { class: 'invalid-feedback' }
|
145
|
+
b.use :hint, wrap_with: { class: 'form-text' }
|
146
|
+
end
|
147
|
+
|
148
|
+
# horizontal forms
|
149
|
+
#
|
150
|
+
# horizontal default_wrapper
|
151
|
+
config.wrappers :horizontal_form, class: 'row mb-3' do |b|
|
152
|
+
b.use :html5
|
153
|
+
b.use :placeholder
|
154
|
+
b.optional :maxlength
|
155
|
+
b.optional :minlength
|
156
|
+
b.optional :pattern
|
157
|
+
b.optional :min_max
|
158
|
+
b.optional :readonly
|
159
|
+
b.use :label, class: 'col-sm-3 col-form-label'
|
160
|
+
b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
|
161
|
+
ba.use :input, class: 'form-control', error_class: 'is-invalid'
|
162
|
+
ba.use :full_error, wrap_with: { class: 'invalid-feedback' }
|
163
|
+
ba.use :hint, wrap_with: { class: 'form-text' }
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
# horizontal input for boolean
|
168
|
+
config.wrappers :horizontal_boolean, class: 'row mb-3' do |b|
|
169
|
+
b.use :html5
|
170
|
+
b.optional :readonly
|
171
|
+
b.wrapper :grid_wrapper, class: 'col-sm-9 offset-sm-3' do |wr|
|
172
|
+
wr.wrapper :form_check_wrapper, class: 'form-check' do |bb|
|
173
|
+
bb.use :input, class: 'form-check-input', error_class: 'is-invalid'
|
174
|
+
bb.use :label, class: 'form-check-label'
|
175
|
+
bb.use :full_error, wrap_with: { class: 'invalid-feedback' }
|
176
|
+
bb.use :hint, wrap_with: { class: 'form-text' }
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
# horizontal input for radio buttons and check boxes
|
182
|
+
config.wrappers :horizontal_collection, item_wrapper_class: 'form-check', item_label_class: 'form-check-label',
|
183
|
+
class: 'row mb-3' do |b|
|
184
|
+
b.use :html5
|
185
|
+
b.optional :readonly
|
186
|
+
b.use :label, class: 'col-sm-3 col-form-label pt-0'
|
187
|
+
b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
|
188
|
+
ba.use :input, class: 'form-check-input', error_class: 'is-invalid'
|
189
|
+
ba.use :full_error, wrap_with: { class: 'invalid-feedback d-block' }
|
190
|
+
ba.use :hint, wrap_with: { class: 'form-text' }
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
# horizontal input for inline radio buttons and check boxes
|
195
|
+
config.wrappers :horizontal_collection_inline, item_wrapper_class: 'form-check form-check-inline',
|
196
|
+
item_label_class: 'form-check-label', class: 'row mb-3' do |b|
|
197
|
+
b.use :html5
|
198
|
+
b.optional :readonly
|
199
|
+
b.use :label, class: 'col-sm-3 col-form-label pt-0'
|
200
|
+
b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
|
201
|
+
ba.use :input, class: 'form-check-input', error_class: 'is-invalid'
|
202
|
+
ba.use :full_error, wrap_with: { class: 'invalid-feedback d-block' }
|
203
|
+
ba.use :hint, wrap_with: { class: 'form-text' }
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
# horizontal file input
|
208
|
+
config.wrappers :horizontal_file, class: 'row mb-3' do |b|
|
209
|
+
b.use :html5
|
210
|
+
b.use :placeholder
|
211
|
+
b.optional :maxlength
|
212
|
+
b.optional :minlength
|
213
|
+
b.optional :readonly
|
214
|
+
b.use :label, class: 'col-sm-3 col-form-label'
|
215
|
+
b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
|
216
|
+
ba.use :input, class: 'form-control', error_class: 'is-invalid'
|
217
|
+
ba.use :full_error, wrap_with: { class: 'invalid-feedback' }
|
218
|
+
ba.use :hint, wrap_with: { class: 'form-text' }
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
# horizontal select input
|
223
|
+
config.wrappers :horizontal_select, class: 'row mb-3' do |b|
|
224
|
+
b.use :html5
|
225
|
+
b.optional :readonly
|
226
|
+
b.use :label, class: 'col-sm-3 col-form-label'
|
227
|
+
b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
|
228
|
+
ba.use :input, class: 'form-select', error_class: 'is-invalid'
|
229
|
+
ba.use :full_error, wrap_with: { class: 'invalid-feedback' }
|
230
|
+
ba.use :hint, wrap_with: { class: 'form-text' }
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
# horizontal multi select
|
235
|
+
config.wrappers :horizontal_multi_select, class: 'row mb-3' do |b|
|
236
|
+
b.use :html5
|
237
|
+
b.optional :readonly
|
238
|
+
b.use :label, class: 'col-sm-3 col-form-label'
|
239
|
+
b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
|
240
|
+
ba.wrapper class: 'd-flex flex-row justify-content-between align-items-center' do |bb|
|
241
|
+
bb.use :input, class: 'form-select mx-1', error_class: 'is-invalid'
|
242
|
+
end
|
243
|
+
ba.use :full_error, wrap_with: { class: 'invalid-feedback d-block' }
|
244
|
+
ba.use :hint, wrap_with: { class: 'form-text' }
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
# horizontal range input
|
249
|
+
config.wrappers :horizontal_range, class: 'row mb-3' do |b|
|
250
|
+
b.use :html5
|
251
|
+
b.use :placeholder
|
252
|
+
b.optional :readonly
|
253
|
+
b.optional :step
|
254
|
+
b.use :label, class: 'col-sm-3 col-form-label pt-0'
|
255
|
+
b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
|
256
|
+
ba.use :input, class: 'form-range', error_class: 'is-invalid'
|
257
|
+
ba.use :full_error, wrap_with: { class: 'invalid-feedback' }
|
258
|
+
ba.use :hint, wrap_with: { class: 'form-text' }
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
# inline forms
|
263
|
+
#
|
264
|
+
# inline default_wrapper
|
265
|
+
config.wrappers :inline_form, class: 'col-12' do |b|
|
266
|
+
b.use :html5
|
267
|
+
b.use :placeholder
|
268
|
+
b.optional :maxlength
|
269
|
+
b.optional :minlength
|
270
|
+
b.optional :pattern
|
271
|
+
b.optional :min_max
|
272
|
+
b.optional :readonly
|
273
|
+
b.use :label, class: 'visually-hidden'
|
274
|
+
|
275
|
+
b.use :input, class: 'form-control', error_class: 'is-invalid'
|
276
|
+
b.use :error, wrap_with: { class: 'invalid-feedback' }
|
277
|
+
b.optional :hint, wrap_with: { class: 'form-text' }
|
278
|
+
end
|
279
|
+
|
280
|
+
# inline input for boolean
|
281
|
+
config.wrappers :inline_boolean, class: 'col-12' do |b|
|
282
|
+
b.use :html5
|
283
|
+
b.optional :readonly
|
284
|
+
b.wrapper :form_check_wrapper, class: 'form-check' do |bb|
|
285
|
+
bb.use :input, class: 'form-check-input', error_class: 'is-invalid'
|
286
|
+
bb.use :label, class: 'form-check-label'
|
287
|
+
bb.use :error, wrap_with: { class: 'invalid-feedback' }
|
288
|
+
bb.optional :hint, wrap_with: { class: 'form-text' }
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
# bootstrap custom forms
|
293
|
+
#
|
294
|
+
# custom input switch for boolean
|
295
|
+
config.wrappers :custom_boolean_switch, class: 'mb-3' do |b|
|
296
|
+
b.use :html5
|
297
|
+
b.optional :readonly
|
298
|
+
b.wrapper :form_check_wrapper, tag: 'div', class: 'form-check form-switch' do |bb|
|
299
|
+
bb.use :input, class: 'form-check-input', error_class: 'is-invalid'
|
300
|
+
bb.use :label, class: 'form-check-label'
|
301
|
+
bb.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
|
302
|
+
bb.use :hint, wrap_with: { class: 'form-text' }
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
# Input Group - custom component
|
307
|
+
# see example app and config at https://github.com/heartcombo/simple_form-bootstrap
|
308
|
+
config.wrappers :input_group, class: 'mb-3' do |b|
|
309
|
+
b.use :html5
|
310
|
+
b.use :placeholder
|
311
|
+
b.optional :maxlength
|
312
|
+
b.optional :minlength
|
313
|
+
b.optional :pattern
|
314
|
+
b.optional :min_max
|
315
|
+
b.optional :readonly
|
316
|
+
b.use :label, class: 'form-label'
|
317
|
+
b.wrapper :input_group_tag, class: 'input-group' do |ba|
|
318
|
+
ba.optional :prepend
|
319
|
+
ba.use :input, class: 'form-control', error_class: 'is-invalid'
|
320
|
+
ba.optional :append
|
321
|
+
ba.use :full_error, wrap_with: { class: 'invalid-feedback' }
|
322
|
+
end
|
323
|
+
b.use :hint, wrap_with: { class: 'form-text' }
|
324
|
+
end
|
325
|
+
|
326
|
+
# Floating Labels form
|
327
|
+
#
|
328
|
+
# floating labels default_wrapper
|
329
|
+
config.wrappers :floating_labels_form, class: 'form-floating mb-3' do |b|
|
330
|
+
b.use :html5
|
331
|
+
b.use :placeholder
|
332
|
+
b.optional :maxlength
|
333
|
+
b.optional :minlength
|
334
|
+
b.optional :pattern
|
335
|
+
b.optional :min_max
|
336
|
+
b.optional :readonly
|
337
|
+
b.use :input, class: 'form-control', error_class: 'is-invalid'
|
338
|
+
b.use :label
|
339
|
+
b.use :full_error, wrap_with: { class: 'invalid-feedback' }
|
340
|
+
b.use :hint, wrap_with: { class: 'form-text' }
|
341
|
+
end
|
342
|
+
|
343
|
+
# custom multi select
|
344
|
+
config.wrappers :floating_labels_select, class: 'form-floating mb-3' do |b|
|
345
|
+
b.use :html5
|
346
|
+
b.optional :readonly
|
347
|
+
b.use :input, class: 'form-select', error_class: 'is-invalid'
|
348
|
+
b.use :label
|
349
|
+
b.use :full_error, wrap_with: { class: 'invalid-feedback' }
|
350
|
+
b.use :hint, wrap_with: { class: 'form-text' }
|
351
|
+
end
|
352
|
+
|
353
|
+
# The default wrapper to be used by the FormBuilder.
|
354
|
+
config.default_wrapper = :vertical_form
|
355
|
+
|
356
|
+
# Custom wrappers for input types. This should be a hash containing an input
|
357
|
+
# type as key and the wrapper that will be used for all inputs with specified type.
|
358
|
+
# rubocop:disable Layout/HashAlignment
|
359
|
+
config.wrapper_mappings = {
|
360
|
+
boolean: :vertical_boolean,
|
361
|
+
check_boxes: :vertical_collection,
|
362
|
+
date: :vertical_form,
|
363
|
+
datetime: :vertical_form,
|
364
|
+
file: :vertical_file,
|
365
|
+
radio_buttons: :vertical_collection,
|
366
|
+
range: :vertical_range,
|
367
|
+
time: :vertical_multi_select,
|
368
|
+
select: :vertical_select
|
369
|
+
}
|
370
|
+
# rubocop:enable Layout/HashAlignment
|
371
|
+
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
# TODO: mover a pg_scaffold
|
4
|
+
|
5
|
+
module PgEngine
|
4
6
|
class Configuracion
|
5
7
|
attr_accessor :sistema_iconos, :clase_botones_chicos, :boton_destroy, :boton_edit,
|
6
8
|
:boton_show, :boton_light, :icono_destroy, :icono_edit, :icono_show, :boton_export, :bootstrap_version,
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PgEngine
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
isolate_namespace PgEngine
|
6
|
+
|
7
|
+
config.i18n.default_locale = :es
|
8
|
+
config.time_zone = 'America/Argentina/Buenos_Aires'
|
9
|
+
|
10
|
+
initializer 'configurar_pg_rails' do
|
11
|
+
# SimpleForm
|
12
|
+
require "#{PgEngine::Engine.root}/config/simple_form/simple_form"
|
13
|
+
require "#{PgEngine::Engine.root}/config/simple_form/simple_form_bootstrap"
|
14
|
+
|
15
|
+
# Rainbow
|
16
|
+
Rainbow.enabled = true
|
17
|
+
|
18
|
+
# Audited for ActiveAdmin
|
19
|
+
require 'audited'
|
20
|
+
ActiveSupport.on_load :active_record do
|
21
|
+
Audited::Audit.class_eval do
|
22
|
+
def self.ransackable_associations(_auth_object = nil)
|
23
|
+
authorizable_ransackable_associations
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.ransackable_attributes(_auth_object = nil)
|
27
|
+
authorizable_ransackable_attributes
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
initializer 'byebug_bullet' do
|
34
|
+
if Rails.env.development?
|
35
|
+
# Byebug
|
36
|
+
require 'byebug/core'
|
37
|
+
begin
|
38
|
+
Byebug.start_server 'localhost', ENV.fetch('BYEBUG_SERVER_PORT', 8989).to_i
|
39
|
+
rescue Errno::EADDRINUSE
|
40
|
+
Rails.logger.debug 'Byebug server already running'
|
41
|
+
end
|
42
|
+
|
43
|
+
# Bullet
|
44
|
+
Bullet.enable = true
|
45
|
+
Bullet.alert = false
|
46
|
+
Bullet.bullet_logger = true
|
47
|
+
Bullet.console = true
|
48
|
+
Bullet.rails_logger = true
|
49
|
+
Bullet.add_footer = true
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -2,10 +2,17 @@
|
|
2
2
|
|
3
3
|
require 'rainbow'
|
4
4
|
|
5
|
-
module
|
5
|
+
module PgEngine
|
6
6
|
module Utils
|
7
7
|
class Logueador
|
8
8
|
class << self
|
9
|
+
def deprecated(mensaje)
|
10
|
+
titulo = Rainbow(" WARNING en #{caller[1]}").yellow.bold
|
11
|
+
detalles = Rainbow(" #{mensaje}").yellow
|
12
|
+
Rails.logger.warn("#{titulo}\n#{detalles}")
|
13
|
+
Rollbar.warning("#{mensaje}\n\n#{caller.join("\n")}")
|
14
|
+
end
|
15
|
+
|
9
16
|
def excepcion(exception)
|
10
17
|
titulo = Rainbow(" EXCEPCION #{exception.class} en #{caller.first}").red.bold
|
11
18
|
detalles = Rainbow(" #{exception.message}").red
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'pg_engine/engine'
|
4
|
+
require_relative 'pg_engine/core_ext'
|
5
|
+
require_relative 'pg_engine/configuracion'
|
6
|
+
require_relative 'pg_engine/utils/logueador'
|
7
|
+
|
8
|
+
module PgEngine
|
9
|
+
class << self
|
10
|
+
attr_writer :configuracion
|
11
|
+
|
12
|
+
def configuracion
|
13
|
+
@configuracion ||= Configuracion.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def config
|
17
|
+
configuracion
|
18
|
+
end
|
19
|
+
|
20
|
+
def configurar
|
21
|
+
yield(configuracion)
|
22
|
+
end
|
23
|
+
|
24
|
+
def resource_route(rails_router, key)
|
25
|
+
rails_router.instance_eval do
|
26
|
+
resources(key) do
|
27
|
+
collection do
|
28
|
+
get :abrir_modal
|
29
|
+
post :buscar
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|