Order the vocabs

This commit is contained in:
Bernie Chiu 2013-08-25 18:11:19 +08:00 committed by chris
parent 28a8880862
commit ab29dd4335
2 changed files with 10 additions and 9 deletions

View File

@ -28,7 +28,7 @@ class Panel::Dictionary::FrontEnd::DictionaryVocabsController < OrbitWidgetContr
end
if params[:search_query].empty?
@vocabs = DictionaryVocab.page(params[:page_main]).per(@page_num)
@vocabs = DictionaryVocab.desc(:created_at).page(params[:page_main]).per(@page_num)
else
@vocabs = DictionaryVocab.solr_search do
fulltext params[:search_query]

View File

@ -15,16 +15,17 @@
<tr>
<td><%= vocab.dictionary_vocab_category.title %></td>
<td><%= link_to truncate(vocab.word,length: 25), panel_dictionary_front_end_dictionary_vocab_path(vocab) %></td>
<td><% if vocab.created_at > Time.now.beginning_of_day %>
<td>
<% if vocab.created_at > Time.now.beginning_of_day %>
<%="#{time_ago_in_words(vocab.created_at)}"%>
<%=t :ago,:scope => :dictionary%>
<% else %>
<%= vocab.created_at.strftime("%Y/%m/%d") %>
<% end %></td>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>