pg_rails 7.6.37 → 7.6.39

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: d78d6754e8cd67e2b293e26fa01585fefdefb68fd030a3ad00a420119ecdcdff
4
- data.tar.gz: 62cf672c47ff40c4bb45d58880643955450d7db7069ebd4df92cffce4283bba8
3
+ metadata.gz: 2de59469aa32c2ef73f030ea848179b8941f67a1eb948b72b018cf2d9e7b1b95
4
+ data.tar.gz: 4311903fb7f15aa7b070e2ac36ff530bc6e4a7750ac011a7843d34a85921483e
5
5
  SHA512:
6
- metadata.gz: 7443db791d97a49a3755d4922c855202522c4a1a980b4c66f44fa45733131827f5c88cc059a88ad2f21495d21e3f226d9fe39ad8af2d420bf2a28ee05f177924
7
- data.tar.gz: 870d9f4006606617247fecd04e93a832ecd13da8d844e0f1086cc4dfdd9da735fd6508167a4e8e29f658ebb5763867a0e68c662d86a889c019f0d1f20d246851
6
+ metadata.gz: 37288f9d151624cb72e6c7567e6fdb875d91b5945baf3d66e045c640fa500d3ff3f1a90cbd6bd76aa898562c0c6b8f9d09aceddd287975f456af068b3310cee3
7
+ data.tar.gz: 63d8f3e1d03d521db97cae73cde5908342bbcd9dc44913289f516ee0c932b63fcdb6e626ed6a575556f04b651315293f7315b5d0e1ed69471f750dfa14fc2375
@@ -174,7 +174,9 @@ export default class extends Controller {
174
174
 
175
175
  mostrarError () {
176
176
  if (this.element.querySelector('.resultados .spinner-border')) {
177
+ // TODO: rastrear causa, probablemente sea por websocket desconectado.
177
178
  Rollbar.error('Time out de asociable.js')
179
+
178
180
  // TODO: link a contacto
179
181
  this.subWrapper.innerHTML = renderToStaticMarkup(
180
182
  <div className="resultados" tabIndex={-1}>
@@ -39,14 +39,17 @@ export default class extends Controller {
39
39
 
40
40
  this.element.addEventListener('pg:record-updated', (ev) => {
41
41
  if (ev.data.dataset.inline) {
42
+ // Is an inline edit submit
42
43
  this.reloadTop()
43
44
  ev.stopPropagation()
44
45
  } else {
45
46
  if (ev.data.dataset.reload) {
47
+ // Must reload modal. Ie: on discard/undiscard
46
48
  this.reload()
47
49
  this.reloadTop()
48
50
  ev.stopPropagation()
49
51
  } else {
52
+ // Is a traditional form submit
50
53
  this.back(ev)
51
54
  }
52
55
  }
@@ -4,6 +4,7 @@
4
4
  ActiveStorage::DirectUploadsController.class_eval do
5
5
  alias_method :old_blob_args, :blob_args
6
6
 
7
+ # FIXME: testear
7
8
  def blob_args
8
9
  old_blob_args.merge(service_name: :local)
9
10
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  wb = xlsx_package.workbook
4
4
 
5
+ # FIXME: add colspaned header with model name
5
6
  title = wb.styles.add_style(
6
7
  b: true, sz: 13, bg_color: '1a172f', fg_color: 'ebebeb'
7
8
  # alignment: { horizontal: :center, vertical: :center }
@@ -30,6 +30,9 @@
30
30
  i.bi.bi-pencil.lh-1
31
31
  = t('pg_engine.base.index.bulk_edit.link', model: clase_modelo)
32
32
 
33
+ / if turbo stream? && Current.account.present?
34
+ / = turbo_stream_from Current.account, @clase_modelo.model_name.plural
35
+
33
36
  - if action_name == 'archived'
34
37
  .text-center.p-3.text-warning-emphasis.border-bottom
35
38
  div
@@ -55,7 +55,7 @@ module PgEngine
55
55
  def notify_all(mensaje, type)
56
56
  send_to_logger(mensaje, type)
57
57
  send_to_rollbar(mensaje, type)
58
- send_to_stdout(mensaje, type) if ENV.fetch('LOG_TO_STDOUT', nil)
58
+ send_to_stdout(mensaje, type) if ENV.fetch('LOG_TO_STDOUT', nil) || (Rails.env.test? && type == :debug)
59
59
  save_internal(mensaje, type) if Rails.env.test?
60
60
  nil
61
61
  end
@@ -110,7 +110,7 @@ module PgEngine
110
110
  end
111
111
 
112
112
  def rainbow_wrap(mensaje, type)
113
- Rainbow(mensaje).bold.send(color_for(type))
113
+ mensaje.split("\n").map { Rainbow(_1).bold.send(color_for(type)) }.join("\n")
114
114
  end
115
115
 
116
116
  def color_for(type)
@@ -47,10 +47,22 @@ $chevron-color: 200,200,200,.5;
47
47
  // background-color: #d2f4ea;
48
48
  }
49
49
 
50
- .pg--nav-button.active {
50
+ .navbar__nav-button.active {
51
51
  --bs-link-color-rgb: white!important;
52
52
  background-color: tint-color($primary, 17%);
53
53
  }
54
+
55
+ .navbar__nav-button[aria-expanded=true] {
56
+ font-weight: bold;
57
+ }
58
+
59
+ // Child entries
60
+ #sidebar .collapse-inner {
61
+ background-color: tint-color($primary, 5%);
62
+ padding-bottom: 0.1em;
63
+ padding-top: 0.1em;
64
+ }
65
+
54
66
  // Los small-items están deprecados
55
67
  #sidebar {
56
68
  &.opened {
@@ -100,7 +112,7 @@ $chevron-color: 200,200,200,.5;
100
112
  }
101
113
  }
102
114
 
103
- .pg--nav-button {
115
+ .navbar__nav-button {
104
116
  padding: 0.4em 1.7em;
105
117
  width: 100%;
106
118
  text-align: right;
@@ -109,11 +121,11 @@ $chevron-color: 200,200,200,.5;
109
121
  .offcanvas-body {
110
122
  padding: 0!important;
111
123
  }
112
- .pg--nav-button:hover {
124
+ .navbar__nav-button:hover {
113
125
  background-color: tint-color($primary, 20%);
114
126
  }
115
127
 
116
- .offcanvas .pg--nav-button {
128
+ .offcanvas .navbar__nav-button {
117
129
  padding: 0.7em 1.7em;
118
130
  text-align: right;
119
131
  }
@@ -43,31 +43,40 @@ class Navbar
43
43
  bar_data = @yaml_data[key]
44
44
  return [] if bar_data.blank?
45
45
 
46
- # rubocop:disable Security/Eval
47
46
  # rubocop:disable Style/MultilineBlockChain:
48
47
  orig_idx = 0
49
48
  bar_data.map do |item|
50
49
  orig_idx += 1
51
- {
52
- title: item['name'],
53
- attributes: item['attributes']&.html_safe,
54
- path: eval(item['path']),
55
- show: item['policy'] ? eval(item['policy']) : true,
56
- priority: item['priority'] || 999_999,
57
- orig_idx:
58
- }
50
+ evaluate_node(item, orig_idx)
59
51
  end.sort_by { |a| [a[:priority], a[:orig_idx]] }
60
- # rubocop:enable Security/Eval
61
52
  # rubocop:enable Style/MultilineBlockChain:
62
53
  end
63
54
 
55
+ def evaluate_node(item, orig_idx = nil)
56
+ # rubocop:disable Security/Eval
57
+ aux = {
58
+ title: item['name'],
59
+ attributes: item['attributes']&.html_safe,
60
+ path: item['path'].present? ? eval(item['path']) : nil,
61
+ show: item['policy'] ? eval(item['policy']) : true,
62
+ priority: item['priority'] || 999_999,
63
+ orig_idx:
64
+ }
65
+ # rubocop:enable Security/Eval
66
+
67
+ if item[:children].present?
68
+ aux[:children] = item[:children].map { |it| evaluate_node(it) }
69
+ end
70
+
71
+ aux
72
+ end
73
+
64
74
  def all_children_hidden?(entry)
65
75
  entry[:children].all? { |child| child[:show] == false }
66
76
  end
67
77
 
68
78
  def any_children_active?(entry, request)
69
79
  entry[:children].any? { |child| active_entry?(child, request) }
70
- true
71
80
  # TODO: quitar
72
81
  end
73
82
 
@@ -1,5 +1,5 @@
1
1
  - content_for :content do
2
- - klass = modal_targeted? ? '' : (yield(:container_class) || 'container-fluid')
2
+ - klass = modal_targeted? ? '' : (yield(:container_class).presence || 'container-fluid')
3
3
  div class="pt-3 #{klass}" style=yield(:container_style)
4
4
  = content_for?(:containerized_content) ? yield(:containerized_content) : yield
5
5
 
@@ -6,5 +6,23 @@ div id="sidebar" class="#{@navbar_opened_class} flex-shrink-0 d-none d-#{@breakp
6
6
  - @navbar.sidebar.each do |entry|
7
7
  - next if @navbar.hide_entry?(entry)
8
8
  li.mb-1
9
- a href=entry[:path] class="d-inline-flex text-decoration-none pg--nav-button #{@navbar.active_entry?(entry, request) ? 'active' : ''} #{entry[:attributes]}"
10
- = entry[:title]
9
+ - if entry[:children].present?
10
+ - entry_id = "nav-entry-#{entry[:orig_idx]}"
11
+ - active = @navbar.active_entry?(entry, request)
12
+ a class="d-inline-flex text-decoration-none navbar__nav-button #{ active ? '' : 'collapsed'} #{entry[:attributes]}" data-bs-toggle="collapse" href="##{entry_id}" role="button" aria-expanded="#{ active ? 'true' : 'false'}" aria-controls=entry_id
13
+ = entry[:title]
14
+ - if active
15
+ span.bi.bi-chevron-down.ms-1 style="font-size: 0.7em"
16
+ - else
17
+ span.bi.bi-chevron-right.ms-1 style="font-size: 0.7em"
18
+
19
+ .collapse data-turbo-temporary=('true' unless @navbar.active_entry?(entry, request)) class="#{ 'show' if @navbar.active_entry?(entry, request)}" id=entry_id
20
+ .collapse-inner
21
+ - entry[:children].each do |child|
22
+ - next if @navbar.hide_entry?(child)
23
+ .mb-1
24
+ a href=child[:path] class="d-inline-flex text-decoration-none navbar__nav-button #{@navbar.active_entry?(child, request) ? 'active' : ''} #{child[:attributes]}"
25
+ = child[:title]
26
+ - else
27
+ a href=entry[:path] class="d-inline-flex text-decoration-none navbar__nav-button #{@navbar.active_entry?(entry, request) ? 'active' : ''} #{entry[:attributes]}"
28
+ = entry[:title]
@@ -10,7 +10,7 @@
10
10
  - @navbar.sidebar.each do |entry|
11
11
  - next if @navbar.hide_entry?(entry)
12
12
  li
13
- a href=entry[:path] class="pg--nav-button pe-4 text-light #{@navbar.active_entry?(entry, request) ? 'active' : ''} #{entry[:attributes]}"
13
+ a href=entry[:path] class="navbar__nav-button pe-4 text-light #{@navbar.active_entry?(entry, request) ? 'active' : ''} #{entry[:attributes]}"
14
14
  = entry[:title]
15
15
  css:
16
16
  .offcanvas a { text-decoration: none; }
@@ -50,3 +50,10 @@ Capybara.register_driver :selenium_chrome_headless_iphone,
50
50
  Capybara.register_driver :selenium_chrome_debugger, &chrome_driver_gen(headless: false, debugger: true)
51
51
 
52
52
  Capybara.javascript_driver = ENV.fetch('DRIVER') { 'selenium_chrome_notebook' }.to_sym
53
+
54
+ RSpec.configure do |config|
55
+ config.before(:each, type: :system) do
56
+ driven_by ENV.fetch('DRIVER', :selenium_chrome_headless_iphone).to_sym,
57
+ using: ENV.fetch('BROWSER', :headless_chrome).to_sym
58
+ end
59
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  # :nocov:
4
4
  module PgRails
5
- VERSION = '7.6.37'
5
+ VERSION = '7.6.39'
6
6
  end
7
7
  # :nocov:
@@ -8,12 +8,15 @@ require 'rails_helper'
8
8
  #
9
9
  # DRIVER=selenium BROWSER=firefox rspec
10
10
  describe '<%= name %>' do
11
+ # include ActionView::RecordIdentifier
12
+
11
13
  subject(:visitar) do
12
- visit 'some url'
14
+ path = tpath("/u/t/some_tenanted_path", query_string: false)
15
+ visit path
13
16
  end
14
17
 
15
- let(:logged_user) { create :user }
16
- let(:account) { ActsAsTenant.current_tenant }
18
+ let(:logged_user) { create :user, :owner }
19
+ # let(:account) { ActsAsTenant.current_tenant }
17
20
 
18
21
  before do
19
22
  login_as logged_user
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.37
4
+ version: 7.6.39
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: 2025-04-02 00:00:00.000000000 Z
11
+ date: 2025-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails