diff --git a/app/helpers/content_viewer_helper.rb b/app/helpers/content_viewer_helper.rb
index 949d2bf..486b2ea 100644
--- a/app/helpers/content_viewer_helper.rb
+++ b/app/helpers/content_viewer_helper.rb
@@ -31,8 +31,7 @@ module ContentViewerHelper
end
def image_label(image)
- text = image.abstract || image.title
- text && (text.first(40) + (text.size > 40 ? '…' : ''))
+ image.title.first(40) + (image.title.size > 40 ? '…' : '')
end
def article_translations(article)
diff --git a/app/views/content_viewer/_uploaded_file.rhtml b/app/views/content_viewer/_uploaded_file.rhtml
index 25b43c4..b32ec6c 100644
--- a/app/views/content_viewer/_uploaded_file.rhtml
+++ b/app/views/content_viewer/_uploaded_file.rhtml
@@ -1,6 +1,10 @@
<% if uploaded_file.image? %>
- <%= link_to content_tag(:span, uploaded_file.display_title), uploaded_file.view_url, :class => 'image', :style => 'background-image: url(%s)'% uploaded_file.public_filename(:thumb) %>
- <%= image_label(uploaded_file) %>
+ <%= link_to '',
+ uploaded_file.view_url,
+ :class => 'image',
+ :style => 'background-image: url(%s)'% uploaded_file.public_filename(:thumb)
+ %>
+ <%=h uploaded_file.title %>
<% else %>
<%= render :partial => 'article', :object => uploaded_file %>
<% end %>
diff --git a/app/views/content_viewer/image_gallery.rhtml b/app/views/content_viewer/image_gallery.rhtml
index 7c40f24..7233b3e 100644
--- a/app/views/content_viewer/image_gallery.rhtml
+++ b/app/views/content_viewer/image_gallery.rhtml
@@ -10,7 +10,7 @@
<% end %>
<% @images.each do |a| %>
- <% content_tag('li', :title => a.abstract, :class => 'image-gallery-item' ) do %>
+ <% content_tag('li', :title => a.title, :class => 'image-gallery-item' ) do %>
<%= render :partial => partial_for_class(a.class), :object => a %>
<% end %>
<% end %>
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index 31d71fa..3d9f385 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -3361,13 +3361,15 @@ div.with_media_panel .formfield input {
.image-gallery ul {
padding: 0px;
text-align: center;
+ width: 486px;
+ margin: auto;
}
.image-gallery-item {
width: 142px;
height: 170px;
list-style: none;
- margin: 5px;
+ margin: 10px;
float: left;
overflow: hidden;
background-repeat: no-repeat;
diff --git a/test/integration/gallery_test.rb b/test/integration/gallery_test.rb
new file mode 100644
index 0000000..b575eea
--- /dev/null
+++ b/test/integration/gallery_test.rb
@@ -0,0 +1,36 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class GalleryTest < ActionController::IntegrationTest
+
+ def setup
+ p = create_user('test_user').person
+ g = fast_create(Gallery, :profile_id => p.id, :path => 'pics')
+ image = UploadedFile.create!(
+ :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'),
+ :parent => g,
+ :profile => p,
+ :title => 'my img1 title',
+ :abstract => 'my img1 long description'
+ )
+ image = UploadedFile.create!(
+ :uploaded_data => fixture_file_upload('/files/other-pic.jpg', 'image/jpg'),
+ :parent => g,
+ :profile => p,
+ :title => '',
+ :abstract => 'that is my picture description'
+ )
+ get '/test_user/pics'
+ end
+
+ should 'display the title of the images when listing' do
+ assert_tag :tag => 'li', :attributes => { :title => 'my img1 title' }
+ assert_select '.image-gallery-item span', 'my img1 title'
+ assert_no_match(/my img1 long description/, @response.body)
+ end
+
+ should 'scape the title of the images' do
+ assert_select '.image-gallery-item:first-child span',
+ '<b must scape title>'
+ end
+
+end
--
libgit2 0.21.2