pg_rails 7.6.6 → 7.6.8

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: 365f1740542a5fbba1bce8e40441e42581235cd67e68a7890292f512a63535d7
4
- data.tar.gz: dfc9376def176892e05dc733c8a0df12a97f4b3da8c2fd0a31b1f7f5fc9b77a5
3
+ metadata.gz: 61bc441e108885c9686261c08fc110a3096fd0da5f43b78c5b995f2d6a0ae69b
4
+ data.tar.gz: b016d6b41b1a814e135c0e15049469ea61c37a056bc4e9545b8946195d0e7164
5
5
  SHA512:
6
- metadata.gz: 94fc43c2038e908511860200282138fc7fa4ca95d8536abbbaa1530e5a975ffcdc8e6d64243669511c7c8a9abe6dfea0922f27fc23eea91f71c455d92295851f
7
- data.tar.gz: 9020921857f2ec5e1d7af48321a9655b2f34557c0496a55b92bebd557772e9873e921bb7f1a9b8133093759c2f388c9ccc395949b13c5ad06ee68d52ae1eee86
6
+ metadata.gz: 31fc27bf74fce36435f8e23283d5612f893baca07f8d90ac26df6bfe870a7aa74df8b91b116445c680da11e8bebb1db35c7dba2f3ed46ab9ca458d72636f1ca8
7
+ data.tar.gz: 0a74fc77e43ef5000cd6acce42f1f48e00bcb07f80847c8a2b3c9c9c2e750ef96dceb51418092f1e3eb75ae160771b4ed4438c524c570dfa8b855a20462f56ba
@@ -61,6 +61,8 @@ module PgAssociable
61
61
 
62
62
  def select_comun(atributo, options, collection)
63
63
  options[:collection] = collection
64
+ options[:include_blank] = 'Ninguno'
65
+ options[:prompt] = nil
64
66
  association atributo, options
65
67
  end
66
68
 
@@ -311,6 +311,10 @@ export default class extends Controller {
311
311
  this.element.dataset.object = object
312
312
  const event = new CustomEvent('pg_associable:changed', { detail: object })
313
313
  this.element.dispatchEvent(event)
314
+ const inlineEdit = this.element.closest('.inline-edit')
315
+ if (inlineEdit) {
316
+ inlineEdit.querySelector('button[type=submit]').click()
317
+ }
314
318
  } else {
315
319
  hiddenField.value = null
316
320
  textField.value = null
@@ -34,6 +34,10 @@ nav[aria-label=breadcrumb] a {
34
34
  border: 1px solid $red;
35
35
  }
36
36
 
37
+ .trix-content figure a:hover {
38
+ text-decoration: underline;
39
+ }
40
+
37
41
  input[disabled] {
38
42
  background-color: #e9e9ed;
39
43
  color: black;
@@ -8,12 +8,6 @@ class InlineComponent < ViewComponent::Base
8
8
  super
9
9
  end
10
10
 
11
- def before_render
12
- return unless controller.in_modal?
13
-
14
- controller.instance_variable_set(:@using_modal, true)
15
- end
16
-
17
11
  SUFIJOS = %i[f text].freeze
18
12
  def unsuffixed(attribute)
19
13
  ret = attribute.to_s.dup
@@ -2,8 +2,12 @@
2
2
  = helpers.pg_form_for(@model, render_errors: false, wrapper_mappings: @wrapper_mappings) do |f|
3
3
  = hidden_field_tag :inline_attribute, @attribute
4
4
 
5
- = f.field @unsuffixed_attribute, label: false, html5: true
6
-
5
+ / html5 solo aplica a datetime
6
+ / date_selector solo aplica a date
7
+ / ignore_date y prompt solo aplica a time
8
+ / cada caso es inocuo para el resto de los types
9
+ = f.field @unsuffixed_attribute, label: false, date_selector: true, minute_step: 15,
10
+ ignore_date: true, prompt: { hour: 'hh', minute: 'mm' }
7
11
  .actions.d-flex.gap-1
8
12
  = button_tag class: 'btn btn-sm btn-primary',
9
13
  data: { controller: 'tooltip', 'bs-title': 'Guardar' } do
@@ -5,6 +5,7 @@ class InlineEditComponent < InlineComponent
5
5
  pg_associable: :inline_form_control,
6
6
  date: :inline_form_control,
7
7
  datetime: :inline_form_control,
8
+ time: :inline_multi_select,
8
9
  select: :inline_form_select
9
10
  }
10
11
 
@@ -1,7 +1,10 @@
1
1
  - if @model.class.inline_editable?(@unsuffixed_attribute) && helpers.policy(@model).edit?
2
2
  = helpers.turbo_frame_tag(@frame_id, class: 'inline-edit')
3
3
  = link_to users_inline_edit_path(model: @model.to_gid, attribute: @attribute),
4
- class: 'text-body-tertiary edit-link', style: 'font-size: 0.8em' do
4
+ data: { \
5
+ controller: :tooltip,
6
+ 'bs-title': "Modificar #{@model.class.human_attribute_name(@attribute).downcase}" },
7
+ class: 'text-body-tertiary edit-link', style: 'font-size: 0.8em' do
5
8
  i.bi.bi-pencil
6
9
  span = @model.decorate.send(@attribute)
7
10
  - else
@@ -34,7 +34,12 @@ module PgEngine
34
34
  if valor.instance_of?(Date)
35
35
  dmy(valor)
36
36
  elsif valor.instance_of?(ActiveSupport::TimeWithZone)
37
- dmy_time(valor)
37
+ column = object.class.columns.find { |c| c.name == method_name.to_s }
38
+ if column.present? && column.type == :time
39
+ hhmm(valor)
40
+ else
41
+ dmy_time(valor)
42
+ end
38
43
  else
39
44
  super
40
45
  end
@@ -51,6 +51,12 @@ module PgEngine
51
51
  date.strftime('%d/%m/%Y %H:%M')
52
52
  end
53
53
 
54
+ def hhmm(time)
55
+ return if time.blank?
56
+
57
+ time.strftime('%H:%M')
58
+ end
59
+
54
60
  def dmy(date)
55
61
  return if date.blank?
56
62
 
@@ -1 +1,16 @@
1
- <%= image_tag blob %>
1
+ <figure class="attachment attachment--<%= blob.representable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>">
2
+ <% if blob.representable? %>
3
+ <%= image_tag blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]) %>
4
+ <% end %>
5
+
6
+ <%= link_to rails_blob_path(blob) do %>
7
+ <figcaption class="attachment__caption">
8
+ <% if caption = blob.try(:caption) %>
9
+ <%= caption %>
10
+ <% else %>
11
+ <span class="attachment__name"><%= blob.filename %></span>
12
+ <span class="attachment__size"><%= number_to_human_size blob.byte_size %></span>
13
+ <% end %>
14
+ </figcaption>
15
+ <% end %>
16
+ </figure>
@@ -141,6 +141,16 @@ SimpleForm.setup do |config|
141
141
  b.use :hint, wrap_with: { class: 'form-text' }
