zutils 0.5.1 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2fb99d41fe0ffcf9bc92c4af427ff166a3b51aee5d16a513bb61786af245ab8b
4
- data.tar.gz: deecc20864d40807f2e5613c90752fa88cba0ec890a7342c66735e41595220c8
3
+ metadata.gz: 8a9eb74781bf8db14a1333f5f644b29cf11516e1bbf794b5905de9f9c18ca4c4
4
+ data.tar.gz: 2bd41f7c6d6f9a20f99189d92cc380cf0621a06c8b2394c8784455f1088edcb7
5
5
  SHA512:
6
- metadata.gz: 7dcd4e480c21b92aa23014b0cc5f125ceddc18bc4d15fe3f818eebf5fca147389f0deb928b4e107824803cee5a82fe86503cb929aae181d2ebc5a37640e7619a
7
- data.tar.gz: 97042c9f956abefaab9761d9bd9ce587598b2e2f0be86e3ee9b9f00fa944b7eeac5244f00fc502d54e2c9fac5d18b911cbc24b4d2f6ee67e3a5b5cd055728001
6
+ metadata.gz: 56d2f7933b7b28722a406d909f9c5db701ee0aaeca5fd38496689e0e03ef10e480d6ed09531aa343a5eaa4d8aa92809140770c034c5268276ba20cd60e263b01
7
+ data.tar.gz: 5bc42418e918437043db8ef865a2ae807d3ed4da7b2c8f95ad597e1b2d8ee2c23fb7705f590e269996cf60ba7421fb7cc8c5f437dbaadf000d4ae230a4e2a58a
@@ -5,7 +5,7 @@
5
5
  <% hide_destroy_action ||= false %>
6
6
 
7
7
  <div class="btn-group">
8
- <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
8
+ <button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
9
9
  Ações
10
10
  <span class="caret"></span>
11
11
  <span class="sr-only">Toggle Dropdown</span>
@@ -13,7 +13,7 @@
13
13
  <ul class="dropdown-menu" role="menu">
14
14
  <% if !hide_read_action && can?(:read, (object.class == Array ? object.last.class : object.class)) %>
15
15
  <li>
16
- <%= link_to object, data: { toggle: 'tooltip', placement: 'top', title: 'Visualizar' } do %>
16
+ <%= link_to object, class: 'dropdown-item', data: { toggle: 'tooltip', placement: 'top', title: 'Visualizar' } do %>
17
17
  <i class="fa fa-eye"></i> Visualizar
18
18
  <% end %>
19
19
  <% end %>
@@ -21,11 +21,11 @@
21
21
  <% if !hide_edit_action && can?(:edit, (object.class == Array ? object.last.class : object.class)) %>
22
22
  <li>
23
23
  <% if object.class == Array %>
24
- <%= link_to eval_with_rescue("edit_#{[object].flatten.map{|x| x.class.to_s.underscore}.join("_")}_path(#{object[0].id}, #{object[1].id})"), data: { toggle: 'tooltip', placement: 'top', title: 'Editar' } do %>
24
+ <%= link_to eval_with_rescue("edit_#{[object].flatten.map{|x| x.class.to_s.underscore}.join("_")}_path(#{object[0].id}, #{object[1].id})"), class: 'dropdown-item', data: { toggle: 'tooltip', placement: 'top', title: 'Editar' } do %>
25
25
  <i class="fa fa-pencil fa-edit"></i> Editar
26
26
  <% end %>
27
27
  <% else %>
28
- <%= link_to eval_with_rescue("edit_#{[object].flatten.map{|x| x.class.to_s.underscore}.join("_")}_path(#{object.id})"), data: { toggle: 'tooltip', placement: 'top', title: 'Editar' } do %>
28
+ <%= link_to eval_with_rescue("edit_#{[object].flatten.map{|x| x.class.to_s.underscore}.join("_")}_path(#{object.id})"), class: 'dropdown-item', data: { toggle: 'tooltip', placement: 'top', title: 'Editar' } do %>
29
29
  <i class="fa fa-pencil fa-edit"></i> Editar
30
30
  <% end %>
31
31
  <% end %>
@@ -33,7 +33,7 @@
33
33
  <% end %>
34
34
  <% if !hide_destroy_action && can?(:destroy, (object.class == Array ? object.last.class : object.class)) %>
35
35
  <li>
36
- <%= link_to object, method: :delete, data: { confirm: 'Tem certeza?', toggle: 'tooltip', placement: 'top', title: 'Apagar' } do %>
36
+ <%= link_to object, method: :delete, class: 'dropdown-item', data: { confirm: 'Tem certeza?', toggle: 'tooltip', placement: 'top', title: 'Apagar' } do %>
37
37
  <i class="fa fa-trash"></i> Apagar
38
38
  <% end %>
39
39
  </li>
@@ -42,7 +42,7 @@
42
42
  <% additional_actions.each do |key, value| %>
43
43
  <% if can? key, (object.class == Array ? object.last.class : object.class) %>
44
44
  <li>
45
- <%= link_to eval_with_rescue("#{value[:link]}(#{object.id})"), value[:options] do %>
45
+ <%= link_to eval_with_rescue("#{value[:link]}(#{object.id})"), value[:options], class: 'dropdown-item' do %>
46
46
  <i class="fa fa-<%= value[:icon] %>"></i> <%= value[:title] %>
47
47
  <% end %>
48
48
  </li>
@@ -0,0 +1,44 @@
1
+ <% exceptions ||= ['created_at', 'updated_at', 'deleted_at'] %>
2
+ <% show_columns ||= [] %>
3
+ <% table_class ||= 'datatables styletable' %>
4
+ <% card_class ||= 'primary' %>
5
+ <% sort_all ||= false %>
6
+ <% show_new &&= true %>
7
+ <% sort_fields ||= [] %>
8
+
9
+ <% hide_actions ||= false %>
10
+
11
+ <% if show_columns.empty? %>
12
+ <% show_columns = list.klass.column_names - exceptions %>
13
+ <% end %>
14
+
15
+ <div class="card card-outline card-<%= card_class %>">
16
+ <div class="card-header with-border">
17
+ <h3 class="card-title">
18
+ <strong>
19
+ <i class="fa fa-list"></i>
20
+ Listagem
21
+ </strong>
22
+ <% if show_new %>
23
+ <%= link_to eval("new_#{list.klass.model_name.singular}_path"), class: "btn btn-xs btn-#{card_class}" do %>
24
+ Cadastar <i class="fa fa-plus"></i>
25
+ <% end %>
26
+ <% end %>
27
+ <div class="text-muted text-xs">
28
+ <%= page_entries_info list, entry_name: '' %>
29
+ </div>
30
+ </h3>
31
+ <div class='card-tools'>
32
+ <%= paginate list, window: 1 %>
33
+ </div>
34
+ </div>
35
+ <div class="card-body p-0">
36
+ <%= render 'shared/list', list: list, show_columns: show_columns, box_class: card_class,
37
+ table_class: table_class, exceptions: exceptions, sort_all: sort_all, sort_fields: sort_fields,
38
+ hide_actions: hide_actions
39
+ %>
40
+ </div>
41
+ <div class="pagination justify-content-center pt-3">
42
+ <%= paginate list %>
43
+ </div>
44
+ </div>
@@ -1,15 +1,20 @@
1
1
  <% excluded_columns ||= [] %>
2
2
  <% additional_columns ||= [] %>
3
3
  <% restricted_columns ||= {} %>
4
+ <% show_columns ||= [] %>
4
5
 
5
6
  <% form_fields ||= (object.class.respond_to?('form_fields') ? object.class.form_fields : {}) %>
6
7
  <% form_ordered_fields ||= (form_fields.empty? ? object.class.column_names : form_fields.keys) %>
7
8
 
9
+ <% if show_columns.empty? %>
10
+ <% show_columns = form_ordered_fields - ['id', 'created_at', 'updated_at', 'deleted_at'] - excluded_columns + additional_columns %>
11
+ <% end %>
12
+
8
13
  <div class="row">
9
- <% (form_ordered_fields - ['id', 'created_at', 'updated_at', 'deleted_at'] - excluded_columns + additional_columns).each do |column| %>
14
+ <% show_columns.each do |column| %>
10
15
  <% wphtml = "col-md-#{(form_fields[column.to_sym].class == Hash ? form_fields[column.to_sym][:size] : form_fields[column.to_sym] ) || 12}" %>
11
- <% hint = (form_fields[column.to_sym].class == Hash ? form_fields[column.to_sym][:hint] : '') %>
12
- <% placeholder = (form_fields[column.to_sym].class == Hash ? form_fields[column.to_sym][:placeholder] : '') %>
16
+ <% hint = (form_fields[column.to_sym].class == Hash ? form_fields[column.to_sym][:hint] : nil) %>
17
+ <% placeholder = (form_fields[column.to_sym].class == Hash ? form_fields[column.to_sym][:placeholder] : nil) %>
13
18
  <% if object.class.column_for_attribute(column).type == :text %>
14
19
  <%= f.input column, input_html: { rows: 10, cols: 20 }, wrapper_html: { class: wphtml }, hint: hint, placeholder: placeholder %>
15
20
  <% elsif [:date, :datetime].include?(object.class.column_for_attribute(column).type) %>
@@ -5,14 +5,19 @@
5
5
  <% parent_resource ||= false %>
6
6
  <% back_link ||= false %>
7
7
  <% box_class ||= 'primary' %>
8
+ <% show_columns ||= [] %>
8
9
 
9
10
  <% form_fields ||= (object.class.respond_to?('form_fields') ? object.class.form_fields : {}) %>
10
11
  <% form_ordered_fields ||= (form_fields.empty? ? object.class.column_names : form_fields.keys) %>
11
12
 
13
+ <% if show_columns.empty? %>
14
+ <% show_columns = form_ordered_fields - ['id', 'created_at', 'updated_at', 'deleted_at'] - excluded_columns + additional_columns %>
15
+ <% end %>
16
+
12
17
  <%= simple_form_for(nested_resource ? [parent_resource, object] : object) do |f| %>
13
- <div class="box box-<%= box_class %>">
14
- <div class="box-header with-border">
15
- <h3 class="box-title">
18
+ <div class="box box-<%= box_class %> card card-outline card-<%= box_class %>">
19
+ <div class="box-header with-border card-header">
20
+ <h3 class="box-title card-title">
16
21
  Dados do <%= object.class.model_name.human %>
17
22
  <% if parent_resource %>
18
23
  <%= link_to 'Cancelar', eval_with_rescue("#{parent_resource.class.model_name.to_s.downcase}_#{controller_name}_path(#{parent_resource.id})"), class: "btn btn-default btn-xs" %>
@@ -22,14 +27,15 @@
22
27
  <%= f.submit 'Salvar', class: "btn btn-#{box_class} btn-xs" %>
23
28
  </h3>
24
29
  </div>
25
- <div class="box-body">
30
+ <div class="box-body card-body">
26
31
  <%= render 'shared/fields', object: object, f: f,
27
32
  excluded_columns: excluded_columns,
28
33
  additional_columns: additional_columns,
29
- restricted_columns: restricted_columns
34
+ restricted_columns: restricted_columns,
35
+ show_columns: show_columns
30
36
  %>
31
37
  </div>
32
- <div class="box-footer">
38
+ <div class="box-footer card-footer">
33
39
  <% if back_link %>
34
40
  <%= link_to 'Cancelar', "javascript:history.back()", class: "btn btn-default" %>
35
41
  <% else %>
@@ -20,25 +20,27 @@
20
20
  <% hide_edit_action ||= false %>
21
21
  <% hide_destroy_action ||= false %>
22
22
 
23
- <div class='box box-<%= box_class %>'>
23
+ <div class='box box-<%= box_class %> card card-outline card-<%= box_class %>'>
24
24
  <% unless hide_header %>
25
- <div class="box-header with-border">
26
- <h3 class="box-title">
27
- <%= list.klass.model_name.human.pluralize %>
25
+ <div class="box-header with-border card-header">
26
+ <h3 class="box-title card-title">
27
+ <strong>
28
+ <%= list.klass.model_name.human.pluralize %>
29
+ </strong>
28
30
  </h3>
29
31
  <% if block_given? %>
30
32
  <%= yield %>
31
33
  <% end %>
32
34
  </div>
33
35
  <% end %>
34
- <div class="box-body <%= 'no-padding' if table_no_padding %>">
36
+ <div class="box-body card-body <%= 'no-padding' if table_no_padding %> <%= 'p-0' if table_no_padding %>">
35
37
  <% unless search_fields.empty? %>
36
38
  <div class="row">
37
39
  <%= search_form_for @q, url: eval(nested_resource ? "#{parent_resource}_#{controller_name}_path" : "#{controller_name}_path") do |f| %>
38
40
  <% search_fields.each do |sf| %>
39
41
  <%= f.input sf[:field], label: sf[:label], required: false, as: sf[:as], collection: sf[:collection], wrapper_html: { class: 'col-md-3' } %>
40
42
  <% end %>
41
- <div class="col-md-3 top-25">
43
+ <div class="col-md-3 top-25 ">
42
44
  <%= f.submit "Pesquisar", class: "btn btn-#{box_class}" %>
43
45
  </div>
44
46
  <% end %>
@@ -65,7 +67,7 @@
65
67
 
66
68
  <% unless hide_links %>
67
69
  <% unless controller_name == 'users' %>
68
- <div class="box-footer">
70
+ <div class="box-footer card-footer">
69
71
  <% if can? :new, list.klass %>
70
72
  <% if nested_resource == true %>
71
73
  <% if parent_resource %>
@@ -5,8 +5,11 @@
5
5
  <% hide_actions ||= false %>
6
6
  <% sort_fields ||= [] %>
7
7
  <% sort_all ||= false %>
8
- <% table_class ||= 'datatables' %>
8
+ <% table_class ||= 'datatables styletable' %>
9
+
9
10
  <% box_class ||= 'primary' %>
11
+ <% card_class ||= 'primary' %>
12
+
10
13
  <% show_columns ||= [] %>
11
14
 
12
15
  <% hide_read_action ||= false %>
@@ -21,25 +24,52 @@
21
24
  <thead>
22
25
  <tr>
23
26
  <% show_columns.each do |column| %>
24
- <% if sort_all || sort_fields.include?(column) %>
25
- <% if /_id$/ =~ column %>
26
- <th><%= sort_link(@q, column, list.klass.human_attribute_name(column.split("_id")[0])) %></th>
27
- <% elsif /_cents$/ =~ column %>
28
- <th><%= sort_link(@q, column, list.klass.human_attribute_name(column.split("_cents")[0])) %></th>
29
- <% elsif /_currency$/ =~ column %>
30
- <% else %>
31
- <th><%= sort_link(@q, column, list.klass.human_attribute_name(column)) %></th>
32
- <% end %>
33
- <% else %>
34
- <% if /_id$/ =~ column %>
35
- <th><%= list.klass.human_attribute_name(column.split("_id")[0]) %></th>
36
- <% elsif /_cents$/ =~ column %>
37
- <th><%= list.klass.human_attribute_name(column.split("_cents")[0]) %></th>
38
- <% elsif /_currency$/ =~ column %>
27
+
28
+ <% column_method = nil %>
29
+ <% column_name = column %>
30
+ <% column_align = ''%>
31
+ <% if column.class == Hash %>
32
+ <% column_name = column[:attribute] %>
33
+ <% column_method = column[:method] %>
34
+ <% column_align = column[:align] %>
35
+ <% end %>
36
+
37
+ <% next if /_currency$/ =~ column_name %>
38
+
39
+ <th data-field="<%= column_method || column_name %>" data-align="<%= column_align %>">
40
+ <% if sort_all || sort_fields.include?(column_name) %>
41
+ <% if column_name.include?('.') %>
42
+ <% s_name = column_method || column_name %>
43
+ <%= sort_link(@q, s_name.split('.').join('_'),
44
+ "#{s_name.split('.')[-2]&.camelize} (#{s_name.split('.')[-1]})")
45
+ %>
46
+ <% elsif /_id$/ =~ column_name %>
47
+ <%= sort_link(@q, column_name, list.klass.human_attribute_name(column_name.split("_id")[0])) %>
48
+ <% elsif /_cents$/ =~ column_name %>
49
+ <%= sort_link(@q, column_name, list.klass.human_attribute_name(column_name.split("_cents")[0])) %>
50
+ <% elsif /_currency$/ =~ column_name %>
51
+ <!-- faz nada -->
52
+ <% elsif column_name == 'id' %>
53
+ <%= sort_link(@q, column_name, '#') %>
54
+ <% else %>
55
+ <%= sort_link(@q, column_name, list.klass.human_attribute_name(column_name)) %>
56
+ <% end %>
39
57
  <% else %>
40
- <th><%= list.klass.human_attribute_name(column) %></th>
58
+ <% if column_name.include?('.') %>
59
+ <% s_name = column_method || column_name %>
60
+ <%= "#{s_name.split('.')[-2]&.camelize} (#{s_name.split('.')[-1]})" %>
61
+ <% elsif /_id$/ =~ column_name %>
62
+ <%= list.klass.human_attribute_name(column_name.split("_id")[0]) %>
63
+ <% elsif /_cents$/ =~ column_name %>
64
+ <%= list.klass.human_attribute_name(column_name.split("_cents")[0]) %>
65
+ <% elsif /_currency$/ =~ column_name %>
66
+ <% elsif column_name == 'id' %>
67
+ #
68
+ <% else %>
69
+ <%= list.klass.human_attribute_name(column_name) %>
70
+ <% end %>
41
71
  <% end %>
42
- <% end %>
72
+ </th>
43
73
  <% end %>
44
74
  <% unless hide_actions %>
45
75
  <th>Ações</th>
@@ -48,50 +78,59 @@
48
78
  </thead>
49
79
  <tbody>
50
80
  <% list.each do |object| %>
