Commit 487508e727841a8aa2efd7c4ada6fa9de5725131
Committed by
Antonio Terceiro
1 parent
19be5f1a
Exists in
master
and in
29 other branches
Display title instead of filename when listing uploaded files
Signed-off-by: Antonio Terceiro <terceiro@colivre.coop.br> (ActionItem1776)
Showing
2 changed files
with
13 additions
and
1 deletions
Show diff stats
app/helpers/cms_helper.rb
... | ... | @@ -28,7 +28,7 @@ module CmsHelper |
28 | 28 | end |
29 | 29 | |
30 | 30 | def link_to_article(article) |
31 | - article_name = short_filename(article.name, 30) | |
31 | + article_name = short_filename(article.title, 30) | |
32 | 32 | if article.folder? |
33 | 33 | link_to article_name, {:action => 'view', :id => article.id}, :class => icon_for_article(article) |
34 | 34 | else | ... | ... |
test/functional/cms_controller_test.rb
... | ... | @@ -1539,4 +1539,16 @@ class CmsControllerTest < Test::Unit::TestCase |
1539 | 1539 | assert_tag :tag => 'label', :attributes => { :for => 'article_accept_comments' }, :content => _('I want to receive comments about this article') |
1540 | 1540 | end |
1541 | 1541 | |
1542 | + should 'display filename if uploaded file has not title' do | |
1543 | + file = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => @profile) | |
1544 | + get :index, :profile => @profile.identifier | |
1545 | + assert_tag :a, :content => "rails.png" | |
1546 | + end | |
1547 | + | |
1548 | + should 'display title if uploaded file has one' do | |
1549 | + file = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => @profile, :title => 'An image') | |
1550 | + get :index, :profile => @profile.identifier | |
1551 | + assert_tag :a, :content => "An image" | |
1552 | + end | |
1553 | + | |
1542 | 1554 | end | ... | ... |