assignments with no preview should show 'No Preview Available'
refs #7425 Marc L. pointed out that this wasn't working. test plan: - create a new assignment with paper submission - give the assignment a score for a student in the speedgrader - as the student verify that the submission details page shows 'No Preview Available' Change-Id: Ie29943589a1a50ca7a14a79d1e1d5e0556ece1f3 Reviewed-on: https://gerrit.instructure.com/10846 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Simon Williams <simon@instructure.com>
This commit is contained in:
parent
101a76f1c8
commit
b8456a26d0
|
@ -1642,6 +1642,10 @@ class Assignment < ActiveRecord::Base
|
|||
submission_types && submission_types.strip != "" && submission_types != "none" && submission_types != 'not_graded' && submission_types != "on_paper" && submission_types != 'external_tool'
|
||||
end
|
||||
|
||||
def expects_external_submission?
|
||||
submission_types == 'on_paper' || submission_types == 'external_tool'
|
||||
end
|
||||
|
||||
def <=>(comparable)
|
||||
sort_key <=> comparable.sort_key
|
||||
end
|
||||
|
|
|
@ -179,7 +179,7 @@
|
|||
});
|
||||
</script>
|
||||
<% end %>
|
||||
<% elsif @submission.has_submission? %>
|
||||
<% elsif @submission.has_submission? || @assignment.expects_external_submission? %>
|
||||
<div style="margin: 20px auto; width: 400px; height: 50px; font-size: 1.5em; font-weight: bold;">
|
||||
<%= t('no_preview_available', 'No Preview Available') %>
|
||||
</div>
|
||||
|
|
|
@ -29,5 +29,15 @@ describe "/submissions/show_preview" do
|
|||
render "submissions/show_preview"
|
||||
response.should_not be_nil
|
||||
end
|
||||
|
||||
it "should give a user-friendly explaination why there's no preview" do
|
||||
course_with_student
|
||||
view_context
|
||||
a = @course.assignments.create!(:title => "some assignment", :submission_types => 'on_paper')
|
||||
assigns[:assignment] = a
|
||||
assigns[:submission] = a.submit_homework(@user)
|
||||
render "submissions/show_preview"
|
||||
response.body.should match /No Preview Available/
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue