diff --git a/vendor/built_in_modules/dictionary/app/controllers/panel/dictionary/front_end/dictionary_vocabs_controller.rb b/vendor/built_in_modules/dictionary/app/controllers/panel/dictionary/front_end/dictionary_vocabs_controller.rb index 3daf22c42..030316b87 100644 --- a/vendor/built_in_modules/dictionary/app/controllers/panel/dictionary/front_end/dictionary_vocabs_controller.rb +++ b/vendor/built_in_modules/dictionary/app/controllers/panel/dictionary/front_end/dictionary_vocabs_controller.rb @@ -19,8 +19,16 @@ class Panel::Dictionary::FrontEnd::DictionaryVocabsController < OrbitWidgetContr # end def index + @item = Page.find(params[:page_id]) + @title = @item.title + if !@item.frontend_data_count.blank? + @page_num = @item.frontend_data_count + else + @page_num = 10 + end + if params[:search_query].empty? - @vocabs = DictionaryVocab.all + @vocabs = DictionaryVocab.page(params[:page_main]).per(@page_num) else @vocabs = DictionaryVocab.solr_search do fulltext params[:search_query] diff --git a/vendor/built_in_modules/dictionary/app/models/dictionary_vocab.rb b/vendor/built_in_modules/dictionary/app/models/dictionary_vocab.rb index 272c066e0..cf3e0427f 100644 --- a/vendor/built_in_modules/dictionary/app/models/dictionary_vocab.rb +++ b/vendor/built_in_modules/dictionary/app/models/dictionary_vocab.rb @@ -5,6 +5,7 @@ class DictionaryVocab include Mongoid::MultiParameterAttributes include Mongoid::Sortable include Sunspot::Mongo + BelongsToCategory = :dictionary_vocab_category include OrbitCoreLib::BelongsToCategoryMayDisable @@ -21,44 +22,29 @@ class DictionaryVocab # field :is_top, :type => Boolean, :default => false # field :is_hot, :type => Boolean, :default => false - # field :is_hidden, :type => Boolean, :default => false + field :is_hidden, :type => Boolean, :default => false scope :can_display, where(is_hidden: false) - + searchable do text :word end belongs_to :dictionary_vocab_category + # has_many :archive_file_multiples, :autosave => true, :dependent => :destroy # accepts_nested_attributes_for :archive_file_multiples, :allow_destroy => true # after_save :save_archive_file_multiples - # searchable do - # text :titles do - # title_translations.to_a.collect{|t| t[1]} - # end - # boolean :frontend_search do - # !is_hidden - # end + searchable do + text :word, :definition - # end - - # def self.search( category_id = nil ) - - # if category_id.to_s.size > 0 - - # find(:all, :conditions => {archive_file_category_id: category_id}).desc( :is_top, :title ) - - # else - - # find(:all).desc( :is_top, :title) - - # end - - # end + boolean :frontend_search do + !is_hidden + end + end # def self.widget_datas diff --git a/vendor/built_in_modules/dictionary/app/views/panel/dictionary/front_end/dictionary_vocabs/index.html.erb b/vendor/built_in_modules/dictionary/app/views/panel/dictionary/front_end/dictionary_vocabs/index.html.erb index 6922cb857..f9cbd9a1c 100644 --- a/vendor/built_in_modules/dictionary/app/views/panel/dictionary/front_end/dictionary_vocabs/index.html.erb +++ b/vendor/built_in_modules/dictionary/app/views/panel/dictionary/front_end/dictionary_vocabs/index.html.erb @@ -27,4 +27,6 @@ - \ No newline at end of file + + +<%= paginate( @vocabs, :param_name => :page_main, :params => {:inner => 'false'} ) rescue nil %> \ No newline at end of file diff --git a/vendor/built_in_modules/dictionary/config/routes.rb b/vendor/built_in_modules/dictionary/config/routes.rb index b2a65b84c..a4dd09900 100644 --- a/vendor/built_in_modules/dictionary/config/routes.rb +++ b/vendor/built_in_modules/dictionary/config/routes.rb @@ -12,19 +12,15 @@ Rails.application.routes.draw do end namespace :front_end do - get "dictionary_vocabs", to: "dictionary_vocabs#index" + match "dictionary_vocabs", to: "dictionary_vocabs#index" resources :dictionary_vocabs end namespace :widget do - get "dictionary_search_block", to: "dictionary_vocabs#dictionary_search_block" - get "dictionary_vocabs", to: "dictionary_vocabs#index" + match "dictionary_search_block", to: "dictionary_vocabs#dictionary_search_block" + match "dictionary_vocabs", to: "dictionary_vocabs#index" resources :dictionary_vocabs end - # namespace :widget do - # match "index" => "archive_files#index" - # match "archive_search_block" => "archive_files#archive_search_block" - # end end end match "/appfront/*path" => redirect("/panel/*path")