Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue17 #133

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
4 changes: 0 additions & 4 deletions app/models/multipart_question.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,6 @@ def check_and_unlock_setup!
end
end

def is_multipart?
true
end

protected

def set_question_setup!(qs)
Expand Down
2 changes: 1 addition & 1 deletion app/models/question.rb
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def is_draft_in_multipart?
end

def is_multipart?
false
question_type == "MultipartQuestion"
end

def modified_at
Expand Down
41 changes: 40 additions & 1 deletion app/views/project_questions/_attribution.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %><br/><% 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 %>
&copy; <%= author_names %>.
<% else %>
Written by <%= author_names %>, &copy; <%= 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 %> <br/> <% 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| %>
<br/>--> <%= render :partial => 'project_questions/attribution',
:locals => {:question_ids => [cq.child_question_id],
:child_question => true} %>
<% end %>
<% end %>

<% if !child_question %><br></br><% end %>
<% end %>
11 changes: 11 additions & 0 deletions app/views/questions/_attribution.html.erb
Original file line number Diff line number Diff line change
@@ -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}) %>
Expand All @@ -20,8 +21,18 @@ Licensed under <%= question.license_id.nil? ? "[unspecified]" : link_to(question
<br/>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| %>
<br/>--> <%= render :partial => 'project_questions/attribution',
:locals => {:question_ids => [cq.child_question_id],
:child_question => true} %>
<% end %>
<% end %>

</div>