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 a0d1cc89..03ada60f 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 00000000..b5aded49 --- /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 %> + + +
+ + + + + + + + + + + + <% @archive_files.each_with_index do |post,i| %> + class="even" <% end %>> + + + + + <% end %> + + +
<%= 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_multiples.asc(:_id).each do | afile | %> + <% if afile.file.file and afile.choose_lang_display(I18n.locale.to_s) %> +
  1. + <%= link_to afile.file_title, afile.file.url, {:target => '_blank', :title => afile.file_title, :class => "o-archives-file"} %> + <%= post.get_file_icon(afile.file.url) %> +
  2. + <% end %> + <% end %> +
+ <% end %> +
+
+ <%= post.archive_file_category.title %> +
+
+ +<%= paginate @archive_files, :param_name => :page_main, :params => {:inner => 'false'} %> + +<%= stylesheet_link_tag "archive/archives" %> + + + + + + + + + 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 index 3028774d..14377a7c 100644 --- 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 @@ -1,49 +1,10 @@ -<% # encoding: utf-8 %> +<%= stylesheet_link_tag "default_widget" %> + + -<%= render :partial => 'shared/search_header',:locals=>{:items=>@archive_files} %> - -
- - - - - - - - - - - - <% @archive_files.each_with_index do |post,i| %> - class="even" <% end %>> - - - - - <% end %> - - -
<%= t("archive.Title")%><%= t("archive.Files")%><%= t("archive.Category")%>
<%= post.title %>
-
- <% if !post.archive_file_multiples.blank? %> -
    - <% post.archive_file_multiples.asc(:_id).each do | afile | %> - <% if afile.file.file and afile.choose_lang_display(I18n.locale.to_s) %> -
  1. - <%= link_to afile.file_title, afile.file.url, {:target => '_blank', :title => afile.file_title, :class => "o-archives-file"} %> - <%= post.get_file_icon(afile.file.url) %> -
  2. - <% end %> - <% end %> -
- <% end %> -
-
- <%= post.archive_file_category.title %> -
-
- -<%= paginate @archive_files, :param_name => :page_main, :params => {:inner => 'false'} %> +
+ <%= render 'index' %> +
<%= stylesheet_link_tag "archive/archives" %> diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/front_end/archive_files/index.js.erb b/vendor/built_in_modules/archive/app/views/panel/archive/front_end/archive_files/index.js.erb new file mode 100644 index 00000000..a0afb16f --- /dev/null +++ b/vendor/built_in_modules/archive/app/views/panel/archive/front_end/archive_files/index.js.erb @@ -0,0 +1 @@ +$('#archive_file_widget').html("<%= j render 'index' %>")