pg_rails 7.0.8.pre.alpha.14 → 7.0.8.pre.alpha.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/pg_engine/app/controllers/concerns/pg_engine/resource.rb +5 -0
- data/pg_engine/app/helpers/pg_engine/pg_rails_helper.rb +3 -3
- data/pg_engine/config/initializers/anycable.rb +13 -0
- data/pg_engine/config/initializers/cable_ready.rb +29 -0
- data/pg_engine/lib/pg_engine/error.rb +4 -0
- data/pg_engine/lib/pg_engine/utils/pg_logger.rb +35 -6
- data/pg_engine/lib/pg_engine.rb +1 -0
- data/pg_engine/spec/helpers/pg_engine/pg_rails_helper_spec.rb +7 -7
- data/pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb +68 -2
- data/pg_layout/app/assets/stylesheets/animations.scss +4 -0
- data/pg_layout/{index.js → app/javascript/application.js} +6 -12
- data/pg_layout/app/javascript/channels/consumer.js +8 -0
- data/pg_layout/app/javascript/channels/index.js +4 -0
- data/pg_layout/app/javascript/config/cable_ready.js +24 -0
- data/pg_layout/app/javascript/config/index.js +1 -0
- data/pg_layout/app/javascript/controllers/application.js +4 -0
- data/pg_layout/app/javascript/controllers/index.js +11 -0
- data/pg_layout/app/javascript/{navbar_controller.js → controllers/navbar_controller.js} +1 -1
- data/pg_layout/app/views/layouts/pg_layout/devise.html.slim +2 -1
- data/pg_layout/app/views/layouts/pg_layout/layout.html.slim +4 -1
- data/pg_layout/app/views/pg_layout/_flash.html.slim +2 -0
- data/pg_rails/js/index.js +1 -1
- data/pg_rails/lib/pg_rails/vcr_support.rb +7 -0
- data/pg_rails/lib/version.rb +1 -1
- metadata +18 -9
- /data/pg_layout/app/javascript/{fadein_onload_controller.js → controllers/fadein_onload_controller.js} +0 -0
- /data/pg_layout/app/javascript/{nested_controller.js → controllers/nested_controller.js} +0 -0
- /data/pg_layout/app/javascript/{pg_form_controller.js → controllers/pg_form_controller.js} +0 -0
- /data/pg_layout/app/javascript/{cookies.js → utils/cookies.js} +0 -0
- /data/pg_layout/app/javascript/{utils.ts → utils/utils.ts} +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 917b686081345cf1d79fb59f3d05a3d288f71f6a9ac223cfa40100a5e897b1c3
         | 
| 4 | 
            +
              data.tar.gz: c21bd06ca22bbabf0701fe3450c09e034d037b7fad3d4bddf4dd6fbd748f6c8d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: ac9c3923a030194773608e8c1231b20044b835aed08b4d9e45705828de5dee18bd770f5736b1525044f0e8da7144ae210552ac5c4f475dea8f4e2e40d2ea4a9c
         | 
| 7 | 
            +
              data.tar.gz: cf395aec16915d30e753bebe8120f8ee9255c8bcd8631b621b72bb12622a94aa26b9aa8e09cabce2d6990a6829e87695d946b1a7af7ce8443dcffd689fd40c83
         | 
| @@ -272,10 +272,15 @@ module PgEngine | |
| 272 272 | 
             
                end
         | 
| 273 273 |  | 
| 274 274 | 
             
                def do_sort(scope, field, direction)
         | 
| 275 | 
            +
                  # TODO: restringir ciertos campos?
         | 
| 275 276 | 
             
                  unless scope.model.column_names.include? field.to_s
         | 
| 276 277 | 
             
                    PgLogger.warn("No existe el campo \"#{field}\"", :warn)
         | 
| 277 278 | 
             
                    return scope
         | 
| 278 279 | 
             
                  end
         | 
| 280 | 
            +
                  unless direction.to_sym.in? %i[asc desc]
         | 
| 281 | 
            +
                    PgLogger.warn("Direction not valid: \"#{direction}\"", :warn)
         | 
| 282 | 
            +
                    return scope
         | 
| 283 | 
            +
                  end
         | 
| 279 284 | 
             
                  scope = scope.order(field => direction)
         | 
| 280 285 | 
             
                  instance_variable_set(:@field, field)
         | 
