Nicolae Claudius
13 years ago
5 changed files with 36 additions and 22 deletions
@ -1,21 +0,0 @@ |
|||||||
<% |
|
||||||
parent_record = @record |
|
||||||
associated = column.singular_association? ? [parent_record.send(column.name)].compact : parent_record.send(column.name).to_a |
|
||||||
associated = associated.sort_by {|r| r.new_record? ? 99999999999 : r.id} unless column.association.options.has_key?(:order) |
|
||||||
if show_blank_record = column.show_blank_record?(associated) |
|
||||||
child = column.singular_association? ? parent_record.send(:"build_#{column.name}") : parent_record.send(column.name).build |
|
||||||
reflection = parent_record.class.reflect_on_association(column.name) |
|
||||||
if reflection && reflection.reverse |
|
||||||
reverse_macro = child.class.reflect_on_association(reflection.reverse).macro |
|
||||||
child.send(:"#{reflection.reverse}=", parent_record) if [:has_one, :belongs_to].include?(reverse_macro) |
|
||||||
end |
|
||||||
associated << child |
|
||||||
end |
|
||||||
subform_div_id = "#{sub_form_id({:association => column.name, :id => parent_record.id || 99999999999})}-div" |
|
||||||
-%> |
|
||||||
<h5><%= column.label -%></h5> |
|
||||||
<div id ="<%= subform_div_id %>" <%= 'style="display: none;"'.html_safe if column.collapsed -%>> |
|
||||||
<%= render :partial => subform_partial_for_column(column), :locals => {:column => column, :parent_record => parent_record, :associated => associated, :show_blank_record => show_blank_record} %> |
|
||||||
</div> |
|
||||||
<%= link_to_visibility_toggle(subform_div_id, {:default_visible => !column.collapsed}) -%> |
|
||||||
<% @record = parent_record -%> |
|
@ -0,0 +1,29 @@ |
|||||||
|
<!DOCTYPE html> |
||||||
|
<html> |
||||||
|
<head> |
||||||
|
<title>Simple DNS</title> |
||||||
|
<%= stylesheet_link_tag "application" %> |
||||||
|
<%= javascript_include_tag "application" %> |
||||||
|
<%= csrf_meta_tag %> |
||||||
|
</head> |
||||||
|
<body class="errors"> |
||||||
|
|
||||||
|
<div id="container"> |
||||||
|
<%= render :partial => 'fragments/top' %> |
||||||
|
<div id="wrapper" class="wat-cf"> |
||||||
|
<div id="main" style="width: 100%;"> |
||||||
|
<div class="block"> |
||||||
|
<div class="content"> |
||||||
|
<div class="inner" data-pjax-container="true"> |
||||||
|
<%= flash_display 'flash' %> |
||||||
|
<%= yield %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<%= render :partial => 'fragments/bottom' %> |
||||||
|
</div> |
||||||
|
|
||||||
|
</body> |
||||||
|
</html> |
Loading…
Reference in new issue