Skip to content

Commit

Permalink
Bugfix: LH #136 - Resolves issue where moderation previews pages for …
Browse files Browse the repository at this point in the history
…items other than topics returned an error.
  • Loading branch information
James Stradling committed Dec 16, 2008
1 parent 9f2df79 commit 6e41a60
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion app/helpers/application_helper.rb
Expand Up @@ -632,7 +632,9 @@ def display_xml_attributes(item)
raq = " » "
html = []

mappings = item.is_a?(Topic) ? item.all_field_mappings : @content_type.content_type_to_field_mappings
mappings = item.is_a?(Topic) ? item.all_field_mappings : \
ContentType.find_by_class_name(item.class.name).content_type_to_field_mappings

content = item.extended_content_pairs

mappings.each do |mapping|
Expand Down
13 changes: 7 additions & 6 deletions test/integration/moderation_views_test.rb
Expand Up @@ -60,13 +60,13 @@ class ModerationViewsTest < ActionController::IntegrationTest
add_grant_as_super_user
login_as('grant')

@image = new_image do
@image = new_still_image do
attach_file "image_file[uploaded_data]", \
File.join(RAILS_ROOT, "test/fixtures/files/white.jpg"), "image/jpg"
end

update_image(@image, :title => "New image updated")
update_image(@image, :title => "New image updated again")
update_item(@image, :title => "New image updated")
update_item(@image, :title => "New image updated again")
end

should "have functioning moderation pages" do
Expand All @@ -80,11 +80,12 @@ class ModerationViewsTest < ActionController::IntegrationTest
def should_have_functioning_moderation_pages(item, controller_name, zoom_class_name)

visit "/site/#{controller_name}/show/#{item.id}"
body_should_contain "New #{controller_name} updated again"

body_should_contain "New #{controller_name.singularize} updated again"
body_should_contain "History"

visit "/site/#{controller_name}/history/#{item.id}"
body_should_contain "Revision History: New #{controller_name} updated again"
body_should_contain "Revision History: New #{controller_name.singularize} updated again"
body_should_contain "Back to live"
1.upto(3) do |i|
body_should_contain "# #{i}"
Expand Down

0 comments on commit 6e41a60

Please sign in to comment.