templus_models 3.0.5 → 3.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/crud_helper.rb +3 -1
- data/app/views/crud/_record.html.erb +30 -4
- data/app/views/crud/_records.html.erb +8 -4
- data/app/views/crud/_shared.html.erb +27 -1
- data/app/views/crud/_show.html.erb +14 -2
- data/lib/templus_models/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 113c5743e7d0a89db83a873c296d5bc7794afbc1
|
4
|
+
data.tar.gz: a4dd2f51ef7f9ea9fbad36c01c412f88652b7772
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 289b16d543ffe6b79d7580749ebae633c3c397bd67bcdffa69a61c747001e34794db6f6c031e6a7be3e66c5f667428ab50dfdfb4abe0fa1a12b8d62c86d8e62f
|
7
|
+
data.tar.gz: fa73fdebf8f701a4a232b13c6ab5892508e7e7d9477342550ad159d44f749b08a6f88ba417bed7958606672e7e881515b7763a3fcaffecfd912f82b5a970a19d
|
data/app/helpers/crud_helper.rb
CHANGED
@@ -178,7 +178,9 @@ module CrudHelper
|
|
178
178
|
if is_active_action("printing")
|
179
179
|
wicked_pdf_image_tag(field.url(:thumb))
|
180
180
|
else
|
181
|
-
|
181
|
+
link_to field.url, target: "_blank" do
|
182
|
+
image_tag(field.url(:thumb))
|
183
|
+
end
|
182
184
|
end
|
183
185
|
elsif video?(field)
|
184
186
|
link_to field, field.url, target: "_blank"
|
@@ -20,7 +20,13 @@
|
|
20
20
|
<td class="row">
|
21
21
|
<% record.send(att[:attribute]).each do |rec| %>
|
22
22
|
<li>
|
23
|
-
|
23
|
+
<% if att[:link_associacao] %>
|
24
|
+
<%= link_to crud_model_path(model: rec.class_name.to_s.underscore, id: rec.id) do %>
|
25
|
+
<%= rec.to_s %>
|
26
|
+
<% end %>
|
27
|
+
<% else %>
|
28
|
+
<%= rec.to_s %>
|
29
|
+
<% end %>
|
24
30
|
</li>
|
25
31
|
<% end %>
|
26
32
|
</td>
|
@@ -33,7 +39,11 @@
|
|
33
39
|
<% end %>
|
34
40
|
</td>
|
35
41
|
<% elsif record.send(att[:attribute]).respond_to?(:url) and record.send(att[:attribute]).url(:thumb) %>
|
36
|
-
<td class="row"
|
42
|
+
<td class="row">
|
43
|
+
<%= link_to record.send(att[:attribute]).url, target: "_blank" do %>
|
44
|
+
<%= image_tag(record.send(att[:attribute]).url(:thumb)) %>
|
45
|
+
<% end %>
|
46
|
+
</td>
|
37
47
|
<% else %>
|
38
48
|
<% if record.send(att[:attribute]).to_s == "false" or record.send(att[:attribute]).to_s == "true" %>
|
39
49
|
<td class="row">
|
@@ -44,7 +54,23 @@
|
|
44
54
|
<% else %>
|
45
55
|
<td class="row">
|
46
56
|
<div class="col-xs-9">
|
47
|
-
|
57
|
+
<% if att[:label_method].present? && record.send(att[:attribute]).present?%>
|
58
|
+
<% if @model.reflect_on_association(att[:attribute]) && att[:link_associacao] %>
|
59
|
+
<%= link_to crud_model_path(model: @model.reflect_on_association(att[:attribute]).class_name.to_s.underscore, id: record.send(att[:attribute]).id) do %>
|
60
|
+
<%= record.send(att[:attribute]).send(att[:label_method]) %>
|
61
|
+
<% end %>
|
62
|
+
<% else %>
|
63
|
+
<%= record.send(att[:attribute]).send(att[:label_method]) %>
|
64
|
+
<% end %>
|
65
|
+
<% else %>
|
66
|
+
<% if @model.reflect_on_association(att[:attribute]) && att[:link_associacao] %>
|
67
|
+
<%= link_to crud_model_path(model: @model.reflect_on_association(att[:attribute]).class_name.to_s.underscore, id: record.send(att[:attribute]).id) do %>
|
68
|
+
<%= record.send(att[:attribute]).to_s %>
|
69
|
+
<% end %>
|
70
|
+
<% else %>
|
71
|
+
<%= record.send(att[:attribute]).to_s %>
|
72
|
+
<% end %>
|
73
|
+
<% end %>
|
48
74
|
</div>
|
49
75
|
</td>
|
50
76
|
<% end %>
|
@@ -88,7 +114,7 @@
|
|
88
114
|
<%= link_to I18n.t(name), crud_associacao_models_path(model: @model.name.underscore, id: record.id, associacao: options[:associacao].to_s), class: "btn btn-success btn-xs" %>
|
89
115
|
<% end %>
|
90
116
|
<% elsif options[:partial].present? %>
|
91
|
-
<%= render options[:partial], record: record %>
|
117
|
+
<%= render options[:partial], record: record, action: :index %>
|
92
118
|
<% end %>
|
93
119
|
<% end %>
|
94
120
|
<% end %>
|
@@ -14,7 +14,11 @@
|
|
14
14
|
<% end %>
|
15
15
|
<th>
|
16
16
|
<% if att[:sort_field].present? %>
|
17
|
-
|
17
|
+
<% if att[:sort_field] == :false %>
|
18
|
+
<%= I18n.t(att[:label]) %>
|
19
|
+
<% else %>
|
20
|
+
<%= sort_link @q, att[:sort_field], I18n.t(att[:label]), {},data: {push: 'partial', target: "#form"}%>
|
21
|
+
<% end %>
|
18
22
|
<% else %>
|
19
23
|
<%= sort_link @q, att[:attribute], I18n.t(att[:label]), {},data: {push: 'partial', target: "#form"}%>
|
20
24
|
<% end %>
|
@@ -44,12 +48,12 @@
|
|
44
48
|
var current = headrow;
|
45
49
|
theadtxt[x].push(current.innerHTML);
|
46
50
|
}
|
47
|
-
}
|
51
|
+
}
|
48
52
|
for (var v = 0, tbody; tbody = tablebody[v]; v++) {
|
49
53
|
for (var x = 0, row; row = tbody.rows[x]; x++) {
|
50
54
|
for (var j = 0, col; col = row.cells[j]; j++) {
|
51
55
|
col.insertAdjacentHTML('afterbegin', '<div class="col-xs-3 no-padding">' + theadtxt[v][j] + '</div>');
|
52
|
-
}
|
56
|
+
}
|
53
57
|
}
|
54
58
|
}
|
55
|
-
</script>
|
59
|
+
</script>
|
@@ -59,6 +59,32 @@
|
|
59
59
|
<% end %>
|
60
60
|
</div>
|
61
61
|
<% elsif is_action_show? %>
|
62
|
+
<% @crud_helper.actions_links.each do |name, options| %>
|
63
|
+
<% unless (options[:can].present? && !@record.instance_eval(&options[:can])) %>
|
64
|
+
<% if options[:url].present? %>
|
65
|
+
<% url = options[:url] %>
|
66
|
+
<% if options[:id] %>
|
67
|
+
<% url += options[:url].include?("?") ? "&id=#{@record.id}" : "?id=#{@record.id}" %>
|
68
|
+
<% else url.include?(":id") %>
|
69
|
+
<% url = url.gsub(":id", "#{@record.id}") %>
|
70
|
+
<% end %>
|
71
|
+
<% if options[:wiselink].present? && options[:wiselink] %>
|
72
|
+
<a href="<%= url %>" class="btn btn-success btn-xs pull-right m-l-xs" data-push="partial" data-target="#form">
|
73
|
+
<%= I18n.t(name) %>
|
74
|
+
</a>
|
75
|
+
<% else %>
|
76
|
+
<a href="<%= url %>" class="btn btn-success btn-xs pull-right m-l-xs">
|
77
|
+
<%= I18n.t(name) %>
|
78
|
+
</a>
|
79
|
+
<% end %>
|
80
|
+
<% elsif options[:partial].present? %>
|
81
|
+
<div class="pull-right m-l-xs">
|
82
|
+
<%= render options[:partial], record: @record, action: :show %>
|
83
|
+
</div>
|
84
|
+
<% end %>
|
85
|
+
<% end %>
|
86
|
+
<% end %>
|
87
|
+
|
62
88
|
<% if (@crud_helper.present? && @crud_helper.destroy_action) && should_destroy?(@crud_helper, @record) %>
|
63
89
|
<% if @crud_associacao.present? %>
|
64
90
|
<%= link_to I18n.t("destroy"), destroy_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: @record.id, page: params[:page], q: params[:q]), class: 'btn btn-danger btn-xs pull-right m-l-xs', data: {method: 'delete', confirm: I18n.t('mensagem_confirm_destroy')} %>
|
@@ -82,7 +108,7 @@
|
|
82
108
|
<%= link_to printing_crud_path(model: @model.name.underscore, id: @record.id, page: params[:page], q: params[:q], format: :pdf), class: "btn btn-success btn-xs pull-right m-l-xs", target: "_blank" do %>
|
83
109
|
<%= I18n.t("devise.printing").html_safe %>
|
84
110
|
<% end %>
|
85
|
-
<% end %>
|
111
|
+
<% end %>
|
86
112
|
<% end %>
|
87
113
|
<% end %>
|
88
114
|
</div>
|
@@ -56,9 +56,21 @@
|
|
56
56
|
<% else %>
|
57
57
|
<td>
|
58
58
|
<% if field[:sf].present? && field[:sf][:label_method].present? && @record.send(field[:attribute]).present?%>
|
59
|
-
|
59
|
+
<% if @model.reflect_on_association(field[:attribute]) && field[:sf][:link_associacao] %>
|
60
|
+
<%= link_to crud_model_path(model: @model.reflect_on_association(field[:attribute]).class_name.to_s.underscore, id: @record.send(field[:attribute]).id) do %>
|
61
|
+
<%= @record.send(field[:attribute]).send(field[:sf][:label_method]) %>
|
62
|
+
<% end %>
|
63
|
+
<% else %>
|
64
|
+
<%= @record.send(field[:attribute]).send(field[:sf][:label_method]) %>
|
65
|
+
<% end %>
|
60
66
|
<% else %>
|
61
|
-
|
67
|
+
<% if @model.reflect_on_association(field[:attribute]) && field[:sf][:link_associacao] %>
|
68
|
+
<%= link_to crud_model_path(model: @model.reflect_on_association(field[:attribute]).class_name.to_s.underscore, id: @record.send(field[:attribute]).id) do %>
|
69
|
+
<%= @record.send(field[:attribute]).to_s %>
|
70
|
+
<% end %>
|
71
|
+
<% else %>
|
72
|
+
<%= @record.send(field[:attribute]).to_s %>
|
73
|
+
<% end %>
|
62
74
|
<% end %>
|
63
75
|
</td>
|
64
76
|
<% end %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: templus_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Sol
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-03-
|
13
|
+
date: 2017-03-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|