2016-03-05 03:14:57 +08:00
|
|
|
<% delete_allowed = User.current.allowed_to?(:manage_files, @course) %>
|
|
|
|
<div class="resources mt10"><!--资源库内容开始--->
|
|
|
|
<div class="homepagePostBrief">
|
|
|
|
<div class="homepagePostPortrait">
|
|
|
|
<%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
|
|
|
|
</div>
|
|
|
|
<div class="homepagePostDes">
|
2016-05-10 14:06:34 +08:00
|
|
|
<div class="homepagePostTitle break_word">
|
2016-03-17 12:37:05 +08:00
|
|
|
<%# 如果有历史版本则提供历史版本下载 %>
|
|
|
|
<% if file.attachment_histories.count == 0 %>
|
|
|
|
<%= link_to truncate(file.filename,length: 35, omission: '...'),
|
|
|
|
download_named_attachment_path(file.id, file.filename),
|
|
|
|
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
|
|
|
|
<% else %>
|
|
|
|
<%= link_to truncate(file.filename,length: 35, omission: '...'), attachment_history_download_path(file.id),
|
|
|
|
:title => file.filename+"\n"+file.description.to_s,
|
|
|
|
:class => "linkGrey3 f_14",
|
|
|
|
:style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;", :remote=>true %>
|
|
|
|
<% end %>
|
2016-03-05 03:14:57 +08:00
|
|
|
<%= file_preview_eye(file, class: 'preview') %>
|
|
|
|
<span id="image_private_<%= file.id%>">
|
|
|
|
<% if file.is_public? == false%>
|
|
|
|
<span class="img_private ml5">私有</span>
|
|
|
|
<%end %>
|
|
|
|
</span>
|
|
|
|
<% if file.is_publish == 0 %>
|
|
|
|
<span class="grey_homework_btn_cir ml5"><%=file.publish_time %> 0点发布</span>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<div class="mt5">
|
|
|
|
<span class="fontGrey2 mr15 fl">上传时间:<%= format_time(file.created_on)%></span>
|
|
|
|
<% if file.tag_list.length > 0%>
|
|
|
|
<span class="fontGrey2 fl mr15">上传类型:<%= file.tag_list[0] %></span>
|
|
|
|
<% end %>
|
|
|
|
<p class="f_l mb5 fontGrey2">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
|
|
|
<p class="fl ml15 fontGrey2">下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
|
|
|
</div>
|
2016-06-16 14:04:12 +08:00
|
|
|
<%# unless file.description.blank? %>
|
2016-03-05 03:14:57 +08:00
|
|
|
<div class="cl"></div>
|
2016-06-16 16:55:25 +08:00
|
|
|
<% if User.current.admin? || ( User.current.logged? && ((is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file)) && ((delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course")) %>
|
2016-06-16 14:04:12 +08:00
|
|
|
<div>
|
|
|
|
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4">
|
|
|
|
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
|
|
|
|
</div>
|
|
|
|
<textarea class="homepageSignatureTextarea none" placeholder="请编辑资源描述" id="file_description_edit_<%= file.id %>"
|
|
|
|
onblur="edit_file_description('<%= update_file_description_course_file_path(@course,file)%>','<%= file.id %>');"><%= file.description %></textarea>
|
|
|
|
</div>
|
|
|
|
<% else %>
|
|
|
|
<div class="fontGrey2 mb4">
|
|
|
|
<% unless file.description.blank? %>
|
|
|
|
<div class="cl"></div>
|
|
|
|
<div class="fontGrey2 mb4">资源描述:<%= file.description %></div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<%# end %>
|
2016-03-05 03:14:57 +08:00
|
|
|
<div class="cl"></div>
|
|
|
|
<div class="tag_h">
|
|
|
|
<!-- container_type = 1 代表是课程里的资源 -->
|
|
|
|
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
|
|
|
|
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
|
|
|
|
</div>
|
|
|
|
<div class="homepagePostSetting">
|
|
|
|
<ul>
|
|
|
|
<li class="homepagePostSettingIcon">
|
2016-06-16 16:55:25 +08:00
|
|
|
<% if User.current.logged? || User.current.admin? %>
|
|
|
|
<% if User.current.admin? || ((is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file)) %>
|
|
|
|
<% if User.current.admin? || ((delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course") %>
|
2016-03-05 03:14:57 +08:00
|
|
|
<ul class="homepagePostSettiongText">
|
|
|
|
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
|
|
|
<li><%= link_to '延期发布',file_hidden_course_file_path(@course,file),:class => "postOptionLink",:remote=>true %></li>
|
|
|
|
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
|
|
|
|
<% if @course.is_public? %>
|
|
|
|
<li>
|
2016-03-17 12:37:05 +08:00
|
|
|
<span id="is_public_<%= file.id %>">
|
|
|
|
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
|
|
|
|
</span>
|
2016-03-05 03:14:57 +08:00
|
|
|
</li>
|
|
|
|
<%end%>
|
|
|
|
<li>
|
|
|
|
<%= link_to( '删除资源', attachment_path(file),
|
2016-03-17 12:37:05 +08:00
|
|
|
:data => {:confirm => l(:text_are_you_sure)},
|
|
|
|
:method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %>
|
2016-03-05 03:14:57 +08:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<% end %>
|
|
|
|
<%else%>
|
|
|
|
<ul class="resourceSendO">
|
|
|
|
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
|
|
|
</ul>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="cl"></div>
|
|
|
|
</div>
|
|
|
|
<div class="cl"></div>
|
|
|
|
</div>
|
2016-02-23 11:04:19 +08:00
|
|
|
</div>
|