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

View File

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