pg_rails 7.3.5 → 7.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78a7c2d3d7277352e4c78b167e2d106a0d6fe1be83a1f5f27d3eacd00c0fb6f7
4
- data.tar.gz: a066552a098bf72375cb3957a53b3f4db473d640ceeeaee833942e181ff057d5
3
+ metadata.gz: 5588099f1a49f3ec2824e706a5a3f32b6434bcf8c06c631893326649a93fcb0c
4
+ data.tar.gz: ab53c02854cea2a04ba5f5dd9400621deab673df6df7e38e309d724b9962d42a
5
5
  SHA512:
6
- metadata.gz: edd3474ce84d32bddd24aa4b010c77c909534874eb8e8101468c7e5ebdf83b9b3db43c245049fae39ca716b79cc582315c81c14b5cdde6117d474b5c2aafeec3
7
- data.tar.gz: cf514c46e8737deaac130cef0049b9e2fec7852948e946cff30b94a97134dbb8dd938b1be95a2e86a140152ad20c396508776a0e86c3bac8f21db5272435b0d1
6
+ metadata.gz: c18c347c8d3e95e24c4bf8b81cefb3a29a3fa5375072fb554aa1647b784b53a471f68481562504689c930854bc9c67898471dc620c8a264179ad291638879d33
7
+ data.tar.gz: 7e8f1c56e3df3ac5e918cf59f4edf1857640014ccc3d422d6f6668981e260d51072e5b73eeb8a40d7fb1fc5ff1398cf58cd2ead5aef358519c1469b6e54b5163
@@ -15,7 +15,7 @@ class InternalErrorComponent < BaseComponent
15
15
  </div>
16
16
  Por favor, intentá nuevamente
17
17
  <br>
18
- o <a class="text-decoration-underline" href="<%= new_public_mensaje_contacto_path %>">dejá un mensaje</a>
18
+ o <a class="text-decoration-underline" href="<%= new_public_mensaje_contacto_path %>" data-turbo="false">dejá un mensaje</a>
19
19
  para que te avisemos
20
20
  <br>
21
21
  cuando el problema esté resuelto 🙏
@@ -379,7 +379,7 @@ module PgEngine
379
379
  def render_listing
380
380
  total = @collection.count
381
381
  current_page = params[:page].presence&.to_i || 1
382
- if current_page_size * (current_page - 1) > total
382
+ if current_page_size * (current_page - 1) >= total
383
383
  current_page = (total.to_f / current_page_size).ceil
384
384
  end
385
385
  @collection = @collection.page(current_page).per(current_page_size)
@@ -96,7 +96,7 @@ module PgEngine
96
96
  @navbar_chevron_class = navbar_expanded ? 'bi-chevron-left' : 'bi-chevron-right'
97
97
  @navbar = Navbar.new(Current.user)
98
98
 
99
- if Rollbar.configuration.enabled && Rails.application.credentials.rollbar.present?
99
+ if defined?(Rollbar) && Rollbar.configuration.enabled && Rails.application.credentials.rollbar.present?
100
100
  @rollbar_token = Rails.application.credentials.rollbar.access_token_client
101
101
  end
102
102
 
@@ -1,5 +1,15 @@
1
1
  module PgEngine
2
2
  class DeviseController < ApplicationController
3
+ prepend_before_action only: :create do
4
+ rate_limiting(
5
+ to: 10,
6
+ within: 1.hour,
7
+ by: -> { request.remote_ip },
8
+ with: -> { head :too_many_requests },
9
+ store: cache_store
10
+ )
11
+ end
12
+
3
13
  before_action :configure_permitted_parameters
4
14
  before_action do
5
15
  @no_main_frame = true
@@ -4,6 +4,16 @@
4
4
 
5
5
  module Public
6
6
  class MensajeContactosController < PublicController
7
+ prepend_before_action only: :create do
8
+ rate_limiting(
9
+ to: 3,
10
+ within: 1.hour,
11
+ by: -> { request.remote_ip },
12
+ with: -> { head :too_many_requests },
13
+ store: cache_store
14
+ )
15
+ end
16
+
7
17
  include PgEngine::Resource
8
18
 
9
19
  self.clase_modelo = MensajeContacto
@@ -1,3 +1,4 @@
1
+ if defined? ActiveAdmin
1
2
  class MyAdapter < ActiveAdmin::AuthorizationAdapter
2
3
  def authorized?(action, subject = nil)
3
4
  user.developer?
@@ -356,3 +357,4 @@ ActiveAdmin.setup do |config|
356
357
  #
357
358
  # config.use_webpacker = true
358
359
  end
360
+ end
@@ -1,3 +1,4 @@
1
+ if defined? Rollbar
1
2
  Rollbar.configure do |config|
2
3
  # Without configuration, Rollbar is enabled in all environments.
3
4
  # To disable in specific environments, set config.enabled=false.
@@ -89,3 +90,4 @@ Rollbar.configure do |config|
89
90
  acceptable_levels.include?(item[:level].to_sym) ? 'gogoogogooo' : 'ignored'
90
91
  end
91
92
  end
93
+ end
@@ -1,4 +1,5 @@
1
1
  Rails.autoloaders.main.ignore(
2
+ "#{Rails.root}/app/admin",
2
3
  "#{PgEngine::Engine.root}/app/admin",
3
4
  "#{PgEngine::Engine.root}/app/assets",
4
5
  "#{PgEngine::Engine.root}/app/javascript",
@@ -35,7 +35,9 @@ Rails.application.routes.draw do
35
35
  pg_resource(:user_accounts)
36
36
  get 'login_as', to: 'users#login_as'
37
37
  end
38
- ActiveAdmin.routes(self)
38
+ if defined? ActiveAdmin
39
+ ActiveAdmin.routes(self)
40
+ end
39
41
  end
40
42
 
41
43
  # Prefix Verb URI Pattern Controller#Action
@@ -28,7 +28,7 @@ module PgEngine
28
28
  initializer 'pg_engine.set_factory_paths', after: 'factory_bot.set_factory_paths' do
29
29
  # Para que tome las factories de pg_engine/spec/factories
30
30
  # además de las de dummy/spec/factories
31
- FactoryBot.definition_file_paths << "#{root}/spec/factories"
31
+ FactoryBot.definition_file_paths << "#{root}/spec/factories" if defined? FactoryBot
32
32
  end
33
33
 
34
34
  initializer 'configurar_pg_rails' do
@@ -35,14 +35,12 @@ require 'discard'
35
35
  require 'audited'
36
36
  require 'pundit'
37
37
  require 'dotenv-rails'
38
- require 'faker'
39
38
  require 'puma'
40
39
  require 'rollbar'
41
40
  require 'sprockets/rails'
42
41
  require 'jsbundling-rails'
43
42
  require 'cssbundling-rails'
44
43
  require 'turbo-rails'
45
- require 'activeadmin'
46
44
  require 'sassc'
47
45
  require 'image_processing'
48
46
  require 'hashid/rails'
@@ -52,6 +50,7 @@ require 'mailgun-ruby'
52
50
  require 'pg_search'
53
51
  require 'view_component'
54
52
  require 'noticed'
53
+ require 'ransack'
55
54
  require 'ransack_memory'
56
55
  require 'holidays'
57
56
 
@@ -74,6 +73,7 @@ if Rails.env.local?
74
73
  # require 'spring-commands-rspec'
75
74
  require 'rspec-rails'
76
75
  require 'factory_bot_rails'
76
+ require 'faker'
77
77
  require 'rails-controller-testing'
78
78
  end
79
79
 
@@ -3,8 +3,9 @@
3
3
 
4
4
  import './set_consumer'
5
5
  import './progress_bar'
6
-
7
6
  import '@hotwired/turbo-rails'
7
+ import { flashMessage } from 'pg_rails/utils'
8
+ import Rollbar from 'rollbar'
8
9
 
9
10
  // TODO: testear con capybara
10
11
  document.addEventListener('turbo:before-cache', () => {
@@ -22,6 +23,25 @@ document.addEventListener('turbo:before-cache', () => {
22
23
  })
23
24
  })
24
25
 
26
+ document.addEventListener('turbo:frame-missing', (ev) => {
27
+ Rollbar.error('Turbo Frame missing')
28
+ ev.preventDefault()
29
+ const html = `
30
+ <div>
31
+ <div class="mb-1">
32
+ Ocurrió algo inesperado
33
+ </div>
34
+ Por favor, intentá nuevamente
35
+ <br>
36
+ o <a class="text-decoration-underline" href="/contacto" data-turbo="false">dejá un mensaje</a>
37
+ para que te avisemos
38
+ <br>
39
+ cuando el problema esté resuelto 🙏
40
+ </div>
41
+ `
42
+
43
+ flashMessage(html, 'alert')
44
+ })
25
45
  // document.addEventListener('turbo:before-stream-render', function () { console.log('turbo:before-stream-render') })
26
46
  // document.addEventListener('turbo:render', function () { console.log('turbo:render') })
27
47
  // document.addEventListener('turbo:before-render', function () { console.log('turbo:before-render') })
@@ -28,7 +28,8 @@ html
28
28
  meta name="cable-history-timestamp" content="#{Time.now.to_i}"
29
29
  = csrf_meta_tags
30
30
  = csp_meta_tag
31
- = action_cable_with_jwt_meta_tag
31
+ - if defined?(AnyCable::Rails)
32
+ = action_cable_with_jwt_meta_tag
32
33
 
33
34
  = stylesheet_link_tag 'application', 'data-turbo-track': 'reload'
34
35
  = javascript_include_tag 'application', 'data-turbo-track': 'reload', type: 'module'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.3.5'
4
+ VERSION = '7.4.1'
5
5
  end
@@ -1,15 +1,17 @@
1
1
  module PgScaffold
2
2
  class Railtie < ::Rails::Railtie
3
3
  initializer 'configurar_generators', after: 'factory_bot.set_fixture_replacement' do
4
- require_relative 'monkey_patches/mejoras_de_atributos'
5
- require_relative 'monkey_patches/mejoras_a_named_base'
4
+ unless Rails.env.production?
5
+ require_relative 'monkey_patches/mejoras_de_atributos'
6
+ require_relative 'monkey_patches/mejoras_a_named_base'
6
7
 
7
- config.app_generators do |g|
8
- g.test_framework :pg_rspec
9
- g.orm :pg_active_record
8
+ config.app_generators do |g|
9
+ g.test_framework :pg_rspec
10
+ g.orm :pg_active_record
10
11
 
11
- g.fallbacks[:pg_rspec] = :rspec
12
- g.fallbacks[:pg_active_record] = :active_record
12
+ g.fallbacks[:pg_rspec] = :rspec
13
+ g.fallbacks[:pg_active_record] = :active_record
14
+ end
13
15
  end
14
16
  end
15
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.3.5
4
+ version: 7.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martín Rosso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-30 00:00:00.000000000 Z
11
+ date: 2024-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails