Skip to content

Commit 4e20d47

Browse files
jstanley0bracken
authored andcommitted
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>
1 parent ef8a4f1 commit 4e20d47

3 files changed

Lines changed: 23 additions & 2 deletions

File tree

app/views/gradebooks/grade_summary.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@
291291
<% if comment.media_comment_id && comment.media_comment_type %>
292292
<div class="comment_media">
293293
<%= t(:media_comment, "This is a media comment,") %><br/>
294-
<a href="#" class="play_comment_link media-comment"><%= t('links.click_to_view', "click here to view") %></a>
294+
<a href="#" class="play_comment_link <%= comment.media_comment_type %>_comment"><%= t('links.click_to_view', "click here to view") %></a>
295295
<span class="media_comment_id" style="display: none;"><%= comment.media_comment_id %></span>
296296
<div class="media_comment_content">
297297
</div>

public/javascripts/grade_summary.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,13 @@ define([
239239
var $parent = $(this).parents(".comment_media"),
240240
comment_id = $parent.getTemplateData({textValues: ['media_comment_id']}).media_comment_id;
241241
if(comment_id) {
242+
var mediaType = 'any';
243+
if ($(this).hasClass('video_comment'))
244+
mediaType = 'video';
245+
else if ($(this).hasClass('audio_comment'))
246+
mediaType = 'audio';
242247
$parent.children(":not(.media_comment_content)").remove();
243-
$parent.find(".media_comment_content").mediaComment('show_inline', comment_id, 'any');
248+
$parent.find(".media_comment_content").mediaComment('show_inline', comment_id, mediaType);
244249
}
245250
});
246251
$("#only_consider_graded_assignments").change(function() {

spec/views/gradebooks/grade_summary.html.erb_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,20 @@
5454
response.should_not be_nil
5555
response.body.should_not match(/Click any score/)
5656
end
57+
58+
it "should know the types of media comments" do
59+
stub_kaltura
60+
course_with_teacher
61+
student_in_course
62+
view_context
63+
a = @course.assignments.create!(:title => 'some assignment', :submission_types => ['online_text_entry'])
64+
sub = a.submit_homework @student, :submission_type => "online_text_entry", :body => "o hai"
65+
sub.add_comment :author => @teacher, :media_comment_id => '0_abcdefgh', :media_comment_type => 'audio'
66+
sub.add_comment :author => @teacher, :media_comment_id => '0_ijklmnop', :media_comment_type => 'video'
67+
assigns[:presenter] = GradeSummaryPresenter.new(@course, @teacher, @student.id)
68+
render "gradebooks/grade_summary"
69+
doc = Nokogiri::HTML::DocumentFragment.parse response.body
70+
doc.at_css('.audio_comment ~ span.media_comment_id').text.should eql '0_abcdefgh'
71+
doc.at_css('.video_comment ~ span.media_comment_id').text.should eql '0_ijklmnop'
72+
end
5773
end

0 commit comments

Comments
 (0)