diff --git a/app/helpers/cms_helper.rb b/app/helpers/cms_helper.rb index e476b4e..a205c3c 100644 --- a/app/helpers/cms_helper.rb +++ b/app/helpers/cms_helper.rb @@ -28,7 +28,7 @@ module CmsHelper end def link_to_article(article) - article_name = short_filename(article.name, 30) + article_name = short_filename(article.title, 30) if article.folder? link_to article_name, {:action => 'view', :id => article.id}, :class => icon_for_article(article) else diff --git a/test/functional/cms_controller_test.rb b/test/functional/cms_controller_test.rb index 71c5e41..a52598b 100644 --- a/test/functional/cms_controller_test.rb +++ b/test/functional/cms_controller_test.rb @@ -1539,4 +1539,16 @@ class CmsControllerTest < Test::Unit::TestCase assert_tag :tag => 'label', :attributes => { :for => 'article_accept_comments' }, :content => _('I want to receive comments about this article') end + should 'display filename if uploaded file has not title' do + file = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => @profile) + get :index, :profile => @profile.identifier + assert_tag :a, :content => "rails.png" + end + + should 'display title if uploaded file has one' do + file = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => @profile, :title => 'An image') + get :index, :profile => @profile.identifier + assert_tag :a, :content => "An image" + end + end -- libgit2 0.21.2