pg_rails 7.4.0 → 7.4.2

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: 76de379c2a544b8c8cbb3dc273d48c889a4e1433382f4cb5506f6af6ab5a87a0
4
- data.tar.gz: 6e8328117a18ec5919b5e524491bd9dae8a157c14af0bf9ad4ff81c360ef39a1
3
+ metadata.gz: 55cfb59ec05d90c2944001cb69e2625c8d4f8e8a1eb460427dca95daf25b4ba4
4
+ data.tar.gz: eb5c2a073a6a1d69a0307e2ae16e9550dc852e2a45bd28aebb2ccc0ef6b0d5d6
5
5
  SHA512:
6
- metadata.gz: '050966c0de869132e98d92ee13a2697f38429a1b11145161318c41ffa00cbba38f02dde11d2d72a6db798171cf99c9377eb48422bd292ba01a89ba5f49a1ee1d'
7
- data.tar.gz: 0c61544a7e0152a31fd2e2cdea22172e809f04125d11cb2d009e40c676bd631e713c9758e9fb7189840e65851df32d2ee94f8f705baebba695ce04f5a8718b5e
6
+ metadata.gz: 890f2a67f70994285f1c5cefd90f8cd36c3604bcb368345e9e5331afa805fa99bb5f15e5bfd81e9e78e0948621f6356df0c855c22fb70d0c10722f974e0438f4
7
+ data.tar.gz: db292c14db052409f0b27c9d11fafce68471f387c633799a7caf2c9f3b49e59829ad14ee3d41976a133d3f5912c56a087fa54068974cd2b42194b97a1d8f4cee
@@ -21,6 +21,7 @@ module PgEngine
21
21
  clazz.helper_method :current_page_size
22
22
  clazz.helper_method :show_filters?
23
23
  clazz.helper_method :available_page_sizes
24
+ clazz.helper_method :column_options_for
24
25
 
25
26
  clazz.before_action do
26
27
  # TODO: quitar esto, que se use el attr_accessor
@@ -65,6 +66,10 @@ module PgEngine
65
66
  end
66
67
  # rubocop:enable Metrics/PerceivedComplexity
67
68
 
69
+ def column_options_for(_object, _attribute)
70
+ { class: 'text-nowrap' }
71
+ end
72
+
68
73
  def referred_by?(object)
69
74
  url_for(object.decorate.target_object) == request.referer
70
75
  end
@@ -2,6 +2,12 @@
2
2
 
3
3
  module PgEngine
4
4
  module IndexHelper
5
+ def column_for(object, attribute)
6
+ content_tag :td, **column_options_for(object, attribute) do
7
+ object.send(attribute).to_s
8
+ end
9
+ end
10
+
5
11
  def encabezado(input, options = {})
6
12
  if input.is_a? Array
7
13
  campo = input.first
@@ -31,7 +31,7 @@ div
31
31
  - object = object.decorate
32
32
  tr id="#{dom_id(object)}"
33
33
  - atributos_para_listar.each do |att, _sort_field|
34
- td.text-nowrap = object.send(att)
34
+ = column_for object, att
35
35
  td.text-nowrap.text-end.ps-5
36
36
  .actions-wrapper
37
37
  = object.extra_actions(size: :sm) if object.respond_to? :extra_actions
@@ -94,10 +94,10 @@ module PgEngine
94
94
  end
95
95
  end
96
96
 
97
- def self.redis_url
97
+ def self.redis_url(host: '127.0.0.1', port: '6379')
98
98
  env_value = ENV.fetch('TEST_ENV_NUMBER', nil)
99
99
  db = (env_value.nil? ? 1 : (env_value.presence || 1)).to_i - 1
100
- "redis://127.0.0.1:6379/#{db}"
100
+ "redis://#{host}:#{port}/#{db}"
101
101
  end
102
102
 
103
103
  GOOGLE_FONTS_URL =
@@ -0,0 +1,16 @@
1
+ h1 Tables
2
+
3
+ table.table
4
+ tr
5
+ td = Faker::Lorem.sentence(word_count: 80)
6
+ td = Faker::Lorem.sentence(word_count: 40)
7
+
8
+ table.table
9
+ tr
10
+ td.column-truncate-30 = Faker::Lorem.sentence(word_count: 80)
11
+ td.column-truncate-70 = Faker::Lorem.sentence(word_count: 40)
12
+
13
+ table.table
14
+ tr
15
+ td.column-truncate-80 = Faker::Lorem.sentence(word_count: 80)
16
+ td = Faker::Lorem.sentence(word_count: 4)
@@ -11,4 +11,6 @@ class AlertComponentPreview < ViewComponent::Preview
11
11
  def tooltips; end
12
12
 
13
13
  def list_group; end
14
+
15
+ def tables; end
14
16
  end
@@ -28,7 +28,7 @@ html
28
28
  meta name="cable-history-timestamp" content="#{Time.now.to_i}"
29
29
  = csrf_meta_tags
30
30
  = csp_meta_tag
31
- - if defined? Anycable
31
+ - if defined?(AnyCable::Rails)
32
32
  = action_cable_with_jwt_meta_tag
33
33
 
34
34
  = stylesheet_link_tag 'application', 'data-turbo-track': 'reload'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.4.0'
4
+ VERSION = '7.4.2'
5
5
  end
@@ -63,6 +63,20 @@ $breadcrumb-margin-bottom: 0;
63
63
  padding-right: 0.75rem !important;
64
64
  }
65
65
 
66
+ $values: 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100;
67
+
68
+ @for $i from 1 through length($values) {
69
+ $value: nth($values, $i);
70
+ $perc: #{percenage($value)};
71
+
72
+ .column-truncate-#{$value} {
73
+ max-width: 0;
74
+ width: percentage($value * 0.01);
75
+ overflow: hidden;
76
+ text-overflow: ellipsis;
77
+ white-space: nowrap;
78
+ }
79
+ }
66
80
 
67
81
  $warning-border-emphasis: shade-color($yellow, 60%);
68
82
  .btn-toolbar .btn-warning {
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.4.0
4
+ version: 7.4.2
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-09-03 00:00:00.000000000 Z
11
+ date: 2024-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -809,6 +809,7 @@ files:
809
809
  - pg_engine/spec/components/previews/alert_component_preview/default.html.slim
810
810
  - pg_engine/spec/components/previews/alert_component_preview/dismisible.html.slim
811
811
  - pg_engine/spec/components/previews/alert_component_preview/list_group.html.slim
812
+ - pg_engine/spec/components/previews/alert_component_preview/tables.html.slim
812
813
  - pg_engine/spec/components/previews/alert_component_preview/tooltips.html.slim
813
814
  - pg_engine/spec/components/previews/internal_error_preview.rb
814
815
  - pg_engine/spec/components/previews/internal_error_preview/default.html.slim