add project attributes to project form

This commit is contained in:
Stefan Tollkühn
2025-07-21 16:31:23 +02:00
parent c04f2170e2
commit 92c34283b0
2 changed files with 6 additions and 4 deletions

View File

@@ -72,7 +72,7 @@ class ProjectsController < ApplicationController
# Only allow a list of trusted parameters through.
def project_params
params.require(:project).permit(
:name,
:name, :email, :short_name,
subprojects_attributes: [
:id, :subproject_name, :client_id, :owner_id, :builder_id, :_destroy,
client_attributes: [:company_name, :firstname, :lastname, :streetname, :zipcode, :city, :country, :email, :phone],

View File

@@ -11,10 +11,12 @@
</div>
<% end %>
<% [:name, :email, :short_name, :offer_date, :order_date].each do |prj_attrib| %>
<div>
<%= form.label :name, style: "display: block" %>
<%= form.text_field :name %>
<%= form.label prj_attrib, style: "display: block" %>
<%= form.text_field prj_attrib %>
</div>
<% end %>
<h3>Subprojects</h3>
<%= form.fields_for :subprojects do |sp_form| %>
@@ -30,7 +32,7 @@
<fieldset>
<legend>Or Create New <%= role.capitalize %></legend>
<%= sp_form.fields_for role do |c_form| %>
<% [:company_name, :firstname, :lastname, :streetname, :zipcode, :city, :country, :email, :phone].each do |attrib|%>
<% [:company_name, :firstname, :lastname, :streetname, :zipcode, :city, :country, :email, :phone].each do |attrib| %>
<%= c_form.label attrib %>
<%= c_form.text_field attrib %><br>
<% end %>