pg_rails 7.6.22.pre.3 → 7.6.23

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: e11eaaf87267c270b7a5dc436af8bc9408b06c98f576f83131e1f0dc8bc90fd1
4
- data.tar.gz: 102b832b63cefc8ad4036af4fbbf4737fb3b7bffba8a3c265e9bad027a91ff46
3
+ metadata.gz: 97cc9ad4a85c63b07fdec127479fad2481b4b0e6bfd132ea2a88248f26469b22
4
+ data.tar.gz: '033854a368aca25c8b76e811a1a83c05a23ce9ad071115da6e8513b82bc2261a'
5
5
  SHA512:
6
- metadata.gz: 638c860b8f356d0fca74690f744f80ea103cfe637cb15e6619e49d98f70f4f9288d26cfcf17896211f656a707b6eab7565e0145e02f84ea260a5a39a8a0faade
7
- data.tar.gz: 07e01cadab3025d652009783410535ccf47037a33d1f1cbb26e9f18020e36b6c34ba05886d78d5112ac95cbd1e885515a7f3c3a2be4333b61bfa75955964c7ea
6
+ metadata.gz: f94452ac22cfd17e8891af82d0412fe45b5acbbdc26d0870a61458098b5f59f4d45787a56210dc5e2d785bf933ecd6121797eb2ace0e15eb958a1e1e7ad11259
7
+ data.tar.gz: 96686a8d9857eb288f035a1c489f4935a837c50dc44c020c3ef51d5c7c7343bf02c7b7cc710bedb7d8f6782d1bcfb9d26406da5680d3a42565eb3ab93cb800bd
@@ -2,7 +2,6 @@
2
2
 
3
3
  module PgEngine
4
4
  # rubocop:disable Rails/ApplicationController
5
- # rubocop:disable Metrics/ClassLength
6
5
  class BaseController < ActionController::Base
7
6
  # Importante que esta línea esté al principio
8
7
  protect_from_forgery with: :exception
@@ -56,6 +55,7 @@ module PgEngine
56
55
  include RouteHelper
57
56
  include PgAssociable::Helpers
58
57
  include FrameHelper
58
+ include PgRailsHelper
59
59
 
60
60
  class Redirect < PgEngine::Error
61
61
  attr_accessor :url
@@ -126,16 +126,6 @@ module PgEngine
126
126
  render_my_component(InternalErrorComponent.new, :ok)
127
127
  end
128
128
 
129
- helper_method :dev_user_or_env?
130
- def dev_user_or_env?
131
- Rails.env.development? || dev_user?
132
- end
133
-
134
- helper_method :dev_user?
135
- def dev_user?
136
- Current.user&.developer?
137
- end
138
-
139
129
  helper_method :mobile_device?
140
130
 
141
131
  layout 'pg_layout/base'
@@ -231,5 +221,4 @@ module PgEngine
231
221
  redirect_back fallback_location: root_path
232
222
  end
233
223
  end
234
- # rubocop:enable Metrics/ClassLength
235
224
  end
@@ -4,6 +4,8 @@
4
4
  module PgEngine
5
5
  class BaseRecordDecorator < Draper::Decorator
6
6
  include ActionView::Helpers
7
+ include PgEngine::DefaultUrlOptions
8
+ include Rails.application.routes.url_helpers
7
9
  include PrintHelper
8
10
  include FormHelper
9
11
  include RouteHelper
@@ -173,7 +175,11 @@ module PgEngine
173
175
  end
174
176
 
175
177
  def object_url
176
- helpers.url_for(target_object)
178
+ # FIXME: arreglar las urls generadas con "helpers"
179
+ # ver cómo se construye el view helper en los jobs
180
+ # y si se puede injectar el default url options ahí
181
+ # helpers.url_for(target_object)
182
+ url_for(target_object)
177
183
  end
178
184
 
179
185
  def nested_record
@@ -9,6 +9,14 @@ module PgEngine
9
9
  end
10
10
  end
11
11
 
12
+ def dev_user_or_env?
13
+ Rails.env.development? || dev_user?
14
+ end
15
+
16
+ def dev_user?
17
+ Current.user&.developer?
18
+ end
19
+
12
20
  private
13
21
 
14
22
  def do_placeholder(src = nil, width: '100%', height: '100%', **img_opts)
@@ -67,5 +67,13 @@ module PgEngine
67
67
  def path_for(array)
