parent
676cf8f180
commit
2e3294a341
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -73,7 +73,6 @@
|
|||
</div><!---re_top end-->
|
||||
<div class="cl"></div>
|
||||
|
||||
|
||||
<div class="re_con" id="course_list">
|
||||
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
|
||||
</div><!---re_con end-->
|
||||
|
|
|
@ -16,8 +16,11 @@
|
|||
<div class="cl"></div>
|
||||
|
||||
<div class="files_tag">
|
||||
<a href="javascript:void(0);" class="files_tag_icon">实验(<span class="c_red">20</span>)</a>
|
||||
<a href="javascript:void(0);" class="files_tag_icon">软件工程(<span class="c_red">20</span>)</a>
|
||||
<% unless @tag_list.nil?%>
|
||||
<% @tag_list.each do |k,v|%>
|
||||
<a href="javascript:void(0);" class="files_tag_icon"><%= k%>(<span class="c_red"><%= v%></span>)</a>
|
||||
<% end%>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue