zutils 0.2.1 → 0.2.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: 697a24c552f8462206708e0f6e57b49ddf3a5d16463dac33f2801918e537f499
4
- data.tar.gz: 8f44c1db6f911795b5a7a84a028f9be91816450af2d44debff1588a590562561
3
+ metadata.gz: 0036a059b0a5365040cc5177473f248fdf162ac323adc606a88d71e76e864e62
4
+ data.tar.gz: bda990502625e46533c264516f6d0fef82821f3ddba0a919a1a314715f98bfab
5
5
  SHA512:
6
- metadata.gz: 73f8317d8dacbc157892212a080e62ced6b7243aff56a8fdba59ab1868a879efba99e39a0aa6b1e677443a0a88f57fd42dc56e114452339f200298fc2b11b227
7
- data.tar.gz: 1ed5a270e3e0258a564506d330a22beb7184727ac0caf70e103898f677fba8d5bd86d9943e31d6013845d0e1e712c41a44ca54dc075769e07a24217ef74c2e9c
6
+ metadata.gz: 3cd01ca929a8c7c1559fff179077ff9c099b0f757381327a1a151df2a35022c84e41fd7681362b05fcf2aeb52ff82d8a89ca59c8998f2463400bdff7db177a09
7
+ data.tar.gz: 80ec6c2a9a0b79cabaef9bc6e900282c5de9f2cef76e51e6b25c4b96b8a3e477edb78f1637c8e3e03deefbd8721f83994b25264308bfc5d54ed8f43a7afc071b
data/.gitignore CHANGED
File without changes
data/CODE_OF_CONDUCT.md CHANGED
File without changes
data/Gemfile CHANGED
File without changes
data/LICENSE.txt CHANGED
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
File without changes
File without changes
File without changes
File without changes
@@ -3,12 +3,15 @@
3
3
  <% hide_actions ||= false %>
4
4
  <% sort_fields ||= [] %>
5
5
 
6
+ <% form_fields ||= (list.first.class.respond_to?('form_fields') ? list.first.class.form_fields : {}) %>
7
+ <% form_ordered_fields ||= (form_fields.empty? ? list.first.class.column_names : form_fields.keys) %>
8
+
6
9
  <table class="table table-striped datatables">
7
10
  <thead>
8
11
  <tr>
9
12
  <% unless list.empty? %>
10
- <% (list.first.class.column_names - exceptions - excluded_columns).each do |column| %>
11
- <% if sort_fields.include? column %>
13
+ <% (form_ordered_fields - exceptions - excluded_columns).each do |column| %>
14
+ <% if sort_fields.include?(column) || sort_fields.include?(column.to_s) || sort_fields.include?(column.to_sym) %>
12
15
  <% if /_id$/ =~ column %>
13
16
  <th><%= sort_link(@q, column, list.first.class.human_attribute_name(column.split("_id")[0])) %></th>
14
17
  <% else %>
@@ -31,7 +34,7 @@
31
34
  <tbody>
32
35
  <% list.each do |object| %>
33
36
  <tr>
34
- <% (list.first.class.column_names - exceptions - excluded_columns).each do |column| %>
37
+ <% (form_ordered_fields - exceptions - excluded_columns).each do |column| %>
35
38
  <td>
36
39
  <% if object.send(column).class == Date or
37
40
  object.send(column).class == DateTime or
@@ -3,6 +3,7 @@
3
3
  <% relationships ||= {} %>
4
4
  <% box_class ||= 'primary' %>
5
5
  <% display_mode ||= 'table' %>
6
+ <% show_buttons &&= true %>
6
7
 
7
8
  <% form_fields ||= (object.class.respond_to?('form_fields') ? object.class.form_fields : {}) %>
8
9
  <% form_ordered_fields ||= (form_fields.empty? ? object.class.column_names : form_fields.keys) %>
@@ -10,15 +11,17 @@
10
11
  <div class="box box-<%= box_class %>">
11
12
  <div class="box-header with-border">
12
13
  <h3 class="box-title"><%=t object.class.model_name.human %></h3>
13
- <% if can? :edit, object %> <!--verificando se o usuario esta logado-->
14
- <%= link_to eval_with_rescue("edit_#{controller_name.singularize}_path(#{object.id})"), class: "btn btn-warning btn-xs", data: { toggle: 'tooltip', placement: 'top', title: 'Editar' } do %>
15
- <i class="fa fa-pencil"></i> Editar
14
+ <% if show_buttons %>
15
+ <% if can? :edit, object %> <!--verificando se o usuario esta logado-->
16
+ <%= link_to eval_with_rescue("edit_#{controller_name.singularize}_path(#{object.id})"), class: "btn btn-warning btn-xs", data: { toggle: 'tooltip', placement: 'top', title: 'Editar' } do %>
17
+ <i class="fa fa-pencil"></i> Editar
18
+ <% end %>
19
+ <% end %>
20
+ <% if nested_resource %>
21
+ <%= link_to 'Listagem', eval_with_rescue("#{parent_resource.class.model_name.to_s.downcase}_#{controller_name}_path(#{parent_resource.id})"), class: "btn btn-default btn-xs" %>
22
+ <% else %>
23
+ <%= link_to 'Listagem', eval_with_rescue("#{controller_name}_path"), class: "btn btn-default btn-xs" %>
16
24
  <% end %>
17
- <% end %>
18
- <% if nested_resource %>
19
- <%= link_to 'Listagem', eval_with_rescue("#{parent_resource.class.model_name.to_s.downcase}_#{controller_name}_path(#{parent_resource.id})"), class: "btn btn-default btn-xs" %>
20
- <% else %>
21
- <%= link_to 'Listagem', eval_with_rescue("#{controller_name}_path"), class: "btn btn-default btn-xs" %>
22
25
  <% end %>
23
26
  </div>
24
27
  <div class="box-body <%= 'no-padding' if display_mode == 'table' %>">
data/bin/console CHANGED
File without changes
data/bin/setup CHANGED
File without changes
data/lib/zutils/engine.rb CHANGED
File without changes
@@ -1,3 +1,3 @@
1
1
  module Zutils
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
data/lib/zutils.rb CHANGED
File without changes
data/zutils.gemspec CHANGED
File without changes
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.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Viana
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-28 00:00:00.000000000 Z
11
+ date: 2018-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails