diff --git a/vendor/built_in_modules/archive/app/controllers/panel/archive/front_end/archive_files_controller.rb b/vendor/built_in_modules/archive/app/controllers/panel/archive/front_end/archive_files_controller.rb index a0d1cc899..03ada60ff 100644 --- a/vendor/built_in_modules/archive/app/controllers/panel/archive/front_end/archive_files_controller.rb +++ b/vendor/built_in_modules/archive/app/controllers/panel/archive/front_end/archive_files_controller.rb @@ -1,4 +1,5 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController + include AdminHelper def initialize super @@ -30,27 +31,26 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController @archive_file_categorys = ArchiveFileCategory.all # @archive_files = ArchiveFile.where( :is_hidden => false ).desc(:is_top).page(params[:page]).per(@page_num) - if params[:search_query] - get_search_result - @archive_files = ArchiveFile.can_display.where(:archive_file_category_id.in => @archive_file_categorys.collect{|t| t.id}).desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num) + if !params[:category_id].blank? && !params[:tag_id].blank? + @archive_files = @archive_files.default_sort(params[:sort]).can_display.where(:archive_file_category_id.in => params[:category_id], :tagged_ids.in => params[:tag_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num) + + @current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil + + elsif !params[:category_id].blank? + @archive_files = ArchiveFile.default_sort(params[:sort]).can_display.where(:archive_file_category_id.in => params[:category_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num) + @current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil + elsif !params[:tag_id].blank? + @archive_files = ArchiveFile.default_sort(params[:sort]).can_display.where(:tagged_ids.in => params[:tag_id]).desc( :is_top ).page( params[:page_main] ).per(@page_num) else - if !params[:category_id].blank? && !params[:tag_id].blank? - @archive_files = @archive_files.can_display.where(:archive_file_category_id.in => params[:category_id], :tagged_ids.in => params[:tag_id]).desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num) - - @current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil - - elsif !params[:category_id].blank? - @archive_files = ArchiveFile.can_display.where(:archive_file_category_id.in => params[:category_id]).desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num) - @current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil - elsif !params[:tag_id].blank? - @archive_files = ArchiveFile.can_display.where(:tagged_ids.in => params[:tag_id]).desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num) - else - @archive_files = ArchiveFile.can_display.desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num) - end + @archive_files = ArchiveFile.default_sort(params[:sort]).can_display.desc( :is_top ).page( params[:page_main] ).per(@page_num) end get_categorys + + if params[:sort] + @archive_files = get_sorted_and_filtered('archive_file', nil, @archive_files) + end end def show diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/front_end/archive_files/_index.html.erb b/vendor/built_in_modules/archive/app/views/panel/archive/front_end/archive_files/_index.html.erb new file mode 100644 index 000000000..b5aded496 --- /dev/null +++ b/vendor/built_in_modules/archive/app/views/panel/archive/front_end/archive_files/_index.html.erb @@ -0,0 +1,56 @@ +<% # encoding: utf-8 %> + + +
<%= sortable(:title, t("archive.Title"))%> | +<%= t("archive.Files")%> | +<%= sortable(:archive_file_category, t("archive.Category"))%> | +
---|---|---|
<%= post.title %> |
+
+
+ <% if !post.archive_file_multiples.blank? %>
+
+
|
+
+ <%= post.archive_file_category.title %>
+ |
+
<%= t("archive.Title")%> | -<%= t("archive.Files")%> | -<%= t("archive.Category")%> | -
---|---|---|
<%= post.title %> |
-
-
- <% if !post.archive_file_multiples.blank? %>
-
-
|
-
- <%= post.archive_file_category.title %>
- |
-