Commit 8f98bc64446aa44d5a3a75be24bb69fbb7c88495
Committed by
Rodrigo Souto
1 parent
84208b3a
Exists in
staging
search: use first image of article if present
Closes !528 Signed-off-by: Braulio Bhavamitra <braulio@eita.org.br> Signed-off-by: Rodrigo Souto <rodrigo@colivre.coop.br>
Showing
1 changed file
with
3 additions
and
1 deletions
Show diff stats
app/views/search/_image.html.erb
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | <% end %> |
| 27 | 27 | <% elsif image.is_a? Gallery %> |
| 28 | 28 | <div class="search-gallery-items"> |
| 29 | - <% r = image.children.order(:updated_at).where('type = ?', 'UploadedFile').last(3) %> | |
| 29 | + <% r = image.children.latest.images.limit(3) %> | |
| 30 | 30 | <% if r.length > 0 %> |
| 31 | 31 | <% r.each_index do |i| img = r[i] %> |
| 32 | 32 | <%= link_to '', img.view_url, :class => "search-image-pic pic-num#{i+1}", |
| ... | ... | @@ -47,6 +47,8 @@ |
| 47 | 47 | <% else %> |
| 48 | 48 | <div class="search-no-image"><span><%= _('No image') %></span></div> |
| 49 | 49 | <% end %> |
| 50 | + <% elsif image.first_image.present? %> | |
| 51 | + <img src="<%= image.first_image %>" class="automatic-abstract-thumb search-image-pic"> | |
| 50 | 52 | <% else %> |
| 51 | 53 | <div class="search-content-type-icon icon-content-<%=image.class.to_s.underscore.dasherize%>"></div> |
| 52 | 54 | <% end %> | ... | ... |