use helper methods in form view

This commit is contained in:
Stefan Tollkühn
2025-07-23 11:37:49 +02:00
parent 576804fa74
commit 366d7ebbf6
4 changed files with 11 additions and 29 deletions

View File

@@ -12,10 +12,10 @@
</div>
<% end %>
<% [:company_name, :firstname, :lastname, :streetname, :zipcode, :city, :country, :email, :phone].each do |attrib|%>
<% client_form_fields.each do |attrib| %>
<div>
<%= form.label attrib, style: "display: block" %>
<%= form.text_field attrib %><br>
<%= form.text_field attrib, value: client.send(attrib) %><br>
</div>
<% end %>

View File

@@ -11,10 +11,10 @@
</div>
<% end %>
<% [:name, :email, :short_name, :offer_date, :order_date].each do |prj_attrib| %>
<% project_form_fields.each do |attrib| %>
<div>
<%= form.label prj_attrib, style: "display: block" %>
<%= form.text_field prj_attrib %>
<%= form.label attrib, style: "display: block" %>
<%= form.text_field attrib, value: project.send(attrib) %>
</div>
<% end %>

View File

@@ -11,10 +11,10 @@
</div>
<% end %>
<% [:streetname, :zipcode, :city, :country].each do |attrib| %>
<% subproject_address_form_fields.each do |attrib| %>
<div>
<%= form.label attrib, style: "display: block" %>
<%= form.text_field attrib %>
<%= form.text_field attrib, value: subproject_address.send(attrib) %>
</div>
<% end %>

View File

@@ -11,30 +11,12 @@
</div>
<% end %>
<% subproject_form_fields.each do |attrib| %>
<div>
<%= form.label :subproject_name, style: "display: block" %>
<%= form.text_field :subproject_name %>
</div>
<div>
<%= form.label :project_id, style: "display: block" %>
<%= form.text_field :project_id %>
</div>
<div>
<%= form.label :client_id, style: "display: block" %>
<%= form.text_field :client_id %>
</div>
<div>
<%= form.label :owner_id, style: "display: block" %>
<%= form.text_field :owner_id %>
</div>
<div>
<%= form.label :builder_id, style: "display: block" %>
<%= form.text_field :builder_id %>
<%= form.label attrib, style: "display: block" %>
<%= form.text_field attrib, value: subproject.send(attrib) %>
</div>
<% end %>
<div>
<%= form.submit %>