zutils 0.3.7 → 0.3.8
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 +91 -38
- data/lib/zutils/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7873068a2a60aa743dbdb26a1fb1c06a9f0eb1d37810502bba370b391bce2a8
|
4
|
+
data.tar.gz: 88af8504d18eec15eea620732cc5f7806662742bf88246b41a248890c8ce6a5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3327b7b596bd97291d0d8291982d4d844cbb9e4f5ba94be5e0d48233eba8bf60c4d03842f60f76e35c2476dbee39f4a89ed3ec9f64d2964731198a2769efcc58
|
7
|
+
data.tar.gz: dce70552ae56876fe8823d3db68bcfe164a559c21f016e7fd921ad1004a84e4f3f99bf55e96743fb7de6f337c454362780d8c2abc6520e1c7c001b7635ac37f1
|
@@ -78,7 +78,7 @@
|
|
78
78
|
<% unless hide_table_header %>
|
79
79
|
<thead>
|
80
80
|
<tr>
|
81
|
-
<th><%= t('field') %></th>
|
81
|
+
<th width='15%'><%= t('field') %></th>
|
82
82
|
<th><%= t('value') %></th>
|
83
83
|
</tr>
|
84
84
|
</thead>
|
@@ -86,7 +86,7 @@
|
|
86
86
|
<% (object.class.column_names - ['id', 'created_at', 'updated_at', 'deleted_at'] - excluded_columns).each do |column| %>
|
87
87
|
<% unless /_currency$/ =~ column %>
|
88
88
|
<tr>
|
89
|
-
<th
|
89
|
+
<th>
|
90
90
|
<% if /_id$/ =~ column && object.respond_to?(column.split('_id')[0]) %>
|
91
91
|
<%= object.class.human_attribute_name(column.split("_id")[0]) %>
|
92
92
|
<% elsif /_cents$/ =~ column %>
|
@@ -117,51 +117,104 @@
|
|
117
117
|
</div>
|
118
118
|
</div>
|
119
119
|
|
120
|
-
<% if relationships.
|
120
|
+
<% if relationships.any? %>
|
121
121
|
<% relationships.each do |key, value| %>
|
122
|
-
|
123
|
-
<div class="box
|
124
|
-
<
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
<
|
130
|
-
<
|
131
|
-
|
122
|
+
<% if object.association(key.to_s).kind_of? ActiveRecord::Associations::BelongsToAssociation %>
|
123
|
+
<div class="box box-<%= box_class %>">
|
124
|
+
<div class="box-header with-border">
|
125
|
+
<h3 class="box-title">
|
126
|
+
<%= Kernel.const_get(key.to_s.singularize.camelize).model_name.human %>
|
127
|
+
</h3>
|
128
|
+
</div>
|
129
|
+
<div class="box-body no-padding">
|
130
|
+
<table class="table table-bordered table-striped no-padding datatables">
|
131
|
+
<% unless hide_table_header %>
|
132
|
+
<thead>
|
133
|
+
<tr>
|
134
|
+
<th width='15%'><%= t('field') %></th>
|
135
|
+
<th><%= t('value') %></th>
|
136
|
+
</tr>
|
137
|
+
</thead>
|
138
|
+
<% end %>
|
139
|
+
<tbody>
|
132
140
|
<% value.each do |v| %>
|
133
|
-
<
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
141
|
+
<tr>
|
142
|
+
<td>
|
143
|
+
<strong>
|
144
|
+
<% if /_id$/ =~ v && Kernel.const_get(key.to_s.singularize.camelize).new.respond_to?(v.split('_id')[0]) %>
|
145
|
+
<%= Kernel.const_get(key.to_s.singularize.camelize).human_attribute_name(v.split('_id')[0]) %>
|
146
|
+
<% elsif /_cents$/ =~ v %>
|
147
|
+
<%= Kernel.const_get(key.to_s.singularize.camelize).human_attribute_name(v.split("_cents")[0]) %>
|
148
|
+
<% else %>
|
149
|
+
<%= Kernel.const_get(key.to_s.singularize.camelize).human_attribute_name(v) %>
|
150
|
+
<% end %>
|
151
|
+
</strong>
|
152
|
+
</td>
|
153
|
+
<td>
|
154
|
+
<% if object.send(key.to_s).send(v).class == Date or
|
155
|
+
object.send(key.to_s).send(v).class == DateTime or
|
156
|
+
object.send(key.to_s).send(v).class == ActiveSupport::TimeWithZone or
|
157
|
+
object.send(key.to_s).send(v).class == Time %>
|
158
|
+
<%=l object.send(key.to_s).send(v) %>
|
159
|
+
<% elsif /_id$/ =~ v && object.send(key.to_s).respond_to?(v.split('_id')[0]) %>
|
160
|
+
<%= object.send(key.to_s).send(v.split("_id")[0])&.name %>
|
161
|
+
<% elsif /_cents$/ =~ v %>
|
162
|
+
<%= number_to_currency object.send(key.to_s).send(v.split("_cents")[0]) %>
|
163
|
+
<% else %>
|
164
|
+
<%= object.send(key.to_s).send(v) %>
|
165
|
+
<% end %>
|
166
|
+
</td>
|
167
|
+
</tr>
|
140
168
|
<% end %>
|
141
|
-
</
|
142
|
-
</
|
143
|
-
|
144
|
-
|
169
|
+
</tbody>
|
170
|
+
</table>
|
171
|
+
</div>
|
172
|
+
</div>
|
173
|
+
<% else %>
|
174
|
+
<div class="box box-<%= box_class %>">
|
175
|
+
<div class="box-header with-border">
|
176
|
+
<h3 class="box-title">
|
177
|
+
<%= Kernel.const_get(key.to_s.singularize.camelize).model_name.human.pluralize %>
|
178
|
+
</h3>
|
179
|
+
</div>
|
180
|
+
<div class="box-body no-padding">
|
181
|
+
<table class="table table-bordered table-striped no-padding datatables">
|
182
|
+
<thead>
|
145
183
|
<tr>
|
146
184
|
<% value.each do |v| %>
|
147
|
-
<
|
148
|
-
<% if
|
149
|
-
|
150
|
-
r.send(v).class == ActiveSupport::TimeWithZone or
|
151
|
-
r.send(v).class == Time %>
|
152
|
-
<%=l r.send(v) %>
|
153
|
-
<% elsif /_id$/ =~ v && r.respond_to?(v.split('_id')[0]) %>
|
154
|
-
<%= r.send(v.split("_id")[0])&.name %>
|
185
|
+
<th>
|
186
|
+
<% if /_id$/ =~ v && Kernel.const_get(key.to_s.singularize.camelize).new.respond_to?(v.split('_id')[0]) %>
|
187
|
+
<%= Kernel.const_get(key.to_s.singularize.camelize).human_attribute_name(v.split('_id')[0]) %>
|
155
188
|
<% else %>
|
156
|
-
<%=
|
189
|
+
<%= Kernel.const_get(key.to_s.singularize.camelize).human_attribute_name(v) %>
|
157
190
|
<% end %>
|
191
|
+
</th>
|
192
|
+
<% end %>
|
193
|
+
</tr>
|
194
|
+
</thead>
|
195
|
+
<tbody>
|
196
|
+
<% object.send(key.to_s).each do |r| %>
|
197
|
+
<tr>
|
198
|
+
<% value.each do |v| %>
|
199
|
+
<td>
|
200
|
+
<% if r.send(v).class == Date or
|
201
|
+
r.send(v).class == DateTime or
|
202
|
+
r.send(v).class == ActiveSupport::TimeWithZone or
|
203
|
+
r.send(v).class == Time %>
|
204
|
+
<%=l r.send(v) %>
|
205
|
+
<% elsif /_id$/ =~ v && r.respond_to?(v.split('_id')[0]) %>
|
206
|
+
<%= r.send(v.split("_id")[0])&.name %>
|
207
|
+
<% else %>
|
208
|
+
<%= r.send(v) %>
|
209
|
+
<% end %>
|
210
|
+
</td>
|
158
211
|
<% end %>
|
159
|
-
</
|
212
|
+
</tr>
|
160
213
|
<% end %>
|
161
|
-
</
|
162
|
-
</
|
163
|
-
</
|
214
|
+
</tbody>
|
215
|
+
</table>
|
216
|
+
</div>
|
164
217
|
</div>
|
165
|
-
|
218
|
+
<% end %>
|
166
219
|
<% end %>
|
167
220
|
<% end %>
|
data/lib/zutils/version.rb
CHANGED