[Git][noosfero/noosfero][master] 2 commits: Consider subdirectory in some images path

Antonio Terceiro gitlab at gitlab.com
Wed Oct 7 09:33:47 BRT 2015


Antonio Terceiro pushed to branch master at Noosfero / noosfero


Commits:
48b50f88 by Arthur Del Esposte at 2015-10-06T21:30:22Z
Consider subdirectory in some images path

Signed-off-by: Rodrigo Souto <rodrigo at colivre.coop.br>
Signed-off-by: Arthur Del Esposte <arthurmde at gmail.com>

- - - - -
792227eb by Antonio Terceiro at 2015-10-07T12:33:25Z
Merge branch 'image-subpath' into 'master'

Consider subdirectory in some images path

Small fixies to allow blog posts present images when Noosfero is running in a  subdirectory

See merge request !694
- - - - -


2 changed files:

- app/models/article.rb
- app/views/cms/media_panel/_image.html.erb


Changes:

=====================================
app/models/article.rb
=====================================
--- a/app/models/article.rb
+++ b/app/models/article.rb
@@ -809,7 +809,7 @@ class Article < ActiveRecord::Base
   end
 
   def first_image
-    img = ( image.present? && { 'src' => image.public_filename } ) ||
+    img = ( image.present? && { 'src' => File.join([Noosfero.root, image.public_filename].join) } ) ||
           Nokogiri::HTML.fragment(self.lead.to_s).css('img[src]').first ||
           Nokogiri::HTML.fragment(self.body.to_s).search('img').first
     img.nil? ? '' : img['src']


=====================================
app/views/cms/media_panel/_image.html.erb
=====================================
--- a/app/views/cms/media_panel/_image.html.erb
+++ b/app/views/cms/media_panel/_image.html.erb
@@ -1,6 +1,6 @@
 <div class="item image" data-item="span" title="<%= @file.name %>">
   <span>
-    <img src="<%= @file.public_filename(:uploaded) %>"/>
+    <%= image_tag(@file.public_filename(:uploaded)) %>
   </span>
   <div class="controls image-controls">
     <a class="button icon-add add-to-text" href="#"><span><%= _('Add to the text') %></span></a>



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/b14e688877270d7fcd301ee07c81cb5e846a13e6...792227ebb311b24d7420bd2271ba3ab3922ed628
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20151007/1299279f/attachment-0001.html>


More information about the Noosfero-dev mailing list