plumb media comment types to grade summary page

fixes CNVS-1839

test plan:
 - as a student, submit an assignment
 - as a teacher, record video and audio comments for the submission
   in speedgrader
 - (wait for kaltura to process the media comments...)
 - as the student, go to the grades page and click the "full details"
   button
 - make sure that the video and audio comments both play properly

Change-Id: I2ab093fde1a2ceec292f149cd535739eca3b1880
Reviewed-on: https://gerrit.instructure.com/19070
QA-Review: Adam Phillipps <adam@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
This commit is contained in:
Jeremy Stanley 2013-03-28 10:09:45 -06:00 committed by Bracken Mosbacker
parent ef8a4f15a9
commit 4e20d4706f
3 changed files with 23 additions and 2 deletions

View File

@ -291,7 +291,7 @@
<% if comment.media_comment_id && comment.media_comment_type %>
<div class="comment_media">
<%= t(:media_comment, "This is a media comment,") %><br/>
<a href="#" class="play_comment_link media-comment"><%= t('links.click_to_view', "click here to view") %></a>
<a href="#" class="play_comment_link <%= comment.media_comment_type %>_comment"><%= t('links.click_to_view', "click here to view") %></a>
<span class="media_comment_id" style="display: none;"><%= comment.media_comment_id %></span>
<div class="media_comment_content">
</div>

View File

@ -239,8 +239,13 @@ define([
var $parent = $(this).parents(".comment_media"),
comment_id = $parent.getTemplateData({textValues: ['media_comment_id']}).media_comment_id;
if(comment_id) {
var mediaType = 'any';
if ($(this).hasClass('video_comment'))
mediaType = 'video';
else if ($(this).hasClass('audio_comment'))
mediaType = 'audio';
$parent.children(":not(.media_comment_content)").remove();
$parent.find(".media_comment_content").mediaComment('show_inline', comment_id, 'any');
$parent.find(".media_comment_content").mediaComment('show_inline', comment_id, mediaType);
}
});
$("#only_consider_graded_assignments").change(function() {

View File

@ -54,4 +54,20 @@ describe "/gradebooks/grade_summary" do
response.should_not be_nil
response.body.should_not match(/Click any score/)
end
it "should know the types of media comments" do
stub_kaltura
course_with_teacher
student_in_course
view_context
a = @course.assignments.create!(:title => 'some assignment', :submission_types => ['online_text_entry'])
sub = a.submit_homework @student, :submission_type => "online_text_entry", :body => "o hai"
sub.add_comment :author => @teacher, :media_comment_id => '0_abcdefgh', :media_comment_type => 'audio'
sub.add_comment :author => @teacher, :media_comment_id => '0_ijklmnop', :media_comment_type => 'video'
assigns[:presenter] = GradeSummaryPresenter.new(@course, @teacher, @student.id)
render "gradebooks/grade_summary"
doc = Nokogiri::HTML::DocumentFragment.parse response.body
doc.at_css('.audio_comment ~ span.media_comment_id').text.should eql '0_abcdefgh'
doc.at_css('.video_comment ~ span.media_comment_id').text.should eql '0_ijklmnop'
end
end