sortable category

This commit is contained in:
thomaschen 2013-08-28 11:43:57 +08:00 committed by chris
parent 276d085a2c
commit 6dbfb239c3
2 changed files with 10 additions and 13 deletions

View File

@ -6,18 +6,6 @@ class Panel::Dictionary::FrontEnd::DictionaryVocabsController < OrbitWidgetContr
@app_title = 'dictionary_vocabs'
end
# def get_search_result
# @search = ArchiveFileCategory.solr_search do
# fulltext params[:search_query]
# with(:frontend_search,true)
# end
# search_result = @search.results.collect{|result| result.id}
# params[:category_id] = @search.results.collect{|result| result.id}
# @archive_file_categorys = ArchiveFileCategory.any_in(_id:search_result).page( params[:page_main]).per(@page_num)
# end
def index
@item = Page.find(params[:page_id])
@title = @item.title
@ -34,6 +22,15 @@ class Panel::Dictionary::FrontEnd::DictionaryVocabsController < OrbitWidgetContr
fulltext params[:search_query]
end.results
end
if !params[:category_id].blank?
@vocabs = DictionaryVocab.default_sort(params[:sort]).can_display.where(:dictionary_vocab_category_id.in => params[:category_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num)
@current_category = DictionaryVocabCategory.from_id(params[:category_id]) rescue nil
end
if params[:sort]
@vocabs = get_sorted_and_filtered('dictionary_vocab', nil, @vocabs)
end
# @item = Page.find(params[:page_id])
# @title = @item.title
# if !@item.frontend_data_count.blank?

View File

@ -4,7 +4,7 @@
<thead>
<tr>
<th class="span2"><%= t :category, :scope => :dictionary %></th>
<th class="span2"><%= sortable(:category, t("dictionary.category"))%></th>
<th class="span2"><%= t :word, :scope => :dictionary %></th>
<th class="span2"><%= t :definition, :scope => :dictionary %></th>
</tr>