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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
# File 'lib/hancock/catalog/admin/item.rb', line 4
def self.config(nav_label = nil, fields = {})
if nav_label.is_a?(Hash)
nav_label, fields = nav_label[:nav_label], nav_label
elsif nav_label.is_a?(Array)
nav_label, fields = nil, nav_label
end
Proc.new {
navigation_label(!nav_label.blank? ? nav_label : I18n.t("hancock.catalog"))
list do
scopes [:sorted, :enabled, nil]
field :enabled, :toggle do
searchable false
end
field :name do
searchable true
end
field :categories do
end
if Hancock::Catalog.config.pages_support and Hancock::Catalog.configuration.can_connect_items_with_pages
field :connected_pages, :hancock_connectable
end
group :content, &Hancock::Admin.content_block
if Hancock::Catalog.config.cache_support
group :caching, &Hancock::Cache::Admin.caching_block
end
end
edit do
field :enabled, :toggle
field :name
if Hancock::Catalog.config.pages_support and Hancock::Catalog.configuration.can_connect_items_with_pages
group :connected_pages do
active false
field :connected_pages, :hancock_connectable do
read_only do
!bindings[:view].current_user.admin?
end
end
end
end
group :categories, &Hancock::Admin.categories_block
field :price, :string
group :URL, &Hancock::Admin.url_block
if Hancock::Catalog.config.gallery_support
group :image, &Hancock::Gallery::Admin.images_block(:item_images)
end
group :content, &Hancock::Admin.content_block
Hancock::RailsAdminGroupPatch::hancock_cms_group(self, fields)
if Hancock::Catalog.config.seo_support
group :seo_n_sitemap, &Hancock::Seo::Admin.seo_n_sitemap_block
end
if Hancock::Catalog.config.cache_support
group :caching, &Hancock::Cache::Admin.caching_block
end
if Hancock::Catalog.config.insertions_support
group :insertions, &Hancock::Admin.insertions_block
end
end
nested_set({max_depth: 1, scopes: []})
sort_embedded(
{
fields: [:item_images]
}
)
if defined?(RailsAdminMultipleFileUpload)
multiple_file_upload(
{
fields: [:item_images]
}
)
end
if block_given?
yield self
end
}
end
|