zutils 0.4.0 → 0.4.1
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/_index.html.erb +4 -11
- data/app/views/shared/_list.html.erb +16 -12
- data/app/views/shared/_show.html.erb +4 -4
- data/lib/zutils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b2290314f33c81d7bdaa68499ef394b9281ec5e1c375cc2b6b6656bd60bb3b2
|
4
|
+
data.tar.gz: 3997dcd75dbf932d10dae0487a72271582188fcb97cb3eaec6d24b5eb2a40f15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b47063da1ef161bcb69abcf9341f09831a08a6b167ba0d52dedf396814236a08fbf0c0a82432fc635b64d557de4ab82bf1900a9d6059fbf5047b4947e0af05e0
|
7
|
+
data.tar.gz: '090d1baed15370f86b9dea7b3e8f1fd980c86edee3e251708e21400c04dd28d49f365357c48dffa948877187514d722086505319041ad8453605b4b8b831c0eb'
|
@@ -4,10 +4,12 @@
|
|
4
4
|
<% sort_all ||= false %>
|
5
5
|
<% nested_resource ||= false %>
|
6
6
|
<% excluded_columns ||= [] %>
|
7
|
+
<% show_columns ||= [] %>
|
7
8
|
<% additional_columns ||= [] %>
|
8
9
|
<% additional_actions ||= [] %>
|
9
10
|
<% box_class ||= 'primary' %>
|
10
11
|
<% table_no_padding ||= false %>
|
12
|
+
<% table_class ||= 'datatables' %>
|
11
13
|
|
12
14
|
<% hide_links ||= false %>
|
13
15
|
<% hide_actions ||= false %>
|
@@ -35,18 +37,10 @@
|
|
35
37
|
<% end %>
|
36
38
|
</div>
|
37
39
|
<% end %>
|
38
|
-
<% if list.empty? %>
|
39
|
-
<table class="table table-striped datatables">
|
40
|
-
<tbody>
|
41
|
-
<tr>
|
42
|
-
<td>Nenhum registro encontrado</td>
|
43
|
-
</tr>
|
44
|
-
</tbody>
|
45
|
-
</table>
|
46
|
-
<% else %>
|
47
40
|
<%= render 'shared/list', list: list, exceptions: exceptions, excluded_columns: excluded_columns,
|
48
41
|
additional_columns: additional_columns, sort_fields: sort_fields, sort_all: sort_all,
|
49
|
-
additional_actions: additional_actions, hide_actions: hide_actions
|
42
|
+
additional_actions: additional_actions, hide_actions: hide_actions, table_class: table_class,
|
43
|
+
show_columns: show_columns
|
50
44
|
%>
|
51
45
|
<% if defined? list.total_pages %>
|
52
46
|
<div class='col-md-4'>
|
@@ -59,7 +53,6 @@
|
|
59
53
|
<%= paginate list, window: 1 %>
|
60
54
|
</div>
|
61
55
|
<% end %>
|
62
|
-
<% end %>
|
63
56
|
</div>
|
64
57
|
|
65
58
|
<% unless hide_links %>
|
@@ -5,29 +5,34 @@
|
|
5
5
|
<% hide_actions ||= false %>
|
6
6
|
<% sort_fields ||= [] %>
|
7
7
|
<% sort_all ||= false %>
|
8
|
+
<% table_class ||= 'datatables' %>
|
9
|
+
<% show_columns ||= [] %>
|
8
10
|
|
9
|
-
<%
|
10
|
-
|
11
|
+
<% if show_columns.empty? %>
|
12
|
+
<% show_columns = list.klass.column_names - exceptions - excluded_columns + additional_columns %>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<table class="table table-striped <%= table_class %>">
|
11
16
|
<thead>
|
12
17
|
<tr>
|
13
|
-
<%
|
18
|
+
<% show_columns.each do |column| %>
|
14
19
|
<% if sort_all || sort_fields.include?(column) %>
|
15
20
|
<% if /_id$/ =~ column %>
|
16
|
-
<th><%= sort_link(@q, column, list.
|
21
|
+
<th><%= sort_link(@q, column, list.klass.human_attribute_name(column.split("_id")[0])) %></th>
|
17
22
|
<% elsif /_cents$/ =~ column %>
|
18
|
-
<th><%= sort_link(@q, column, list.
|
23
|
+
<th><%= sort_link(@q, column, list.klass.human_attribute_name(column.split("_cents")[0])) %></th>
|
19
24
|
<% elsif /_currency$/ =~ column %>
|
20
25
|
<% else %>
|
21
|
-
<th><%= sort_link(@q, column, list.
|
26
|
+
<th><%= sort_link(@q, column, list.klass.human_attribute_name(column)) %></th>
|
22
27
|
<% end %>
|
23
28
|
<% else %>
|
24
29
|
<% if /_id$/ =~ column %>
|
25
|
-
<th><%= list.
|
30
|
+
<th><%= list.klass.human_attribute_name(column.split("_id")[0]) %></th>
|
26
31
|
<% elsif /_cents$/ =~ column %>
|
27
|
-
<th><%= list.
|
32
|
+
<th><%= list.klass.human_attribute_name(column.split("_cents")[0]) %></th>
|
28
33
|
<% elsif /_currency$/ =~ column %>
|
29
34
|
<% else %>
|
30
|
-
<th><%= list.
|
35
|
+
<th><%= list.klass.human_attribute_name(column) %></th>
|
31
36
|
<% end %>
|
32
37
|
<% end %>
|
33
38
|
<% end %>
|
@@ -39,7 +44,7 @@
|
|
39
44
|
<tbody>
|
40
45
|
<% list.each do |object| %>
|
41
46
|
<tr>
|
42
|
-
<%
|
47
|
+
<% show_columns.each do |column| %>
|
43
48
|
<% next if /_currency$/ =~ column %>
|
44
49
|
<td>
|
45
50
|
<% if object.send(column).class == Date or
|
@@ -67,5 +72,4 @@
|
|
67
72
|
</tr>
|
68
73
|
<% end %>
|
69
74
|
</tbody>
|
70
|
-
</table>
|
71
|
-
<% end %>
|
75
|
+
</table>
|
@@ -16,20 +16,20 @@
|
|
16
16
|
<div class="box-header with-border">
|
17
17
|
<h3 class="box-title"><%= object.class.model_name.human %></h3>
|
18
18
|
<% unless hide_links %>
|
19
|
-
<% if can? :
|
19
|
+
<% if can? :new, object.class %> <!--verificando se o usuario esta logado-->
|
20
20
|
<% if nested_resource %>
|
21
21
|
<%= 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
|
-
<i class="fa fa-plus"></i>
|
22
|
+
Cadastrar <i class="fa fa-plus"></i>
|
23
23
|
<% end %>
|
24
24
|
<% else %>
|
25
25
|
<%= link_to eval("new_#{object.class.model_name.singular}_path"), class: "btn btn-#{box_class} btn-xs", data: { toggle: 'tooltip', placement: 'top', title: 'Cadastrar' } do %>
|
26
|
-
<i class="fa fa-plus"></i>
|
26
|
+
Cadastrar <i class="fa fa-plus"></i>
|
27
27
|
<% end %>
|
28
28
|
<% end %>
|
29
29
|
<% end %>
|
30
30
|
<% if can? :edit, object %> <!--verificando se o usuario esta logado-->
|
31
31
|
<%= 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
|
-
<i class="fa fa-pencil"></i>
|
32
|
+
Editar <i class="fa fa-pencil"></i>
|
33
33
|
<% end %>
|
34
34
|
<% end %>
|
35
35
|
<% if nested_resource %>
|
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.1
|
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-
|
11
|
+
date: 2019-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|