pg_rails 7.1.13 → 7.1.15

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: 4a90a7a62e376e482f5e3c072c38f859478a7a333d606de01c8d5481cefd8fb5
4
- data.tar.gz: ec85008cd9234bb9c7435ca6838af3ca380c2f34c43fb80bd30e9d2608d2dfc6
3
+ metadata.gz: 266cfada8ad43cc522e6208107c12715f29ac0393c93154046d377f0ca434598
4
+ data.tar.gz: 1fec4b327371b492aa75ec6640b7c9a85f93afceb7d89074aec369f67f85cb11
5
5
  SHA512:
6
- metadata.gz: 9039afd99e6a910e4e1a47c125e8285992360d1979836a0d7df1c1f9f4b0837ee4bf8b5d266384998cabcc765dfe8bd4b0fa96143ba9baa58946b4697e97addd
7
- data.tar.gz: c2b42d1565fc804d2ef3015c197820abc54a8425d66d27f6b57f21a768779ceab9ade935dfefb85db8016bcce98988f3378b9bb1cf99a4dfc0f223a335b0a046
6
+ metadata.gz: a985cde74ba0a65f4f234d0b5648cf7465291dfcd16da6d92ea9d3a1b62c1bb8a9a0c70a4936dcf7bbf679b2f8b6d8ba56b3a9e8bdf8133e3d81b8e5d28a9941
7
+ data.tar.gz: 9213cd8758d1f4ea9a9ead1c5f0aa8ba26e67cb83ec2a643e7635a0e6ce37caa02e722f174b5b5b10ecfac6f65eb386d0356e8f54bb12c9e34bc91552fb8bed9
@@ -32,7 +32,7 @@ export default class extends Controller {
32
32
 
33
33
  disconnect (e) {
34
34
  this.modalPuntero.hide()
35
- this.element.dispatchEvent(new Event('hidden.bs.modal'))
35
+ document.dispatchEvent(new Event('hidden.bs.modal'))
36
36
  this.modalPuntero.dispose()
37
37
  }
38
38
  }
@@ -3,11 +3,12 @@
3
3
  .d-flex.align-items-center.px-3.py-2
4
4
  .px-2.d-none.d-sm-inline-block
5
5
  span.bi.bi-funnel-fill
6
- = helpers.search_form_for @q, url: url_for do |f|
6
+ = helpers.search_form_for @q, url: url_for, html: { 'data-turbo-action': :advance } do |f|
7
7
  .row.g-1
8
8
  .col
9
9
  .row.g-1
10
10
  = @builder.filtros_html(form: f)
11
+ = @extra_fields
11
12
  .col-auto.gap-1.d-flex.align-items-start
12
13
  = helpers.button_tag class: 'btn btn-sm btn-primary col-auto' do
13
14
  span.bi.bi-search
@@ -7,4 +7,8 @@ class SearchBarComponent < ViewComponent::Base
7
7
 
8
8
  super
9
9
  end
10
+
11
+ def extra_fields(&)
12
+ @extra_fields = capture(&)
13
+ end
10
14
  end
@@ -22,7 +22,8 @@ module Admin
22
22
  def create
23
23
  saved = false
24
24
  ActiveRecord::Base.transaction do
25
- # FIXME: acá la transaction jode porque el ActiveJob no puede deserializar el Email
25
+ # TODO: acá la transaction jode porque el ActiveJob no puede deserializar el Email
26
+ # Con rails 7.2 esto se debería arreglar
26
27
  if (saved = @email.save)
27
28
  PgEngine::AdminMailer.with(email_object: @email).admin_mail.deliver_later
28
29
  end
@@ -162,9 +162,14 @@ module PgEngine
162
162
  def pg_respond_show(object = nil)
163
163
  object ||= instancia_modelo
164
164
  if params[:modal].present?
165
- render turbo_stream: turbo_stream.append_all(
166
- 'body', partial: 'pg_layout/modal_show', locals: { object: }
167
- )
165
+ respond_to do |format|
166
+ format.html
167
+ format.turbo_stream do
168
+ render turbo_stream: turbo_stream.append_all(
169
+ 'body', partial: 'pg_layout/modal_show', locals: { object: }
170
+ )
171
+ end
172
+ end
168
173
  else
169
174
  respond_to do |format|
170
175
  format.json { render json: object }
@@ -91,11 +91,12 @@ module PgEngine
91
91
  end
92
92
 
93
93
  if Current.user.present?
94
+ # TODO: quitar el limit 3, discard en events
94
95
  @notifications = Current.user.notifications.order(id: :desc).includes(:event)
95
96
  .where(type: 'SimpleUserNotifier::Notification')
97
+ .limit(3)
96
98
  unseen = @notifications.unseen.any?
97
- # FIXME: testear y fixear, buscar el primero que esté present
98
- tooltip = @notifications.unseen.map(&:tooltip).first
99
+ tooltip = @notifications.unseen.map(&:tooltip).select(&:presence).first
99
100
  @notifications_bell = NotificationsBellComponent.new(
100
101
  unseen:,
101
102
  tooltip:
@@ -1 +1 @@
1
- span#tooltip data-bs-toggle="tooltip" data-bs-title="El tooltip" las cosas
1
+ span#tooltip data-controller="tooltip" data-bs-title="El tooltip" las cosas
@@ -1,16 +1,6 @@
1
1
  import * as bootstrap from 'bootstrap'
2
2
 
3
- document.addEventListener('turbo:load', bindTooltips)
4
- document.addEventListener('turbo:render', bindTooltips)
5
-
6
- const tooltipsQuery = '[data-bs-toggle="tooltip"]'
7
-
8
- function bindTooltips () {
9
- const toastElList = document.querySelectorAll(tooltipsQuery)
10
- Array.from(toastElList).map(tooltipEl => {
11
- return new bootstrap.Tooltip(tooltipEl)
12
- })
13
- }
3
+ const tooltipsQuery = '[data-controller="tooltip"]'
14
4
 
15
5
  document.addEventListener('show.bs.tooltip', (ev) => {
16
6
  const toastElList = document.querySelectorAll(tooltipsQuery)
@@ -10,6 +10,7 @@ import FiltrosController from './filtros_controller'
10
10
  import NotificationsController from './notifications_controller'
11
11
  import SelectizeController from './selectize_controller'
12
12
  import ThemeController from './theme_controller'
13
+ import TooltipController from './tooltip_controller'
13
14
 
14
15
  application.register('navbar', NavbarController)
15
16
  application.register('nested', NestedController)
@@ -21,5 +22,6 @@ application.register('filtros', FiltrosController)
21
22
  application.register('notifications', NotificationsController)
22
23
  application.register('selectize', SelectizeController)
23
24
  application.register('theme', ThemeController)
25
+ application.register('tooltip', TooltipController)
24
26
 
25
27
  // TODO: testear con capybara todo lo que se pueda
@@ -0,0 +1,28 @@
1
+ import { Controller } from '@hotwired/stimulus'
2
+ import * as bootstrap from 'bootstrap'
3
+
4
+ export default class extends Controller {
5
+ tooltip = null
6
+
7
+ connect () {
8
+ if (this.element.dataset.bsTrigger === 'contextmenu') {
9
+ this.element.addEventListener('contextmenu', (ev) => {
10
+ ev.preventDefault()
11
+ if (!this.tooltip) {
12
+ this.tooltip = new bootstrap.Tooltip(this.element, {
13
+ trigger: 'focus'
14
+ })
15
+ this.tooltip.show()
16
+ }
17
+ })
18
+ } else {
19
+ this.tooltip = new bootstrap.Tooltip(this.element)
20
+ }
21
+ }
22
+
23
+ disconnect () {
24
+ if (this.tooltip) {
25
+ this.tooltip.dispose()
26
+ }
27
+ }
28
+ }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.1.13'
4
+ VERSION = '7.1.15'
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.1.13
4
+ version: 7.1.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-08-12 00:00:00.000000000 Z
11
+ date: 2024-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -839,6 +839,7 @@ files:
839
839
  - pg_layout/app/javascript/controllers/selectize_controller.js
840
840
  - pg_layout/app/javascript/controllers/switcher_controller.js
841
841
  - pg_layout/app/javascript/controllers/theme_controller.js
842
+ - pg_layout/app/javascript/controllers/tooltip_controller.js
842
843
  - pg_layout/app/javascript/utils/cookies.js
843
844
  - pg_layout/app/javascript/utils/utils.ts
844
845
  - pg_layout/app/lib/navbar.rb