142
142
  end
143
143
 
144
+ config.wrappers :inline_multi_select, class: '' do |b|
145
+ b.use :html5
146
+ b.optional :readonly
147
+ b.wrapper class: 'd-flex flex-row justify-content-between align-items-center' do |ba|
148
+ ba.use :input, class: 'form-select form-select-sm mx-1', error_class: 'is-invalid'
149
+ end
150
+ b.use :error, wrap_with: { class: 'invalid-feedback d-block' }
151
+ b.use :hint, wrap_with: { class: 'form-text' }
152
+ end
153
+
144
154
  # vertical range input
145
155
  config.wrappers :vertical_range, class: 'mb-3' do |b|
146
156
  b.use :html5
@@ -5,6 +5,30 @@ import './elements'
5
5
 
6
6
  import { Turbo } from '@hotwired/turbo-rails'
7
7
 
8
+ document.addEventListener('trix-before-initialize', (ev) => {
9
+ Trix.config.lang.attachFiles = "Adjuntar archivos"
10
+ Trix.config.lang.bold = "Negrita"
11
+ Trix.config.lang.bullets = "Lista sin números"
12
+ Trix.config.lang.byte = "Byte"
13
+ Trix.config.lang.bytes = "Bytes"
14
+ Trix.config.lang.captionPlaceholder = "Agregá un subtítulo"
15
+ Trix.config.lang.code = "Monospace"
16
+ Trix.config.lang.heading1 = "Título"
17
+ Trix.config.lang.indent = "Incrementar nivel"
18
+ Trix.config.lang.italic = "Cursiva"
19
+ Trix.config.lang.link = "Linkear"
20
+ Trix.config.lang.numbers = "Lista numerada"
21
+ Trix.config.lang.outdent = "Disminuir nivel"
22
+ Trix.config.lang.quote = "Cita"
23
+ Trix.config.lang.redo = "Rehacer"
24
+ Trix.config.lang.remove = "Quitar"
25
+ Trix.config.lang.strike = "Tachar"
26
+ Trix.config.lang.undo = "Deshacer"
27
+ Trix.config.lang.unlink = "Deslinkear"
28
+ Trix.config.lang.url = "URL"
29
+ Trix.config.lang.urlPlaceholder = "Ingresá una URL"
30
+ })
31
+
8
32
  document.addEventListener('pg:record-created', (ev) => {
9
33
  Turbo.visit(window.location)
10
34
  setTimeout(() => {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.6.6'
4
+ VERSION = '7.6.8'
5
5
  end
@@ -77,9 +77,11 @@ $values: 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100;
77
77
  white-space: nowrap;
78
78
  min-width: 30em * $value * 0.01;
79
79
 
80
- // TODO: con css grid esto se debería poder hacer mejor
80
+ // FIXME: con css grid esto se debería poder hacer mejor
81
+ // además, el pg_asociable directamente se rompe
81
82
  &:has(form) {
82
83
  min-width: 28em;
84
+ overflow: initial;
83
85
  }
84
86
  }
85
87
  }
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.6
4
+ version: 7.6.8
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-10-10 00:00:00.000000000 Z
11
+ date: 2024-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails