zutils 3.0.0 → 3.0.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7d2ca7875c5cbac73748c37b83b6585c114033acb1d53ebffe8ac023b6667c9
|
4
|
+
data.tar.gz: c44982f7748a5ce410e3a1a25d32d559ae39ef8038c6ffee24141c27d8a50e43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78e0a5f117208de343e28c7870b9de07f84747ef28e0d3f1717d1113993ff67cda831f5bec0c4e6b79eef9b01b45e914448c9a056b9700e8c35e02ccc5f6b84f
|
7
|
+
data.tar.gz: b474063b7effcbcd514cd12131d0b6bffa31565b14886d727b449ff50f56ccc1b987562e649869016dc8be65427240e969a76f59c1074230b7f3b1077398d2d2
|
@@ -1,6 +1,9 @@
|
|
1
1
|
<% size ||= "md" %>
|
2
2
|
<% labels ||= false %>
|
3
3
|
<% hide ||= [] %>
|
4
|
+
<% new_color ||= 'primary' %>
|
5
|
+
<% edit_color ||= 'warning' %>
|
6
|
+
<% delete_color ||= 'danger' %>
|
4
7
|
<div class="row">
|
5
8
|
<div class="col text-nowrap">
|
6
9
|
<% unless hide.include? "show" %>
|
@@ -16,7 +19,7 @@
|
|
16
19
|
<% end %>
|
17
20
|
<% unless hide.include? "new" %>
|
18
21
|
<%= link_to eval_with_rescue("new_#{[object].flatten.map{|x| x.class.to_s.underscore}.join("_")}_path"),
|
19
|
-
class: "mb-1 btn btn-#{size} btn
|
22
|
+
class: "mb-1 btn btn-#{size} btn-#{new_color}", data: { "bs-toggle": "tooltip", "bs-placement": "top", "bs-title": "Cadastrar" } do %>
|
20
23
|
<% if labels %>
|
21
24
|
<div class="d-none d-sm-inline-block">
|
22
25
|
Cadastrar
|
@@ -27,7 +30,7 @@
|
|
27
30
|
<% end %>
|
28
31
|
<% unless hide.include? "edit" %>
|
29
32
|
<%= link_to eval_with_rescue("edit_#{[object].flatten.map{|x| x.class.to_s.underscore}.join("_")}_path(#{object.id})"),
|
30
|
-
class: "mb-1 btn btn-#{size} btn
|
33
|
+
class: "mb-1 btn btn-#{size} btn-#{edit_color}", data: { "bs-toggle": "tooltip", "bs-placement": "top", "bs-title": "Editar" } do %>
|
31
34
|
<% if labels %>
|
32
35
|
<div class="d-none d-sm-inline-block">
|
33
36
|
Editar
|
@@ -50,7 +53,7 @@
|
|
50
53
|
<% unless hide.include? "delete" %>
|
51
54
|
<%= button_to object, method: :delete, form: { data: { turbo_confirm: 'Tem certeza?' }, class: 'd-inline'},
|
52
55
|
data: { "bs-toggle": "tooltip", "bs-placement": "top", "bs-title": "Apagar" },
|
53
|
-
class: "mb-1 btn btn-#{size} btn
|
56
|
+
class: "mb-1 btn btn-#{size} btn-#{delete_color}" do %>
|
54
57
|
<% if labels %>
|
55
58
|
<div class="d-none d-sm-inline-block">
|
56
59
|
Apagar
|
@@ -64,7 +67,7 @@
|
|
64
67
|
<div class="col col-auto text-right">
|
65
68
|
<%= button_to object, method: :delete, form: { data: { turbo_confirm: 'Tem certeza?' }, class: 'd-inline'},
|
66
69
|
data: { "bs-toggle": "tooltip", "bs-placement": "top", "bs-title": "Apagar" },
|
67
|
-
class: "mb-1 btn btn-#{size} btn
|
70
|
+
class: "mb-1 btn btn-#{size} btn-#{delete_color}" do %>
|
68
71
|
<% if labels %>
|
69
72
|
<div class="d-none d-sm-inline-block">
|
70
73
|
Apagar
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<% card_color ||= 'danger' %>
|
2
|
+
<% default_field = {name: :id_eq, attrs: {label: false, required: false, placeholder: 'ID', wrapper: false}} %>
|
3
|
+
<% received_field = defined?(main_field) ? main_field : {} %>
|
4
|
+
<% main_field = default_field.deep_merge(received_field) %>
|
5
|
+
<%= search_form_for @q, url: url do |f| %>
|
6
|
+
<div class="card card-outline card-<%= card_color %>" data-controller='filtering'>
|
7
|
+
<div class="card-header with-bormainder">
|
8
|
+
<div class="input-group">
|
9
|
+
<div class="input-group-prepend">
|
10
|
+
<button type="button" class="btn btn-<%= card_color %>" data-action="click->filtering#toggle">
|
11
|
+
<i class="fa fa-angle-right" data-filtering-target='icon'></i>
|
12
|
+
<span class="d-none d-sm-inline-block">
|
13
|
+
Filtrar
|
14
|
+
</span>
|
15
|
+
</button>
|
16
|
+
</div>
|
17
|
+
<%= f.input (main_field&.dig(:name) || :id_eq), main_field&.dig(:attrs) %>
|
18
|
+
<div class="input-group-append">
|
19
|
+
<%= button_tag type: "submit", class: "btn btn-#{card_color}" do %>
|
20
|
+
<i class="fa fa-search"></i>
|
21
|
+
<span class="d-none d-sm-inline-block">
|
22
|
+
Buscar
|
23
|
+
</span>
|
24
|
+
<% end %>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
<div class="row">
|
28
|
+
<div class="col-md-12 active-filters" data-filtering-target='filters'></div>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
<div class="card-body" style='display: none;' data-filtering-target='body'>
|
32
|
+
<div class="row">
|
33
|
+
<% search_fields ||= [] %>
|
34
|
+
<% search_fields.each do |sf| %>
|
35
|
+
<% default_attrs = {required: false, wrapper_html: {class: "col-md-3"}} %>
|
36
|
+
<% received_attrs = sf.dig(:attrs) || {} %>
|
37
|
+
<% attrs = default_attrs.deep_merge(received_attrs) %>
|
38
|
+
<%= f.input sf.dig(:name), attrs %>
|
39
|
+
<% end %>
|
40
|
+
</div>
|
41
|
+
<%= button_tag type: "submit", class: "btn btn-#{card_color}" do %>
|
42
|
+
<i class="fa fa-search"></i> Buscar
|
43
|
+
<% end %>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
<% end %>
|
@@ -9,6 +9,10 @@
|
|
9
9
|
<% hide ||= %w[show delete] %>
|
10
10
|
<% size ||= "xs" %>
|
11
11
|
|
12
|
+
<% new_color ||= 'primary' %>
|
13
|
+
<% edit_color ||= 'warning' %>
|
14
|
+
<% delete_color ||= 'danger' %>
|
15
|
+
|
12
16
|
<% if show_columns.empty? %>
|
13
17
|
<% form_fields ||= (object.class.respond_to?('form_fields') ? object.class.form_fields : {}) %>
|
14
18
|
<% form_ordered_fields ||= (form_fields.empty? ? object.class.column_names : form_fields.keys) %>
|
@@ -206,4 +210,4 @@
|
|
206
210
|
<% end %>
|
207
211
|
<% end %>
|
208
212
|
<% end %>
|
209
|
-
<%= render "shared/btn_action_links", object: object, labels: true, hide: hide %>
|
213
|
+
<%= render "shared/btn_action_links", object: object, labels: true, hide: hide, new_color: new_color, edit_color: edit_color, delete_color: delete_color %>
|
data/lib/zutils/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo Viana
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- app/views/shared/_index.html.erb
|
77
77
|
- app/views/shared/_list.html.erb
|
78
78
|
- app/views/shared/_modal.html.erb
|
79
|
+
- app/views/shared/_search_form.html.erb
|
79
80
|
- app/views/shared/_show.html.erb
|
80
81
|
- bin/console
|
81
82
|
- bin/setup
|