pg_rails 7.6.22 → 7.6.23

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba5c6d7d214fdfee7b74981aec959f7ab5b0b993ef14527d6fc50024aa2e90be
4
- data.tar.gz: 72d42c66107bafeabfd63f9249223ddb33317edfbacf296e432a88c280d1452e
3
+ metadata.gz: 97cc9ad4a85c63b07fdec127479fad2481b4b0e6bfd132ea2a88248f26469b22
4
+ data.tar.gz: '033854a368aca25c8b76e811a1a83c05a23ce9ad071115da6e8513b82bc2261a'
5
5
  SHA512:
6
- metadata.gz: fb4e10fe0f30f27a36509b16051abade54c8c84c8a3f0141d54910a2d671b534dabea23c1dda48d3f2500339e3e539e22813ddbd8d0b7e225a114ef6e193b42b
7
- data.tar.gz: b3a897a09bd7f58c85aa783cc7ee8e10ff145afa75d515d16a1fd48006c029c4fbd3a41f16707b805d34700a4c5150c18ab6c252e80a731c07fda1a581962d19
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]
@@ -72,7 +72,7 @@ module PgEngine
72
72
  return :procura if request.host.match(/procura/)
73
73
  return :factura if request.host.match(/factura/)
74
74
 
75
- pg_warn 'default site_brand assigned'
75
+ pg_warn 'default site_brand assigned' unless Rails.env.local?
76
76
 
77
77
  :factura
78
78
  end
@@ -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'
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
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