Commit 48b50f8829052e384c1c78ba70051fb70c72d716

Authored by Arthur Esposte
1 parent 70d40ab5

Consider subdirectory in some images path

Signed-off-by: Rodrigo Souto <rodrigo@colivre.coop.br>
Signed-off-by: Arthur Del Esposte <arthurmde@gmail.com>
app/models/article.rb
... ... @@ -809,7 +809,7 @@ class Article &lt; ActiveRecord::Base
809 809 end
810 810  
811 811 def first_image
812   - img = ( image.present? && { 'src' => image.public_filename } ) ||
  812 + img = ( image.present? && { 'src' => File.join([Noosfero.root, image.public_filename].join) } ) ||
813 813 Nokogiri::HTML.fragment(self.lead.to_s).css('img[src]').first ||
814 814 Nokogiri::HTML.fragment(self.body.to_s).search('img').first
815 815 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>
... ...