51
- <tr>
52
- <% show_columns.each do |column| %>
53
- <% next if /_currency$/ =~ column %>
54
- <td>
55
- <% if column.include?('.') %>
56
- <% o = object %>
57
- <% column.split('.').each{|m| o = o.send(m) if o } %>
58
- <%= o %>
59
- <% elsif object.send(column).class == Date or
60
- object.send(column).class == DateTime or
61
- object.send(column).class == ActiveSupport::TimeWithZone or
62
- object.send(column).class == Time %>
63
- <%=l object.send(column) %>
64
- <% elsif object.send(column).respond_to? 'attached?' %>
65
- <% if object.send(column).class == ActiveStorage::Attached::One %>
66
- <% if object.send(column).attached? %>
67
- <%= link_to rails_blob_path(object.send(column)), class: "btn btn-#{box_class} btn-xs", target: '_blank' do %>
68
- <i class="fa fa-file-o"></i> Arquivo
81
+ <tr>
82
+ <% show_columns.each do |column| %>
83
+
84
+ <% column_method = nil %>
85
+ <% column_name = column %>
86
+ <% if column.class == Hash %>
87
+ <% column_name = column[:attribute] %>
88
+ <% column_method = column[:method] %>
89
+ <% end %>
90
+
91
+ <% next if /_currency$/ =~ column_name %>
92
+
93
+ <td>
94
+ <% if column_name.include?('.') %>
95
+ <% o = object %>
96
+ <% column_name.split('.').each{|m| o = o.send(m) if o } %>
97
+ <%= o %>
98
+ <% elsif object.send(column_name).class == Date or
99
+ object.send(column_name).class == DateTime or
100
+ object.send(column_name).class == ActiveSupport::TimeWithZone or
101
+ object.send(column_name).class == Time %>
102
+ <%=l object.send(column_name) %>
103
+ <% elsif object.send(column_name).respond_to? 'attached?' %>
104
+ <% if object.send(column_name).class == ActiveStorage::Attached::One %>
105
+ <% if object.send(column_name).attached? %>
106
+ <%= link_to rails_blob_path(object.send(column_name)), class: "btn btn-#{box_class} #{card_class} btn-xs", target: '_blank' do %>
107
+ <i class="fa fa-file-o"></i> Arquivo
108
+ <% end %>
109
+ <% end %>
69
110
  <% end %>
111
+ <% elsif /_id$/ =~ column_name && object.respond_to?(column_name.split('_id')[0]) %>
112
+ <%= object.send(column_name.split("_id")[0])&.name %>
113
+ <% elsif /_cents$/ =~ column_name %>
114
+ <%= number_to_currency object.send(column_name.split("_cents")[0]) %>
115
+ <% elsif /_currency$/ =~ column_name %>
116
+ <!-- faz nada -->
117
+ <% elsif column_name.include?(".") %>
118
+ <%= eval("object.#{column_name}") %>
119
+ <% elsif column_name == 'id' %>
120
+ <%= link_to object.id, object %>
121
+ <% else %>
122
+ <%= object.send(column_method || column_name) %>
70
123
  <% end %>
71
- <% end %>
72
- <% elsif /_id$/ =~ column && object.respond_to?(column.split('_id')[0]) %>
73
- <%= object.send(column.split("_id")[0])&.name %>
74
- <% elsif /_cents$/ =~ column %>
75
- <%= number_to_currency object.send(column.split("_cents")[0]) %>
76
- <% elsif /_currency$/ =~ column %>
77
- <!-- faz nada -->
78
- <% elsif column.include?(".") %>
79
- <%= eval("object.#{column}") %>
80
- <% elsif column == 'id' %>
81
- <%= link_to object.id, object %>
82
- <% else %>
83
- <%= object.send(column) %>
124
+ </td>
84
125
  <% end %>
85
- </td>
86
- <% end %>
87
- <% unless hide_actions %>
88
- <td>
89
- <%= render 'shared/action_links', object: object, additional_actions: additional_actions,
90
- hide_read_action: hide_read_action, hide_edit_action: hide_edit_action, hide_destroy_action: hide_destroy_action
91
- %>
92
- </td>
93
- <% end %>
94
- </tr>
126
+ <% unless hide_actions %>
127
+ <td>
128
+ <%= render 'shared/action_links', object: object, additional_actions: additional_actions,
129
+ hide_read_action: hide_read_action, hide_edit_action: hide_edit_action, hide_destroy_action: hide_destroy_action
130
+ %>
131
+ </td>
132
+ <% end %>
133
+ </tr>
95
134
  <% end %>
96
135
  </tbody>
97
136
  </table>
@@ -16,38 +16,44 @@
16
16
  <% show_columns = form_ordered_fields - ['id', 'created_at', 'updated_at', 'deleted_at'] - excluded_columns + additional_columns %>
17
17
  <% end %>
18
18
 
19
- <div class="box box-<%= box_class %>">
19
+ <div class="box box-<%= box_class %> card card-outline card-<%= box_class %>">
20
20
  <% unless hide_header %>
