socialforge/app/views/files/_course_file.html.erb

153 lines
6.8 KiB
Plaintext
Raw Normal View History

<% attachmenttypes = @course.attachmenttypes %>
<% sufixtypes = @course.contenttypes %>
2014-11-18 18:02:01 +08:00
<% delete_allowed = User.current.allowed_to?(:manage_files, @course) %>
<%= stylesheet_link_tag 'resource', :media => 'all' %>
2014-11-18 18:02:01 +08:00
<div class="container">
<div class="resource"><!--资源库内容开始--->
<div class="re_top">
<form class="re_search f_l ">
<input type="text" name="" class="re_schbox" style="padding: 0px" />
<input type="submit" value="课内搜索" class="re_schbtn b_dblue" />
<input type="submit" value="全站搜索" class="re_schbtn b_lblue" />
</form>
<a href="#" class="re_fabu f_r b_lblue">上传资源</a>
2014-11-18 18:02:01 +08:00
</div><!---re_top end-->
<div class="cl"></div>
<div class="re_con">
<div class="re_con_top">
<p class="f_l c_blue f_b f_14">共有&nbsp;<%= User.current.member_of_course?(@course) ? @all_attachments.count : 0 %>&nbsp;个资源</p>
<p class="f_r">按&nbsp;<a href="#" class="f_b c_grey">时间</a>&nbsp;/&nbsp;<a href="#" class="f_b c_grey">下载次数</a>&nbsp;/&nbsp;<a href="#" class="f_b c_grey">引用次数</a>&nbsp;排序</p>
</div>
<div class="cl"></div>
<% @curse_attachments.each do |file| %>
<%if file.is_public == 0 && !User.current.member_of_course?(@course)%>
<%next%>
<%end%>
<div class="re_con_box">
<div class=" ">
<%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
2014-11-19 11:03:23 +08:00
<a href="#" class="f_l re_select">选入我的课程</a>
<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=>"f_l re_open",:method => :post %>
</span>
2014-11-18 18:02:01 +08:00
</div>
<div class="cl"></div>
<div class="">
<p class="f_l c_grey02">文件大小:<%= number_to_human_size(file.filesize) %></p>
<%= 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 %>
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>&nbsp;&nbsp;|&nbsp;&nbsp;下载<%= file.downloads %>&nbsp;&nbsp;|&nbsp;&nbsp;引用0 </p>
</div>
<div class="cl"></div>
<div class="tag_h">
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %>
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %>
</div>
<div class="cl"></div>
</div><!---re_con_box end-->
<% end %>
<ul class="wlist"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%></ul>
<div class="cl"></div>
</div><!---re_con end-->
</div>
</div>
<!-- old code -->
2014-10-28 22:34:51 +08:00
<span class="borad-title"><%= t(:label_user_course) %>资源共享区</span>
<div class="content-title-top">
2014-10-28 22:34:51 +08:00
<%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @course) %>
<div class="clearfix"></div>
<div id="file_buttons" class="nhidden">
<%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @course) %>
<%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @course) %>
2014-07-17 15:05:49 +08:00
<p></p>
<div id="upload_file_div" class="relation_file_div hidden">
<%= render :partial => 'course_new', locals: {course: @course} %>
</div>
<div id="relation_file_div" class="relation_file_div hidden">
<fieldset>
<legend>搜索</legend>
<%= form_tag(
attachments_autocomplete_path(:format => 'js'),
:remote => true,
:method => :post) do %>
<%= label_tag(:attach_search, "按关键字搜索:") %>
<%= text_field_tag(:attach_search) %>
<%#= submit_tag("Search") %>
<% end -%>
<%= form_tag course_attach_relation_path(:format => 'js'),
method: :post,
remote: true,
id: "relation_file_form",
:class => 'hidden' do %>
<%= hidden_field_tag(:class_name, 'course') %>
<%= hidden_field_tag(:class_id, params[:course_id]) %>
<div id="relation_file">
</div>
<div class="kclearfix" style='margin-top: 10px;'>
<%= submit_tag(l(:button_add)) -%>
</div>
<% end -%>
</fieldset>
<div class="line_under" style="margin:20px 0px;"></div>
</div>
</div>
2014-07-21 17:33:13 +08:00
<div class="box" id="files-box">
<label for="files-box" style="font-weight:bold;">&nbsp;&nbsp;<%= l(:label_files_filter) %></label>
<% if attachmenttypes.any? %>
&nbsp; &nbsp; &nbsp;
<label for="attachment_browse_label"><%= l(:attachment_browse) %></label>
<%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0' ) +options_from_collection_for_select(attachmenttypes, "id", "typeName", params[:type]),
2014-07-21 17:33:13 +08:00
:onchange => "course_attachmenttypes_searchex(this.value)" %>
<% end %>
<% if sufixtypes.any? %>
&nbsp;
<label for="attach_sufix_browse_label"><%= l(:attachment_sufix_browse) %></label>
2014-10-28 22:34:51 +08:00
<%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes),
2014-07-21 17:33:13 +08:00
:onchange => "course_attachment_contenttypes_searchex(this.value)" %>
<% end %>
</div>
</div>
<%= javascript_tag "observeSearchfield('attach_search', null, '#{ escape_javascript attachments_autocomplete_path(:course_id => @course.id, :format => 'js') }')" %>
<% delete_allowed = User.current.allowed_to?(:manage_files, @course) %>
<div id="all_browse_div" class="all_browse_div">
<%#= render :partial => 'course_show_all_attachment' %>
<% if (@attachtype==0 && @contenttype=='0') || (@attachtype.nil? && @contenttype.nil?) %>
<%= render partial: "course_show_all_attachment"%>
<%else%>
<%= render partial: "course_sort_by_attachtypel"%>
<%end%>
</div>
2014-10-28 22:34:51 +08:00
<% html_title(l(:label_attachment_plural)) -%>