rendering assignment discussions in group context, fixes #4634
Change-Id: I0a5650b6e2905c6b7257fca1b1233b529b81b218 Reviewed-on: https://gerrit.instructure.com/3799 Reviewed-by: Zach Wily <zach@instructure.com> Tested-by: Hudson <hudson@instructure.com>
This commit is contained in:
parent
4cf750ab0f
commit
873a0cc042
|
@ -101,7 +101,7 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
<% if can_do(@topic.assignment, @current_user, :update) || @assignment.try(:rubric_association).try(:rubric) %>
|
||||
<a href="#" rel="<%= context_url(@context, :context_assignment_rubric_url, @assignment.id) %>" class="show_rubric_link button button-sidebar-wide"><%= image_tag "rubric.png" %> Show Assignment Rubric</a>
|
||||
<a href="#" rel="<%= context_url(@assignment.context, :context_assignment_rubric_url, @assignment.id) %>" class="show_rubric_link button button-sidebar-wide"><%= image_tag "rubric.png" %> Show Assignment Rubric</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
@ -120,7 +120,7 @@
|
|||
<% end %>
|
||||
<% if @assignment %>
|
||||
<% if can_do(@assignment, @current_user, :update) %>
|
||||
<a href="<%= context_url(@context, :context_rubrics_url) %>" id="add_rubric_url" style="display: none;"> </a>
|
||||
<a href="<%= context_url(@assignment.context, :context_rubrics_url) %>" id="add_rubric_url" style="display: none;"> </a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if (@topic && @topic.context_module_tag && @topic.context_module_tag.context_module) || (@topic.for_assignment? && @topic.assignment.context_module_tag && @topic.assignment.context_module_tag.context_module) %>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
def assignment_model(opts={})
|
||||
course_model(:reusable => true)
|
||||
@assignment = @course.assignments.create!(assignment_valid_attributes.merge(opts))
|
||||
@assignment = factory_with_protected_attributes(@course.assignments, assignment_valid_attributes.merge(opts))
|
||||
@assignment.context.should eql(@course) rescue false
|
||||
@a = @assignment
|
||||
@c = @course
|
||||
|
@ -32,4 +32,4 @@ def assignment_valid_attributes
|
|||
:due_at => Time.now,
|
||||
:points_possible => "1.5"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -33,4 +33,23 @@ describe "/discussion_topics/show" do
|
|||
render "discussion_topics/show"
|
||||
response.should have_tag("div#entry_list")
|
||||
end
|
||||
|
||||
it "should render in a group context" do
|
||||
assignment_model(:submission_types => 'discussion_topic')
|
||||
rubric_association_model(:association => @assignment, :purpose => 'grading')
|
||||
group_model
|
||||
view_context(@group, @user)
|
||||
@topic = @assignment.discussion_topic
|
||||
@entry = @topic.discussion_entries.create!(:message => "some message")
|
||||
@topic.discussion_entries.create!(:message => "another message")
|
||||
assigns[:topic] = @topic
|
||||
assigns[:grouped_entries] = @topic.discussion_entries.group_by(&:parent_id)
|
||||
assigns[:entries] = @topic.discussion_entries
|
||||
assigns[:all_entries] = @topic.discussion_entries
|
||||
assigns[:assignment] = @assignment
|
||||
@topic.for_assignment?.should be_true
|
||||
@topic.assignment.rubric_association.rubric.should_not be_nil
|
||||
render "discussion_topics/show"
|
||||
response.should have_tag("div#entry_list")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue