add dropdowns for client, owner, builder in subproject form
This commit is contained in:
		| @@ -1,6 +1,6 @@ | |||||||
| module SubprojectsHelper | module SubprojectsHelper | ||||||
|   def subproject_form_fields |   def subproject_form_fields | ||||||
|     [:subproject_name, :project_id, :client_id, :owner_id, :builder_id] |     [:subproject_name, :project, :client, :owner, :builder] | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def subproject_view_fields |   def subproject_view_fields | ||||||
|   | |||||||
| @@ -14,7 +14,14 @@ | |||||||
|   <% subproject_form_fields.each do |attrib| %> |   <% subproject_form_fields.each do |attrib| %> | ||||||
|   <div> |   <div> | ||||||
|     <%= form.label attrib, style: "display: block" %> |     <%= form.label attrib, style: "display: block" %> | ||||||
|  |     <% case attrib %> | ||||||
|  |       <% when :project %> | ||||||
|  |         <%= form.collection_select :project_id, Project.all, :id, -> (project) { "#{project.name}" }, prompt: "Select Project" %> | ||||||
|  |       <% when :client, :owner, :builder %> | ||||||
|  |         <%= form.collection_select "#{attrib}_id", Client.all, :id, -> (client) { "#{client.company_name} (#{client.lastname}, #{client.firstname})" }, prompt: "Select #{attrib.capitalize}" %> | ||||||
|  |     <% else %> | ||||||
|       <%= form.text_field attrib, value: subproject.send(attrib) %> |       <%= form.text_field attrib, value: subproject.send(attrib) %> | ||||||
|  |     <% end %> | ||||||
|   </div> |   </div> | ||||||
|   <% end %> |   <% end %> | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Stefan Tollkühn
					Stefan Tollkühn