<%= render :partial => 'search/image', :object => product %>
diff --git a/public/designs/themes/noosfero/images/rails.png b/public/designs/themes/noosfero/images/rails.png
new file mode 100644
index 0000000..b8441f1
Binary files /dev/null and b/public/designs/themes/noosfero/images/rails.png differ
diff --git a/public/images/star.png b/public/images/star.png
new file mode 100644
index 0000000..0e49bbf
Binary files /dev/null and b/public/images/star.png differ
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index 8e927f0..072e42b 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -6146,3 +6146,10 @@ li.profile-activity-item.upload_image .activity-gallery-images-count-1 img {
width: 100px;
text-align: center;
}
+
+#product-list .highlighted-product img.star {
+ position: absolute;
+ top: 2px;
+ right: 2px;
+ z-index: 10;
+}
diff --git a/test/functional/catalog_controller_test.rb b/test/functional/catalog_controller_test.rb
index 0779405..42de220 100644
--- a/test/functional/catalog_controller_test.rb
+++ b/test/functional/catalog_controller_test.rb
@@ -109,4 +109,22 @@ class CatalogControllerTest < ActionController::TestCase
assert_tag :tag => 'span', :content => 'This is Plugin2 speaking!', :attributes => {:id => 'plugin2'}
end
+ should 'add highlighted-product CSS class around a highlighted product' do
+ prod = @enterprise.products.create!(:name => 'Highlighted Product', :product_category => @product_category, :highlighted => true)
+ get :index, :profile => @enterprise.identifier
+ assert_tag :tag => 'li', :attributes => { :class => 'product highlighted-product' }, :content => /Highlighted Product/
+ end
+
+ should 'do not add highlighted-product CSS class around an ordinary product' do
+ prod = @enterprise.products.create!(:name => 'Ordinary Product', :product_category => @product_category, :highlighted => false)
+ get :index, :profile => @enterprise.identifier
+ assert_no_tag :tag => 'li', :attributes => { :class => 'product highlighted-product' }, :content => /Ordinary Product/
+ end
+
+ should 'display star image in highlighted product' do
+ prod = @enterprise.products.create!(:name => 'The Eyes Are The Light', :product_category => @product_category, :highlighted => true)
+ get :index, :profile => @enterprise.identifier
+ assert_tag :tag => 'img', :attributes => { :class => 'star', :src => /star.png/ }
+ end
+
end
diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb
index 661abb9..7e1c2a3 100644
--- a/test/functional/search_controller_test.rb
+++ b/test/functional/search_controller_test.rb
@@ -926,6 +926,20 @@ class SearchControllerTest < ActionController::TestCase
end
end
+ should 'add highlighted-product CSS class around a highlighted product' do
+ enterprise = fast_create(Enterprise)
+ product = Product.create!(:name => 'Enter Sandman', :enterprise_id => enterprise.id, :product_category_id => @product_category.id, :highlighted => true)
+ get :products
+ assert_tag :tag => 'li', :attributes => { :class => 'search-product-item highlighted-product' }, :content => /Enter Sandman/
+ end
+
+ should 'do not add highlighted-product CSS class around an ordinary product' do
+ enterprise = fast_create(Enterprise)
+ product = Product.create!(:name => 'Holier Than Thou', :enterprise_id => enterprise.id, :product_category_id => @product_category.id, :highlighted => false)
+ get :products
+ assert_no_tag :tag => 'li', :attributes => { :class => 'search-product-item highlighted-product' }, :content => /Holier Than Thou/
+ end
+
##################################################################
##################################################################
diff --git a/test/unit/display_helper_test.rb b/test/unit/display_helper_test.rb
index 171c180..baf4ff9 100644
--- a/test/unit/display_helper_test.rb
+++ b/test/unit/display_helper_test.rb
@@ -44,4 +44,14 @@ class DisplayHelperTest < ActiveSupport::TestCase
assert_equal 'go to
www.noosfero.org yeah!', html
end
+ should 'return path to file under theme dir if theme has that file' do
+ stubs(:theme_path).returns('/designs/themes/noosfero')
+ assert_equal '/designs/themes/noosfero/images/rails.png', themed_path('/images/rails.png')
+ end
+
+ should 'return path to file under public dir if theme hasnt that file' do
+ stubs(:theme_path).returns('/designs/themes/noosfero')
+ assert_equal '/images/invalid-file.png', themed_path('/images/invalid-file.png')
+ end
+
end
--
libgit2 0.21.2