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
|
# File 'lib/shop_variants/controllers/products_controller.rb', line 5
def self.included(base)
base.class_eval do
before_filter :config_global_variants
before_filter :config_index_variants, :only => [ :index ]
before_filter :config_edit_variants, :only => [ :edit, :update ]
before_filter :assets_edit_variants, :only => [ :edit, :update ]
def config_global_variants
@parts << 'variants'
end
def config_index_variants
@buttons << 'variants'
end
def config_edit_variants
@buttons << 'browse_templates'
@buttons << 'new_variant'
@popups << 'browse_templates'
@popups << 'new_variant'
end
def assets_edit_variants
include_stylesheet 'admin/extensions/shop/variants/edit'
include_javascript 'admin/extensions/shop/variants/edit'
@routes << {
:name => 'admin_shop_product_variant_path',
:path => admin_shop_product_variant_path(@shop_product, ':id')
}
@routes << {
:name => 'sort_admin_shop_product_variants_path',
:path => sort_admin_shop_product_variants_path(@shop_product)
}
end
end
end
|