21
- <div class="box-header with-border">
22
- <h3 class="box-title"><%= object.class.model_name.human %></h3>
23
- <% unless hide_links %>
24
- <% if show_actions.include?('new') && can?(:new, object.class) %>
25
- <% if nested_resource %>
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 %>
27
- Cadastrar <i class="fa fa-plus"></i>
21
+ <div class="box-header with-border card-header">
22
+ <h3 class="box-title card-title">
23
+ <%= object.class.model_name.human %>
24
+ <% unless hide_links %>
25
+ <% if show_actions.include?('new') && can?(:new, object.class) %>
26
+ <% if nested_resource %>
27
+ <%= 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 %>
28
+ Cadastrar <i class="fa fa-plus"></i>
29
+ <% end %>
30
+ <% else %>
31
+ <%= 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 %>
32
+ Cadastrar <i class="fa fa-plus"></i>
33
+ <% end %>
28
34
  <% end %>
29
- <% else %>
30
- <%= 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 %>
31
- Cadastrar <i class="fa fa-plus"></i>
35
+ <% end %>
36
+ <% if show_actions.include?('edit') && can?(:edit, object) %>
37
+ <%= 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 %>
38
+ Editar <i class="fa fa-pencil fa-pen"></i>
32
39
  <% end %>
33
40
  <% end %>
34
- <% end %>
35
- <% if show_actions.include?('edit') && can?(:edit, object) %>
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 %>
37
- Editar <i class="fa fa-pencil"></i>
41
+ <% if show_actions.include?('index') %>
42
+ <% if nested_resource %>
43
+ <%= link_to eval_with_rescue("#{parent_resource.class.model_name.singular}_#{object.class.model_name.plural}_path(#{parent_resource.id})"), class: "btn btn-default btn-xs", data: { toggle: 'tooltip', placement: 'top', title: 'Listagem' } do %>
44
+ Listagem <i class="fa fa-bars"></i>
45
+ <% end %>
46
+ <% else %>
47
+ <%= link_to eval_with_rescue("#{object.class.model_name.plural}_path"), class: "btn btn-default btn-xs", data: { toggle: 'tooltip', placement: 'top', title: 'Listagem' } do %>
48
+ Listagem <i class="fa fa-bars"></i>
49
+ <% end %>
50
+ <% end %>
38
51
  <% end %>
39
52
  <% end %>
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 %>
53
+ <% if block_given? %>
54
+ <%= yield %>
46
55
  <% end %>
47
- <% end %>
48
- <% if block_given? %>
49
- <%= yield %>
50
- <% end %>
56
+ </h3>
51
57
  </div>
52
58
  <% end %>
53
59
  <div class="box-body no-padding">
@@ -1,3 +1,3 @@
1
1
  module Zutils
2
- VERSION = "0.5.1"
2
+ VERSION = "1.1.1"
3
3
  end
data/zutils.gemspec CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
33
  spec.require_paths = ["lib"]
34
34
 
35
- spec.add_dependency 'rails', '~> 5.0'
35
+ spec.add_dependency 'rails', '~> 6.0'
36
36
 
37
37
  spec.add_development_dependency "bundler", "~> 1.16"
38
38
  spec.add_development_dependency "rake", "~> 10.0"
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.5.1
4
+ version: 1.1.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-10-21 00:00:00.000000000 Z
11
+ date: 2021-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.0'
19
+ version: '6.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.0'
26
+ version: '6.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -68,6 +68,7 @@ files:
68
68
  - app/assets/javascripts/zutils.js
69
69
  - app/assets/stylesheets/zutils.scss
70
70
  - app/views/shared/_action_links.html.erb
71
+ - app/views/shared/_card_list.html.erb
71
72
  - app/views/shared/_fields.html.erb
72
73
  - app/views/shared/_form.html.erb
73
74
  - app/views/shared/_index.html.erb