zutils 0.3.4 → 0.3.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/_index.html.erb +29 -19
- data/app/views/shared/_list.html.erb +1 -0
- data/app/views/shared/_show.html.erb +54 -42
- 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: 03053f0f54df36cd364d503549a97fa7f5125a250cf84b5b031a237a098a7b59
|
4
|
+
data.tar.gz: 3cc44ed720cc7eb10e9e8c6419154d346cd621b81fb4da74976bfbe472038c38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b55b90d928c7c7598c06012cd50e00f49d3033cd62c6c2c611e44513696c6e36fedce993b29ab6751d65069b36999736d08ffb0ce0b2a8348b89bcc9fee300b
|
7
|
+
data.tar.gz: fb328aa9f9e0008a5913321a424cffe0a4b550daaae8b45cad3a9a215130eaeeb152c25b00a20ff84077cef59da14fd56bcd1fa775b662d804a3e617c7f7d7bd
|
@@ -7,14 +7,22 @@
|
|
7
7
|
<% additional_columns ||= [] %>
|
8
8
|
<% additional_actions ||= [] %>
|
9
9
|
<% box_class ||= 'primary' %>
|
10
|
+
<% table_no_padding ||= false %>
|
11
|
+
|
12
|
+
<% hide_links ||= false %>
|
13
|
+
<% hide_actions ||= false %>
|
14
|
+
<% hide_header ||= false %>
|
15
|
+
<% hide_footer ||= false %>
|
10
16
|
|
11
17
|
<div class='box box-<%= box_class %>'>
|
12
|
-
|
13
|
-
<
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
+
<% unless hide_header %>
|
19
|
+
<div class="box-header with-border">
|
20
|
+
<h3 class="box-title">
|
21
|
+
<%= list.klass.model_name.human.pluralize %>
|
22
|
+
</h3>
|
23
|
+
</div>
|
24
|
+
<% end %>
|
25
|
+
<div class="box-body <%= 'no-padding' if table_no_padding %>">
|
18
26
|
<% unless search_fields.empty? %>
|
19
27
|
<div class="row">
|
20
28
|
<%= search_form_for @q, url: eval(nested_resource ? "#{parent_resource}_#{controller_name}_path" : "#{controller_name}_path") do |f| %>
|
@@ -38,7 +46,7 @@
|
|
38
46
|
<% else %>
|
39
47
|
<%= render 'shared/list', list: list, exceptions: exceptions, excluded_columns: excluded_columns,
|
40
48
|
additional_columns: additional_columns, sort_fields: sort_fields, sort_all: sort_all,
|
41
|
-
additional_actions: additional_actions
|
49
|
+
additional_actions: additional_actions, hide_actions: hide_actions
|
42
50
|
%>
|
43
51
|
<% if defined? list.total_pages %>
|
44
52
|
<div class='col-md-4'>
|
@@ -54,22 +62,24 @@
|
|
54
62
|
<% end %>
|
55
63
|
</div>
|
56
64
|
|
57
|
-
<% unless
|
58
|
-
|
59
|
-
|
60
|
-
<% if
|
61
|
-
<% if
|
62
|
-
|
65
|
+
<% unless hide_links %>
|
66
|
+
<% unless controller_name == 'users' %>
|
67
|
+
<div class="box-footer">
|
68
|
+
<% if can? :new, controller_name.singularize %>
|
69
|
+
<% if nested_resource == true %>
|
70
|
+
<% if parent_resource %>
|
71
|
+
<%= link_to eval("new_#{parent_resource.class.model_name.singular}_#{list.klass.model_name.singular}_path(#{parent_resource.id})"), class: "btn btn-#{box_class}" do %>
|
72
|
+
<%= t('.new', default: t("helpers.links.new")) %> <%= list.klass.model_name.human %> <i class='fa fa-plus'></i>
|
73
|
+
<% end %>
|
74
|
+
<% end %>
|
75
|
+
<% else %>
|
76
|
+
<%= link_to eval("new_#{list.klass.model_name.singular}_path"), class: "btn btn-#{box_class}" do %>
|
63
77
|
<%= t('.new', default: t("helpers.links.new")) %> <%= list.klass.model_name.human %> <i class='fa fa-plus'></i>
|
64
78
|
<% end %>
|
65
79
|
<% end %>
|
66
|
-
<% else %>
|
67
|
-
<%= link_to eval("new_#{list.klass.model_name.singular}_path"), class: "btn btn-#{box_class}" do %>
|
68
|
-
<%= t('.new', default: t("helpers.links.new")) %> <%= list.klass.model_name.human %> <i class='fa fa-plus'></i>
|
69
|
-
<% end %>
|
70
80
|
<% end %>
|
71
|
-
|
72
|
-
|
81
|
+
</div>
|
82
|
+
<% end %>
|
73
83
|
<% end %>
|
74
84
|
|
75
85
|
</div>
|
@@ -51,6 +51,7 @@
|
|
51
51
|
<%= object.send(column.split("_id")[0])&.name %>
|
52
52
|
<% elsif /_cents$/ =~ column %>
|
53
53
|
<%= number_to_currency object.send(column.split("_cents")[0]) %>
|
54
|
+
<% elsif /_currency$/ =~ column %>
|
54
55
|
<% elsif column == 'id' %>
|
55
56
|
<%= link_to object.id, object %>
|
56
57
|
<% else %>
|
@@ -3,35 +3,41 @@
|
|
3
3
|
<% relationships ||= {} %>
|
4
4
|
<% box_class ||= 'primary' %>
|
5
5
|
<% display_mode ||= 'table' %>
|
6
|
+
<% hide_links ||= false %>
|
7
|
+
<% hide_header ||= false %>
|
6
8
|
|
7
9
|
<% form_fields ||= (object.class.respond_to?('form_fields') ? object.class.form_fields : {}) %>
|
8
10
|
<% form_ordered_fields ||= (form_fields.empty? ? object.class.column_names : form_fields.keys) %>
|
9
11
|
|
10
12
|
<div class="box box-<%= box_class %>">
|
11
|
-
|
12
|
-
<
|
13
|
-
|
14
|
-
<%
|
15
|
-
|
16
|
-
|
13
|
+
<% unless hide_header %>
|
14
|
+
<div class="box-header with-border">
|
15
|
+
<h3 class="box-title"><%= object.class.model_name.human %></h3>
|
16
|
+
<% unless hide_links %>
|
17
|
+
<% if can? :edit, object %> <!--verificando se o usuario esta logado-->
|
18
|
+
<% if nested_resource %>
|
19
|
+
<%= 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 %>
|
20
|
+
<i class="fa fa-plus"></i> Cadastrar
|
21
|
+
<% end %>
|
22
|
+
<% else %>
|
23
|
+
<%= 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 %>
|
24
|
+
<i class="fa fa-plus"></i> Cadastrar
|
25
|
+
<% end %>
|
26
|
+
<% end %>
|
17
27
|
<% end %>
|
18
|
-
|
19
|
-
|
20
|
-
|
28
|
+
<% if can? :edit, object %> <!--verificando se o usuario esta logado-->
|
29
|
+
<%= 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 %>
|
30
|
+
<i class="fa fa-pencil"></i> Editar
|
31
|
+
<% end %>
|
32
|
+
<% end %>
|
33
|
+
<% if nested_resource %>
|
34
|
+
<%= 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" %>
|
35
|
+
<% else %>
|
36
|
+
<%= link_to 'Listagem', eval_with_rescue("#{object.class.model_name.plural}_path"), class: "btn btn-default btn-xs" %>
|
21
37
|
<% end %>
|
22
38
|
<% end %>
|
23
|
-
|
24
|
-
|
25
|
-
<%= 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 %>
|
26
|
-
<i class="fa fa-pencil"></i> Editar
|
27
|
-
<% end %>
|
28
|
-
<% end %>
|
29
|
-
<% if nested_resource %>
|
30
|
-
<%= 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" %>
|
31
|
-
<% else %>
|
32
|
-
<%= link_to 'Listagem', eval_with_rescue("#{object.class.model_name.plural}_path"), class: "btn btn-default btn-xs" %>
|
33
|
-
<% end %>
|
34
|
-
</div>
|
39
|
+
</div>
|
40
|
+
<% end %>
|
35
41
|
<div class="box-body <%= 'no-padding' if display_mode == 'table' %>">
|
36
42
|
<% if display_mode == 'dt' %>
|
37
43
|
<div class="row">
|
@@ -69,27 +75,33 @@
|
|
69
75
|
<% if display_mode == 'table' %>
|
70
76
|
<table class="table table-bordered table-striped no-padding datatables">
|
71
77
|
<% (object.class.column_names - ['id', 'created_at', 'updated_at', 'deleted_at'] - excluded_columns).each do |column| %>
|
72
|
-
|
73
|
-
<
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
object.send(column).class ==
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
78
|
+
<% unless /_currency$/ =~ column %>
|
79
|
+
<tr>
|
80
|
+
<th width='15%'>
|
81
|
+
<% if /_id$/ =~ column && object.respond_to?(column.split('_id')[0]) %>
|
82
|
+
<%= object.class.human_attribute_name(column.split("_id")[0]) %>
|
83
|
+
<% elsif /_cents$/ =~ column %>
|
84
|
+
<%= object.class.human_attribute_name(column.split("_cents")[0]) %>
|
85
|
+
<% else %>
|
86
|
+
<%= object.class.human_attribute_name(column) %>
|
87
|
+
<% end %>
|
88
|
+
</th>
|
89
|
+
<td>
|
90
|
+
<% if object.send(column).class == Date or
|
91
|
+
object.send(column).class == DateTime or
|
92
|
+
object.send(column).class == ActiveSupport::TimeWithZone or
|
93
|
+
object.send(column).class == Time %>
|
94
|
+
<%=l object.send(column) %>
|
95
|
+
<% elsif /_id$/ =~ column && object.respond_to?(column.split('_id')[0]) %>
|
96
|
+
<%= object.send(column.split("_id")[0])&.name %>
|
97
|
+
<% elsif /_cents$/ =~ column %>
|
98
|
+
<%= number_to_currency object.send(column.split("_cents")[0]) %>
|
99
|
+
<% else %>
|
100
|
+
<%= object.send(column) %>
|
101
|
+
<% end %>
|
102
|
+
</td>
|
103
|
+
</tr>
|
104
|
+
<% end %>
|
93
105
|
<% end %>
|
94
106
|
</table>
|
95
107
|
<% end %>
|
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.3.
|
4
|
+
version: 0.3.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-03-
|
11
|
+
date: 2019-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|