Skip to content

Commit ca4cb5e

Browse files
committed
Update templates_controller - API integration
1 parent 335abeb commit ca4cb5e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

app/controllers/org_admin/templates_controller.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def edit
130130
template = Template.includes(:org, :phases).find(params[:id])
131131
authorize template
132132
# Load the info needed for the overview section if the authorization check passes!
133-
phases = template.phases.includes(sections: { questions: :question_options })
133+
phases = template.phases.includes(sections: { questions: [:question_options, :question_identifiers] })
134134
.order('phases.number',
135135
'sections.number',
136136
'questions.number',
@@ -140,6 +140,7 @@ def edit
140140
'phases.modifiable',
141141
'sections.title',
142142
'questions.text',
143+
'question_identifiers.value',
143144
'question_options.text')
144145
if template.latest?
145146
render 'container', locals: {
@@ -171,6 +172,8 @@ def create
171172
args = template_params
172173
# Swap in the appropriate visibility enum value for the checkbox value
173174
args[:visibility] = parse_visibility(args, current_user.org)
175+
# set api_server if one is associated with this template and its plans
176+
args[:api_server_id] = params[:api_server_id]
174177

175178
# creates a new template with version 0 and new family_id
176179
@template = Template.new(args)
@@ -202,6 +205,9 @@ def update
202205
# Swap in the appropriate visibility enum value for the checkbox value
203206
args[:visibility] = parse_visibility(args, current_user.org)
204207

208+
# set api_server if one is associated with this template and its plans
209+
args[:api_server_id] = params[:api_server_id]
210+
205211
template.assign_attributes(args)
206212
template.links = ActiveSupport::JSON.decode(params['template-links']) if params['template-links'].present?
207213
if template.save

0 commit comments

Comments
 (0)