zutils 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/shared/_show.html.erb +79 -84
- data/lib/zutils/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1e2951ef16b864b5c89d7e59c3218cb039d1a2a346e0beb06a86e8af897fa2b
|
4
|
+
data.tar.gz: 504f657bb23981540599fa840021a0b7d051306f425728b21948dba1fdac8f1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6c01ff42e72d2f2c5a6324848397133153024852c8505e1b23e0a148fdb0d982306f9f918ae15fec1ee60d6ed8386b8f252896cfb456a4cf66fcbfed7034701
|
7
|
+
data.tar.gz: 78a06d0e450914380028662375e453f5fd59a41885683077d8940377409225c8f1f8ecf9e1f7615e666feea9683d125720053c5fdbc9aa7f967fb81ca4902ae1
|
@@ -1,22 +1,27 @@
|
|
1
1
|
<% excluded_columns ||= [] %>
|
2
|
+
<% additional_columns ||= [] %>
|
3
|
+
<% show_columns ||= [] %>
|
4
|
+
|
2
5
|
<% nested_resource ||= false %>
|
3
6
|
<% relationships ||= {} %>
|
4
7
|
<% box_class ||= 'primary' %>
|
5
|
-
<% display_mode ||= 'table' %>
|
6
8
|
<% hide_links ||= false %>
|
9
|
+
<% show_actions ||= ['new', 'edit', 'index'] %>
|
7
10
|
<% hide_header ||= false %>
|
8
11
|
<% hide_table_header ||= false %>
|
9
|
-
<% additional_columns ||= [] %>
|
10
12
|
|
11
|
-
<%
|
12
|
-
<%
|
13
|
+
<% if show_columns.empty? %>
|
14
|
+
<% form_fields ||= (object.class.respond_to?('form_fields') ? object.class.form_fields : {}) %>
|
15
|
+
<% form_ordered_fields ||= (form_fields.empty? ? object.class.column_names : form_fields.keys) %>
|
16
|
+
<% show_columns = form_ordered_fields - ['id', 'created_at', 'updated_at', 'deleted_at'] - excluded_columns + additional_columns %>
|
17
|
+
<% end %>
|
13
18
|
|
14
19
|
<div class="box box-<%= box_class %>">
|
15
20
|
<% unless hide_header %>
|
16
21
|
<div class="box-header with-border">
|
17
22
|
<h3 class="box-title"><%= object.class.model_name.human %></h3>
|
18
23
|
<% unless hide_links %>
|
19
|
-
<% if can?
|
24
|
+
<% if show_actions.include?('new') && can?(:new, object.class) %>
|
20
25
|
<% if nested_resource %>
|
21
26
|
<%= link_to eval_with_rescue("new_#{parent_resource.class.model_name.singular}_#{object.class.model_name.singular}_path(#{parent_resource.id})"), class: "btn btn-#{box_class} btn-xs", data: { toggle: 'tooltip', placement: 'top', title: 'Cadastrar' } do %>
|
22
27
|
Cadastrar <i class="fa fa-plus"></i>
|
@@ -27,94 +32,74 @@
|
|
27
32
|
<% end %>
|
28
33
|
<% end %>
|
29
34
|
<% end %>
|
30
|
-
<% if can?
|
35
|
+
<% if show_actions.include?('edit') && can?(:edit, object) %>
|
31
36
|
<%= link_to eval_with_rescue("edit_#{object.class.model_name.singular}_path(#{object.id})"), class: "btn btn-warning btn-xs", data: { toggle: 'tooltip', placement: 'top', title: 'Editar' } do %>
|
32
37
|
Editar <i class="fa fa-pencil"></i>
|
33
38
|
<% end %>
|
34
39
|
<% end %>
|
35
|
-
<% if
|
36
|
-
|
37
|
-
|
38
|
-
|
40
|
+
<% if show_actions.include?('index') %>
|
41
|
+
<% if nested_resource %>
|
42
|
+
<%= link_to 'Listagem', eval_with_rescue("#{parent_resource.class.model_name.singular}_#{object.class.model_name.plural}_path(#{parent_resource.id})"), class: "btn btn-default btn-xs" %>
|
43
|
+
<% else %>
|
44
|
+
<%= link_to 'Listagem', eval_with_rescue("#{object.class.model_name.plural}_path"), class: "btn btn-default btn-xs" %>
|
45
|
+
<% end %>
|
39
46
|
<% end %>
|
40
47
|
<% end %>
|
48
|
+
<% if block_given? %>
|
49
|
+
<%= yield %>
|
50
|
+
<% end %>
|
41
51
|
</div>
|
42
52
|
<% end %>
|
43
|
-
<div class="box-body
|
44
|
-
|
45
|
-
|
46
|
-
<
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
<%
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
<thead>
|
81
|
-
<tr>
|
82
|
-
<th width='15%'><%= t('field') %></th>
|
83
|
-
<th><%= t('value') %></th>
|
84
|
-
</tr>
|
85
|
-
</thead>
|
86
|
-
<% end %>
|
87
|
-
<% (object.class.column_names - ['id', 'created_at', 'updated_at', 'deleted_at'] - excluded_columns + additional_columns).each do |column| %>
|
88
|
-
<% unless /_currency$/ =~ column %>
|
89
|
-
<tr>
|
90
|
-
<th>
|
91
|
-
<% if /_id$/ =~ column && object.respond_to?(column.split('_id')[0]) %>
|
92
|
-
<%= object.class.human_attribute_name(column.split("_id")[0]) %>
|
93
|
-
<% elsif /_cents$/ =~ column %>
|
94
|
-
<%= object.class.human_attribute_name(column.split("_cents")[0]) %>
|
95
|
-
<% else %>
|
96
|
-
<%= object.class.human_attribute_name(column) %>
|
97
|
-
<% end %>
|
98
|
-
</th>
|
99
|
-
<td>
|
100
|
-
<% if object.send(column).class == Date or
|
101
|
-
object.send(column).class == DateTime or
|
102
|
-
object.send(column).class == ActiveSupport::TimeWithZone or
|
103
|
-
object.send(column).class == Time %>
|
104
|
-
<%=l object.send(column) %>
|
105
|
-
<% elsif /_id$/ =~ column && object.respond_to?(column.split('_id')[0]) %>
|
106
|
-
<%= object.send(column.split("_id")[0])&.name %>
|
107
|
-
<% elsif /_cents$/ =~ column %>
|
108
|
-
<%= number_to_currency object.send(column.split("_cents")[0]) %>
|
109
|
-
<% else %>
|
110
|
-
<%= object.send(column) %>
|
53
|
+
<div class="box-body no-padding">
|
54
|
+
<table class="table table-bordered table-striped no-padding datatables">
|
55
|
+
<% unless hide_table_header %>
|
56
|
+
<thead>
|
57
|
+
<tr>
|
58
|
+
<th width='15%'><%= t('field') %></th>
|
59
|
+
<th><%= t('value') %></th>
|
60
|
+
</tr>
|
61
|
+
</thead>
|
62
|
+
<% end %>
|
63
|
+
<% show_columns.each do |column| %>
|
64
|
+
<% unless /_currency$/ =~ column %>
|
65
|
+
<tr>
|
66
|
+
<th>
|
67
|
+
<% if /_id$/ =~ column && object.respond_to?(column.split('_id')[0]) %>
|
68
|
+
<%= object.class.human_attribute_name(column.split("_id")[0]) %>
|
69
|
+
<% elsif /_cents$/ =~ column %>
|
70
|
+
<%= object.class.human_attribute_name(column.split("_cents")[0]) %>
|
71
|
+
<% else %>
|
72
|
+
<%= object.class.human_attribute_name(column) %>
|
73
|
+
<% end %>
|
74
|
+
</th>
|
75
|
+
<td>
|
76
|
+
<% if column.include?('.') %>
|
77
|
+
<% o = object %>
|
78
|
+
<% column.split('.').each{|m| o = o.send(m) if o } %>
|
79
|
+
<%= o %>
|
80
|
+
<% elsif object.send(column).class == Date or
|
81
|
+
object.send(column).class == DateTime or
|
82
|
+
object.send(column).class == ActiveSupport::TimeWithZone or
|
83
|
+
object.send(column).class == Time %>
|
84
|
+
<%=l object.send(column) %>
|
85
|
+
<% elsif object.send(column).respond_to? 'attached?' %>
|
86
|
+
<% if object.send(column).class == ActiveStorage::Attached::One %>
|
87
|
+
<%= link_to rails_blob_path(object.send(column)), class: "btn btn-#{box_class} btn-xs", target: '_blank' do %>
|
88
|
+
<i class="fa fa-file-o"></i> Arquivo
|
89
|
+
<% end %>
|
111
90
|
<% end %>
|
112
|
-
|
113
|
-
|
114
|
-
|
91
|
+
<% elsif /_id$/ =~ column && object.respond_to?(column.split('_id')[0]) %>
|
92
|
+
<%= object.send(column.split("_id")[0])&.name %>
|
93
|
+
<% elsif /_cents$/ =~ column %>
|
94
|
+
<%= number_to_currency object.send(column.split("_cents")[0]) %>
|
95
|
+
<% else %>
|
96
|
+
<%= object.send(column) %>
|
97
|
+
<% end %>
|
98
|
+
</td>
|
99
|
+
</tr>
|
115
100
|
<% end %>
|
116
|
-
|
117
|
-
|
101
|
+
<% end %>
|
102
|
+
</table>
|
118
103
|
</div>
|
119
104
|
</div>
|
120
105
|
|
@@ -199,11 +184,21 @@
|
|
199
184
|
<tr>
|
200
185
|
<% value.each do |v| %>
|
201
186
|
<td>
|
202
|
-
<% if
|
187
|
+
<% if v.include?('.') %>
|
188
|
+
<% o = r %>
|
189
|
+
<% v.split('.').each{|m| o = o.send(m) if o } %>
|
190
|
+
<%= o %>
|
191
|
+
<% elsif r.send(v).class == Date or
|
203
192
|
r.send(v).class == DateTime or
|
204
193
|
r.send(v).class == ActiveSupport::TimeWithZone or
|
205
194
|
r.send(v).class == Time %>
|
206
195
|
<%=l r.send(v) %>
|
196
|
+
<% elsif r.send(v).respond_to? 'attached?' %>
|
197
|
+
<% if r.send(v).class == ActiveStorage::Attached::One %>
|
198
|
+
<%= link_to rails_blob_path(r.send(v)), class: "btn btn-#{box_class} btn-xs", target: '_blank' do %>
|
199
|
+
<i class="fa fa-file-o"></i> Arquivo
|
200
|
+
<% end %>
|
201
|
+
<% end %>
|
207
202
|
<% elsif /_id$/ =~ v && r.respond_to?(v.split('_id')[0]) %>
|
208
203
|
<%= r.send(v.split("_id")[0])&.name %>
|
209
204
|
<% else %>
|
data/lib/zutils/version.rb
CHANGED
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.4.
|
4
|
+
version: 0.4.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: 2019-06-
|
11
|
+
date: 2019-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
|
-
rubygems_version: 3.0.
|
102
|
+
rubygems_version: 3.0.1
|
103
103
|
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: Utilidades gerais para aplicações rails
|