zutils 1.1.1 → 1.1.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: 8a9eb74781bf8db14a1333f5f644b29cf11516e1bbf794b5905de9f9c18ca4c4
4
- data.tar.gz: 2bd41f7c6d6f9a20f99189d92cc380cf0621a06c8b2394c8784455f1088edcb7
3
+ metadata.gz: bff9fb81ac8f0156f7d46644f0da08d0324b413f72ab8a2fc293d2963bafed93
4
+ data.tar.gz: a5ab72d937c600876d05e1dcceca038bb08873077e7760170b0a89a486326649
5
5
  SHA512:
6
- metadata.gz: 56d2f7933b7b28722a406d909f9c5db701ee0aaeca5fd38496689e0e03ef10e480d6ed09531aa343a5eaa4d8aa92809140770c034c5268276ba20cd60e263b01
7
- data.tar.gz: 5bc42418e918437043db8ef865a2ae807d3ed4da7b2c8f95ad597e1b2d8ee2c23fb7705f590e269996cf60ba7421fb7cc8c5f437dbaadf000d4ae230a4e2a58a
6
+ metadata.gz: 33345cf00d787c3c7c5ea059c2e6d671071e62b6331492a5f799e9bd6c1493a51dcb577da6bb57f74701c3b1bef37c08c22206ee73ffb04d2798b9ab7c537a70
7
+ data.tar.gz: b980a28133573afad4290a1f7e1124182e44fe4a4d12da0c7cdddf727c7873650faf0e4997f16168be76e88fa719db69080eb602eec999b1e3b434843fb0e4a9
@@ -39,9 +39,11 @@
39
39
  <th data-field="<%= column_method || column_name %>" data-align="<%= column_align %>">
40
40
  <% if sort_all || sort_fields.include?(column_name) %>
41
41
  <% if column_name.include?('.') %>
42
- <% s_name = column_method || column_name %>
43
- <%= sort_link(@q, s_name.split('.').join('_'),
44
- "#{s_name.split('.')[-2]&.camelize} (#{s_name.split('.')[-1]})")
42
+ <% mname = column_name.split('.')[-2]&.camelize %>
43
+ <% cname = column_name.split('.')[-1] %>
44
+ <% model = Kernel.const_get(mname) %>
45
+ <%= sort_link(@q, column_name.split('.').join('_'),
46
+ "#{model.model_name.human} (#{model.human_attribute_name(cname)})")
45
47
  %>
46
48
  <% elsif /_id$/ =~ column_name %>
47
49
  <%= sort_link(@q, column_name, list.klass.human_attribute_name(column_name.split("_id")[0])) %>
@@ -92,9 +94,13 @@
92
94
 
93
95
  <td>
94
96
  <% if column_name.include?('.') %>
95
- <% o = object %>
96
- <% column_name.split('.').each{|m| o = o.send(m) if o } %>
97
- <%= o %>
97
+ <% if column_method.nil? %>
98
+ <% o = object %>
99
+ <% column_name.split('.').each{|m| o = o.send(m) if o } %>
100
+ <%= o %>
101
+ <% else %>
102
+ <%= object.send(column_method) %>
103
+ <% end %>
98
104
  <% elsif object.send(column_name).class == Date or
99
105
  object.send(column_name).class == DateTime or
100
106
  object.send(column_name).class == ActiveSupport::TimeWithZone or
@@ -1,3 +1,3 @@
1
1
  module Zutils
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zutils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Viana
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-24 00:00:00.000000000 Z
11
+ date: 2021-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails