课程资源库
This commit is contained in:
parent
3b08adfc68
commit
e35d2daa0a
|
@ -745,7 +745,16 @@ class FilesController < ApplicationController
|
|||
q = "%#{@q.strip}%"
|
||||
@result = find_course_attache q,@course,sort
|
||||
@result = visable_attachemnts @result
|
||||
if params[:other]
|
||||
@result = @result.select{|attachment|
|
||||
!attachment.tag_list.include?('课件') &&
|
||||
!attachment.tag_list.include?('软件') &&
|
||||
!attachment.tag_list.include?('媒体') &&
|
||||
!attachment.tag_list.include?('代码') &&
|
||||
!attachment.tag_list.include?('论文') }
|
||||
else
|
||||
@result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} unless @tag_name.blank?
|
||||
end
|
||||
@searched_attach = paginateHelper @result,10
|
||||
@tag_list = get_course_tag_list @course
|
||||
|
||||
|
|
|
@ -1,2 +1,7 @@
|
|||
$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)),
|
||||
:remote=>true,:class=>"f_l re_open",:method => :post) %>");
|
||||
$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)),
|
||||
:remote=>true,:class=>"postOptionLink",:method => :post) %>");
|
||||
<%if @attachment.is_public? %>
|
||||
$("#image_private_<%= @attachment.id%>").html('')
|
||||
<%else%>
|
||||
$("#image_private_<%= @attachment.id%>").html('<span class="img_private ml5">私有</span>')
|
||||
<%end%>
|
|
@ -2,7 +2,7 @@
|
|||
<script>
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id")
|
||||
$("#container").css('width',1000)
|
||||
$("#container").css('width',"1000px")
|
||||
});
|
||||
function searchone4reload(fileid){
|
||||
var url = "<%= searchone4reload_course_files_path(@course)%>";
|
||||
|
@ -75,13 +75,13 @@
|
|||
<ul class="resourcesSelect">
|
||||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
<ul class="resourcesType">
|
||||
<li><a href="javascript:void(0);" class="resourcesTypeAll resourcesGrey">全部</a></li>
|
||||
<li><a href="javascript:void(0);" class="homepagePostTypeAssignment postTypeGrey">课件</a></li>
|
||||
<li><a href="javascript:void(0);" class="softwareIcon postTypeGrey">软件</a></li>
|
||||
<li><a href="javascript:void(0);" class="mediaIcon resourcesGrey">媒体</a></li>
|
||||
<li><a href="javascript:void(0);" class="codeIcon resourcesGrey">代码</a></li>
|
||||
<li><a href="javascript:void(0);" class="thesisIcon resourcesGrey">论文</a></li>
|
||||
<li><a href="javascript:void(0);" class="othersIcon resourcesGrey">其它</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@course)%>','','<%= @q%>','<%= @course.id%>');" class="resourcesTypeAll resourcesGrey">全部</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@course)%>','课件','<%= @q%>','<%= @course.id%>');" class="homepagePostTypeAssignment postTypeGrey">课件</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@course)%>','软件','<%= @q%>','<%= @course.id%>');" class="softwareIcon postTypeGrey">软件</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@course)%>','媒体','<%= @q%>','<%= @course.id%>');" class="mediaIcon resourcesGrey">媒体</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@course)%>','代码','<%= @q%>','<%= @course.id%>');" class="codeIcon resourcesGrey">代码</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@course)%>','论文','<%= @q%>','<%= @course.id%>');" class="thesisIcon resourcesGrey">论文</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@course,:other=>true)%>','其他','<%= @q%>','<%= @course.id%>');" class="othersIcon resourcesGrey">其它</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -100,8 +100,13 @@
|
|||
<!-- show_window('light','fade','20%','35%')-->
|
||||
<!--<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload();">上传资源</a>-->
|
||||
</div>
|
||||
<div>
|
||||
<div class="fileTagWrap" id="files_tag">
|
||||
<%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @tag_name}%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="re_con_top">
|
||||
<p class="f_l c_blue f_b f_14">共有 <%= @all_attachments.count%> 个资源</p>
|
||||
<p class="f_l fontBlue f_b f_14">共有 <span id="attachment_count"><%= @all_attachments.count%></span> 个资源</p>
|
||||
<p class="f_r" style="color: #808080">
|
||||
<% if @order == "asc" %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /
|
||||
|
@ -114,15 +119,11 @@
|
|||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="files_tag" id="files_tag">
|
||||
<%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @tag_name}%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div id="course_list">
|
||||
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<% html_title(l(:label_attachment_plural)) -%>
|
|
@ -1,4 +1,4 @@
|
|||
<div id="course_list">
|
||||
|
||||
<% delete_allowed = User.current.allowed_to?(:manage_files, course) %>
|
||||
<% curse_attachments.each do |file| %>
|
||||
<% if file.is_public? || User.current.member_of_course?(course) || User.current.admin? %>
|
||||
|
@ -8,27 +8,22 @@
|
|||
<%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word mt-4">
|
||||
<a href="<%= user_path(file.author)%>" class="newsBlue mr15">
|
||||
<%= file.author.realname.blank? ? file.author.login : file.author.realname %>
|
||||
</a>
|
||||
<% if file.container_type == 'Course' && file.container_id==course.id%>
|
||||
TO <a href="javascript:void(0)" class="newsBlue ml15"><%= course.name%> | 资源库</a></div>
|
||||
<%else%>
|
||||
上传了资源
|
||||
<%end %>
|
||||
<div class="homepagePostTitle break_word">
|
||||
<div class="homepagePostTitle break_word mt-4">
|
||||
<%= 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 => "linkBlue f_14 f_b" %>
|
||||
<%= 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>
|
||||
</div>
|
||||
<div class="mt5">
|
||||
<span class="fontGrey2 mr15 fl">上传时间:<%= format_date(file.created_on)%></span>
|
||||
<span class="fontGrey2 fl mr15">上传类型:<%= %></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>
|
||||
|
@ -39,14 +34,14 @@
|
|||
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
|
||||
</div>
|
||||
<div class="homepagePostSetting">
|
||||
<% if User.current.logged? %>
|
||||
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><a href="javascript:void(0);" class="postOptionLink">发送</a></li>
|
||||
<% if User.current.logged? %>
|
||||
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
|
||||
|
||||
<% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %>
|
||||
|
||||
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
|
||||
<% if @course.is_public? %>
|
||||
<li>
|
||||
<span id="is_public_<%= file.id %>">
|
||||
|
@ -60,29 +55,38 @@
|
|||
</span>
|
||||
</li>
|
||||
<%end%>
|
||||
<li><a href="javascript:void(0);" class="postOptionLink">删除资源</a></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<li>
|
||||
<%= link_to( '删除资源', attachment_path(file),
|
||||
: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"%>
|
||||
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="re_con_box"><span class='fr mr10 pr_join_span '><%= file.filename %>是私有资源</span></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
||||
</div>
|
||||
<!--<ul class="wlist">-->
|
||||
<!--<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>-->
|
||||
<!--</ul>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
<% if curse_attachments.count == 10%>
|
||||
<% if params[:action] == 'search' %>
|
||||
<div id="show_more_attachments" class="loadMore mt10 f_grey">展开更多<%=link_to "", search_course_files_path({:course_id => course.id,:page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "more_attachments_link",:remote => "true",:class => "none" %></div>
|
||||
<%else%>
|
||||
<!-- 全站搜索的时候 返回的页码对象是obj_pages,而站内搜索返回的页码对象是feedback_pages -->
|
||||
<div id="show_more_attachments" class="loadMore mt10 f_grey">展开更多<%=link_to "", course_files_path({:course_id => course.id,:page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "more_attachments_link",:remote => "true",:class => "none" %></div>
|
||||
<%end%>
|
||||
<% end%>
|
||||
<script type="text/javascript">
|
||||
$("#show_more_attachments").mouseover(function(){
|
||||
$("#more_attachments_link").click();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
<% tag_list.each do |k,v|%>
|
||||
<% if tag_name && tag_name == k%>
|
||||
<!-- 鼠标不能移动是因为 href="javascript:void(0);"导致的 -->
|
||||
<span> <a class="files_tag_select" ondblclick="rename_tag($(this),'<%= k %>','',<%= 6 %>);"><%= k%>(<%= v%>)</a></span>
|
||||
<span> <a class="files_tag_select" ondblclick="rename_tag($(this),'<%= k %>','',<%= 6 %>);"><%= k%> x<%= v%></a></span>
|
||||
<% else%>
|
||||
<span class="files_tag_icon" >
|
||||
<a title="双击可编辑"
|
||||
onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(course)%>','<%= k%>','<%= @q%>','<%= course.id%>');"
|
||||
ondblclick="rename_tag($(this),'<%= k %>','',<%= 6 %>);"><%= k%>(<%= v%>)</a></span>
|
||||
ondblclick="rename_tag($(this),'<%= k %>','',<%= 6 %>);"><%= k%> x<%= v%></a></span>
|
||||
<% end%>
|
||||
<% end%>
|
||||
<% end%>
|
|
@ -1,12 +1,18 @@
|
|||
<div id="resource_list">
|
||||
|
||||
<% if @container_type == 0 %>
|
||||
<div id="resource_list">
|
||||
<%= render :partial => 'project_file_new', locals: {project: @project} %>
|
||||
<% elsif @container_type == 1 %>
|
||||
<%= render :partial => 'course_file', locals: {course: @course} %>
|
||||
<% elsif @container_type == 2 %>
|
||||
<%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% elsif @container_type == 1 %>
|
||||
<div id="resource_list">
|
||||
<%= render :partial => 'course_file', locals: {course: @course} %>
|
||||
</div>
|
||||
<% elsif @container_type == 2 %>
|
||||
<div id="resource_list">
|
||||
<%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
<script type='text/javascript'>
|
||||
var slideHeight = 29;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
<% if @course %>
|
||||
$("#show_more_attachments").replaceWith("<%= escape_javascript( render :partial => 'files/course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>");
|
||||
<%end %>
|
|
@ -1 +1,6 @@
|
|||
$("#course_list").html("<%= escape_javascript(render :partial => 'course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach})%>");
|
||||
<% if (@obj_pages &&( @obj_pages.page > 1)) || (@feedback_pages && (@feedback_pages.page > 1)) %> //搜索的时候有时候是需要加载下一页,有时候是直接替换当前 #course_list。这个根据 page来判定
|
||||
$("#show_more_attachments").replaceWith("<%= escape_javascript( render :partial => 'files/course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach} )%>");
|
||||
<% else %>
|
||||
$("#course_list").html("<%= escape_javascript(render :partial => 'files/course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach})%>");
|
||||
$("#attachment_count").html("<%= @result.count%>")
|
||||
<% end %>
|
|
@ -1 +1,2 @@
|
|||
$("#course_list").html("<%= escape_javascript(render :partial => 'course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach})%>");
|
||||
$("#attachment_count").html("<%= @result.count%>")
|
|
@ -756,7 +756,14 @@ a.wzan_visited{background:url(../images/new_project/public_icon.png) 0px -503px
|
|||
.files_tag{ width:670px; min-height:22px;margin-bottom:10px;}/* overflow:hidden; */
|
||||
/*padding:1px 10px 修改原因,padding会导致内部输入框和外边框有边距*/
|
||||
a.files_tag_icon{ width:auto;background:#e2f3f9; color:#54aeca; border:1px solid #bbe2ef; padding:1px 5px; float:left; margin-right:10px;margin-bottom:10px; }
|
||||
span.files_tag_icon{ width:auto;background:#e2f3f9; color:#54aeca; border:1px solid #bbe2ef; padding:1px 5px; float:left; margin-right:10px;margin-bottom:10px;cursor: pointer }
|
||||
span.files_tag_icon{ width: auto;
|
||||
background: #E1ECF4;
|
||||
color: #39739D;
|
||||
padding: 2px 5px;
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
cursor: pointer; }
|
||||
a.files_tag_select{ background:#64bdd9; color:#fff; border:1px solid #bbe2ef; padding:1px 1px; float:left; margin-right:10px;margin-bottom:10px;}/* padding:1px 10px;*/
|
||||
|
||||
/* 20150423作业评分*/
|
||||
|
@ -1241,3 +1248,8 @@ div.disable_link {background-color: #c1c1c1 !important;}
|
|||
.support{ background:url(../images/public_icon.png) -66px -45px no-repeat; width:18px; height:21px;}
|
||||
.function{ background:url(../images/public_icon.png) -66px -70px no-repeat; width:18px; height:21px;}
|
||||
.weekly{ background:url(../images/public_icon.png) -66px -95px no-repeat; width:18px; height:21px;}
|
||||
|
||||
.reCon{ margin:5px; width:710px;}
|
||||
.reTop{width:710px; height:40px; background:#eaeaea; padding:5px;}
|
||||
.filesTag{ width:auto;background:#e2f3f9; color:#54aeca; border:1px solid #bbe2ef; padding:1px 5px; float:left; margin-right:10px;cursor: pointer }
|
||||
.fileTagWrap{ width:710px;}
|
||||
|
|
Loading…
Reference in New Issue