Skip to content

Commit f3dac60

Browse files
committed
removed references to api_server as resesarch-fi feature will be a plugin instead
1 parent dc26d78 commit f3dac60

File tree

3 files changed

+59
-80
lines changed

3 files changed

+59
-80
lines changed

app/controllers/org_admin/templates_controller.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,6 @@ def create
172172
args = template_params
173173
# Swap in the appropriate visibility enum value for the checkbox value
174174
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]
177175

178176
# creates a new template with version 0 and new family_id
179177
@template = Template.new(args)
@@ -205,9 +203,6 @@ def update
205203
# Swap in the appropriate visibility enum value for the checkbox value
206204
args[:visibility] = parse_visibility(args, current_user.org)
207205

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

app/models/template.rb

Lines changed: 59 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
# created_at :datetime
1919
# updated_at :datetime
2020
# family_id :integer
21-
# org_id :integer
22-
# api_server_id :integer
21+
# org_id :intege
2322
#
2423
# Indexes
2524
#
@@ -70,8 +69,6 @@ class Template < ApplicationRecord
7069

7170
belongs_to :org
7271

73-
belongs_to :api_server, optional: true
74-
7572
has_many :plans
7673

7774
has_many :phases, dependent: :destroy
@@ -495,29 +492,29 @@ def template_has_any_question_identifiers(template_id)
495492
phases = template.phases
496493
for phase in phases do
497494
sections = phase.sections
498-
for section in sections do
495+
for section in sections do
499496
questions = section.questions
500497
for question in questions do
501-
if question.question_identifiers.exists?
498+
if question.question_identifiers.exists?
502499
for qid in question.question_identifiers do
503-
if !qid.value.blank? && !qid.name.blank?
504-
return true
500+
if !qid.value.blank? && !qid.name.blank?
501+
return true
505502
break
506-
end
507-
end
508-
end
503+
end
504+
end
505+
end
509506
end
510-
end
507+
end
511508
end
512509
end
513-
514-
# This method is reponsible to generate the Question Identifiers list
510+
511+
# This method is reponsible to generate the Question Identifiers list
515512
# for one template. It returns a html formated list.
516513
def html_question_identifiers_list(template_id)
517514
#Get the template
518515
template = Template.find(template_id)
519516
phases = template.phases
520-
517+
521518
html = "<div>"
522519
for phase in phases do
523520
sections = phase.sections
@@ -526,63 +523,63 @@ def html_question_identifiers_list(template_id)
526523
html += "<div>
527524
<h4 class=\"modal-title\">Phase - %{phase_title} </h4><hr/>" % { phase_title: phase.title }
528525

529-
for section in sections do
526+
for section in sections do
530527
questions = section.questions
531528

532529
# to verify if there is a question identifier in the section
533530
for question in questions do
534531
for qid in question.question_identifiers do
535-
if !qid.value.blank? && !qid.name.blank?
532+
if !qid.value.blank? && !qid.name.blank?
536533
html += "<div>
537534
<h5 class=\"modal-title\">Section - %{section_title}</h5>" % { section_title: section.title }
538-
end
539-
break
540-
end
535+
end
536+
break
537+
end
541538
break
542-
end
539+
end
543540

544541
# to display the question text and the question identifiers
545542
for question in questions do
546-
if question.question_identifiers.exists?
543+
if question.question_identifiers.exists?
547544
html += "<ul>"
548-
545+
549546
for qid in question.question_identifiers do
550-
if !qid.value.blank? && !qid.name.blank?
547+
if !qid.value.blank? && !qid.name.blank?
551548
clean_question_text = question.text.gsub(/<p>(.*?)<\/p>/, "\\1")
552549
html += "<div class=\"col-md-8\">
553550
<label>Question %{question_number} - %{question_text}</label></div>" % { question_number: question.number, question_text: clean_question_text }
554-
end
555-
break
556-
end
557-
551+
end
552+
break
553+
end
554+
558555
for qid in question.question_identifiers do
559-
if !qid.value.blank? && !qid.name.blank?
556+
if !qid.value.blank? && !qid.name.blank?
560557
html += "<li class=\"list-group-item\" style=\"border: none\">Identifier Value: %{identifier_value}</li>" % { identifier_value: qid.value }
561558
html += "<li class=\"list-group-item\" style=\"border: none\">Identifier Name: %{identifier_name}</li>" % { identifier_name: qid.name }
562-
end
559+
end
563560
end
564561
html += "</ul>"
565-
562+
566563
end
567-
564+
568565
end
569-
html += "<hr/></div>"
566+
html += "<hr/></div>"
570567
end
571-
html += "<hr/></div>"
572-
end
568+
html += "<hr/></div>"
569+
end
573570

