21 lines
661 B
Ruby
21 lines
661 B
Ruby
module SubprojectsHelper
|
|
def subproject_form_fields
|
|
[:subproject_name, :project, :client, :owner, :builder]
|
|
end
|
|
|
|
def subproject_view_fields
|
|
[:subproject_name, :project, :client, :owner, :builder, :subproject_address]
|
|
end
|
|
|
|
def subproject_form_input(form, attrib, subproject)
|
|
case attrib
|
|
when :project
|
|
form.collection_select :project_id, Project.all, :id, :name, prompt: "Select Project"
|
|
when :client, :owner, :builder
|
|
form.collection_select "#{attrib}_id", Client.all, :id, :display_name, prompt: "Select #{attrib.to_s.capitalize}"
|
|
else
|
|
form.text_field attrib, value: subproject.send(attrib)
|
|
end
|
|
end
|
|
end
|