@@ -171,7 +171,11 @@ def show
171171 else
172172 Rails . configuration . x . plans . default_visibility
173173 end
174-
174+ # Get all of the available funders
175+ @funders = Org . funder
176+ . includes ( identifiers : :identifier_scheme )
177+ . joins ( :templates )
178+ . where ( templates : { published : true } ) . uniq . sort_by ( &:name )
175179 # TODO: Seems strange to do this. Why are we just not using an `edit` route?
176180 @editing = ( !params [ :editing ] . nil? && @plan . administerable_by? ( current_user . id ) )
177181
@@ -188,7 +192,7 @@ def show
188192 @important_ggs << [ current_user . org , @all_ggs_grouped_by_org [ current_user . org ] ]
189193 end
190194 @all_ggs_grouped_by_org . each do |org , ggs |
191- @important_ggs << [ org , ggs ] if org . organisation?
195+ @important_ggs << [ org , ggs ] if Org . default_orgs . include? ( org )
192196
193197 # If this is one of the already selected guidance groups its important!
194198 unless ( ggs & @selected_guidance_groups ) . empty?
@@ -209,6 +213,8 @@ def show
209213 Template . where ( family_id : @plan . template . customization_of ) . first
210214 end
211215
216+ @research_domains = ResearchDomain . all . order ( :label )
217+
212218 respond_to :html
213219 end
214220 # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
@@ -259,8 +265,12 @@ def update
259265
260266 # TODO: For some reason the `fields_for` isn't adding the
261267 # appropriate namespace, so org_id represents our funder
262- funder = org_from_params ( params_in : attrs , allow_create : true )
263- @plan . funder_id = funder . id if funder . present?
268+ funder_attrs = plan_params [ :funder ]
269+ funder_attrs [ :org_id ] = plan_params [ :funder ] [ :id ]
270+ funder = org_from_params ( params_in : funder_attrs , allow_create : true )
271+ @plan . funder_id = funder &.id
272+ attrs . delete ( :funder )
273+
264274 process_grant ( grant_params : plan_params [ :grant ] )
265275 attrs . delete ( :grant )
266276 attrs = remove_org_selection_params ( params_in : attrs )
@@ -467,6 +477,8 @@ def plan_params
467477 params . require ( :plan )
468478 . permit ( :template_id , :title , :visibility , :description , :identifier ,
469479 :start_date , :end_date , :org_id , :org_name , :org_crosswalk ,
480+ :ethical_issues , :ethical_issues_description , :ethical_issues_report ,
481+ :research_domain_id , :funding_status ,
470482 grant : %i[ name value ] ,
471483 org : %i[ id org_id org_name org_sources org_crosswalk ] ,
472484 funder : %i[ id org_id org_name org_sources org_crosswalk ] )
0 commit comments