zutils 3.0.4 → 3.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/views/shared/_btn_action_links.html.erb +66 -56
- data/app/views/shared/_card_list.html.erb +9 -13
- data/app/views/shared/_form.html.erb +18 -18
- data/app/views/shared/_index.html.erb +63 -34
- data/app/views/shared/_search_form.html.erb +9 -3
- data/app/views/shared/_show.html.erb +21 -17
- data/lib/zutils/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0e1895f78aa7d4945cf23c0969f73bec1830c2fd0b0c25fa06557115dae7c45
|
4
|
+
data.tar.gz: d4cbbe66d10c88ac221d138f7eb65f57f971d0db6a08d59346223ac0e976d4bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e7ed06ae889974c04ae750ae8d0de3c10dd051e7cda2e902f3ebd9d5e8aeda6f3291194bdd4c338af2946de78c589f929d8564b2f8fd595076b620ff8583740
|
7
|
+
data.tar.gz: ee0d23b851a49e9d8e3b229f56134d6dc5be58292c460a2c9952b328c5fd2e761d76ec28fb75945d57329a431c2e9d8cc8d0319c51cd3a7d228b292d5be83285
|
@@ -4,81 +4,91 @@
|
|
4
4
|
<% new_color ||= 'primary' %>
|
5
5
|
<% edit_color ||= 'warning' %>
|
6
6
|
<% delete_color ||= 'danger' %>
|
7
|
-
<div class="row">
|
7
|
+
<div class="row align-items-center">
|
8
8
|
<div class="col text-nowrap">
|
9
|
-
<%
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
<% if can? :show, object %>
|
10
|
+
<% unless hide.include? "show" %>
|
11
|
+
<%= link_to object, class: "btn btn-#{size} btn-default",
|
12
|
+
data: { "bs-toggle": "tooltip", "bs-placement": "top", "bs-title": "Visualizar" } do %>
|
13
|
+
<% if labels %>
|
14
|
+
<div class="d-none d-sm-inline-block">
|
15
|
+
Ver
|
16
|
+
</div>
|
17
|
+
<% end %>
|
18
|
+
<i class="fa fa-fw fa-eye"></i>
|
16
19
|
<% end %>
|
17
|
-
<i class="fa fa-fw fa-eye"></i>
|
18
20
|
<% end %>
|
19
21
|
<% end %>
|
20
|
-
<%
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
<% if can? :new, object %>
|
23
|
+
<% unless hide.include? "new" %>
|
24
|
+
<%= link_to eval_with_rescue("new_#{[object].flatten.map{|x| x.class.to_s.underscore}.join("_")}_path"),
|
25
|
+
class: "btn btn-#{size} btn-#{new_color}", data: { "bs-toggle": "tooltip", "bs-placement": "top", "bs-title": "Cadastrar" } do %>
|
26
|
+
<% if labels %>
|
27
|
+
<div class="d-none d-sm-inline-block">
|
28
|
+
Cadastrar
|
29
|
+
</div>
|
30
|
+
<% end %>
|
31
|
+
<i class="fa fa-fw fa-plus"></i>
|
27
32
|
<% end %>
|
28
|
-
<i class="fa fa-fw fa-plus"></i>
|
29
33
|
<% end %>
|
30
34
|
<% end %>
|
31
|
-
<%
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
<% if can? :edit, object %>
|
36
|
+
<% unless hide.include? "edit" %>
|
37
|
+
<%= link_to eval_with_rescue("edit_#{[object].flatten.map{|x| x.class.to_s.underscore}.join("_")}_path(#{object.id})"),
|
38
|
+
class: "btn btn-#{size} btn-#{edit_color}", data: { "bs-toggle": "tooltip", "bs-placement": "top", "bs-title": "Editar" } do %>
|
39
|
+
<% if labels %>
|
40
|
+
<div class="d-none d-sm-inline-block">
|
41
|
+
Editar
|
42
|
+
</div>
|
43
|
+
<% end %>
|
44
|
+
<i class="fa fa-fw fa-pen"></i>
|
38
45
|
<% end %>
|
39
|
-
<i class="fa fa-fw fa-pen"></i>
|
40
46
|
<% end %>
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
47
|
+
<% unless hide.include? "back" %>
|
48
|
+
<%= link_to eval_with_rescue("#{[object].flatten.map{|x| x.class.to_s.underscore.pluralize}.join("_")}_path"),
|
49
|
+
class: "btn btn-#{size}", data: { "bs-toggle": "tooltip", "bs-placement": "top", "bs-title": "Voltar" } do %>
|
50
|
+
<% if labels %>
|
51
|
+
<div class="d-none d-sm-inline-block">
|
52
|
+
Voltar
|
53
|
+
</div>
|
54
|
+
<% end %>
|
55
|
+
<i class="fa fa-fw fa-arrow-left"></i>
|
49
56
|
<% end %>
|
50
|
-
<i class="fa fa-fw fa-arrow-left"></i>
|
51
57
|
<% end %>
|
52
58
|
<% end %>
|
53
|
-
<%
|
54
|
-
|
59
|
+
<% if can? :destroy, object %>
|
60
|
+
<% unless hide.include? "delete" %>
|
61
|
+
<%= button_to object, method: :delete, form: { data: { turbo_confirm: 'Tem certeza?' }, class: 'd-inline'},
|
55
62
|
data: { "bs-toggle": "tooltip", "bs-placement": "top", "bs-title": "Apagar" },
|
56
|
-
class: "
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
63
|
+
class: "btn btn-#{size} btn-#{delete_color}" do %>
|
64
|
+
<% if labels %>
|
65
|
+
<div class="d-none d-sm-inline-block">
|
66
|
+
Apagar
|
67
|
+
</div>
|
68
|
+
<% end %>
|
69
|
+
<i class="fa fa-fw fa-trash"></i>
|
61
70
|
<% end %>
|
62
|
-
<i class="fa fa-fw fa-trash"></i>
|
63
71
|
<% end %>
|
64
72
|
<% end %>
|
73
|
+
<!-- adicionar menus via bloco -->
|
74
|
+
<% if block_given? %>
|
75
|
+
<%= yield %>
|
76
|
+
<% end %>
|
65
77
|
</div>
|
66
78
|
<% unless hide.include? "delete_right" %>
|
67
|
-
|
68
|
-
|
79
|
+
<% if can? :destroy, object %>
|
80
|
+
<div class="col col-auto text-right">
|
81
|
+
<%= button_to object, method: :delete, form: { data: { turbo_confirm: 'Tem certeza?' }, class: 'd-inline'},
|
69
82
|
data: { "bs-toggle": "tooltip", "bs-placement": "top", "bs-title": "Apagar" },
|
70
|
-
class: "
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
83
|
+
class: "btn btn-#{size} btn-#{delete_color}" do %>
|
84
|
+
<% if labels %>
|
85
|
+
<div class="d-none d-sm-inline-block">
|
86
|
+
Apagar
|
87
|
+
</div>
|
88
|
+
<% end %>
|
89
|
+
<i class="fa fa-fw fa-trash"></i>
|
75
90
|
<% end %>
|
76
|
-
|
77
|
-
|
78
|
-
</div>
|
79
|
-
<% end %>
|
80
|
-
<!-- adicionar menus via bloco -->
|
81
|
-
<% if block_given? %>
|
82
|
-
<%= yield %>
|
91
|
+
</div>
|
92
|
+
<% end %>
|
83
93
|
<% end %>
|
84
94
|
</div>
|
@@ -1,7 +1,8 @@
|
|
1
1
|
<% exceptions ||= ['created_at', 'updated_at', 'deleted_at'] %>
|
2
2
|
<% show_columns ||= [] %>
|
3
|
-
<%
|
3
|
+
<% card_class ||= 'primary' %>
|
4
4
|
<% sort_all ||= false %>
|
5
|
+
<% hide_new ||= false %>
|
5
6
|
<% sort_fields ||= [] %>
|
6
7
|
<% table_class ||= 'bootstrap-table' %>
|
7
8
|
|
@@ -15,22 +16,19 @@
|
|
15
16
|
<% show_columns = list.klass.column_names - exceptions %>
|
16
17
|
<% end %>
|
17
18
|
|
18
|
-
<div class="card card-outline card-<%=
|
19
|
+
<div class="card card-outline card-<%= card_class %>" data-controller="<%= controller %>">
|
19
20
|
<div class="card-header with-border">
|
20
21
|
<h3 class="card-title">
|
21
22
|
<strong>
|
22
|
-
<i class="
|
23
|
+
<i class="fa fa-<%= list.klass.icon %>"></i>
|
23
24
|
Listagem de
|
24
25
|
<%= list.klass.model_name.human.pluralize %>
|
25
26
|
</strong>
|
26
|
-
<% unless
|
27
|
-
<%= link_to eval("new_#{list.klass.model_name.singular}_path"), class: "btn btn-xs btn-#{
|
27
|
+
<% unless hide_new %>
|
28
|
+
<%= link_to eval("new_#{list.klass.model_name.singular}_path"), class: "btn btn-xs btn-#{card_class}" do %>
|
28
29
|
Cadastar <i class="fa fa-plus"></i>
|
29
30
|
<% end %>
|
30
31
|
<% end %>
|
31
|
-
<% if block_given? %>
|
32
|
-
<%= yield %>
|
33
|
-
<% end %>
|
34
32
|
<div class="text-muted text-xs">
|
35
33
|
<%= page_entries_info list, entry_name: '' %>
|
36
34
|
</div>
|
@@ -39,11 +37,9 @@
|
|
39
37
|
<%= paginate list, window: 1 %>
|
40
38
|
</div>
|
41
39
|
</div>
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
%>
|
46
|
-
</div>
|
40
|
+
<%= render 'shared/list', list: list, show_columns: show_columns, card_class: card_class, table_class: table_class,
|
41
|
+
exceptions: exceptions, sort_all: sort_all, sort_fields: sort_fields, hide: hide, size: size, hide_actions: hide_actions
|
42
|
+
%>
|
47
43
|
</div>
|
48
44
|
<div class="row">
|
49
45
|
<div class="col" >
|
@@ -27,26 +27,26 @@
|
|
27
27
|
show_columns: show_columns
|
28
28
|
%>
|
29
29
|
</div>
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
</div>
|
31
|
+
<div class="text-right">
|
32
|
+
<% if back_link %>
|
33
|
+
<%= link_to 'Cancelar', "javascript:history.back()", class: "btn" %>
|
34
|
+
<% else %>
|
35
|
+
<% if parent_resource %>
|
36
|
+
<%= link_to eval_with_rescue("#{parent_resource.class.model_name.to_s.downcase}_#{controller_name}_path(#{parent_resource.id})"), class: "btn" do %>
|
37
|
+
Cancelar
|
38
|
+
<i class="fa fa-cancel fa-fw"></i>
|
39
|
+
<% end %>
|
33
40
|
<% else %>
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
<i class="fa fa-cancel fa-fw"></i>
|
38
|
-
<% end %>
|
39
|
-
<% else %>
|
40
|
-
<%= link_to eval_with_rescue("#{controller_name}_path"), class: "btn" do %>
|
41
|
-
Cancelar
|
42
|
-
<i class="fa fa-cancel fa-fw"></i>
|
43
|
-
<% end %>
|
41
|
+
<%= link_to eval_with_rescue("#{controller_name}_path"), class: "btn" do %>
|
42
|
+
Cancelar
|
43
|
+
<i class="fa fa-cancel fa-fw"></i>
|
44
44
|
<% end %>
|
45
45
|
<% end %>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
<% end %>
|
47
|
+
<%= button_tag type: :submit, class: "btn btn-#{card_color}" do %>
|
48
|
+
Salvar
|
49
|
+
<i class="fa fa-fw fa-save"></i>
|
50
|
+
<% end %>
|
51
51
|
</div>
|
52
52
|
<% end %>
|
@@ -7,58 +7,87 @@
|
|
7
7
|
<% additional_columns ||= [] %>
|
8
8
|
<% additional_actions ||= [] %>
|
9
9
|
<% card_color ||= 'danger' %>
|
10
|
-
<% table_padding ||= false %>
|
11
10
|
<% table_class ||= 'bootstrap-table' %>
|
12
|
-
|
13
11
|
<% hide ||= %w[new back delete_right] %>
|
14
12
|
<% size ||= "xs" %>
|
15
13
|
<% controller ||= "bootstrap-table" %>
|
16
|
-
|
17
14
|
<% hide_actions ||= false %>
|
18
|
-
|
15
|
+
<% pagy ||= @pagy %>
|
19
16
|
<div class="card card-outline card-<%= card_color %>" data-controller="<%= controller %>">
|
20
17
|
<% unless hide.include? 'header' %>
|
21
18
|
<div class="card-header with-border">
|
22
|
-
<
|
23
|
-
<
|
24
|
-
<
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
19
|
+
<div class="row">
|
20
|
+
<div class="col-md-6">
|
21
|
+
<h3 class="card-title">
|
22
|
+
<strong>
|
23
|
+
<i class="<%= list.klass.icon %>"></i>
|
24
|
+
Listagem de
|
25
|
+
<%= list.klass.model_name.human.pluralize %>
|
26
|
+
</strong>
|
27
|
+
<% unless hide.include? "header_new" %>
|
28
|
+
<%= link_to eval("new_#{list.klass.model_name.singular}_path"), class: "btn btn-xs btn-#{card_color}" do %>
|
29
|
+
Cadastar <i class="fa fa-plus"></i>
|
30
|
+
<% end %>
|
31
|
+
<% end %>
|
32
|
+
<% if block_given? %>
|
33
|
+
<%= yield %>
|
34
|
+
<% end %>
|
35
|
+
<div class="text-muted text-xs">
|
36
|
+
<% if defined? Kaminari %>
|
37
|
+
<%= page_entries_info list, entry_name: '' %>
|
38
|
+
<% end %>
|
39
|
+
<% if pagy && defined?(Pagy) %>
|
40
|
+
<%== pagy_info(pagy) %>
|
41
|
+
<% end %>
|
42
|
+
</div>
|
43
|
+
</h3>
|
44
|
+
</div>
|
45
|
+
<div class="col-md-6">
|
46
|
+
<div class="float-right">
|
47
|
+
<% if defined? Kaminari %>
|
48
|
+
<%= paginate list, window: 1 %>
|
49
|
+
<% end %>
|
50
|
+
<% if pagy && defined?(Pagy) %>
|
51
|
+
<% if defined? pagy_bootstrap_nav %>
|
52
|
+
<%== pagy_bootstrap_nav(pagy) %>
|
53
|
+
<% else %>
|
54
|
+
<%== pagy_nav(pagy) %>
|
55
|
+
<% end %>
|
56
|
+
<% end %>
|
57
|
+
</div>
|
38
58
|
</div>
|
39
|
-
</h3>
|
40
|
-
<div class='card-tools'>
|
41
|
-
<%= paginate list, window: 1 %>
|
42
59
|
</div>
|
43
60
|
</div>
|
44
61
|
<% end %>
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
%>
|
51
|
-
</div>
|
62
|
+
<%= render 'shared/list', list: list, exceptions: exceptions, excluded_columns: excluded_columns,
|
63
|
+
additional_columns: additional_columns, sort_fields: sort_fields, sort_all: sort_all,
|
64
|
+
additional_actions: additional_actions, hide_actions: hide_actions, table_class: table_class,
|
65
|
+
show_columns: show_columns, hide: hide, size: size, card_color: card_color, controller: controller
|
66
|
+
%>
|
52
67
|
</div>
|
53
|
-
<div class="row">
|
68
|
+
<div class="row mb-2">
|
54
69
|
<div class="col" >
|
55
70
|
<div class="text-muted text-xs">
|
56
|
-
|
71
|
+
<% if defined? Kaminari %>
|
72
|
+
<%= page_entries_info list, entry_name: '' %>
|
73
|
+
<% end %>
|
74
|
+
<% if pagy && defined?(Pagy) %>
|
75
|
+
<%== pagy_info(pagy) %>
|
76
|
+
<% end %>
|
57
77
|
</div>
|
58
78
|
</div>
|
59
79
|
<div class="col">
|
60
80
|
<div class="float-right">
|
61
|
-
|
81
|
+
<% if defined? Kaminari %>
|
82
|
+
<%= paginate list, window: 1 %>
|
83
|
+
<% end %>
|
84
|
+
<% if pagy && defined?(Pagy) %>
|
85
|
+
<% if defined? pagy_bootstrap_nav %>
|
86
|
+
<%== pagy_bootstrap_nav(pagy) %>
|
87
|
+
<% else %>
|
88
|
+
<%== pagy_nav(pagy) %>
|
89
|
+
<% end %>
|
90
|
+
<% end %>
|
62
91
|
</div>
|
63
92
|
</div>
|
64
|
-
</div>
|
93
|
+
</div>
|
@@ -1,14 +1,20 @@
|
|
1
1
|
<% card_color ||= 'danger' %>
|
2
|
+
<% search_object ||= @q%>
|
2
3
|
<% default_field = {name: :id_eq, attrs: {label: false, required: false, placeholder: 'ID', wrapper: false}} %>
|
3
4
|
<% received_field = defined?(main_field) ? main_field : {} %>
|
4
5
|
<% main_field = default_field.deep_merge(received_field) %>
|
5
|
-
|
6
|
+
<% opened ||= false %>
|
7
|
+
<%= search_form_for search_object, url: url do |f| %>
|
6
8
|
<div class="card card-outline card-<%= card_color %>" data-controller='filtering'>
|
7
9
|
<div class="card-header with-border">
|
8
10
|
<div class="input-group">
|
9
11
|
<div class="input-group-prepend">
|
10
12
|
<button type="button" class="btn btn-<%= card_color %>" data-action="click->filtering#toggle">
|
11
|
-
|
13
|
+
<% if opened %>
|
14
|
+
<i class="fa fa-fw fa-angle-down" data-filtering-target='icon'></i>
|
15
|
+
<% else %>
|
16
|
+
<i class="fa fa-fw fa-angle-right" data-filtering-target='icon'></i>
|
17
|
+
<% end %>
|
12
18
|
<span class="d-none d-sm-inline-block">
|
13
19
|
Filtrar
|
14
20
|
</span>
|
@@ -28,7 +34,7 @@
|
|
28
34
|
<div class="col-md-12 active-filters" data-filtering-target='filters'></div>
|
29
35
|
</div>
|
30
36
|
</div>
|
31
|
-
<div class="card-body" style='display: none;' data-filtering-target='body'>
|
37
|
+
<div class="card-body" style='<%= 'display: none;' unless opened %>' data-filtering-target='body'>
|
32
38
|
<div class="row">
|
33
39
|
<% search_fields ||= [] %>
|
34
40
|
<% search_fields.each do |sf| %>
|
@@ -19,25 +19,27 @@
|
|
19
19
|
<% show_columns = form_ordered_fields - ['id', 'created_at', 'updated_at', 'deleted_at'] - excluded_columns + additional_columns %>
|
20
20
|
<% end %>
|
21
21
|
|
22
|
-
|
23
|
-
<div class="card-
|
24
|
-
<div class="
|
25
|
-
<div class="
|
26
|
-
<
|
27
|
-
<
|
28
|
-
<
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
22
|
+
<% unless hide.include? "top_bar" %>
|
23
|
+
<div class="card card-outline card-<%= card_color %>">
|
24
|
+
<div class="card-header">
|
25
|
+
<div class="row align-items-center">
|
26
|
+
<div class="col-12 col-md-auto">
|
27
|
+
<h3 class="card-title">
|
28
|
+
<strong>
|
29
|
+
<i class="fa fa<%= object.class.icon %>"></i>
|
30
|
+
Visualizar <%=t object.class.model_name.human %>
|
31
|
+
</strong>
|
32
|
+
</h3>
|
33
|
+
</div>
|
34
|
+
<div class="col-12 col-md mr-auto">
|
35
|
+
<% if can? :manage, object %>
|
36
|
+
<%= render "shared/btn_action_links", size: "xs", object: object, labels: true, hide: hide, new_color: new_color, edit_color: edit_color, delete_color: delete_color %>
|
37
|
+
<% end %>
|
38
|
+
</div>
|
37
39
|
</div>
|
38
40
|
</div>
|
39
41
|
</div>
|
40
|
-
|
42
|
+
<% end %>
|
41
43
|
<% if lookup_context.find_all("#{object.class.model_name.plural}/_#{object.class.model_name.singular}").any? %>
|
42
44
|
<%= render object %>
|
43
45
|
<% else %>
|
@@ -210,4 +212,6 @@
|
|
210
212
|
<% end %>
|
211
213
|
<% end %>
|
212
214
|
<% end %>
|
213
|
-
|
215
|
+
<% unless hide.include? "bottom_bar" %>
|
216
|
+
<%= render "shared/btn_action_links", object: object, labels: true, hide: hide, new_color: new_color, edit_color: edit_color, delete_color: delete_color %>
|
217
|
+
<% end %>
|
data/lib/zutils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo Viana
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-03-28 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: rails
|
@@ -88,7 +87,6 @@ homepage: http://gitlab.tjpi.jus.br/
|
|
88
87
|
licenses:
|
89
88
|
- MIT
|
90
89
|
metadata: {}
|
91
|
-
post_install_message:
|
92
90
|
rdoc_options: []
|
93
91
|
require_paths:
|
94
92
|
- lib
|
@@ -103,8 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
101
|
- !ruby/object:Gem::Version
|
104
102
|
version: '0'
|
105
103
|
requirements: []
|
106
|
-
rubygems_version: 3.5
|
107
|
-
signing_key:
|
104
|
+
rubygems_version: 3.6.5
|
108
105
|
specification_version: 4
|
109
106
|
summary: Utilidades gerais para aplicações rails
|
110
107
|
test_files: []
|