-
Notifications
You must be signed in to change notification settings - Fork 1
/
service_contracts_extension.rb
33 lines (26 loc) · 1.03 KB
/
service_contracts_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
# Uncomment this if you reference any of your controllers in activate
# require_dependency 'application'
class ServiceContractsExtension < Spree::Extension
version "1.0"
description "Describe your extension here"
url "http://yourwebsite.com/service_contracts"
def activate
Product.class_eval do
has_and_belongs_to_many :service_contracts
end
# Add a link to the shipment centers administration page on the configuration page
Admin::ConfigurationsController.class_eval do
before_filter :add_service_contract_links, :only => :index
def add_service_contract_links
@extension_links << {:link => admin_service_contracts_path, :link_text => t(:service_contracts), :description => t(:manage_service_contracts)}
end
end
Admin::ProductsController.class_eval do
before_filter :add_contracts_tab
private
def add_contracts_tab
@product_admin_tabs << { :name => "Contracts", :url => "admin_product_service_contracts_url" }
end
end
end
end