-
Notifications
You must be signed in to change notification settings - Fork 28
/
enchanced_option_types_extension.rb
executable file
·47 lines (38 loc) · 1.28 KB
/
enchanced_option_types_extension.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Uncomment this if you reference any of your controllers in activate
# require_dependency 'application'
class EnchancedOptionTypesExtension < Spree::Extension
version "1.0"
description "Describe your extension here"
url "http://yourwebsite.com/enchanced_option_types"
# Please use enchanced_option_types/config/routes.rb instead for extension routes.
# def self.require_gems(config)
# config.gem "gemname-goes-here", :version => '1.2.3'
# end
def activate
base = File.dirname(__FILE__)
Dir.glob(File.join(base, "app/**/*_decorator.rb")){|c| load(c)}
# FileUtils.cp Dir.glob(File.join(base, "public/stylesheets/*.css")), File.join(RAILS_ROOT, "public/stylesheets/")
# FileUtils.cp Dir.glob(File.join(base, "public/javascripts/*.js")), File.join(RAILS_ROOT, "public/javascripts")
# make your helper avaliable in all views
Spree::BaseController.class_eval do
helper VariantSelection
end
Numeric.class_eval do
def sign_symbol
if self > 0
"+"
elsif self < 0
"-"
else
""
end
end
end
Admin::PrototypesController.class_eval do
before_filter :load_sortable
def load_sortable
render_to_string :partial => 'sortable_header'
end
end
end
end