Commit 9b89d389d7bc120d341b26fae57e92bcdb3f70e7
Committed by
Antonio Terceiro
1 parent
e38b8396
Exists in
master
and in
22 other branches
ActionItem966: image description is clipped on image gallery
Showing
4 changed files
with
17 additions
and
4 deletions
Show diff stats
app/views/content_viewer/_uploaded_file.rhtml
1 | 1 | <% if uploaded_file.image? %> |
2 | - <div> <%= link_to image_tag(uploaded_file.public_filename(:thumb)), uploaded_file.view_url %> </div> | |
2 | + <div> <%= link_to image_tag(uploaded_file.public_filename(:thumb), :title => uploaded_file.abstract), uploaded_file.view_url %> </div> | |
3 | 3 | <% else %> |
4 | 4 | <%= render :partial => 'article', :object => uploaded_file %> |
5 | 5 | <% end %> | ... | ... |
app/views/content_viewer/image_gallery.rhtml
... | ... | @@ -2,14 +2,13 @@ |
2 | 2 | <%= @page.body %> |
3 | 3 | </div> |
4 | 4 | |
5 | - | |
6 | 5 | <div class="image-gallery"> |
7 | 6 | <p><%= button(:slideshow, _('View slideshow'), @page.url.merge(:slideshow => true))%></p> |
8 | 7 | <ul> |
9 | 8 | <% @images.each do |a| %> |
10 | 9 | <li class="image-gallery-item"> |
11 | 10 | <%= render :partial => partial_for_class(a.class), :object => a %> |
12 | - <span><%= a.abstract %></span> | |
11 | + <span><%= a.abstract && a.abstract.first(40) %></span> | |
13 | 12 | </li> |
14 | 13 | <% end %> |
15 | 14 | </ul> | ... | ... |
public/stylesheets/folder.css
test/functional/content_viewer_controller_test.rb
... | ... | @@ -835,4 +835,18 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
835 | 835 | get :view_page, :profile => profile.identifier, :page => blog_post.explode_path |
836 | 836 | assert_no_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{b.id}/} |
837 | 837 | end |
838 | + | |
839 | + should 'show only first 40 chars of abstract in image gallery' do | |
840 | + login_as(profile.identifier) | |
841 | + folder = Folder.create!(:name => 'gallery', :profile => profile, :view_as => 'image_gallery') | |
842 | + file = UploadedFile.create!(:profile => profile, :parent => folder, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
843 | + | |
844 | + file.abstract = 'a long abstract bigger then 40 chars for testing' | |
845 | + file.save! | |
846 | + | |
847 | + get :view_page, :profile => profile.identifier, :page => folder.explode_path | |
848 | + | |
849 | + assert_tag :tag => 'li', :attributes => {:class => 'image-gallery-item'}, :child => {:tag => 'span', :content => 'a long abstract bigger then 40 chars for'} | |
850 | + end | |
851 | + | |
838 | 852 | end | ... | ... |