Sha256: cebd17c285f7a97852e1c2940771c2d344251d8c1088e76d5a78e069c326a8a1
Contents?: true
Size: 1.57 KB
Versions: 3
Compression:
Stored size: 1.57 KB
Contents
<% modelo = f.object.class.reflect_on_association(key.to_s).class_name.constantize %> <% if f.object.present? && !f.object.send(key).present? %> <% if [:has_many,:has_and_belongs_to_many].include?(f.object.class.reflect_on_association(key).macro) %> <% f.object.send(key).build %> <% else %> <% f.object.send("build_#{key}") %> <% end %> <% end %> <%= f.simple_fields_for key do |g| %> <div class="col-sm-12"> <h3><%= groups[:label] %></h3> </div> <% groups[:fields].each do |field| %> <% if field[:sf].present? && field[:sf][:grupo].present? %> <%= render "/crud/form_group", f: g, key: field[:attribute], groups: field[:sf] %> <% else %> <% if modelo.reflect_on_association(field[:attribute]).class == ActiveRecord::Reflection::BelongsToReflection && is_raro_crud(modelo.reflect_on_association(field[:attribute]).class_name) && field[:sf][:add_registro].nil?%> <%= render_plus_button(field,g,modelo,f.object) %> <%else%> <%= render_field(field,g,modelo,f.object) %> <%end%> <% end %> <% end %> <% if [:has_many,:has_and_belongs_to_many].include?(f.object.class.reflect_on_association(key).macro) %> <div class="form-group"> <div class="col-sm-10 col-sm-offset-2"> <%= g.link_to_remove "Remover #{groups[:sublabel] || groups[:label].downcase}" %> </div> </div> <% end %> <% end %> <% if [:has_many,:has_and_belongs_to_many].include?(f.object.class.reflect_on_association(key).macro) %> <div class="form-group"> <div class="col-sm-12"> <%= f.link_to_add "Adicionar #{groups[:sublabel] || groups[:label].downcase}", key %> </div> </div> <% end %>
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
templus_models-1.5.5 | app/views/crud/_form_group.html.erb |
templus_models-1.5.4 | app/views/crud/_form_group.html.erb |
templus_models-1.5.3 | app/views/crud/_form_group.html.erb |