Commit 81f665117649399f9e4324211216c4f4a669dd27

Authored by Arthur Esposte
Committed by Antonio Terceiro
1 parent bcaf32ef
Exists in stable-1.2

Consider subdirectory in some images path

Signed-off-by: Rodrigo Souto <rodrigo@colivre.coop.br>
Signed-off-by: Arthur Del Esposte <arthurmde@gmail.com>
(cherry picked from commit 48b50f8829052e384c1c78ba70051fb70c72d716)
app/models/article.rb
... ... @@ -788,7 +788,7 @@ class Article &lt; ActiveRecord::Base
788 788 end
789 789  
790 790 def first_image
791   - img = ( image.present? && { 'src' => image.public_filename } ) ||
  791 + img = ( image.present? && { 'src' => File.join([Noosfero.root, image.public_filename].join) } ) ||
792 792 Nokogiri::HTML.fragment(self.lead.to_s).css('img[src]').first ||
793 793 Nokogiri::HTML.fragment(self.body.to_s).search('img').first
794 794 img.nil? ? '' : img['src']
... ...
app/views/cms/media_panel/_image.html.erb
1 1 <div class="item image" data-item="span" title="<%= @file.name %>">
2 2 <span>
3   - <img src="<%= @file.public_filename(:uploaded) %>"/>
  3 + <%= image_tag(@file.public_filename(:uploaded)) %>
4 4 </span>
5 5 <div class="controls image-controls">
6 6 <a class="button icon-add add-to-text" href="#"><span><%= _('Add to the text') %></span></a>
... ...