-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsitemap_search_extension.rb
More file actions
37 lines (34 loc) · 1.5 KB
/
sitemap_search_extension.rb
File metadata and controls
37 lines (34 loc) · 1.5 KB
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
# Uncomment this if you reference any of your controllers in activate
# require_dependency 'application'
class SitemapSearchExtension < Radiant::Extension
version "#{File.read(File.expand_path(File.dirname(__FILE__)) + '/VERSION')}"
description "Adds simple search feature for pages, snippets, layouts, et al."
url "https://github.com/avonderluft/radiant-sitemap_search-extension"
def activate
unless defined?(PageListView)
raise "The Page List View extension is required - install from RAILS_ROOT with 'script/extension install page_list_view'"
end
tab "Content" do
add_item "Search", '/admin/search'
end
Page.send :include, SitemapSearch::Model
Layout.send :include, SitemapSearch::Model
admin.layout.index.bottom.delete 'new_button'
admin.layout.index.add :bottom, 'admin/search/layout_index_bottom'
if defined?(SnippetsExtension)
Snippet.send :include, SitemapSearch::Model
admin.snippet.index.bottom.delete 'new_button'
admin.snippet.index.add :bottom, 'admin/search/snippet_index_bottom'
end
if defined?(TemplatesExtension)
Template.send :include, SitemapSearch::Model
admin.template.index.bottom.delete 'new_button'
admin.template.index.add :bottom, 'admin/search/template_index_bottom'
end
if defined?(BannerRotatorExtension)
Banner.send :include, SitemapSearch::Model
admin.banner.index.bottom.delete 'new_button'
admin.banner.index.add :bottom, 'admin/search/banner_index_bottom'
end
end
end