diff --git a/app/models/plan.rb b/app/models/plan.rb index 96876f4..9d5190b 100644 --- a/app/models/plan.rb +++ b/app/models/plan.rb @@ -236,13 +236,13 @@ # plan - Plan to be deep copied # # Returns Plan - # CHANGES # Added Research Output Support + # Added Project/Meta/ResearchOutput Fragments copy def self.deep_copy(plan) plan_copy = plan.dup - plan_copy.title = "Copy of " + plan.title plan_copy.feedback_requested = false plan_copy.save! + plan_copy.copy_plan_fragments(plan) plan.research_outputs.each do |research_output| research_output_copy = ResearchOutput.deep_copy(research_output) research_output_copy.plan_id = plan_copy.id diff --git a/app/models/research_output.rb b/app/models/research_output.rb index 721aabb..804c0e5 100644 --- a/app/models/research_output.rb +++ b/app/models/research_output.rb @@ -132,7 +132,7 @@ ) fragment_description.instantiate - unless description_question.nil? + if description_question.present? && plan.template.structured? # Create a new answer for the ResearchOutputDescription Question # This answer will be displayed in the Write Plan tab, pre filled with the ResearchOutputDescription info fragment_description.answer = Answer.create( diff --git a/app/models/template.rb b/app/models/template.rb index b079b0b..0254153 100644 --- a/app/models/template.rb +++ b/app/models/template.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # == Schema Information # # Table name: templates @@ -31,6 +32,7 @@ include GlobalHelpers include ValidationMessages include ValidationValues + prepend Dmpopidor::Models::Template validates_with TemplateLinksValidator diff --git a/app/views/branded/paginable/plans/_privately_visible.html.erb b/app/views/branded/paginable/plans/_privately_visible.html.erb index 69c3d1c..16d801b 100644 --- a/app/views/branded/paginable/plans/_privately_visible.html.erb +++ b/app/views/branded/paginable/plans/_privately_visible.html.erb @@ -63,7 +63,10 @@ <% end %>