Soler basic search
This commit is contained in:
parent
6ed89ea9af
commit
481f04c07b
|
@ -19,7 +19,11 @@ class Panel::Dictionary::FrontEnd::DictionaryVocabsController < OrbitWidgetContr
|
|||
# end
|
||||
|
||||
def index
|
||||
@vocabs = DictionaryVocab.all
|
||||
if params[:search_query].empty?
|
||||
@vocabs = DictionaryVocab.all
|
||||
else
|
||||
@vocabs = DictionaryVocab.search(params[:search_query])
|
||||
end
|
||||
# @item = Page.find(params[:page_id])
|
||||
# @title = @item.title
|
||||
# if !@item.frontend_data_count.blank?
|
||||
|
|
|
@ -27,6 +27,17 @@ class DictionaryVocab
|
|||
|
||||
belongs_to :dictionary_vocab_category
|
||||
|
||||
def self.search(search)
|
||||
if search
|
||||
@search = DictionaryVocab.solr_search do
|
||||
fulltext(search)
|
||||
with(:frontend_search, true)
|
||||
end
|
||||
else
|
||||
scoped
|
||||
end
|
||||
end
|
||||
|
||||
# has_many :archive_file_multiples, :autosave => true, :dependent => :destroy
|
||||
|
||||
# accepts_nested_attributes_for :archive_file_multiples, :allow_destroy => true
|
||||
|
|
|
@ -12,11 +12,11 @@ Rails.application.routes.draw do
|
|||
end
|
||||
|
||||
namespace :front_end do
|
||||
get "dictionary_vocabs", to: "dictionary_vocabs#index"
|
||||
resources :dictionary_vocabs
|
||||
end
|
||||
|
||||
namespace :widget do
|
||||
# match "index" => "archive_files#index"
|
||||
get "dictionary_search_block", to: "dictionary_vocabs#dictionary_search_block"
|
||||
get "dictionary_vocabs", to: "dictionary_vocabs#index"
|
||||
resources :dictionary_vocabs
|
||||
|
|
|
@ -29,7 +29,7 @@ module Dictionary
|
|||
# link_field :archive_file_category_with_title,{:method => 'panel_archive_front_end_archive_files_path',:args=>{:category_id => [:archive_file_category,:id]}}
|
||||
# end
|
||||
|
||||
# categories_query 'ArchiveFileCategory.all'
|
||||
categories_query 'DictionaryVocabCategory.all'
|
||||
# tags_query 'ArchiveTag.all'
|
||||
|
||||
# customize_widget "index" do
|
||||
|
|
Loading…
Reference in New Issue