removed pulgin sort

This commit is contained in:
Harry Bomrah 2016-03-14 15:47:38 +08:00
parent fb8ea6ebc7
commit 11ef39743a
2 changed files with 19 additions and 22 deletions

View File

@ -1,11 +1,10 @@
class Admin::ArchiveFilesController < OrbitAdminController
def index
@table_fields = [:status, :category, :title, :update_at,:last_modified,"archive.downloaded_times"]
@table_fields = [:status, :category, :title, :updated_at,:last_modified,"archive.downloaded_times"]
@categories = @module_app.categories
@tags = @module_app.tags
@filter_fields = filter_fields(@categories, @tags)
@archives = ArchiveFile.order_by(sort)
.with_categories(filters("category"))
.with_tags(filters("tag"))
@ -83,23 +82,17 @@ class Admin::ArchiveFilesController < OrbitAdminController
def setup_vars
@module_app = ModuleApp.where(:key => "archive").first
end
def sort
unless params[:sort].blank?
case params[:sort]
when "status"
@sort = [[:is_top, params[:order]],
[:is_hot, params[:order]],
[:is_hidden,params[:order]]]
when "category"
@sort = {:category_id=>params[:order]}
when "title"
@sort = {:title=>params[:order]}
when "last_modified"
@sort = {:update_user_id=>params[:order]}
end
else
@sort = {:created_at=>'desc'}
end
@sort
end
# def sort
# unless params[:sort].blank?
# case params[:sort]
# when "downloaded_times"
# else
# @sort = sort
# end
# else
# @sort = sort
# end
# @sort
# end
end

View File

@ -6,7 +6,11 @@
<thead>
<tr class="sort-header">
<% @table_fields.each do |f| %>
<%= thead(f) %>
<% if f == "archive.downloaded_times" %>
<%= thead(f,true,false) %>
<% else %>
<%= thead(f) %>
<% end %>
<% end %>
</tr>
</thead>