Commit 48b50f8829052e384c1c78ba70051fb70c72d716
1 parent
70d40ab5
Exists in
master
and in
29 other branches
Consider subdirectory in some images path
Signed-off-by: Rodrigo Souto <rodrigo@colivre.coop.br> Signed-off-by: Arthur Del Esposte <arthurmde@gmail.com>
Showing
2 changed files
with
2 additions
and
2 deletions
Show diff stats
app/models/article.rb
@@ -809,7 +809,7 @@ class Article < ActiveRecord::Base | @@ -809,7 +809,7 @@ class Article < ActiveRecord::Base | ||
809 | end | 809 | end |
810 | 810 | ||
811 | def first_image | 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 | Nokogiri::HTML.fragment(self.lead.to_s).css('img[src]').first || | 813 | Nokogiri::HTML.fragment(self.lead.to_s).css('img[src]').first || |
814 | Nokogiri::HTML.fragment(self.body.to_s).search('img').first | 814 | Nokogiri::HTML.fragment(self.body.to_s).search('img').first |
815 | img.nil? ? '' : img['src'] | 815 | img.nil? ? '' : img['src'] |
app/views/cms/media_panel/_image.html.erb
1 | <div class="item image" data-item="span" title="<%= @file.name %>"> | 1 | <div class="item image" data-item="span" title="<%= @file.name %>"> |
2 | <span> | 2 | <span> |
3 | - <img src="<%= @file.public_filename(:uploaded) %>"/> | 3 | + <%= image_tag(@file.public_filename(:uploaded)) %> |
4 | </span> | 4 | </span> |
5 | <div class="controls image-controls"> | 5 | <div class="controls image-controls"> |
6 | <a class="button icon-add add-to-text" href="#"><span><%= _('Add to the text') %></span></a> | 6 | <a class="button icon-add add-to-text" href="#"><span><%= _('Add to the text') %></span></a> |