From c90b8e63ac3b9700b9c23242f391244ed4181181 Mon Sep 17 00:00:00 2001 From: Joenio Costa Date: Thu, 8 Nov 2012 21:26:22 +0000 Subject: [PATCH] Highlight the products in listing --- app/helpers/display_helper.rb | 8 ++++++++ app/views/catalog/index.rhtml | 5 ++++- app/views/search/_product.rhtml | 2 +- public/designs/themes/noosfero/images/rails.png | Bin 0 -> 1787 bytes public/images/star.png | Bin 0 -> 3666 bytes public/stylesheets/application.css | 7 +++++++ test/functional/catalog_controller_test.rb | 18 ++++++++++++++++++ test/functional/search_controller_test.rb | 14 ++++++++++++++ test/unit/display_helper_test.rb | 10 ++++++++++ 9 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 public/designs/themes/noosfero/images/rails.png create mode 100644 public/images/star.png diff --git a/app/helpers/display_helper.rb b/app/helpers/display_helper.rb index 472e474..a0514d6 100644 --- a/app/helpers/display_helper.rb +++ b/app/helpers/display_helper.rb @@ -8,6 +8,14 @@ module DisplayHelper opts end + def themed_path(file) + if File.exists?(File.join(Rails.root, 'public', theme_path, file)) + File.join(theme_path, file) + else + file + end + end + def image_link_to_product(product, opts={}) return _('No product') unless product target = product_path(product) diff --git a/app/views/catalog/index.rhtml b/app/views/catalog/index.rhtml index 3ebdba0..da59ec6 100644 --- a/app/views/catalog/index.rhtml +++ b/app/views/catalog/index.rhtml @@ -8,9 +8,12 @@ <% extra_content = @plugins.dispatch(:catalog_item_extras, product).collect { |content| instance_eval(&content) } %> <% extra_content_list = @plugins.dispatch(:catalog_list_item_extras, product).collect { |content| instance_eval(&content) } %> -
  • "> +
  • <%= ' highlighted-product' if product.highlighted? %>">