zutils 0.4.2 → 0.4.3

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: d1088d0a1d7425c185cb09685ab233fff37a78d734274ae4cd134436681e7289
4
- data.tar.gz: 8a5a28ff4120e34c27f6461482b67a46c2bbcb510e3487d1802eec6d9ab277fc
3
+ metadata.gz: d3cd4aace4730d5f5cf066943ce4971d0dac4404a8fe7b7c73e7d7c3437aad11
4
+ data.tar.gz: 992e6b14a629069ce2c54b82e696c7ed45108c23de2c0bf0610cc74944f62383
5
5
  SHA512:
6
- metadata.gz: 61160fa13546f45e83c7ace88fab430ae3c389ed580103135e51b46cca6420f70919a939000787bdc04cceba2dd986394f28786ffd544ebb29e0c364a317b4bd
7
- data.tar.gz: bcc45cb2dd11fbba63907ed71d13afbc26ca14deed370dd7e4435ddb2afe871443a103832b865ac008f2e4abb054ff80951ce6f6a5e109a22fb9f23462a90798
6
+ metadata.gz: 63923805827527085aa1dcb9238580c2a48c85596a3af2b0796eec666d56a173ccdc7c1bc829daa90a3d6febdfbdf81b4b2970d32d21efb11986390dad3843ec
7
+ data.tar.gz: 1863c982819053125d987fabd623e63b95346e577b7d8d23c54227c13ae258d6f7e184aff3a04e117f11b89db2cd0a1da5d2d83e8d3b8c155347b72bd5f2c9b6
@@ -1,5 +1,9 @@
1
1
  <% additional_actions ||= {} %>
2
2
 
3
+ <% hide_read_action ||= false %>
4
+ <% hide_edit_action ||= false %>
5
+ <% hide_destroy_action ||= false %>
6
+
3
7
  <div class="btn-group">
4
8
  <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
5
9
  Ações
@@ -7,14 +11,14 @@
7
11
  <span class="sr-only">Toggle Dropdown</span>
8
12
  </button>
9
13
  <ul class="dropdown-menu" role="menu">
10
- <% if can? :read, (object.class == Array ? object.last.class : object.class) %>
14
+ <% if !hide_read_action && can?(:read, (object.class == Array ? object.last.class : object.class)) %>
11
15
  <li>
12
16
  <%= link_to object, data: { toggle: 'tooltip', placement: 'top', title: 'Visualizar' } do %>
13
17
  <i class="fa fa-eye"></i> Visualizar
14
18
  <% end %>
15
19
  <% end %>
16
20
  </li>
17
- <% if can? :edit, (object.class == Array ? object.last.class : object.class) %>
21
+ <% if !hide_edit_action && can?(:edit, (object.class == Array ? object.last.class : object.class)) %>
18
22
  <li>
19
23
  <% if object.class == Array %>
20
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 %>
@@ -27,7 +31,7 @@
27
31
  <% end %>
28
32
  </li>
29
33
  <% end %>
30
- <% if can? :destroy, (object.class == Array ? object.last.class : object.class) %>
34
+ <% if !hide_destroy_action && can?(:destroy, (object.class == Array ? object.last.class : object.class)) %>
31
35
  <li>
32
36
  <%= link_to object, method: :delete, data: { confirm: 'Tem certeza?', toggle: 'tooltip', placement: 'top', title: 'Apagar' } do %>
33
37
  <i class="fa fa-trash"></i> Apagar
@@ -16,6 +16,10 @@
16
16
  <% hide_header ||= false %>
17
17
  <% hide_footer ||= false %>
18
18
 
19
+ <% hide_read_action ||= false %>
20
+ <% hide_edit_action ||= false %>
21
+ <% hide_destroy_action ||= false %>
22
+
19
23
  <div class='box box-<%= box_class %>'>
20
24
  <% unless hide_header %>
21
25
  <div class="box-header with-border">
@@ -40,7 +44,7 @@
40
44
  <%= render 'shared/list', list: list, exceptions: exceptions, excluded_columns: excluded_columns,
41
45
  additional_columns: additional_columns, sort_fields: sort_fields, sort_all: sort_all,
42
46
  additional_actions: additional_actions, hide_actions: hide_actions, table_class: table_class,
43
- show_columns: show_columns
47
+ show_columns: show_columns, hide_read_action: hide_read_action, hide_edit_action: hide_edit_action, hide_destroy_action: hide_destroy_action
44
48
  %>
45
49
  <% if defined? list.total_pages %>
46
50
  <div class='col-md-4'>
@@ -8,6 +8,10 @@
8
8
  <% table_class ||= 'datatables' %>
9
9
  <% show_columns ||= [] %>
10
10
 
11
+ <% hide_read_action ||= false %>
12
+ <% hide_edit_action ||= false %>
13
+ <% hide_destroy_action ||= false %>
14
+
11
15
  <% if show_columns.empty? %>
12
16
  <% show_columns = list.klass.column_names - exceptions - excluded_columns + additional_columns %>
13
17
  <% end %>
@@ -66,7 +70,9 @@
66
70
  <% end %>
67
71
  <% unless hide_actions %>
68
72
  <td>
69
- <%= render 'shared/action_links', object: object, additional_actions: additional_actions %>
73
+ <%= render 'shared/action_links', object: object, additional_actions: additional_actions,
74
+ hide_read_action: hide_read_action, hide_edit_action: hide_edit_action, hide_destroy_action: hide_destroy_action
75
+ %>
70
76
  </td>
71
77
  <% end %>
72
78
  </tr>
@@ -1,3 +1,3 @@
1
1
  module Zutils
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
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.2
4
+ version: 0.4.3
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-05-21 00:00:00.000000000 Z
11
+ date: 2019-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  requirements: []
102
- rubygems_version: 3.0.3
102
+ rubygems_version: 3.0.1
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: Utilidades gerais para aplicações rails