1
0
Fork 0

Move HTML to partial

This commit is contained in:
Alex Kotov 2018-12-02 22:00:01 +05:00
parent f757420cf1
commit 7600e048a7
No known key found for this signature in database
GPG key ID: 4E831250F47DE154
2 changed files with 26 additions and 25 deletions

View file

@ -0,0 +1,25 @@
<%= simple_form_for passport do |f| %>
<%= f.simple_fields_for :passport_map do |ff| %>
<%= ff.input :surname %>
<%= ff.input :given_name %>
<%= ff.input :patronymic %>
<%= ff.input :sex,
as: :radio_buttons,
collection: PassportMap.sexes.keys.map { |sex|
[Passport.human_attribute_name("sex.#{sex}"), sex]
} %>
<%= ff.input :date_of_birth, start_year: Date.today.year - 150,
end_year: Date.today.year %>
<%= ff.input :place_of_birth %>
<%= ff.input :series %>
<%= ff.input :number %>
<%= ff.input :issued_by %>
<%= ff.input :unit_code %>
<%= ff.input :date_of_issue, start_year: Date.today.year - 150,
end_year: Date.today.year %>
<% end %>
<%= f.input :images %>
<%= f.button :submit %>
<% end %>

View file

@ -1,27 +1,3 @@
<div class="container">
<%= simple_form_for @passport do |f| %>
<%= f.simple_fields_for :passport_map do |ff| %>
<%= ff.input :surname %>
<%= ff.input :given_name %>
<%= ff.input :patronymic %>
<%= ff.input :sex,
as: :radio_buttons,
collection: PassportMap.sexes.keys.map { |sex|
[Passport.human_attribute_name("sex.#{sex}"), sex]
} %>
<%= ff.input :date_of_birth, start_year: Date.today.year - 150,
end_year: Date.today.year %>
<%= ff.input :place_of_birth %>
<%= ff.input :series %>
<%= ff.input :number %>
<%= ff.input :issued_by %>
<%= ff.input :unit_code %>
<%= ff.input :date_of_issue, start_year: Date.today.year - 150,
end_year: Date.today.year %>
<% end %>
<%= f.input :images %>
<%= f.button :submit %>
<% end %>
<%= render partial: 'form', locals: { passport: @passport } %>
</div>