From 070dfc0914c8b397fb27d9de0b0b854856a12bc8 Mon Sep 17 00:00:00 2001 From: Leandro Nunes dos Santos Date: Tue, 20 Jul 2010 00:28:14 -0300 Subject: [PATCH] The FeaturedProductsBlock doesn't works with noosfero 0.25.0 version. --- app/helpers/application_helper.rb | 4 ++++ app/helpers/display_helper.rb | 6 +++++- app/helpers/manage_products_helper.rb | 4 ---- app/views/blocks/featured_products.rhtml | 4 ++-- features/featured_products_block.feature | 35 +++++++++++++++++++++++++++++++++++ features/step_definitions/noosfero_steps.rb | 3 ++- 6 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 features/featured_products_block.feature diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2577a97..6c40a73 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -973,4 +973,8 @@ module ApplicationHelper link_to_remote(label, options, html_options.merge(:class => 'ui_button fg-button')) end + def float_to_currency(value) + number_to_currency(value, :unit => environment.currency_unit, :separator => environment.currency_separator, :delimiter => environment.currency_delimiter, :format => "%u %n") + end + end diff --git a/app/helpers/display_helper.rb b/app/helpers/display_helper.rb index 989121c..94d6c6e 100644 --- a/app/helpers/display_helper.rb +++ b/app/helpers/display_helper.rb @@ -2,12 +2,16 @@ module DisplayHelper def link_to_product(product, opts={}) return _('No product') unless product - target = product.enterprise.enabled? ? product.enterprise.public_profile_url.merge(:controller => 'manage_products', :action => 'show', :id => product) : product.enterprise.url + target = product_path(product) link_to content_tag( 'span', product.name ), target, opts end + def product_path(product) + product.enterprise.enabled? ? product.enterprise.public_profile_url.merge(:controller => 'manage_products', :action => 'show', :id => product) : product.enterprise.url + end + def link_to_category(category, full = true) return _('Uncategorized product') unless category name = full ? category.full_name(' → ') : category.name diff --git a/app/helpers/manage_products_helper.rb b/app/helpers/manage_products_helper.rb index 6ff212e..14c48fa 100644 --- a/app/helpers/manage_products_helper.rb +++ b/app/helpers/manage_products_helper.rb @@ -152,10 +152,6 @@ module ManageProductsHelper link_to(_('Change category'), { :action => 'edit_category', :id => product.id}, options) end - def float_to_currency(value) - number_to_currency(value, :unit => environment.currency_unit, :separator => environment.currency_separator, :delimiter => environment.currency_delimiter, :format => "%u %n") - end - def display_value(product) price = product.price unless price.blank? || price.zero? diff --git a/app/views/blocks/featured_products.rhtml b/app/views/blocks/featured_products.rhtml index 67cffec..1b68288 100644 --- a/app/views/blocks/featured_products.rhtml +++ b/app/views/blocks/featured_products.rhtml @@ -9,13 +9,13 @@