引用次数统计包括多级引用
This commit is contained in:
parent
ad2a4487c8
commit
8a3669ba3b
|
@ -94,9 +94,15 @@ module FilesHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_qute_number attachment
|
def get_qute_number attachment
|
||||||
if attachment.copy_from.nil?
|
if attachment.copy_from
|
||||||
return 0
|
result = Attachment.find_by_sql("select count(*) as number from attachments where copy_from = #{attachment.copy_from}")
|
||||||
|
else
|
||||||
|
result = Attachment.find_by_sql("select count(*) as number from attachments where copy_from = #{attachment.id}")
|
||||||
|
end
|
||||||
|
if result.nil? || result.count <= 0
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return result[0].number
|
||||||
end
|
end
|
||||||
count = Attachment.find_by_sql("select count(*) from attachments where copy_from = #{attachment.copy_from}")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -41,7 +41,7 @@
|
||||||
<p class="f_l c_grey02 font">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
<p class="f_l c_grey02 font">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||||
<%= link_to( l(:button_delete), attachment_path(file),
|
<%= link_to( l(:button_delete), attachment_path(file),
|
||||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if delete_allowed && file.container_id == @course.id && file.container_type == "Course"%>
|
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if delete_allowed && file.container_id == @course.id && file.container_type == "Course"%>
|
||||||
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> <!--| 引用<%#=get_qute_number file %>--> </p>
|
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= get_qute_number file %> </p>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<div class="tag_h">
|
<div class="tag_h">
|
||||||
|
|
Loading…
Reference in New Issue