Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Decorate base helper instead.

The current helper was not applied so better to decorate
Spree::BaseHelper with social methods. Also the absolute_image_url was
used in view but private so we made it public.
  • Loading branch information...
commit dc87b4c70c3889b960b326e871a44cf9068b6047 1 parent fb56b85
@futhr futhr authored
View
12 app/helpers/spree/social_helper.rb → app/helpers/spree/base_helper_decorator.rb
@@ -1,5 +1,5 @@
module Spree
- module SocialHelper
+ BaseHelper.module_eval do
def pin_it_button(product)
return if product.images.empty?
@@ -17,15 +17,15 @@ def absolute_product_image(image)
escape absolute_image_url(image.attachment.url)
end
+ def absolute_image_url(url)
+ return url if url.starts_with? 'http'
+ request.protocol + request.host + url
+ end
+
private
def escape(string)
URI.escape string, /[^#{URI::PATTERN::UNRESERVED}]/
end
-
- def absolute_image_url(url)
- return url if url.starts_with? 'http'
- request.protocol + request.host + url
- end
end
end
View
2  spec/helpers/spree/social_helper_spec.rb → spec/helpers/spree/base_helper_decorator_spec.rb
@@ -1,4 +1,4 @@
-RSpec.describe Spree::SocialHelper, type: :helper do
+RSpec.describe Spree::BaseHelper, type: :helper do
skip 'pin_it_button(product)'
skip 'absolute_product_image(image)'
end
Please sign in to comment.
Something went wrong with that request. Please try again.