pg_rails 7.4.1 → 7.4.3

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: c92bec79721ca86a7228a00acdf6ee2e968c240a1739cdd4b7c61a0f2a7784b5
4
+ data.tar.gz: 0701cd071509d9ef7a0fbd7ed8d0cc6e4122b40fe865d021e981b94e96a618e5
5
5
  SHA512:
6
- metadata.gz: c18c347c8d3e95e24c4bf8b81cefb3a29a3fa5375072fb554aa1647b784b53a471f68481562504689c930854bc9c67898471dc620c8a264179ad291638879d33
7
- data.tar.gz: 7e8f1c56e3df3ac5e918cf59f4edf1857640014ccc3d422d6f6668981e260d51072e5b73eeb8a40d7fb1fc5ff1398cf58cd2ead5aef358519c1469b6e54b5163
6
+ metadata.gz: 9888c6b99cf12f74e07aee5bcd4b93d84aa8449ff4854926a8ba9357bf9a20144936337d4b9bb6e1bc8a4dc064d45eaccd44a38986a8816a9aef53939a96fd44
7
+ data.tar.gz: 8acb411a451cc8685e3a3cf84bfdfe44ea2c90ae9ffe24d3bcf45ae566ae0c3efe2ea79e96dc74ded65c226ac698d6b660e0d4ce5a547984e65c0bba360bfc6c
@@ -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
@@ -22,7 +22,7 @@ div
22
22
  thead.table-light
23
23
  tr
24
24
  - atributos_para_listar.each do |att|
25
- th = encabezado att, ordenable: true
25
+ th.text-nowrap style="font-size: 0.8em" = encabezado att, ordenable: true
26
26
  th.text-end
27
27
  - unless @export_link == false
28
28
  = @clase_modelo.new.decorate.export_link(request.url)
@@ -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,22 @@
1
+ h1 Tables
2
+
3
+ h4 None
4
+ .table-responsive
5
+ table.table
6
+ tr
7
+ td.text-nowrap = Faker::Lorem.sentence(word_count: 80)
8
+ td.text-nowrap = Faker::Lorem.sentence(word_count: 40)
9
+
10
+ h4 30-70
11
+ .table-responsive
12
+ table.table
13
+ tr
14
+ td.column-truncate-30 = Faker::Lorem.sentence(word_count: 80)
15
+ td.column-truncate-70 = Faker::Lorem.sentence(word_count: 40)
16
+
17
+ h4 80-
18
+ .table-responsive
19
+ table.table
20
+ tr
21
+ td.column-truncate-80 = Faker::Lorem.sentence(word_count: 80)
22
+ td.text-nowrap = 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.3'
5
5
  end
@@ -63,6 +63,21 @@ $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
+ min-width: 30em * $value * 0.01;
79
+ }
80
+ }
66
81
 
67
82
  $warning-border-emphasis: shade-color($yellow, 60%);
68
83
  .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.3
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