zutils 0.2.4 → 0.2.5

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: b1eedd32e33f12af64918a90e28c00f53f83e3be11fc54716d6e89457ceef6d5
4
- data.tar.gz: 5c8427865592d8b9ce3b99eeb3c1f1616ccd19f20d4415fb0a577e04dfa6a7db
3
+ metadata.gz: 64a2ebbb9e87c1305e9b3983fc7ee644e06d86df468aa1facd3b5f6129d4a7df
4
+ data.tar.gz: 5b461925540c49b78ca1ea2309c38f95036bcd3b0c4370b3271cd8cdc70c8805
5
5
  SHA512:
6
- metadata.gz: 7e4d07acef4febb18331f7bc0ec58b2645a84a5cbaf30235821818d7cb2e222dea8d30bde9c8d00068600d9631d60dccdfa304eed819b079065667b1f13b11a4
7
- data.tar.gz: 6ef3be19b893e365d44d16d86a76394b47fada5812ef7b86484097326cdbcf3f055d03e2edbb44a3051c212d109eff0bc6e51c30ac290c564edea2f2f3f2b4f6
6
+ metadata.gz: d7ce40487cf3664f224f118481bfbd982febe1cf711e8fbaf3078669e2b6422a04efc59bc83b3f90b910b2db63033a51e10e145851be7b7bc37440b9f6a432c0
7
+ data.tar.gz: 1d489306f34a3146dfbedad2acdb523d8424bd8311b76db93b67271f4dbc62302ecb61efddf1c7684cfd5b17c2760449818489ba3e4faac012096f78ca47991e
@@ -3,57 +3,59 @@
3
3
  <% hide_actions ||= false %>
4
4
  <% sort_fields ||= [] %>
5
5
 
6
- <% form_fields ||= (list.first.class.respond_to?('form_fields') ? list.first.class.form_fields : {}) %>
7
- <% form_ordered_fields ||= (form_fields.empty? ? list.first.class.column_names : form_fields.keys) %>
6
+ <% unless list.empty? %>
7
+ <% form_fields ||= (list.first.class.respond_to?('form_fields') ? list.first.class.form_fields : {}) %>
8
+ <% form_ordered_fields ||= (form_fields.empty? ? list.first.class.column_names : form_fields.keys) %>
8
9
 
9
- <table class="table table-striped datatables">
10
- <thead>
11
- <tr>
12
- <% unless list.empty? %>
13
- <% (form_ordered_fields - exceptions - excluded_columns).each do |column| %>
14
- <% if sort_fields.include?(column) || sort_fields.include?(column.to_s) || sort_fields.include?(column.to_sym) %>
15
- <% if /_id$/ =~ column %>
16
- <th><%= sort_link(@q, column, list.first.class.human_attribute_name(column.split("_id")[0])) %></th>
10
+ <table class="table table-striped datatables">
11
+ <thead>
12
+ <tr>
13
+ <% unless list.empty? %>
14
+ <% (form_ordered_fields - exceptions - excluded_columns).each do |column| %>
15
+ <% if sort_fields.include?(column) || sort_fields.include?(column.to_s) || sort_fields.include?(column.to_sym) %>
16
+ <% if /_id$/ =~ column %>
17
+ <th><%= sort_link(@q, column, list.first.class.human_attribute_name(column.split("_id")[0])) %></th>
18
+ <% else %>
19
+ <th><%= sort_link(@q, column, list.first.class.human_attribute_name(column)) %></th>
20
+ <% end %>
17
21
  <% else %>
18
- <th><%= sort_link(@q, column, list.first.class.human_attribute_name(column)) %></th>
22
+ <% if /_id$/ =~ column %>
23
+ <th><%= list.first.class.human_attribute_name(column.split("_id")[0]) %></th>
24
+ <% else %>
25
+ <th><%= list.first.class.human_attribute_name(column) %></th>
26
+ <% end %>
19
27
  <% end %>
28
+ <% end %>
29
+ <% unless hide_actions %>
30
+ <th>Ações</th>
31
+ <% end %>
32
+ <% end %>
33
+ </tr>
34
+ </thead>
35
+ <tbody>
36
+ <% list.each do |object| %>
37
+ <tr>
38
+ <% (form_ordered_fields - exceptions - excluded_columns).each do |column| %>
39
+ <td>
40
+ <% if object.send(column).class == Date or
41
+ object.send(column).class == DateTime or
42
+ object.send(column).class == ActiveSupport::TimeWithZone or
43
+ object.send(column).class == Time %>
44
+ <%=l object.send(column) %>
45
+ <% elsif /_id$/ =~ column && object.respond_to?(column.split('_id')[0]) %>
46
+ <%= object.send(column.split("_id")[0])&.name %>
20
47
  <% else %>
21
- <% if /_id$/ =~ column %>
22
- <th><%= list.first.class.human_attribute_name(column.split("_id")[0]) %></th>
23
- <% else %>
24
- <th><%= list.first.class.human_attribute_name(column) %></th>
25
- <% end %>
48
+ <%= object.send(column) %>
26
49
  <% end %>
50
+ </td>
27
51
  <% end %>
28
52
  <% unless hide_actions %>
29
- <th>Ações</th>
30
- <% end %>
31
- <% end %>
32
- </tr>
33
- </thead>
34
- <tbody>
35
- <% list.each do |object| %>
36
- <tr>
37
- <% (form_ordered_fields - exceptions - excluded_columns).each do |column| %>
38
- <td>
39
- <% if object.send(column).class == Date or
40
- object.send(column).class == DateTime or
41
- object.send(column).class == ActiveSupport::TimeWithZone or
42
- object.send(column).class == Time %>
43
- <%=l object.send(column) %>
44
- <% elsif /_id$/ =~ column && object.respond_to?(column.split('_id')[0]) %>
45
- <%= object.send(column.split("_id")[0])&.name %>
46
- <% else %>
47
- <%= object.send(column) %>
53
+ <td>
54
+ <%= render 'shared/action_links', object: object %>
55
+ </td>
48
56
  <% end %>
49
- </td>
50
- <% end %>
51
- <% unless hide_actions %>
52
- <td>
53
- <%= render 'shared/action_links', object: object %>
54
- </td>
57
+ </tr>
55
58
  <% end %>
56
- </tr>
57
- <% end %>
58
- </tbody>
59
- </table>
59
+ </tbody>
60
+ </table>
61
+ <% end %>
@@ -1,3 +1,3 @@
1
1
  module Zutils
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
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: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Viana
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-07 00:00:00.000000000 Z
11
+ date: 2019-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails