templus_models 1.5.2 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/crud_controller.rb +1 -1
- data/app/helpers/crud_helper.rb +10 -2
- data/app/views/crud/_form_group.html.erb +2 -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: 1d5f40c5d477a3f89c62e865f78829b10459c71e
|
4
|
+
data.tar.gz: 196f38866cd729c07c2997aa3dc96be3ea8e9fec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c8391370ca672bb1801c8796de51046c501f474dfd613c53aaf5caf2eea9eb8c77db6713dc2ac912bf89b3a5bb3e2b03f3f7df5bcdc3444ed2f9ee6e5918b74
|
7
|
+
data.tar.gz: fdcf411a09b2fd67d6ba1c9d3e4fe605b151599828f2b179f6a599f0907c6f3ba59e50a2050ce5349fbea765b0181d78ff13a20775d1386d685843b274095785
|
@@ -204,7 +204,7 @@ class CrudController < ApplicationController
|
|
204
204
|
group = {chave => [:id, :_destroy]}
|
205
205
|
groups.each do |field|
|
206
206
|
if field[:sf].present? && field[:sf][:grupo].present?
|
207
|
-
group[chave] << permitt_group(fields, field[:attribute], field[:sf][:fields], key.to_s.
|
207
|
+
group[chave] << permitt_group(fields, field[:attribute], field[:sf][:fields], mod.reflect_on_association(key.to_s).class_name.constantize)
|
208
208
|
else
|
209
209
|
modelo = mod.reflect_on_association(key.to_s).class_name.constantize
|
210
210
|
if modelo.reflect_on_association(field[:attribute])
|
data/app/helpers/crud_helper.rb
CHANGED
@@ -128,7 +128,11 @@ module CrudHelper
|
|
128
128
|
elsif !field[:sf][:create].nil? && !field[:sf][:create] && record.new_record?
|
129
129
|
else
|
130
130
|
unless modelo.reflect_on_association(field[:attribute])
|
131
|
-
|
131
|
+
if modelo.new.send(field[:attribute]).class.to_s =~ /Uploader/ and f.object.send(field[:attribute]).present?
|
132
|
+
f.input field[:attribute], field[:sf].merge(hint: "Arquivo Atual: #{f.object.send(field[:attribute]).file.filename}")
|
133
|
+
else
|
134
|
+
f.input field[:attribute], field[:sf]
|
135
|
+
end
|
132
136
|
else
|
133
137
|
f.association field[:attribute], field[:sf]
|
134
138
|
end
|
@@ -142,7 +146,11 @@ module CrudHelper
|
|
142
146
|
field[:sf][:collection] = f.instance_eval &field[:sf][:collection_if]
|
143
147
|
end
|
144
148
|
unless modelo.reflect_on_association(field[:attribute])
|
145
|
-
|
149
|
+
if modelo.new.send(field[:attribute]).class.to_s =~ /Uploader/ and f.object.send(field[:attribute]).present?
|
150
|
+
f.input field[:attribute], field[:sf].merge(hint: "Arquivo Atual: #{f.object.send(field[:attribute]).file.filename}")
|
151
|
+
else
|
152
|
+
f.input field[:attribute], field[:sf]
|
153
|
+
end
|
146
154
|
else
|
147
155
|
f.association field[:attribute], field[:sf]
|
148
156
|
end
|
@@ -24,7 +24,7 @@
|
|
24
24
|
<% if [:has_many,:has_and_belongs_to_many].include?(f.object.class.reflect_on_association(key).macro) %>
|
25
25
|
<div class="form-group">
|
26
26
|
<div class="col-sm-10 col-sm-offset-2">
|
27
|
-
<%= g.link_to_remove "Remover #{groups[:label].downcase}" %>
|
27
|
+
<%= g.link_to_remove "Remover #{groups[:sublabel] || groups[:label].downcase}" %>
|
28
28
|
</div>
|
29
29
|
</div>
|
30
30
|
<% end %>
|
@@ -32,7 +32,7 @@
|
|
32
32
|
<% if [:has_many,:has_and_belongs_to_many].include?(f.object.class.reflect_on_association(key).macro) %>
|
33
33
|
<div class="form-group">
|
34
34
|
<div class="col-sm-12">
|
35
|
-
<%= f.link_to_add "Adicionar #{groups[:label].downcase}", key %>
|
35
|
+
<%= f.link_to_add "Adicionar #{groups[:sublabel] || groups[:label].downcase}", key %>
|
36
36
|
</div>
|
37
37
|
</div>
|
38
38
|
<% 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: 1.5.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Sol
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-11-
|
12
|
+
date: 2015-11-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|