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,318 +0,0 @@
1
- //= require pg_rails/validaciones
2
- //= require pg_rails/asociacion_creable
3
-
4
- document.addEventListener("DOMContentLoaded", function(event) {
5
- window.PgRails = new function() {
6
- pg_rails = this
7
- pg_rails.campo_dependiente_hacer = function(principal, dependiente, valor) {
8
- if( principal.val() == valor ) {
9
- dependiente.closest('.form-group').removeClass('ocultar')
10
- } else {
11
- dependiente.closest('.form-group').addClass('ocultar')
12
- }
13
- }
14
- pg_rails.encolumnar = function(principal, dependiente) {
15
- var fila = $('<div class="row">');
16
- fila = fila.insertBefore(principal.closest('.form-group'));
17
- var col1 = $('<div class="col-sm-6">');
18
- var col2 = $('<div class="col-sm-6">');
19
- col1.append(principal.closest('.form-group'));
20
- col2.append(dependiente.closest('.form-group'));
21
- fila.append(col1);
22
- fila.append(col2);
23
- }
24
- pg_rails.campo_dependiente = function(campo, depende_de, valor) {
25
- var principal = $('form.simple_form *[name*=' + depende_de + ']');
26
- var dependiente = $('form.simple_form *[name*=' + campo + ']');
27
- pg_rails.encolumnar(principal, dependiente)
28
- principal.change(function() {
29
- pg_rails.campo_dependiente_hacer(principal, dependiente, valor);
30
- })
31
- pg_rails.campo_dependiente_hacer(principal, dependiente, valor);
32
- }
33
- pg_rails.bindear = function(contexto) {
34
- if(contexto == null) {
35
- contexto = $('body');
36
- } else {
37
- contexto = $(contexto);
38
- }
39
- AsociacionCreable.bindear(contexto);
40
- $(contexto).find('.listado a[data-method=delete]').click(function(e) {
41
- var boton = this;
42
- e.preventDefault();
43
- e.stopPropagation();
44
- var url = $(this).attr('href');
45
- var confirmar = $(this).data('confirm');
46
- if(!confirmar) {
47
- confirmar = "¿Estás seguro?"
48
- }
49
- if( confirm(confirmar) ) {
50
- $.ajax(url, {
51
- dataType: 'json',
52
- method: 'DELETE',
53
- }).done(function(response) {
54
- if($(boton).closest('.smart-listing').length > 0) {
55
- $(boton).closest('.smart-listing').smart_listing().reload()
56
- } else {
57
- window.location.reload();
58
- }
59
- pg_rails.showToast("Elemento borrado");
60
- }).fail(function(response) {
61
- pg_rails.error_toast(response.responseJSON.error);
62
- });
63
- }
64
- })
65
- // $('.tooltip').remove();
66
- // $("[rel=tooltip]").tooltip({ boundary: 'window' });
67
- // $(contexto).find("[rel=tooltip]").tooltip();
68
- $(contexto).find('form.pg-form').each(function(i,e) {
69
- // $(e).validate();
70
- });
71
- if( typeof $.fn.best_in_place == 'function' ) {
72
- $(contexto).find('table:has(.best_in_place)').css('table-layout', 'fixed');
73
- $(contexto).find(".best_in_place").best_in_place();
74
- $(contexto).find(".best_in_place").on('ajax:error', function(event, response) {
75
- pg_rails.showToast("error", response.responseText)
76
- });
77
- $(contexto).find(".best_in_place").on('best_in_place:activate', function(event, response) {
78
- var textarea = $(this).find('textarea');
79
- if( textarea.length > 0 ) {
80
- var valor = textarea.val();
81
- valor = valor.replace(/<br>/g, "\n")
82
- textarea.val(valor)
83
- }
84
- });
85
- }
86
- // $(".best_in_place").on('ajax:success', function(event, response) {
87
- // pg_rails.showToast("success", "👍")
88
- // });
89
- if( typeof $.fn.datepicker == 'function' ) {
90
- $.fn.datepicker.defaults.format = 'dd/mm/yyyy';
91
- $(contexto).find('.datefield').datepicker({
92
- 'format': 'dd/mm/yyyy',
93
- 'todayBtn': 'linked',
94
- 'autoclose': 'true',
95
- 'language': 'es',
96
- 'zIndexOffset': 2000,
97
- });
98
- $(contexto).find('.datefield').on('changeDate', function() {
99
- $(this).keydown();
100
- });
101
- }
102
-
103
- if( typeof($.fn.selectize) == 'function' ) {
104
- $(contexto).find('select[multiple=multiple]').selectize();
105
- }
106
- if( typeof($.fn.chosen) == 'function' ) {
107
- $(contexto).find(".chosen-select:visible").chosen('destroy');
108
- $(contexto).find(".chosen-select:visible").chosen();
109
- contexto.on('shown.bs.collapse', function() {
110
- // Cuando hay un chosen en un collapse, lo inicializo al mostrarse
111
- contexto.find('.chosen-select:visible').chosen();
112
- })
113
- }
114
- $(contexto).find('form').dependent_fields();
115
- contexto.find('.pg_ajax_link:not(.bindeado)').each(function(i, elem) {
116
- $(this).addClass('bindeado');
117
- $(this).click(function() {
118
- $.get($(this).data('url'))
119
- })
120
- });
121
- }
122
-
123
- pg_rails.insert_options = function(element, options, default_option, template_id, atributo_nombre) {
124
- if (options.length === 0) {
125
- default_option = '-';
126
- }
127
-
128
- var template_html;
129
- if( template_id != null ) {
130
- template_html = $(template_id).html();
131
- } else {
132
- template_html = '<option value="">{{default_option}}</option>{{#each array}}<option value="{{id}}">{{' + atributo_nombre + '}}</option>{{/each}}'
133
- }
134
- var template = Handlebars.compile(template_html);
135
- element.html(template({array: options, default_option: default_option}));
136
- element.trigger("chosen:updated");
137
- }
138
-
139
- pg_rails.abrir_modal = function(contenido, titulo = '', opciones = {}) {
140
- var header = '<div class="modal-header">' +
141
- ' <h5 class="modal-title">' + titulo + '</h5>' +
142
- ' <button type="button" class="close" data-dismiss="modal" aria-label="Close">' +
143
- ' <span aria-hidden="true">&times;</span>' +
144
- ' </button>' +
145
- '</div>';
146
- if( opciones['dialog_class'] ) {
147
- var dialog_class = 'modal-dialog ' + opciones['dialog_class'];
148
- } else {
149
- var dialog_class = 'modal-dialog';
150
- }
151
- var modal = $('<div class="modal"><div class="' + dialog_class + '"><div class="modal-content">' + header + '<div class="modal-body">');
152
- modal.find('.modal-body').html(contenido);
153
- $('body').append(modal);
154
- modal.on('hidden.bs.modal', function() {
155
- // $(this).modal('dispose');
156
- $(this).remove();
157
- })
158
- modal.modal('show');
159
- return modal;
160
- }
161
-
162
- pg_rails.error_toast = function(message) {
163
- pg_rails.showToast("error", message);
164
- }
165
-
166
- pg_rails.showToast = function (type, message) {
167
- var title = null;
168
- if (type === "notice" || type === "success") {
169
- type="success";
170
- title = "Notificación";
171
- } else if (type === "alert" || type === "error") {
172
- type="error";
173
- title = "Error";
174
- } else if (type === "warning" ) {
175
- type="warning";
176
- title = "Advertencia";
177
- } else if (type === "info" ) {
178
- type="info";
179
- title = "Notificación";
180
- } else {
181
- message = type;
182
- title = "Notificación";
183
- type = "success";
184
- }
185
-
186
- if (typeof $.fn.toast == "function") {
187
- var template_html = "\
188
- <div class='toast toast-{{type}}' role='alert' aria-live='assertive' aria-atomic='true'>\
189
- <div class='toast-header'>\
190
- <strong class='mr-auto'>{{title}}</strong>\
191
- <button type='button' class='ml-2 mb-1 close' data-dismiss='toast' aria-label='Close'>\
192
- <span aria-hidden='true'>&times;</span>\
193
- </button>\
194
- </div>\
195
- <div class='toast-body'>\
196
- {{message}}\
197
- </div>\
198
- </div>";
199
-
200
- var template = Handlebars.compile(template_html);
201
- var toast = $(template({message: message, title: title, type: type}));
202
- $("#toast-container").append(toast);
203
- $(toast).toast({
204
- delay: 3000,
205
- // autohide: false,
206
- });
207
- $(toast).toast('show');
208
- $(toast).on('hidden.bs.toast', function () {
209
- $(toast).remove();
210
- })
211
- } else {
212
- if (window.toastr) {
213
- var shortCutFunction = type;
214
-
215
- title = "";
216
-
217
- window.toastr.options = {
218
- closeButton: true,
219
- debug: false,
220
- progressBar: true,
221
- preventDuplicates: false,
222
- positionClass: "toast-top-right",
223
- onclick: null,
224
- showDuration: "400",
225
- hideDuration: "1000",
226
- timeOut: "7000",
227
- extendedTimeOut: "1000",
228
- showEasing: "swing",
229
- hideEasing: "linear",
230
- showMethod: "fadeIn",
231
- hideMethod: "fadeOut"
232
- };
233
-
234
- $("#toastrOptions").text("Command: toastr["
235
- + shortCutFunction
236
- + "](\""
237
- + message
238
- + (title ? "\", \"" + title : '')
239
- + "\")\n\ntoastr.options = "
240
- + JSON.stringify(toastr.options, null, 2)
241
- );
242
- var $toast = window.toastr[shortCutFunction](message, title);
243
- } else {
244
- alert(message);
245
- }
246
- }
247
- }
248
-
249
- window.jQuery.fn.ocultar_campo = function() {
250
- this.hide();
251
- this.find('.chosen-select').addClass('ignore-validation');
252
- this.find("input:not(.keep-disabled), select:not(.keep-disabled)").attr("disabled",true);
253
- this.find("input, select").trigger("change"); //Esto es por si hay dependencias internas que se acomoden
254
- }
255
-
256
- window.jQuery.fn.mostrar_campo = function() {
257
- this.show();
258
- this.find('.chosen-select').removeClass('ignore-validation');
259
- this.find("input:not(.keep-disabled), select:not(.keep-disabled)").attr("disabled",false);
260
- this.find("input, select").trigger("change"); //Esto es por si hay dependencias internas que se acomoden
261
- }
262
-
263
- window.jQuery.fn.dependent_fields = function() {
264
- var that = this;
265
-
266
- var update_dependent = function() {
267
- var target = this;
268
- var options = {};
269
- options[$(target).data('key')] = $(this).val().toString();
270
- $.getJSON($(target).data('url'), options)
271
- .done(function(response) {
272
- // var id = $(target).data('id')
273
- // var siguiente_select = $("[data-id='"+id+"'] ~ select").first();
274
- var siguiente_select = $(target).nextAll('select').first()
275
- pg_rails.insert_options(siguiente_select, response, 'Seleccione una opción', null, 'to_s');
276
- $(siguiente_select).trigger('change');
277
- }).fail(function(response) { });
278
- }
279
-
280
- var bind_events = function(target) {
281
- var main = $(target).find('select').last();
282
- var selectores = $(target).find('select').not(main); // Todos menos el último
283
- $(selectores).each(function(i, selector) {
284
- $(selector).on('change', update_dependent);
285
- })
286
- }
287
-
288
- // TODO: Polemic
289
- $(that).on('nested:fieldAdded', function(event){
290
- var field = event.field;
291
- bind_events(field);
292
- });
293
-
294
- $(that).find('.form-group.dependent_fields').each(function(i, field) {
295
- bind_events(field);
296
- })
297
- }
298
- }
299
-
300
- $(document).on('nested:fieldAdded', function(event){
301
- PgRails.bindear(event.field);
302
- });
303
-
304
-
305
- // para que no se submiteen los forms al apretar enter en inputs que no son de submit
306
- $(document).ready(function() {
307
- $(window).keydown(function(event){
308
- if(event.keyCode == 13) {
309
- if( event.target.tagName == 'INPUT' && $(event.target).attr('type') != 'submit' &&
310
- !$(event.target).hasClass('allow-enter-submit')) {
311
- event.preventDefault();
312
- return false;
313
- }
314
- }
315
- });
316
- });
317
-
318
- });
@@ -1,5 +0,0 @@
1
- @import "bootstrap-datepicker.css";
2
- @import "chosen";
3
- @import "fontawesome-free-5.10.1-web/css/all";
4
- @import 'selectize';
5
- @import 'selectize.bootstrap3';
@@ -1,29 +0,0 @@
1
-
2
- body .chosen-container-active.chosen-with-drop .chosen-single {
3
- background: none;
4
- }
5
- body .chosen-container-single .chosen-single {
6
- padding-top: 2px;
7
- border: 1px solid #e5e6e7;
8
- border: 1px solid #ced4da;
9
- background: none;
10
- box-shadow: none;
11
- }
12
-
13
- .chosen-container.chosen-with-drop .chosen-drop {
14
- // margin-top: 0px;
15
- }
16
- .chosen-container-single a.chosen-single {
17
- height: 36px;
18
- line-height: 30px;
19
- }
20
- .chosen-container-single .chosen-single div {
21
- padding-top: 5px;
22
- }
23
- .chosen-container-single .chosen-drop {
24
- min-width: 190px;
25
- margin-top: -3px;
26
- }
27
- .chosen-container.chosen-container-single .chosen-single {
28
- border-radius: 4px;
29
- }
@@ -1,199 +0,0 @@
1
- // @import 'pg_rails/pg_chosen';
2
-
3
- // Google Maps Places API
4
- // Para que funcione en los modales
5
- .pac-container {
6
- z-index: 1051 !important;
7
- }
8
-
9
- .simple_form {
10
- .ocultar {
11
- input, select, textarea {
12
- display: none;
13
- }
14
- }
15
- }
16
- .form-group.asociacion_creable {
17
- input.oculto {
18
- visibility: hidden;
19
- position: absolute;
20
- }
21
-
22
- &:not(.completado) {
23
- .borrar_seleccion {
24
- display: none;
25
- }
26
- }
27
- }
28
- // oculto la columna de actions
29
- .modal-seleccionar-asociado .listado th:last-child,
30
- .modal-seleccionar-asociado .listado td:last-child {
31
- display: none;
32
- }
33
- .modal-seleccionar-asociado .listado {
34
- td {
35
- cursor: pointer;
36
- }
37
- }
38
- .modal-seleccionar-asociado .listado tr:hover {
39
- background-color: lightgrey;
40
- }
41
-
42
- .listado {
43
- td, th {
44
- padding: 0.25rem 1rem;
45
- }
46
- }
47
- .listado .btn-xs {
48
- margin-right: 4px;
49
- }
50
- .listado .btn-sm {
51
- min-width: 25px;
52
- height: 25px;
53
- padding: 1px;
54
- margin-right: 4px;
55
- }
56
-
57
- .form-group.producto {
58
- .form-control.selectize-control {
59
- height: 36px;
60
- // width: 200px;
61
- }
62
- .chosen-container {
63
- // max-width: 200px;
64
- }
65
- }
66
- // hay que agregar la clase pg-form a los forms que queremos afectar
67
- .pg-form {
68
- max-width: 1000px;
69
-
70
- .form-control {
71
- font-size: 13px;
72
- }
73
-
74
- .form-control.selectize-control {
75
- height: 36px;
76
- }
77
- .form-group {
78
- /*transition: height .5s ease 0s;*/
79
- transition: opacity .3s ease 0s;
80
- opacity: 1;
81
- max-width: 300px;
82
- margin-bottom: 6px;
83
-
84
- &.datetime {
85
- max-width: 600px;
86
- }
87
-
88
- &.dependent_fields {
89
- max-width: 600px;
90
- }
91
-
92
- &.ocultar {
93
- /*height: 0px;*/
94
- opacity: 0;
95
- }
96
- }
97
-
98
- .form-control.error {
99
- border: 1px solid red;
100
- }
101
-
102
- label.error {
103
- color: red;
104
- }
105
- }
106
-
107
- .filter {
108
- display: inline-block;
109
- // margin-right: 10px;
110
- // margin-bottom: 10px;
111
- vertical-align: top;
112
- min-width: 200px;
113
-
114
- .input-group {
115
- width: 230px;
116
- }
117
- }
118
-
119
- .dependent_fields select {
120
- // width: calc(99% / 2);
121
- // width: 500px;
122
- display: block;
123
- margin-bottom: 15px;
124
- }
125
-
126
- .dependent_fields label {
127
- display: block;
128
- text-align: left!important;
129
- }
130
-
131
- .dependent_fields {
132
- // max-width: 400px;
133
- }
134
-
135
- .btn.exportar:hover {
136
- cursor: pointer;
137
- }
138
-
139
-
140
- // Editar en lugar
141
- .editar_en_lugar_v2 {
142
- cursor: pointer;
143
- text-decoration: underline dotted lightgrey;
144
- }
145
- .editar_en_lugar_v2::after {
146
- padding-left: 13px;
147
- content: '✎';
148
- opacity: 0;
149
- }
150
- .editar_en_lugar_v2:hover::after {
151
- opacity: 1;
152
- }
153
-
154
- .editar_en_lugar_v2 form {
155
- display: inline-block!important;
156
- }
157
- .editar_en_lugar_v2 input {
158
- display: inline-block;
159
- }
160
- .editar_en_lugar_v2 input[type=submit] {
161
- margin-left: 10px;
162
- }
163
-
164
- .pg_ajax_link {
165
- cursor: pointer;
166
- color: #337ab7;
167
- text-decoration: none;
168
- }
169
- .pg_ajax_link:hover {
170
- color: #23527c;
171
- text-decoration: underline;
172
- }
173
-
174
- .pg-max-width-xxs {
175
- max-width: 350px;
176
- }
177
- .pg-max-width-xs {
178
- max-width: 450px;
179
- }
180
- .pg-max-width-sm {
181
- max-width: 600px;
182
- }
183
- .pg-max-width {
184
- max-width: 800px;
185
- }
186
- .pg-max-width-lg {
187
- max-width: 1000px;
188
- }
189
- .pg-max-width-xl {
190
- max-width: 1200px;
191
- }
192
-
193
- .pg-revert-width {
194
- width: revert;
195
- }
196
-
197
- .pg-form input.date {
198
- max-width: 140px;
199
- }
@@ -1,10 +0,0 @@
1
- // estilos para Bootstrap 3
2
-
3
- @import 'pg_rails/pg_rails';
4
-
5
- .pg-form {
6
- .dropdown-menu > li > a {
7
- padding: 6px 20px;
8
- font-size: 14px;
9
- }
10
- }
@@ -1,12 +0,0 @@
1
- // estilos para Bootstrap 4
2
-
3
- @import "bootstrap-4.4.1/bootstrap";
4
- @import 'pg_rails/pg_rails';
5
-
6
- .tooltip { pointer-events: none; }
7
-
8
- .form-group.asociacion_creable {
9
- button {
10
- font-size: 11px;
11
- }
12
- }
@@ -1 +0,0 @@
1
- @import 'pg_rails/pg_rails';