pg_rails 7.4.1 → 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: 5588099f1a49f3ec2824e706a5a3f32b6434bcf8c06c631893326649a93fcb0c
4
- data.tar.gz: ab53c02854cea2a04ba5f5dd9400621deab673df6df7e38e309d724b9962d42a
3
+ metadata.gz: 55cfb59ec05d90c2944001cb69e2625c8d4f8e8a1eb460427dca95daf25b4ba4
4
+ data.tar.gz: eb5c2a073a6a1d69a0307e2ae16e9550dc852e2a45bd28aebb2ccc0ef6b0d5d6
5
5
  SHA512:
6
- metadata.gz: c18c347c8d3e95e24c4bf8b81cefb3a29a3fa5375072fb554aa1647b784b53a471f68481562504689c930854bc9c67898471dc620c8a264179ad291638879d33
7
- data.tar.gz: 7e8f1c56e3df3ac5e918cf59f4edf1857640014ccc3d422d6f6668981e260d51072e5b73eeb8a40d7fb1fc5ff1398cf58cd2ead5aef358519c1469b6e54b5163
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.4.1'
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.4.1
4
+ version: 7.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martín Rosso
@@ -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