574-
html += "</div>"
575-
end
571+
html += "</div>"
572+
end
576573

577574

578-
# This method is reponsible to generate the Question Identifiers list
575+
# This method is reponsible to generate the Question Identifiers list
579576
# for one template. It returns a html formated list.
580577
def export_question_identifiers_list(template_id)
581578
#Get the template
582579
template = Template.find(template_id)
583580
phases = template.phases
584-
585-
html = "<html>
581+
582+
html = "<html>
586583
<head>
587584
<title>%{template_title}</title>
588585
</head>
@@ -593,54 +590,54 @@ def export_question_identifiers_list(template_id)
593590

594591
html += "<h2>Phase - %{phase_title}</h2>" % { phase_title: phase.title }
595592

596-
for section in sections do
593+
for section in sections do
597594
questions = section.questions
598595

599596
# to verify if there is a question identifier in the section
600597
for question in questions do
601598
for qid in question.question_identifiers do
602-
if !qid.value.blank? && !qid.name.blank?
599+
if !qid.value.blank? && !qid.name.blank?
603600
html += "<h3>Section - %{section_title}</h3>" % { section_title: section.title }
604-
end
605-
break
606-
end
601+
end
602+
break
603+
end
607604
break
608-
end
605+
end
609606

610607
# to display the question text and the question identifiers
611608
for question in questions do
612-
if question.question_identifiers.exists?
609+
if question.question_identifiers.exists?
613610
html += "<ul>"
614-
611+
615612
for qid in question.question_identifiers do
616-
if !qid.value.blank? && !qid.name.blank?
613+
if !qid.value.blank? && !qid.name.blank?
617614
clean_question_text = question.text.gsub(/<p>(.*?)<\/p>/, "\\1")
618615
html += "
619616
<p>Question %{question_number} - %{question_text}</p>" % { question_number: question.number, question_text: clean_question_text }
620-
end
621-
break
622-
end
623-
617+
end
618+
break
619+
end
620+
624621
for qid in question.question_identifiers do
625-
if !qid.value.blank? && !qid.name.blank?
622+
if !qid.value.blank? && !qid.name.blank?
626623
html += "<li>Identifier Value: %{identifier_value}</li>" % { identifier_value: qid.value }
627624
html += "<li>Identifier Name: %{identifier_name}</li>" % { identifier_name: qid.name }
628-
end
625+
end
629626
end
630627
html += "</ul><br>"
631-
628+
632629
end
633-
630+
634631
end
635-
html += "<br>"
632+
html += "<br>"
636633
end
637-
end
634+
end
638635

639636
html += "</body>
640-
</html>"
641-
end
637+
</html>"
638+
end
639+
642640

643-
644641

645642

646643
private

app/views/org_admin/templates/_form.html.erb

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,6 @@
1111
<%= f.text_area(:description, class: "template", spellcheck: true) %>
1212
</div>
1313

14-
<% if Rails.configuration.x.research_fi.active %>
15-
<div class="form-control mb-3">
16-
<div class="row">
17-
<div class="col-6">
18-
<%= f.label(:api_server, _('Enable interoperation with an external system'), class: "form-label")%>
19-
<%= select_tag :api_server_id,
20-
options_for_select(ApiServer.pluck(:title, :id), selected: f.object.api_server_id),
21-
class: 'form-select', "aria-labelledby": "api_server_id", include_blank: _("--Select--")%>
22-
</div>
23-
</div>
24-
</div>
25-
<% end %>
26-
2714
<% if current_user.org.funder? && !current_user.org.funder_only? %>
2815
<!-- If the Org is a funder and another org type then allow then to set the visibility -->
2916
<div class="form-control mb-3 col-xs-8">

0 commit comments

Comments
 (0)