diff --git a/app/models/multipart_question.rb b/app/models/multipart_question.rb
index 932fb95..db3303f 100644
--- a/app/models/multipart_question.rb
+++ b/app/models/multipart_question.rb
@@ -198,10 +198,6 @@ def check_and_unlock_setup!
end
end
- def is_multipart?
- true
- end
-
protected
def set_question_setup!(qs)
diff --git a/app/models/question.rb b/app/models/question.rb
index 79bf973..8fee867 100644
--- a/app/models/question.rb
+++ b/app/models/question.rb
@@ -341,7 +341,7 @@ def is_draft_in_multipart?
end
def is_multipart?
- false
+ question_type == "MultipartQuestion"
end
def modified_at
diff --git a/app/views/project_questions/_attribution.html.erb b/app/views/project_questions/_attribution.html.erb
index 9f3aada..9594bd7 100644
--- a/app/views/project_questions/_attribution.html.erb
+++ b/app/views/project_questions/_attribution.html.erb
@@ -8,4 +8,43 @@
<% # Replace with code to print attribution for all of the given questions
%>
-<%= @question_ids %>
+<% child_question ||= false %>
+<% question_ids.each do |id| %>
+ <% question = Question.find_by_id(id) %>
+ <% collaborators = question.question_collaborators %>
+
+ <%= question_id_link(question) %><% unless child_question %>
<% end %>
+
+ <% author_names = collaborator_names(collaborators.select{|c| c.is_author}) %>
+ <% copyright_names = collaborator_names(collaborators.select{|c| c.is_copyright_holder}) %>
+
+ <% if author_names == copyright_names %>
+ © <%= author_names %>.
+ <% else %>
+ Written by <%= author_names %>, © <%= copyright_names %>.
+ <% end %>
+ Licensed under <%= question.license_id.nil? ? "[unspecified]" : link_to(question.license.short_name, question.license.url) %>.
+
+ <% if question.is_derivation? %>
+ <% source_question = question.source_question %>
+ <% source_collaborators = source_question.question_collaborators %>
+ <% if !child_question %>
<% end %>
+ Derived from <%= question_id_link(source_question) %> by
+ <%= collaborator_names(source_collaborators.select{|c| c.is_author}) %>.
+ <% end %>
+
+ <% if question.is_published? %>
+ <%= link_to "Version History",
+ question_history_path(question) %>.
+ <% end %>
+
+ <% if question.is_multipart? && !child_question %>
+ <% question.child_question_parts.each do |cq| %>
+
--> <%= render :partial => 'project_questions/attribution',
+ :locals => {:question_ids => [cq.child_question_id],
+ :child_question => true} %>
+ <% end %>
+ <% end %>
+
+ <% if !child_question %>
<% end %>
+<% end %>
diff --git a/app/views/questions/_attribution.html.erb b/app/views/questions/_attribution.html.erb
index b1a289f..df2f51d 100644
--- a/app/views/questions/_attribution.html.erb
+++ b/app/views/questions/_attribution.html.erb
@@ -1,6 +1,7 @@
<%# Copyright 2011-2012 Rice University. Licensed under the Affero General Public
License version 3 or later. See the COPYRIGHT file for details. %>
+<% child_question ||= false %>
<% collaborators = question.question_collaborators %>
<% author_names = collaborator_names(collaborators.select{|c| c.is_author}) %>
@@ -20,8 +21,18 @@ Licensed under <%= question.license_id.nil? ? "[unspecified]" : link_to(question
Derived from <%= question_id_link(source_question) %> by
<%= collaborator_names(source_collaborators.select{|c| c.is_author}) %>.
<% end %>
+
<% if question.is_published? %>
<%= link_to "Version History",
question_history_path(question) %>.
<% end %>
+
+<% if question.is_multipart? && !child_question %>
+ <% question.child_question_parts.each do |cq| %>
+
--> <%= render :partial => 'project_questions/attribution',
+ :locals => {:question_ids => [cq.child_question_id],
+ :child_question => true} %>
+ <% end %>
+ <% end %>
+