| 281 286 | 
             
                  instance_variable_set(:@direction, direction)
         | 
| @@ -8,7 +8,7 @@ module PgEngine | |
| 8 8 | 
             
                  current_user&.current_account
         | 
| 9 9 | 
             
                end
         | 
| 10 10 |  | 
| 11 | 
            -
                def img_placeholder(src  | 
| 11 | 
            +
                def img_placeholder(src: nil, width: '100%', height: '100%', fade_in: false, **img_opts)
         | 
| 12 12 | 
             
                  if fade_in || src.nil?
         | 
| 13 13 | 
             
                    img_opts = img_opts.merge(style: [img_opts[:style], 'display:none'].compact.join(';'))
         | 
| 14 14 | 
             
                    do_placeholder(src, width:, height:, **img_opts)
         | 
| @@ -20,8 +20,8 @@ module PgEngine | |
| 20 20 | 
             
                private
         | 
| 21 21 |  | 
| 22 22 | 
             
                def do_placeholder(src = nil, width: '100%', height: '100%', **img_opts)
         | 
| 23 | 
            -
                  content_tag('div', class: 'placeholder-glow') do
         | 
| 24 | 
            -
                    content_tag('div', class: 'placeholder | 
| 23 | 
            +
                  content_tag('div', class: 'placeholder-glow', style: "width: #{width}; height: #{height}") do
         | 
| 24 | 
            +
                    content_tag('div', class: 'placeholder w-100 h-100') do
         | 
| 25 25 | 
             
                      if src.present?
         | 
| 26 26 | 
             
                        image_tag src,
         | 
| 27 27 | 
             
                                  'data-controller': 'fadein_onload',
         | 
| @@ -0,0 +1,13 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # Add Warden middleware to AnyCable stack to allow accessing
         | 
| 4 | 
            +
            # Devise current user via `env["warden"].user`.
         | 
| 5 | 
            +
            #
         | 
| 6 | 
            +
            # See https://docs.anycable.io/ruby/authentication
         | 
| 7 | 
            +
            #
         | 
| 8 | 
            +
            # NOTE: This is only needed in environments where you use AnyCable.
         | 
| 9 | 
            +
            if defined?(AnyCable::Rails)
         | 
| 10 | 
            +
              AnyCable::Rails::Rack.middleware.use Warden::Manager do |config|
         | 
| 11 | 
            +
                Devise.warden_config = config
         | 
| 12 | 
            +
              end
         | 
| 13 | 
            +
            end
         | 
| @@ -0,0 +1,29 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
            Dotenv.load
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            CableReady.configure do |config|
         | 
| 5 | 
            +
              # Enable/disable exiting / warning when the sanity checks fail options:
         | 
| 6 | 
            +
              # `:exit` or `:warn` or `:ignore`
         | 
| 7 | 
            +
              #
         | 
| 8 | 
            +
              # config.on_failed_sanity_checks = :exit
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              # Enable/disable assets compilation
         | 
| 11 | 
            +
              # `true` or `false`
         | 
| 12 | 
            +
              #
         | 
| 13 | 
            +
              # config.precompile_assets = true
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              # Define your own custom operations
         | 
| 16 | 
            +
              # https://cableready.stimulusreflex.com/customization#custom-operations
         | 
| 17 | 
            +
              #
         | 
| 18 | 
            +
              # config.add_operation_name :jazz_hands
         | 
| 19 | 
            +
             | 
| 20 | 
            +
              # Change the default Active Job queue used for broadcast_later and broadcast_later_to
         | 
| 21 | 
            +
              #
         | 
| 22 | 
            +
              # config.broadcast_job_queue = :default
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              # Specify a default debounce time for CableReady::Updatable callbacks
         | 
| 25 | 
            +
              # Doing so is a best practice to avoid heavy ActionCable traffic
         | 
| 26 | 
            +
              #
         | 
| 27 | 
            +
              # config.updatable_debounce_time = 0.1.seconds
         | 
| 28 | 
            +
              config.verifier_key = ENV.fetch('ANYCABLE_CABLE_READY_KEY')
         | 
| 29 | 
            +
            end
         | 
| @@ -2,10 +2,20 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            require 'rainbow'
         | 
| 4 4 |  | 
| 5 | 
            +
            # TODO: poder pasar blocks
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            def pg_err(obj)
         | 
| 8 | 
            +
              PgEngine::PgLogger.error(obj)
         | 
| 9 | 
            +
            end
         | 
| 10 | 
            +
             | 
| 5 11 | 
             
            def pg_warn(obj, type = :error)
         | 
| 6 12 | 
             
              PgEngine::PgLogger.warn(obj, type)
         | 
| 7 13 | 
             
            end
         | 
| 8 14 |  | 
| 15 | 
            +
            def pg_log(obj, type = :debug)
         | 
| 16 | 
            +
              PgEngine::PgLogger.warn("#{obj.inspect} (#{obj.class})", type)
         | 
| 17 | 
            +
            end
         | 
| 18 | 
            +
             | 
| 9 19 | 
             
            module PgEngine
         | 
| 10 20 | 
             
              class PgLogger
         | 
| 11 21 | 
             
                class << self
         | 
| @@ -18,9 +28,22 @@ module PgEngine | |
| 18 28 | 
             
                  #   Rollbar.warning("#{mensaje}\n\n#{caller.join("\n")}")
         | 
| 19 29 | 
             
                  # end
         | 
| 20 30 |  | 
| 31 | 
            +
                  def error(obj)
         | 
| 32 | 
            +
                    # TODO: arreglar
         | 
| 33 | 
            +
                    # Si es dev o test lanzo el error y si no, lo logueo para que no le salte al usuario
         | 
| 34 | 
            +
                    # raise obj if Rails.env.local? && ENV.fetch('RAISE_ERRORS', nil).present?
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                    mensaje = if obj.is_a?(Exception) && obj.backtrace.present?
         | 
| 37 | 
            +
                                "#{obj.inspect}\nBacktrace:\n#{cleaner.clean(obj.backtrace).join("\n")}"
         | 
| 38 | 
            +
                              else
         | 
| 39 | 
            +
                                obj
         | 
| 40 | 
            +
                              end
         | 
| 41 | 
            +
                    notify(mensaje, :error)
         | 
| 42 | 
            +
                  end
         | 
| 43 | 
            +
             | 
| 21 44 | 
             
                  def warn(obj, type = :error)
         | 
| 22 | 
            -
                    mensaje = if obj.is_a?  | 
| 23 | 
            -
                                obj. | 
| 45 | 
            +
                    mensaje = if obj.is_a?(Exception) && obj.backtrace.present?
         | 
| 46 | 
            +
                                "#{obj.inspect}\nBacktrace:\n#{cleaner.clean(obj.backtrace).join("\n")}"
         | 
| 24 47 | 
             
                              else
         | 
| 25 48 | 
             
                                obj
         | 
| 26 49 | 
             
                              end
         | 
| @@ -37,18 +60,22 @@ module PgEngine | |
| 37 60 | 
             
                  end
         | 
| 38 61 |  | 
| 39 62 | 
             
                  def titulo(mensaje, type)
         | 
| 40 | 
            -
                    Rainbow(mensaje).bold.send(color_for(type))
         | 
| 63 | 
            +
                    Rainbow("#{type.to_s.upcase}: #{mensaje}").bold.send(color_for(type))
         | 
| 41 64 | 
             
                  end
         | 
| 42 65 |  | 
| 43 66 | 
             
                  def detalles(type)
         | 
| 44 | 
            -
                    Rainbow(" | 
| 67 | 
            +
                    Rainbow("  called in #{bktrc[0]}").send(color_for(type))
         | 
| 45 68 | 
             
                  end
         | 
| 46 69 |  | 
| 47 | 
            -
                  def  | 
| 70 | 
            +
                  def cleaner
         | 
| 48 71 | 
             
                    bc = ActiveSupport::BacktraceCleaner.new
         | 
| 49 72 | 
             
                    bc.add_filter   { |line| line.gsub(%r{.*pg_rails/}, '') }
         | 
| 50 73 | 
             
                    bc.add_silencer { |line| /pg_logger/.match?(line) }
         | 
| 51 | 
            -
                    bc | 
| 74 | 
            +
                    bc
         | 
| 75 | 
            +
                  end
         | 
| 76 | 
            +
             | 
| 77 | 
            +
                  def bktrc
         | 
| 78 | 
            +
                    cleaner.clean(caller)
         | 
| 52 79 | 
             
                  end
         | 
| 53 80 |  | 
| 54 81 | 
             
                  def color_for(type)
         | 
| @@ -57,6 +84,8 @@ module PgEngine | |
| 57 84 | 
             
                      :blue
         | 
| 58 85 | 
             
                    when :warn
         | 
| 59 86 | 
             
                      :yellow
         | 
| 87 | 
            +
                    when :debug
         | 
| 88 | 
            +
                      :orange
         | 
| 60 89 | 
             
                    else # :error
         | 
| 61 90 | 
             
                      :red
         | 
| 62 91 | 
             
                    end
         | 
    
        data/pg_engine/lib/pg_engine.rb
    CHANGED
    
    
| @@ -3,7 +3,7 @@ require 'rails_helper' | |
| 3 3 | 
             
            describe PgEngine::PgRailsHelper do
         | 
| 4 4 | 
             
              describe '#img_placeholder' do
         | 
| 5 5 | 
             
                it 'si no es fade_in' do
         | 
| 6 | 
            -
                  asd = img_placeholder('bla', fade_in: false, class: 'img-fluid', style: 'color:red')
         | 
| 6 | 
            +
                  asd = img_placeholder(src: 'bla', fade_in: false, class: 'img-fluid', style: 'color:red')
         | 
| 7 7 | 
             
                  expectation = <<~HTML
         | 
| 8 8 | 
             
                    <img class="img-fluid" style="color:red" src="/images/bla" />
         | 
| 9 9 | 
             
                  HTML
         | 
| @@ -11,10 +11,10 @@ describe PgEngine::PgRailsHelper do | |
| 11 11 | 
             
                end
         | 
| 12 12 |  | 
| 13 13 | 
             
                it 'si tiene style' do
         | 
| 14 | 
            -
                  asd = img_placeholder('bla', fade_in: true, class: 'img-fluid', style: 'color:red')
         | 
| 14 | 
            +
                  asd = img_placeholder(src: 'bla', fade_in: true, class: 'img-fluid', style: 'color:red')
         | 
| 15 15 | 
             
                  expectation = <<~HTML
         | 
| 16 | 
            -
                    <div class="placeholder-glow">
         | 
| 17 | 
            -
                      <div class="placeholder | 
| 16 | 
            +
                    <div class="placeholder-glow" style="width: 100%; height: 100%">
         | 
| 17 | 
            +
                      <div class="placeholder w-100 h-100">
         | 
| 18 18 | 
             
                      <img data-controller="fadein_onload" class="img-fluid" style="color:red;display:none" src="/images/bla" />
         | 
| 19 19 | 
             
                      </div>
         | 
| 20 20 | 
             
                    </div>
         | 
| @@ -23,10 +23,10 @@ describe PgEngine::PgRailsHelper do | |
| 23 23 | 
             
                end
         | 
| 24 24 |  | 
| 25 25 | 
             
                it 'si no tiene style' do
         | 
| 26 | 
            -
                  asd = img_placeholder('bla', fade_in: true, class: 'img-fluid')
         | 
| 26 | 
            +
                  asd = img_placeholder(src: 'bla', fade_in: true, class: 'img-fluid')
         | 
| 27 27 | 
             
                  expectation = <<~HTML
         | 
| 28 | 
            -
                    <div class="placeholder-glow">
         | 
| 29 | 
            -
                      <div class="placeholder | 
| 28 | 
            +
                    <div class="placeholder-glow" style="width: 100%; height: 100%">
         | 
| 29 | 
            +
                      <div class="placeholder w-100 h-100">
         | 
| 30 30 | 
             
                      <img data-controller="fadein_onload" class="img-fluid" style="display:none" src="/images/bla" />
         | 
| 31 31 | 
             
                      </div>
         | 
| 32 32 | 
             
                    </div>
         | 
| @@ -1,8 +1,43 @@ | |
| 1 1 | 
             
            require 'rails_helper'
         | 
| 2 2 |  | 
| 3 | 
            -
            TYPES = %i[error warn info].freeze
         | 
| 3 | 
            +
            TYPES = %i[error warn info debug].freeze
         | 
| 4 4 |  | 
| 5 5 | 
             
            describe PgEngine::PgLogger do
         | 
| 6 | 
            +
              describe '#pg_err' do
         | 
| 7 | 
            +
                before do
         | 
| 8 | 
            +
                  TYPES.each do |type|
         | 
| 9 | 
            +
                    allow(Rails.logger).to receive(type)
         | 
| 10 | 
            +
                    allow(Rollbar).to receive(type)
         | 
| 11 | 
            +
                  end
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                shared_examples 'logger' do |type|
         | 
| 15 | 
            +
                  it do
         | 
| 16 | 
            +
                    expect(Rails.logger).to have_received(type).twice
         | 
| 17 | 
            +
                  end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                  it do
         | 
| 20 | 
            +
                    expect(Rollbar).to have_received(type).once
         | 
| 21 | 
            +
                  end
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                context 'con string' do
         | 
| 25 | 
            +
                  before { pg_err('bla') }
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                  it_behaves_like 'logger', :error
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                context 'con exception' do
         | 
| 31 | 
            +
                  before do
         | 
| 32 | 
            +
                    raise StandardError, 'bla'
         | 
| 33 | 
            +
                  rescue StandardError => e
         | 
| 34 | 
            +
                    pg_err(e)
         | 
| 35 | 
            +
                  end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                  it_behaves_like 'logger', :error
         | 
| 38 | 
            +
                end
         | 
| 39 | 
            +
              end
         | 
| 40 | 
            +
             | 
| 6 41 | 
             
              describe '#pg_warn' do
         | 
| 7 42 | 
             
                before do
         | 
| 8 43 | 
             
                  TYPES.each do |type|
         | 
| @@ -30,9 +65,40 @@ describe PgEngine::PgLogger do | |
| 30 65 | 
             
                end
         | 
| 31 66 |  | 
| 32 67 | 
             
                context 'con exception' do
         | 
| 33 | 
            -
                  before  | 
| 68 | 
            +
                  before do
         | 
| 69 | 
            +
                    raise StandardError, 'bla'
         | 
| 70 | 
            +
                  rescue StandardError => e
         | 
| 71 | 
            +
                    pg_warn(e)
         | 
| 72 | 
            +
                  end
         | 
| 34 73 |  | 
| 35 74 | 
             
                  it_behaves_like 'logger', :error
         | 
| 36 75 | 
             
                end
         | 
| 37 76 | 
             
              end
         | 
| 77 | 
            +
             | 
| 78 | 
            +
              describe '#pg_log' do
         | 
| 79 | 
            +
                before do
         | 
| 80 | 
            +
                  TYPES.each do |type|
         | 
| 81 | 
            +
                    allow(Rails.logger).to receive(type)
         | 
| 82 | 
            +
                    allow(Rollbar).to receive(type)
         | 
| 83 | 
            +
                  end
         | 
| 84 | 
            +
                end
         | 
| 85 | 
            +
             | 
| 86 | 
            +
                shared_examples 'logger' do |type|
         | 
| 87 | 
            +
                  it do
         | 
| 88 | 
            +
                    expect(Rails.logger).to have_received(type).twice
         | 
| 89 | 
            +
                  end
         | 
| 90 | 
            +
             | 
| 91 | 
            +
                  it do
         | 
| 92 | 
            +
                    expect(Rollbar).to have_received(type).once
         | 
| 93 | 
            +
                  end
         | 
| 94 | 
            +
                end
         | 
| 95 | 
            +
             | 
| 96 | 
            +
                TYPES.each do |type|
         | 
| 97 | 
            +
                  context "con type #{type}" do
         | 
| 98 | 
            +
                    before { pg_log('bla', type) }
         | 
| 99 | 
            +
             | 
| 100 | 
            +
                    it_behaves_like 'logger', type
         | 
| 101 | 
            +
                  end
         | 
| 102 | 
            +
                end
         | 
| 103 | 
            +
              end
         | 
| 38 104 | 
             
            end
         | 
| @@ -1,16 +1,10 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
            import  | 
| 3 | 
            -
            import  | 
| 4 | 
            -
             | 
| 5 | 
            -
            import FadeinOnloadController from './app/javascript/fadein_onload_controller'
         | 
| 1 | 
            +
            import './config'
         | 
| 2 | 
            +
            import './channels'
         | 
| 3 | 
            +
            import './controllers'
         | 
| 4 | 
            +
             | 
| 6 5 | 
             
            // Bootstrap's toasts
         | 
| 7 6 | 
             
            import * as bootstrap from 'bootstrap'
         | 
| 8 7 |  | 
| 9 | 
            -
            window.Stimulus.register('navbar', NavbarController)
         | 
| 10 | 
            -
            window.Stimulus.register('nested', NestedController)
         | 
| 11 | 
            -
            window.Stimulus.register('pg_form', PgFormController)
         | 
| 12 | 
            -
            window.Stimulus.register('fadein_onload', FadeinOnloadController)
         | 
| 13 | 
            -
             | 
| 14 8 | 
             
            document.addEventListener('turbo:load', function () {
         | 
| 15 9 | 
             
              const toastElList = document.querySelectorAll('.toast:not(.hide):not(.show)')
         | 
| 16 10 | 
             
              Array.from(toastElList).map(toastEl => new bootstrap.Toast(toastEl).show())
         | 
| @@ -25,11 +19,11 @@ document.addEventListener('turbo:load', function () { | |
| 25 19 | 
             
              const callback = (mutationList, observer) => {
         | 
| 26 20 | 
             
                for (const mutation of mutationList) {
         | 
| 27 21 | 
             
                  if (mutation.type === 'childList') {
         | 
| 28 | 
            -
                    console.log('A child node has been added or removed.')
         | 
| 22 | 
            +
                    // console.log('A child node has been added or removed.')
         | 
| 29 23 | 
             
                    const toastElList = document.querySelectorAll('.toast:not(.hide):not(.show)')
         | 
| 30 24 | 
             
                    Array.from(toastElList).map(toastEl => new bootstrap.Toast(toastEl).show())
         | 
| 31 25 | 
             
                  } else if (mutation.type === 'attributes') {
         | 
| 32 | 
            -
                    console.log(`The ${mutation.attributeName} attribute was modified.`)
         | 
| 26 | 
            +
                    // console.log(`The ${mutation.attributeName} attribute was modified.`)
         | 
| 33 27 | 
             
                  }
         | 
| 34 28 | 
             
                }
         | 
| 35 29 | 
             
              }
         | 
| @@ -0,0 +1,8 @@ | |
| 1 | 
            +
            // Action Cable provides the framework to deal with WebSockets in Rails.
         | 
| 2 | 
            +
            // You can generate new channels where WebSocket features live using the `bin/rails generate channel` command.
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            import { createConsumer } from '@anycable/web'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            export default createConsumer({
         | 
| 7 | 
            +
              protocol: 'actioncable-v1-ext-json'
         | 
| 8 | 
            +
            })
         | 
| @@ -0,0 +1,24 @@ | |
| 1 | 
            +
            import consumer from '../channels/consumer'
         | 
| 2 | 
            +
            import CableReady from 'cable_ready'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            const anycable = consumer.cable
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            if (anycable) {
         | 
| 7 | 
            +
              anycable.on('connect', ev => {
         | 
| 8 | 
            +
                if (ev.reconnect) {
         | 
| 9 | 
            +
                  console.log('Welcome back!')
         | 
| 10 | 
            +
                } else {
         | 
| 11 | 
            +
                  console.log('Welcome!')
         | 
| 12 | 
            +
                }
         | 
| 13 | 
            +
              })
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              anycable.on('disconnect', ev => {
         | 
| 16 | 
            +
                if (ev.reason) {
         | 
| 17 | 
            +
                  console.log(`Disconnected because: ${ev.reason}`)
         | 
| 18 | 
            +
                } else {
         | 
| 19 | 
            +
                  console.log('Disconnected')
         | 
| 20 | 
            +
                }
         | 
| 21 | 
            +
              })
         | 
| 22 | 
            +
            }
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            CableReady.initialize({ consumer })
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            import './cable_ready'
         | 
| @@ -0,0 +1,11 @@ | |
| 1 | 
            +
            import { application } from './application'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            import NavbarController from './navbar_controller'
         | 
| 4 | 
            +
            import NestedController from './nested_controller'
         | 
| 5 | 
            +
            import PgFormController from './pg_form_controller'
         | 
| 6 | 
            +
            import FadeinOnloadController from './fadein_onload_controller'
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            application.register('navbar', NavbarController)
         | 
| 9 | 
            +
            application.register('nested', NestedController)
         | 
| 10 | 
            +
            application.register('pg_form', PgFormController)
         | 
| 11 | 
            +
            application.register('fadein_onload', FadeinOnloadController)
         | 
| @@ -5,7 +5,8 @@ html | |
| 5 5 | 
             
                meta name="viewport" content="width=device-width,initial-scale=1"
         | 
| 6 6 | 
             
                = csrf_meta_tags
         | 
| 7 7 | 
             
                = csp_meta_tag
         | 
| 8 | 
            -
             | 
| 8 | 
            +
                meta name="cable-history-timestamp" content="#{Time.now.to_i}"
         | 
| 9 | 
            +
                = action_cable_with_jwt_meta_tag
         | 
| 9 10 | 
             
                = stylesheet_link_tag 'application', 'data-turbo-track': 'reload'
         | 
| 10 11 | 
             
                = javascript_include_tag 'application', 'data-turbo-track': 'reload', type: 'module'
         | 
| 11 12 | 
             
              body
         | 
| @@ -3,13 +3,16 @@ html | |
| 3 3 | 
             
              head
         | 
| 4 4 | 
             
                title = Rails.application.class.module_parent_name
         | 
| 5 5 | 
             
                meta name="viewport" content="width=device-width,initial-scale=1"
         | 
| 6 | 
            -
                 | 
| 6 | 
            +
                - if @turbo_no_cache
         | 
| 7 | 
            +
                  meta name="turbo-cache-control" content="no-cache"
         | 
| 7 8 | 
             
                / meta name="turbo-refresh-method" content="morph"
         | 
| 8 9 | 
             
                / meta name="turbo-refresh-scroll" content="preserve"
         | 
| 9 10 | 
             
                / meta name="turbo-prefetch" content="true"
         | 
| 10 11 | 
             
                meta name="view-transition" content="same-origin"
         | 
| 12 | 
            +
                meta name="cable-history-timestamp" content="#{Time.now.to_i}"
         | 
| 11 13 | 
             
                = csrf_meta_tags
         | 
| 12 14 | 
             
                = csp_meta_tag
         | 
| 15 | 
            +
                = action_cable_with_jwt_meta_tag
         | 
| 13 16 |  | 
| 14 17 | 
             
                = stylesheet_link_tag 'application', 'data-turbo-track': 'reload'
         | 
| 15 18 | 
             
                = javascript_include_tag 'application', 'data-turbo-track': 'reload', type: 'module'
         | 
    
        data/pg_rails/js/index.js
    CHANGED
    
    | @@ -1,2 +1,2 @@ | |
| 1 1 | 
             
            import './../../pg_associable'
         | 
| 2 | 
            -
            import './../../pg_layout'
         | 
| 2 | 
            +
            import './../../pg_layout/app/javascript/application'
         | 
| @@ -9,6 +9,13 @@ VCR.configure do |config| | |
| 9 9 | 
             
              }
         | 
| 10 10 | 
             
              config.hook_into :webmock
         | 
| 11 11 | 
             
              config.configure_rspec_metadata!
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              # * `ignore_localhost = true` is equivalent to `ignore_hosts 'localhost',
         | 
| 14 | 
            +
              #   '127.0.0.1', '0.0.0.0'`. It is particularly useful for when you use
         | 
| 15 | 
            +
              #   VCR with a javascript-enabled capybara driver, since capybara boots
         | 
| 16 | 
            +
              #   your rack app and makes localhost requests to it to check that it has
         | 
| 17 | 
            +
              #   booted.
         | 
| 18 | 
            +
              config.ignore_localhost = true
         | 
| 12 19 | 
             
            end
         | 
| 13 20 |  | 
| 14 21 | 
             
            RSpec.configure do |config|
         | 
    
        data/pg_rails/lib/version.rb
    CHANGED
    
    
    
        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.0.8.pre.alpha. | 
| 4 | 
            +
              version: 7.0.8.pre.alpha.15
         | 
| 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-03- | 
| 11 | 
            +
            date: 2024-03-27 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies: []
         | 
| 13 13 | 
             
            description: Rails goodies.
         | 
| 14 14 | 
             
            email:
         | 
| @@ -89,6 +89,8 @@ files: | |
| 89 89 | 
             
            - pg_engine/app/views/pg_engine/base/index.html.slim
         | 
| 90 90 | 
             
            - pg_engine/app/views/pg_engine/base/new.html.slim
         | 
| 91 91 | 
             
            - pg_engine/config/initializers/active_admin.rb
         | 
| 92 | 
            +
            - pg_engine/config/initializers/anycable.rb
         | 
| 93 | 
            +
            - pg_engine/config/initializers/cable_ready.rb
         | 
| 92 94 | 
             
            - pg_engine/config/initializers/devise.rb
         | 
| 93 95 | 
             
            - pg_engine/config/initializers/rollbar.rb
         | 
| 94 96 | 
             
            - pg_engine/config/initializers/simple_form_monkey_patch.rb
         | 
| @@ -111,6 +113,7 @@ files: | |
| 111 113 | 
             
            - pg_engine/lib/pg_engine/configuracion.rb
         | 
| 112 114 | 
             
            - pg_engine/lib/pg_engine/core_ext.rb
         | 
| 113 115 | 
             
            - pg_engine/lib/pg_engine/engine.rb
         | 
| 116 | 
            +
            - pg_engine/lib/pg_engine/error.rb
         | 
| 114 117 | 
             
            - pg_engine/lib/pg_engine/route_helpers.rb
         | 
| 115 118 | 
             
            - pg_engine/lib/pg_engine/utils/pdf_preview_generator.rb
         | 
| 116 119 | 
             
            - pg_engine/lib/pg_engine/utils/pg_logger.rb
         | 
| @@ -136,12 +139,19 @@ files: | |
| 136 139 | 
             
            - pg_engine/spec/pg_engine/pdf_preview_generator_spec.rb
         | 
| 137 140 | 
             
            - pg_layout/app/assets/stylesheets/animations.scss
         | 
| 138 141 | 
             
            - pg_layout/app/assets/stylesheets/sidebar.scss
         | 
| 139 | 
            -
            - pg_layout/app/javascript/ | 
| 140 | 
            -
            - pg_layout/app/javascript/ | 
| 141 | 
            -
            - pg_layout/app/javascript/ | 
| 142 | 
            -
            - pg_layout/app/javascript/ | 
| 143 | 
            -
            - pg_layout/app/javascript/ | 
| 144 | 
            -
            - pg_layout/app/javascript/ | 
| 142 | 
            +
            - pg_layout/app/javascript/application.js
         | 
| 143 | 
            +
            - pg_layout/app/javascript/channels/consumer.js
         | 
| 144 | 
            +
            - pg_layout/app/javascript/channels/index.js
         | 
| 145 | 
            +
            - pg_layout/app/javascript/config/cable_ready.js
         | 
| 146 | 
            +
            - pg_layout/app/javascript/config/index.js
         | 
| 147 | 
            +
            - pg_layout/app/javascript/controllers/application.js
         | 
| 148 | 
            +
            - pg_layout/app/javascript/controllers/fadein_onload_controller.js
         | 
| 149 | 
            +
            - pg_layout/app/javascript/controllers/index.js
         | 
| 150 | 
            +
            - pg_layout/app/javascript/controllers/navbar_controller.js
         | 
| 151 | 
            +
            - pg_layout/app/javascript/controllers/nested_controller.js
         | 
| 152 | 
            +
            - pg_layout/app/javascript/controllers/pg_form_controller.js
         | 
| 153 | 
            +
            - pg_layout/app/javascript/utils/cookies.js
         | 
| 154 | 
            +
            - pg_layout/app/javascript/utils/utils.ts
         | 
| 145 155 | 
             
            - pg_layout/app/lib/navbar.rb
         | 
| 146 156 | 
             
            - pg_layout/app/views/devise/confirmations/new.html.erb
         | 
| 147 157 | 
             
            - pg_layout/app/views/devise/mailer/confirmation_instructions.html.erb
         | 
| @@ -170,7 +180,6 @@ files: | |
| 170 180 | 
             
            - pg_layout/app/views/pg_layout/_navbar.html.erb
         | 
| 171 181 | 
             
            - pg_layout/app/views/pg_layout/_rollbar.html.erb
         | 
| 172 182 | 
             
            - pg_layout/app/views/pg_layout/_sidebar.html.erb
         | 
| 173 | 
            -
            - pg_layout/index.js
         | 
| 174 183 | 
             
            - pg_layout/lib/pg_layout.rb
         | 
| 175 184 | 
             
            - pg_layout/lib/pg_layout/engine.rb
         | 
| 176 185 | 
             
            - pg_rails/js/index.js
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         |