properly copy links to equation images

Test Plan:
 * Create a text area with an equation in it from the default
equation editor.
 * copy the course
 * the equation should still be there in the new course

closes #8237

Change-Id: I9238f8e0a305ee95963e0774651f45624d50e459
Reviewed-on: https://gerrit.instructure.com/10335
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
This commit is contained in:
Bracken Mosbacker 2012-04-25 14:18:36 -06:00
parent 94cd9e34c9
commit bdf9e32fb4
2 changed files with 4 additions and 1 deletions

View File

@ -74,6 +74,8 @@ class ImportedHtmlConverter
end
elsif attr == 'href' && node['class'] && node['class'] =~ /instructure_inline_media_comment/
# Course copy media reference, leave it alone
elsif attr == 'src' && node['class'] && node['class'] =~ /equation_image/
# Equation image, leave it alone
elsif val =~ %r{\A/assessment_questions/\d+/files/\d+}
# The file is in the context of an AQ, leave the link alone
elsif val =~ %r{\A/courses/\d+/files/\d+}

View File

@ -511,10 +511,11 @@ describe ContentMigration do
@bank = @copy_from.assessment_question_banks.create!(:title => 'Test Bank')
@attachment = attachment_with_context(@copy_from)
@attachment2 = @attachment = Attachment.create!(:filename => 'test.jpg', :display_name => "test.jpg", :uploaded_data => StringIO.new('psych!'), :folder => Folder.unfiled_folder(@copy_from), :context => @copy_from)
data = {"name" => "Hi", "question_text" => <<-HTML, "answers" => [{"id" => 1}, {"id" => 2}]}
data = {"name" => "Hi", "question_text" => <<-HTML.strip, "answers" => [{"id" => 1}, {"id" => 2}]}
File ref:<img src="/courses/#{@copy_from.id}/files/#{@attachment.id}/download">
different file ref: <img src="/courses/#{@copy_from.id}/file_contents/course%20files/unfiled/test.jpg">
media object: <a id="media_comment_0_l4l5n0wt" class="instructure_inline_media_comment video_comment" href="/media_objects/0_l4l5n0wt">this is a media comment</a>
equation: <img class="equation_image" title="Log_216" src="/equation_images/Log_216" alt="Log_216">
HTML
@question = @bank.assessment_questions.create!(:question_data => data)
@question.reload.question_data['question_text'].should =~ %r{/assessment_questions/}