pg_rails 7.6.22 → 7.6.24.pre.3

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: 515caff33953b3d9a058e092be6152c0e9da6ca0fe740075c5fca7833bc39644
4
+ data.tar.gz: 4ed2e3e33a0c6d39461c20f7a616c04f182c909f557125739bb065d4e92f58e9
5
5
  SHA512:
6
- metadata.gz: fb4e10fe0f30f27a36509b16051abade54c8c84c8a3f0141d54910a2d671b534dabea23c1dda48d3f2500339e3e539e22813ddbd8d0b7e225a114ef6e193b42b
7
- data.tar.gz: b3a897a09bd7f58c85aa783cc7ee8e10ff145afa75d515d16a1fd48006c029c4fbd3a41f16707b805d34700a4c5150c18ab6c252e80a731c07fda1a581962d19
6
+ metadata.gz: 5715a8c111e862a1e560f1e095b4f601700f841a2bdb76dad9594c33774b9c5d369947a553a63d5a12ddd0240f2c09380f6e04baee3db28715ae56e5f2ffbccb
7
+ data.tar.gz: d96915a2c9aaf4210491829e80ecb0785d706375f9a3610e38676c9e1708dc01db22b89e5f8a4a6daad49ef934b6e3147a4b13a00cdabe4cd6f0adcbb23e9d1b
@@ -152,15 +152,6 @@ input[type=datetime-local], input[type=datetime] {
152
152
  @extend .bg-primary;
153
153
  }
154
154
 
155
- // Root variables
156
- :root {
157
- --bs-border-radius-sm: 0.06rem;
158
- --bs-border-radius: 0.1rem;
159
- --bs-border-radius-lg: 0.25rem;
160
- --bs-border-radius-xl: 0.45rem;
161
- --bs-border-radius-xxl: 0.6rem;
162
- --bs-border-color: #a7b7bb;
163
- }
164
155
 
165
156
  // Alerts
166
157
  .alert-dismissible {
@@ -1,4 +1,5 @@
1
1
  class InlineComponent < ViewComponent::Base
2
+ include PgEngine::IndexHelper
2
3
  def initialize(model, attribute)
3
4
  @model = model
4
5
  @attribute = attribute
@@ -7,15 +8,4 @@ class InlineComponent < ViewComponent::Base
7
8
 
8
9
  super
9
10
  end
10
-
11
- SUFIJOS = %i[f text].freeze
12
- def unsuffixed(attribute)
13
- ret = attribute.to_s.dup
14
-
15
- SUFIJOS.each do |sufijo|
16
- ret.gsub!(/_#{sufijo}$/, '')
17
- end
18
-
19
- ret
20
- end
21
11
  end
@@ -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
@@ -8,20 +8,29 @@ module PgEngine
8
8
  end
9
9
  end
10
10
 
11
+ SUFIJOS = %i[f text].freeze
12
+ def unsuffixed(attribute, sufijos = SUFIJOS)
13
+ ret = attribute.to_s.dup
14
+
15
+ sufijos.each do |sufijo|
16
+ ret.gsub!(/_#{sufijo}$/, '')
17
+ end
18
+
19
+ ret
20
+ end
21
+
22
+ def unsuffixed_for_export(attribute)
23
+ unsuffixed(attribute, %i[f])
24
+ end
25
+
11
26
  def encabezado(input, options = {})
12
27
  if input.is_a? Array
13
- campo = input.first
28
+ campo = unsuffixed(input.first)
14
29
  sort_field = input.last
15
30
  else
16
- campo = sort_field = input
17
- sort_field = sort_field.to_s.sub(/_f\z/, '')
18
- sort_field = sort_field.to_s.sub(/_text\z/, '')
31
+ campo = sort_field = unsuffixed(input)
19
32
  end
20
33
 
21
- # Unsuffixed
22
- campo = campo.to_s.sub(/_f\z/, '')
23
- campo = campo.to_s.sub(/_text\z/, '')
24
-
25
34
  clase = options[:clase] || @clase_modelo
26
35
 
27
36
  human_name = scoped_human_attr_name(clase, campo, 'listado_header')
@@ -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,8 +1,8 @@
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:
6
5
  a.navbar-brand img {
7
6
  max-height: 31px;
7
+ max-width: 100%;
8
8
  }
@@ -1,16 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  wb = xlsx_package.workbook
4
+
5
+ title = wb.styles.add_style(
6
+ b: true, sz: 13, bg_color: '1a172f', fg_color: 'ebebeb'
7
+ # alignment: { horizontal: :center, vertical: :center }
8
+ )
9
+
4
10
  wb.add_worksheet(name: @clase_modelo.nombre_plural) do |sheet|
5
11
  headers = atributos_para_listar.map { |a, _sort_by| @clase_modelo.human_attribute_name(a) }
6
- headers.prepend 'ID interno'
7
- sheet.add_row(headers)
12
+ headers.append 'ID interno'
13
+ sheet.add_row(headers, style: headers.map { title })
8
14
 
9
15
  @collection.decorate.each do |object|
10
16
  array = atributos_para_listar.map do |att, _sort_by|
11
- object.send(att)
17
+ object.send(unsuffixed_for_export(att))
12
18
  end
13
- array.prepend object.to_key
19
+ array.append object.to_key
14
20
  sheet.add_row array
15
21
  end
16
22
  end
@@ -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]
@@ -7,9 +7,9 @@ module PgEngine
7
7
  @default_site_brand = :factura
8
8
 
9
9
  @options = {
10
- landing_site_url: {
11
- procura: 'https://bien.com.ar/procura',
12
- factura: 'https://bien.com.ar/factura'
10
+ landing_site_url: { # Se usa en el footer de los mails
11
+ procura: 'https://procura.bien.com.ar',
12
+ factura: 'https://factura.bien.com.ar'
13
13
  },
14
14
  logo_navbar_url: {
15
15
  procura: 'test/procura-logo-navbar-1.png',
@@ -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
@@ -80,4 +80,16 @@ describe 'Resources', :tpath_req do
80
80
  expect { subject }.to change { cosa.reload.discarded_at }.to(be_nil)
81
81
  end
82
82
  end
83
+
84
+ describe '#download' do
85
+ subject do
86
+ get '/u/t/cosas.xlsx'
87
+ end
88
+
89
+ it do
90
+ subject
91
+ expect(response.content_type).to eq 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
92
+ expect(response).to be_successful
93
+ end
94
+ end
83
95
  end
@@ -37,7 +37,7 @@ window.addEventListener('trix-file-accept', function (event) {
37
37
  const maxFileSize = 1024 * 1024 * 10 // 10MB
38
38
  if (event.file.size > maxFileSize) {
39
39
  event.preventDefault()
40
- flashMessage('Lo siento mucho pero el tamaño máximo por archivo es de 10MB', 'warning')
40
+ flashMessage('El tamaño máximo por archivo es de 10MB', 'warning')
41
41
  }
42
42
  })
43
43
 
@@ -0,0 +1,19 @@
1
+ import { application } from './application'
2
+
3
+ import NavbarController from './navbar_controller'
4
+ import FadeinOnloadController from './fadein_onload_controller'
5
+ import ClearTimeoutController from './clear_timeout_controller'
6
+ import SwitcherController from './switcher_controller'
7
+ import ThemeController from './theme_controller'
8
+ import TooltipController from './tooltip_controller'
9
+ import PopoverController from './popover_controller'
10
+ import PopoverTogglerController from './popover_toggler_controller'
11
+
12
+ application.register('navbar', NavbarController)
13
+ application.register('fadein_onload', FadeinOnloadController)
14
+ application.register('clear-timeout', ClearTimeoutController)
15
+ application.register('switcher', SwitcherController)
16
+ application.register('theme', ThemeController)
17
+ application.register('tooltip', TooltipController)
18
+ application.register('popover', PopoverController)
19
+ application.register('popover-toggler', PopoverTogglerController)
@@ -0,0 +1,3 @@
1
+ import './controllers/index-landing.js'
2
+
3
+ import '@hotwired/turbo-rails'
@@ -27,13 +27,16 @@ 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
34
37
 
35
38
  = stylesheet_link_tag 'application', 'data-turbo-track': 'reload'
36
- = javascript_include_tag 'application', 'data-turbo-track': 'reload', type: 'module'
39
+ = javascript_include_tag 'application', 'data-turbo-track': 'reload'
37
40
  meta(name="actioncable-protocol"
38
41
  content="#{Rails.env.test? ? 'actioncable-v1-json' : 'actioncable-v1-ext-json'}")
39
42
  - if @rollbar_token.present?
@@ -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
@@ -0,0 +1 @@
1
+ import './../../pg_layout/app/javascript/landing'
@@ -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.24-3'
5
5
  end
@@ -1,3 +1,37 @@
1
+ // Default bootstrap colours
2
+ $blue: #0d6efd !default;
3
+ $indigo: #6610f2 !default;
4
+ $purple: #6f42c1 !default;
5
+ $pink: #d63384 !default;
6
+ $red: #dc3545 !default;
7
+ $orange: #fd7e14 !default;
8
+ $yellow: #ffc107 !default;
9
+ $green: #198754 !default;
10
+ $teal: #20c997 !default;
11
+ $cyan: #0dcaf0 !default;
12
+
13
+ // Overriding some of the default colours
14
+ $yellow: #ffb401;
15
+ $orange: #e35b17;
16
+ $red: #a70101;
17
+
18
+ $warning: $yellow;
19
+ $info: #87accc;
20
+
21
+ $warning-text-emphasis: $orange;
22
+ $danger-text-emphasis: #910303;
23
+
24
+ $tooltip-opacity: 1;
25
+ $tooltip-bg: var(--bs-primary) !default;
26
+ $tooltip-color: var(--bs-light) !default;
27
+
28
+ $enable-validation-icons: false;
29
+ $focus-ring-width: .05rem;
30
+ $alert-padding-y: 0.5rem;
31
+ $alert-margin-bottom: 0.5rem;
32
+
33
+ $breadcrumb-margin-bottom: 0;
34
+
1
35
  @import "bootstrap/scss/mixins/banner";
2
36
  @include bsBanner("");
3
37
 
@@ -0,0 +1,8 @@
1
+ :root {
2
+ --bs-border-radius-sm: 0.06rem;
3
+ --bs-border-radius: 0.1rem;
4
+ --bs-border-radius-lg: 0.25rem;
5
+ --bs-border-radius-xl: 0.45rem;
6
+ --bs-border-radius-xxl: 0.6rem;
7
+ --bs-border-color: #a7b7bb;
8
+ }
@@ -1,41 +1,10 @@
1
- // Default bootstrap colours
2
- $blue: #0d6efd !default;
3
- $indigo: #6610f2 !default;
4
- $purple: #6f42c1 !default;
5
- $pink: #d63384 !default;
6
- $red: #dc3545 !default;
7
- $orange: #fd7e14 !default;
8
- $yellow: #ffc107 !default;
9
- $green: #198754 !default;
10
- $teal: #20c997 !default;
11
- $cyan: #0dcaf0 !default;
12
-
13
- // Overriding some of the default colours
14
- $yellow: #ffb401;
15
- $orange: #e35b17;
16
- $red: #a70101;
17
-
18
- $warning: $yellow;
19
- $info: #87accc;
20
-
21
- $warning-text-emphasis: $orange;
22
- $danger-text-emphasis: #910303;
23
-
24
- $tooltip-opacity: 1;
25
- $tooltip-bg: var(--bs-primary) !default;
26
- $tooltip-color: var(--bs-light) !default;
27
1
 
28
2
  $font-size-base: 0.9rem;
29
- $enable-validation-icons: false;
30
- $focus-ring-width: .05rem;
31
- $alert-padding-y: 0.5rem;
32
- $alert-margin-bottom: 0.5rem;
33
-
34
- $breadcrumb-margin-bottom: 0;
35
3
 
36
4
  @import 'bootstrap_pre';
37
5
  @import 'bootstrap_overrides';
38
6
  @import 'bootstrap_post';
7
+ @import 'border_radius';
39
8
 
40
9
  @import './../../pg_engine/app/assets/stylesheets/pg_rails_b5';
41
10
  @import './../../pg_associable/app/assets/stylesheets/pg_associable';
@@ -47,6 +16,7 @@ $breadcrumb-margin-bottom: 0;
47
16
  @import 'trix/dist/trix';
48
17
  @import 'tom-select/dist/scss/tom-select.bootstrap5';
49
18
 
19
+ // Tom Select
50
20
  .ts-control {
51
21
  padding-top: 2px!important;
52
22
  padding-bottom: 2px!important;
@@ -63,6 +33,7 @@ $breadcrumb-margin-bottom: 0;
63
33
  padding-right: 0.75rem !important;
64
34
  }
65
35
 
36
+ // Column truncate
66
37
  $values: 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100;
67
38
 
68
39
  @for $i from 1 through length($values) {
@@ -86,6 +57,7 @@ $values: 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100;
86
57
  }
87
58
  }
88
59
 
60
+ // Buttons border in nav toolbar
89
61
  $warning-border-emphasis: shade-color($yellow, 60%);
90
62
  .btn-toolbar .btn-warning {
91
63
  border: 1px solid $warning-border-emphasis;
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.24.pre.3
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: 2025-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -986,6 +986,7 @@ files:
986
986
  - pg_layout/app/javascript/controllers/embedded_frame_controller.js
987
987
  - pg_layout/app/javascript/controllers/fadein_onload_controller.js
988
988
  - pg_layout/app/javascript/controllers/filtros_controller.js
989
+ - pg_layout/app/javascript/controllers/index-landing.js
989
990
  - pg_layout/app/javascript/controllers/index.js
990
991
  - pg_layout/app/javascript/controllers/navbar_controller.js
991
992
  - pg_layout/app/javascript/controllers/nested_controller.js
@@ -999,6 +1000,7 @@ files:
999
1000
  - pg_layout/app/javascript/controllers/tooltip_controller.js
1000
1001
  - pg_layout/app/javascript/elements/index.js
1001
1002
  - pg_layout/app/javascript/elements/pg_event.js
1003
+ - pg_layout/app/javascript/landing.js
1002
1004
  - pg_layout/app/javascript/utils/cookies.js
1003
1005
  - pg_layout/app/javascript/utils/utils.ts
1004
1006
  - pg_layout/app/lib/navbar.rb
@@ -1047,6 +1049,7 @@ files:
1047
1049
  - pg_layout/lib/pg_layout/engine.rb
1048
1050
  - pg_layout/spec/lib/navbar_spec.rb
1049
1051
  - pg_rails/js/index.js
1052
+ - pg_rails/js/landing.js
1050
1053
  - pg_rails/lib/pg_rails.rb
1051
1054
  - pg_rails/lib/pg_rails/capybara_support.rb
1052
1055
  - pg_rails/lib/pg_rails/current_attributes_support.rb
@@ -1062,6 +1065,7 @@ files:
1062
1065
  - pg_rails/scss/bootstrap_overrides.scss
1063
1066
  - pg_rails/scss/bootstrap_post.scss
1064
1067
  - pg_rails/scss/bootstrap_pre.scss
1068
+ - pg_rails/scss/border_radius.scss
1065
1069
  - pg_rails/scss/pg_rails.scss
1066
1070
  - pg_scaffold/lib/generators/pg_active_record/model/model_generator.rb
1067
1071
  - pg_scaffold/lib/generators/pg_active_record/model/templates/admin.rb