[Git][noosfero/noosfero][master] 2 commits: Highlight block fix
Antonio Terceiro
gitlab at gitlab.com
Thu Jul 16 16:19:07 BRT 2015
Antonio Terceiro pushed to branch master at Noosfero / noosfero
Commits:
26f01247 by Tallys Martins at 2015-07-16T16:17:38Z
Highlight block fix
- Hightlight block links no longer break when noosfero is under a subdir
Signed-off-by: Andre Bernardes <andrebsguedes at gmail.com>
Signed-off-by: Tallys Martins <tallysmartins at yahoo.com.br>
- - - - -
84003a1c by Antonio Terceiro at 2015-07-16T16:18:08Z
Merge branch 'softwarepublico/noosfero-highlight_block_fix'
Closes merge request !623
- - - - -
2 changed files:
- app/models/highlights_block.rb
- test/unit/highlights_block_test.rb
Changes:
=====================================
app/models/highlights_block.rb
=====================================
--- a/app/models/highlights_block.rb
+++ b/app/models/highlights_block.rb
@@ -12,6 +12,7 @@ class HighlightsBlock < Block
block.images.each do |i|
i[:image_id] = i[:image_id].to_i
i[:position] = i[:position].to_i
+ i[:address] = Noosfero.root + i[:address] unless Noosfero.root.nil?
begin
file = UploadedFile.find(i[:image_id])
i[:image_src] = file.public_filename
=====================================
test/unit/highlights_block_test.rb
=====================================
--- a/test/unit/highlights_block_test.rb
+++ b/test/unit/highlights_block_test.rb
@@ -119,6 +119,19 @@ class HighlightsBlockTest < ActiveSupport::TestCase
block.featured_images
end
+ should 'return correct sub-dir address' do
+ Noosfero.stubs(:root).returns("/social")
+ f1 = mock()
+ f1.expects(:public_filename).returns('address')
+ UploadedFile.expects(:find).with(1).returns(f1)
+ block = HighlightsBlock.new
+ i1 = {:image_id => 1, :address => '/address', :position => 3, :title => 'address'}
+ block.images = [i1]
+ block.save!
+ block.reload
+ assert_equal block.images.first[:address], "/social/address"
+ end
+
[Environment, Profile].each do |klass|
should "choose between owner galleries when owner is #{klass.name}" do
owner = fast_create(klass)
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/6fb823a93b9dc95f54f16e7f4c094ef70a8f5537...84003a1cfb29f9b6c547e05d39bf1dafb3dec7ba
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150716/c3ade2ed/attachment.html>
More information about the Noosfero-dev
mailing list