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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eec9f6718520ae99d686f122694a1fe37cfab627
4
- data.tar.gz: 3a4e215f8924c5db90173309119bb62ea7b5ed51
3
+ metadata.gz: 1d5f40c5d477a3f89c62e865f78829b10459c71e
4
+ data.tar.gz: 196f38866cd729c07c2997aa3dc96be3ea8e9fec
5
5
  SHA512:
6
- metadata.gz: 8608adf4e91b264bbb95b0627652ff9d9b75e76627e27adcb41503d3c83a5342b7c8bf3388d1e782671836b37eac6a71ee0e3dc4266441a9c182e493260daca6
7
- data.tar.gz: fe47911c91fbcb6e01ab695a448a08aef4ae65dba576fa85530466cda9e5cd36f660332457cb38b58f6aa180601d03124858f99d5de78532fc4189a11a1087c1
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.camelcase.singularize.constantize)
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])
@@ -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
- f.input field[:attribute], field[:sf]
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
- f.input field[:attribute], field[:sf]
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 %>
@@ -1,3 +1,3 @@
1
1
  module TemplusModels
2
- VERSION = "1.5.2"
2
+ VERSION = "1.5.3"
3
3
  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.2
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 00:00:00.000000000 Z
12
+ date: 2015-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails