templus_models 1.2.3 → 1.2.4
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 +1 -1
- data/app/raro_crud/raro_crud.rb +1 -1
- data/app/views/crud/_form.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: f40049a130be15773eb9bfbc66db8112331a7397
|
4
|
+
data.tar.gz: d5dab79cff5a21238652c28cd5992d933423ce14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de03fcada6f4e9008e2d9314beea4aea5c15b3669d6b22e3cfdac8cfc93649267761da68b0fe7c418059e18b295ce67dbf7dcd8d3e8212f3935a490b36be30cb
|
7
|
+
data.tar.gz: d2717ff5a912d42edd7e07d14349594df4125201d0eceef951369ab7e78e5f7a46782625270675286458f78e60817a2eaf98e67da3e7861ccdf09fe1ea6e9de4
|
data/app/helpers/crud_helper.rb
CHANGED
@@ -131,7 +131,7 @@ module CrudHelper
|
|
131
131
|
end
|
132
132
|
else
|
133
133
|
if field[:sf][:value] and field[:sf][:value].class == Proc
|
134
|
-
field[:sf][:input_html]
|
134
|
+
field[:sf][:input_html] ||= {}
|
135
135
|
field[:sf][:input_html][:value] = f.instance_eval &field[:sf][:value]
|
136
136
|
end
|
137
137
|
if field[:sf][:collection_if] and field[:sf][:collection_if].class == Proc
|
data/app/raro_crud/raro_crud.rb
CHANGED
@@ -293,7 +293,7 @@ class RaroCrud
|
|
293
293
|
{campo: :complemento, label: "Complemento"},
|
294
294
|
{campo: :bairro, label: "Bairro"},
|
295
295
|
{campo: :estado, label: "Estado", collection: Estado.order(:sigla).pluck(:sigla)},
|
296
|
-
{campo: :cidade_id, label: "Cidade", collection_if: Proc.new{|f| f.try(:object).try(:
|
296
|
+
{campo: :cidade_id, label: "Cidade", collection_if: Proc.new{|f| f.try(:object).try(:estado).try(:present?) ? (f.try(:object).try(:estado).try(:cidades) || []) : []}}
|
297
297
|
].each do |field|
|
298
298
|
value = {}
|
299
299
|
field.each do |atr|
|
@@ -28,9 +28,9 @@
|
|
28
28
|
|
29
29
|
<% end %>
|
30
30
|
<%@crud_helper.form_groups.each do |key, groups|%>
|
31
|
-
<% if [:has_many,:has_and_belongs_to_many].include?(@model.reflect_on_association(key).macro) && @record.new_record? %>
|
31
|
+
<% if [:has_many,:has_and_belongs_to_many].include?(@model.reflect_on_association(key).macro) && @record.new_record? && !@record.send(key).present? %>
|
32
32
|
<% @record.send(key).build %>
|
33
|
-
<% elsif @record.new_record?%>
|
33
|
+
<% elsif @record.new_record? && !@record.send(key).present?%>
|
34
34
|
<% @record.send("build_#{key}") %>
|
35
35
|
<% end %>
|
36
36
|
<%= f.simple_fields_for key do |g| %>
|
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.2.
|
4
|
+
version: 1.2.4
|
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-
|
12
|
+
date: 2015-07-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|