From fd24fbe082a4c07160dee96015b984aeeadcdb77 Mon Sep 17 00:00:00 2001 From: saurabhbhatia Date: Mon, 16 Dec 2013 16:08:12 +0800 Subject: [PATCH] Commit for Basic Site --- Gemfile | 8 ++++++-- app/controllers/admin/page_parts_controller.rb | 2 +- app/models/user/user.rb | 1 + config/initializers/sunspot_mongoid.rb | 2 ++ config/routes.rb | 3 ++- .../built_in_modules/announcement/app/models/bulletin.rb | 5 ++++- .../built_in_modules/archive/app/models/archive_file.rb | 2 +- .../built_in_modules/web_resource/app/models/web_link.rb | 2 +- 8 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 config/initializers/sunspot_mongoid.rb diff --git a/Gemfile b/Gemfile index 08fec358..f74a5734 100644 --- a/Gemfile +++ b/Gemfile @@ -26,6 +26,7 @@ gem "geocoder" gem 'mini_magick' gem 'mongoid', '> 2.1', '< 3.0.0' +gem 'mongoid_search', '~> 0.2.8' gem 'mongoid-tree', :require => 'mongoid/tree' gem "mongo_session_store-rails3", '3.0.6' gem 'nokogiri' @@ -42,8 +43,11 @@ gem 'resque-restriction' # gem 'ruby-debug19' gem 'rubyzip', '< 1.0.0' -gem 'sunspot_mongo' -gem 'sunspot_solr' +gem 'sunspot_mongoid2' +# gem 'sunspot_mongo' +gem 'sunspot_solr', github: 'sunspot/sunspot', branch: 'master' +gem 'sunspot_rails', github: 'sunspot/sunspot', branch: 'master' + gem 'progress_bar' gem 'sinatra' diff --git a/app/controllers/admin/page_parts_controller.rb b/app/controllers/admin/page_parts_controller.rb index 1950eb65..442f5e7d 100644 --- a/app/controllers/admin/page_parts_controller.rb +++ b/app/controllers/admin/page_parts_controller.rb @@ -104,7 +104,7 @@ class Admin::PagePartsController < OrbitBackendController def update @part = PagePart.find(params[:id]) # Sometimes category is passed into params[:page], so this line makes sure it will also be in params[:page_part] too - # params[:page_part][:category] ||= params[:page][:category] if + # params[:page_part][:category] ||= params[:page][:category] if @part.update_attributes(params[:page_part]) set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu') flash.now[:notice] = t('update.success.content') diff --git a/app/models/user/user.rb b/app/models/user/user.rb index 222bbb68..814d2d3f 100644 --- a/app/models/user/user.rb +++ b/app/models/user/user.rb @@ -22,6 +22,7 @@ class User field :cache_dept,type: Hash field :status_record,type: Hash field :approved, type: Boolean, :default => false + field :reset_password_sent_at, :type => Time has_and_belongs_to_many :approving_apps, class_name: 'AuthApproval', inverse_of: 'authorized_users' has_and_belongs_to_many :managing_apps, class_name: 'AuthManager', inverse_of: 'authorized_users' diff --git a/config/initializers/sunspot_mongoid.rb b/config/initializers/sunspot_mongoid.rb new file mode 100644 index 00000000..ced0e07b --- /dev/null +++ b/config/initializers/sunspot_mongoid.rb @@ -0,0 +1,2 @@ +Sunspot.session = Sunspot::Rails.build_session +ActionController::Base.module_eval { include(Sunspot::Rails::RequestLifecycle) } \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index dedbc744..f8174291 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,7 +3,8 @@ Orbit::Application.routes.draw do # get "robots.txt" => 'robots#index' - devise_for :users, :controllers => { :registrations => "registrations", :confirmations => 'confirmations' } do + devise_for :users, :controllers => { :registrations => "registrations", :confirmations => 'confirmations', :passwords => 'passwords' } do + resources :passwords match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put end diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index 3ba8010e..adfc0016 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -3,7 +3,9 @@ class Bulletin include Mongoid::Document include Mongoid::Timestamps include Mongoid::MultiParameterAttributes - include Sunspot::Mongo + # include Mongoid::FullTextSearch + include Mongoid::Search + include Sunspot::Mongoid2 include Impressionist::Impressionable include OrbitCategory::Categorizable @@ -37,6 +39,7 @@ class Bulletin validates :title, :at_least_one => true + search_in :title, :subtitle, :text #before_save :clean_values, :save_bulletin_links, :save_bulletin_files searchable do diff --git a/vendor/built_in_modules/archive/app/models/archive_file.rb b/vendor/built_in_modules/archive/app/models/archive_file.rb index 387cec70..26cf91e0 100644 --- a/vendor/built_in_modules/archive/app/models/archive_file.rb +++ b/vendor/built_in_modules/archive/app/models/archive_file.rb @@ -4,7 +4,7 @@ class ArchiveFile include Mongoid::Timestamps include Mongoid::MultiParameterAttributes include Mongoid::Sortable - include Sunspot::Mongo + include Sunspot::Mongoid2 include OrbitCategory::Categorizable include OrbitModel::LanguageRestrict diff --git a/vendor/built_in_modules/web_resource/app/models/web_link.rb b/vendor/built_in_modules/web_resource/app/models/web_link.rb index c0b95ea8..c2b1bba5 100644 --- a/vendor/built_in_modules/web_resource/app/models/web_link.rb +++ b/vendor/built_in_modules/web_resource/app/models/web_link.rb @@ -3,7 +3,7 @@ class WebLink include Mongoid::Document include Mongoid::Timestamps include Mongoid::MultiParameterAttributes - include Sunspot::Mongo + include Sunspot::Mongoid2 include OrbitCategory::Categorizable include OrbitModel::LanguageRestrict