Permalink
Browse files

adding some options to a helper

  • Loading branch information...
beaucollins committed Sep 17, 2009
1 parent 36a26f4 commit 7a2e6fc0784afd630579bb197af348d321964250
Showing with 7 additions and 6 deletions.
  1. +7 −6 lib/power_reviews/view_helpers.rb
@@ -5,13 +5,14 @@ def power_reviews_javascript_tag
javascript_include_tag('/system/pwr/engine/js/full')
end
- def power_reviews_javascript_variables
+ def power_reviews_javascript_variables(options = {})
+ options = {
+ :locale => 'en_US',
+ :zip_location => '/system/',
+ :pr_style_sheet => ''
+ }.merge(options)
javascript_tag do
- <<-eos
- var pr_locale= "en_US";
- var pr_zip_location= "/system/";
- //var pr_style_sheet= "http://www.yoursite.com/css/pr_override.css";
- eos
+ options.collect { |key, val| "var pr_#{key} = '#{val}';" unless val.blank? }.compact!.join("\n")
end
end

0 comments on commit 7a2e6fc

Please sign in to comment.