Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

A generator and /search page, since the controller requires it

  • Loading branch information...
commit 4f3a2ff31cd654100018d80cec6c190b93db8ccd 1 parent de5ed01
@joemsak joemsak authored ugisozols committed
View
18 db/migrate/01_create_search_page.rb
@@ -0,0 +1,18 @@
+class CreateSearchPage < ActiveRecord::Migration
+
+ def self.up
+ load(Rails.root.join('db', 'seeds', 'refinerycms_search.rb'))
+ end
+
+ def self.down
+ if defined?(UserPlugin)
+ UserPlugin.destroy_all({:name => "refinerycms_search"})
+ end
+
+ if defined?(Page)
+ Page.delete_all({:link_url => "/search"})
+ end
+
+ end
+
+end
View
24 db/seeds/refinerycms_search.rb
@@ -0,0 +1,24 @@
+if defined?(::User)
+ User.all.each do |user|
+ if user.plugins.where(:name => 'refinerycms_search').blank?
+ user.plugins.create(:name => 'refinerycms_search',
+ :position => (user.plugins.maximum(:position) || -1) +1)
+ end
+ end
+end
+
+if defined?(::Page)
+ unless Page.where(:menu_match => "^/search.*$").any?
+ page = Page.create(
+ :title => "Search Results",
+ :link_url => "/search",
+ :deletable => false,
+ :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
+ :menu_match => "^/search.*$"
+ )
+
+ Page.default_parts.each do |default_page_part|
+ page.parts.create(:title => default_page_part, :body => nil)
+ end
+ end
+end
View
8 lib/generators/refinerycms_search_generator.rb
@@ -0,0 +1,8 @@
+require 'refinery/generators'
+
+class RefinerycmsSearchGenerator < ::Refinery::Generators::EngineInstaller
+
+ source_root File.expand_path('../../../', __FILE__)
+ engine_name "search"
+
+end
Please sign in to comment.
Something went wrong with that request. Please try again.