Commit 1241aa31b9aeac9a999c7750806da0c882b4af50

Authored by Evandro Jr
2 parents ca204d73 443c6e09

Merge branch 'stable' of gitlab.com:participa/noosfero into stable

app/helpers/layout_helper.rb
... ... @@ -2,6 +2,7 @@ module LayoutHelper
2 2  
3 3 def body_classes
4 4 # Identify the current controller and action for the CSS:
  5 + (logged_in? ? " logged-in" : "") +
5 6 " controller-#{controller.controller_name}" +
6 7 " action-#{controller.controller_name}-#{controller.action_name}" +
7 8 " template-#{@layout_template || if profile.blank? then 'default' else profile.layout_template end}" +
... ...
plugins/virtuoso/lib/virtuoso_plugin/noosfero_harvest.rb
... ... @@ -148,15 +148,9 @@ class VirtuosoPlugin::NoosferoHarvest
148 148  
149 149 def process_value(value)
150 150 if value.kind_of?(String)
151   - value = /https?:\/\//.match(value) ? RDF::URI.new(value) : strip_tags(value)
152   - elsif value.kind_of?(ActiveSupport::TimeWithZone)
153   - value = RDF::Literal::DateTime.new(value)
154   - elsif !!value == value
155   - value = RDF::Literal::Boolean.new(value)
156   - elsif value.kind_of?(Float)
157   - value = RDF::Literal::Double.new(value)
  151 + value = /^https?:\/\//.match(value) ? RDF::URI.new(value) : RDF::Literal.new(strip_tags(value).delete("\n|\r"))
158 152 else
159   - value
  153 + value = RDF::Literal.new(value)
160 154 end
161 155 end
162 156  
... ...
test/unit/layout_helper_test.rb 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +require File.dirname(__FILE__) + '/../test_helper'
  2 +
  3 +class LayoutHelperTest < ActionView::TestCase
  4 +
  5 + should 'append logged-in class in body when user is logged-in' do
  6 + expects(:logged_in?).returns(true)
  7 + expects(:profile).returns(nil).at_least_once
  8 + assert_includes body_classes.split, 'logged-in'
  9 + end
  10 +
  11 + should 'not append logged-in class when user is not logged-in' do
  12 + expects(:logged_in?).returns(false)
  13 + expects(:profile).returns(nil).at_least_once
  14 + assert_not_includes body_classes.split, 'logged-in'
  15 + end
  16 +
  17 +end
... ...