diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index c9380516c..7c399e996 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -60,6 +60,9 @@ class FilesController < ApplicationController sort = "#{@sort} #{@order}" end + show_attachments [@course] + @tag_list = attachment_tag_list @all_attachments + begin q = "%#{params[:name].strip}%" #(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank? @@ -273,6 +276,8 @@ class FilesController < ApplicationController show_attachments @containers + @tag_list = attachment_tag_list @all_attachments + render :layout => 'base_courses' end diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index 3c8ed63d4..111b9214f 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -120,6 +120,14 @@ module FilesHelper result end + def attachment_tag_list attachments + tag_list = Hash.new + attachments.each do |attachment| + attachment.tag_list.map{|tag| tag_list.has_key?(tag) ? tag_list[tag] = tag_list[tag] + 1 : tag_list[tag] = 1} + end + tag_list.sort {|a,b| b[1]<=>a[1]} + end + def visable_attachemnts_insite attachments,obj result = [] if obj.is_a?(Course) diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index 2bc780a27..62fd14248 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -73,7 +73,6 @@
-