68
68
  url_for(array.push({ only_path: true }))
69
69
  end
70
+
71
+ def context_root_path
72
+ if Current.tid.present?
73
+ tenant_root_path(tid: Current.tid)
74
+ else
75
+ (Current.user.present? ? users_root_path : root_path)
76
+ end
77
+ end
70
78
  end
71
79
  end
@@ -1,5 +1,4 @@
1
- - href = Current.tid.present? ? tenant_root_path(tid: Current.tid) : root_path
2
- a.navbar-brand href="#{ href }"
1
+ a.navbar-brand href="#{ context_root_path }" data-turbo="false"
3
2
  = image_tag(PgEngine.site_brand.logo_navbar_url, alt: PgEngine.site_brand.name)
4
3
 
5
4
  css:
@@ -48,6 +48,7 @@ Rails.application.routes.draw do
48
48
  end
49
49
 
50
50
  # root to: 'users/accounts#index'
51
+ # FIXME: qué onda
51
52
  root to: redirect('/u')
52
53
 
53
54
  namespace :admin, path: 'a' do
@@ -11,7 +11,7 @@ module PgEngine
11
11
  def value_for(key)
12
12
  options = @options[key.to_sym]
13
13
 
14
- raise PgEngine::Error, 'Key not found' if options.nil?
14
+ raise PgEngine::Error, "Key not found: #{key}" if options.nil?
15
15
 
16
16
  if Current.app_name.present? && options.keys.include?(Current.app_name)
17
17
  options[Current.app_name]
@@ -6,7 +6,6 @@ module PgEngine
6
6
 
7
7
  @default_site_brand = :factura
8
8
 
9
- # FIXME: mover los pngs a pg_engine/ dentro de una carpeta test/
10
9
  @options = {
11
10
  landing_site_url: {
12
11
  procura: 'https://bien.com.ar/procura',
@@ -73,7 +72,7 @@ module PgEngine
73
72
  return :procura if request.host.match(/procura/)
74
73
  return :factura if request.host.match(/factura/)
75
74
 
76
- pg_warn 'default site_brand assigned'
75
+ pg_warn 'default site_brand assigned' unless Rails.env.local?
77
76
 
78
77
  :factura
79
78
  end
@@ -8,7 +8,7 @@ html
8
8
  - if @turbo_page_requires_reload
9
9
  meta name="turbo-visit-control" content="reload"
10
10
 
11
- - cache :title_icon
11
+ - cache [:title_icon, Current.app_name]
12
12
  title = PgEngine.site_brand.name
13
13
  - begin
14
14
  = render partial: 'layouts/favicon'
@@ -27,7 +27,10 @@ html
27
27
  meta name="turbo-prefetch" content="#{ENV.fetch('TURBO_PREFETCH_ENABLE', 'false')}"
28
28
  meta name="view-transition" content="same-origin"
29
29
  meta name="cable-history-timestamp" content="#{Time.now.to_i}"
30
- = csrf_meta_tags
30
+
31
+ - unless @skip_csrf_meta_tags
32
+ = csrf_meta_tags
33
+
31
34
  = csp_meta_tag
32
35
  - if defined?(AnyCable::Rails)
33
36
  = action_cable_with_jwt_meta_tag
@@ -114,10 +117,11 @@ html
114
117
  = captured_content
115
118
 
116
119
  div style="width:100%; height: 10em"
117
- .d-flex.gap-1.justify-content-center.opacity-50 data-controller="theme"
118
- | (Beta) Tema:
119
- = link_to 'Claro', 'javascript:void(0)', 'data-action': 'theme#light'
120
- = link_to 'Oscuro', 'javascript:void(0)', 'data-action': 'theme#dark'
120
+ - if dev_user?
121
+ .d-flex.gap-1.justify-content-center.opacity-50 data-controller="theme"
122
+ | (Beta) Tema:
123
+ = link_to 'Claro', 'javascript:void(0)', 'data-action': 'theme#light'
124
+ = link_to 'Oscuro', 'javascript:void(0)', 'data-action': 'theme#dark'
121
125
  = render partial: 'layouts/footer'
122
126
  div style="width:100%; height: 10em"
123
127
  = render_turbo_stream_title
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.6.22-3'
4
+ VERSION = '7.6.23'
5
5
  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.6.22.pre.3
4
+ version: 7.6.23
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-11-09 00:00:00.000000000 Z
11
+ date: 2024-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails