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/concerto_manykinds/engine.rb', line 9
def plugin_info(plugin_info_class)
@plugin_info ||= plugin_info_class.new do
add_route("manykinds", ConcertoManykinds::Engine)
init do
Rails.logger.info "ConcertoManykinds: Initialization code is running"
end
add_controller_hook "TemplatesController", :show, :before do
@manykinds = Manykind.where(:template_id => @template.id)
@manykind_new = Manykind.new
end
add_view_hook "TemplatesController", :sidebar, :partial => "concerto_manykinds/templates/details"
add_controller_hook "Subscription", :filter_contents, :around do
allowed_kinds = Manykind.kinds_for(self.screen.template.id, self.field.id).collect {|r| r.kind_id }
allowed_kinds << self.field.kind.id
@contents.reject!{|c| !allowed_kinds.include?(c.kind_id)}
end
end
end
|