Merge branch 'hjq_new_course' into develop
This commit is contained in:
commit
fdaaaf9d20
|
@ -529,6 +529,7 @@ class FilesController < ApplicationController
|
|||
if attachment.publish_time > Date.today
|
||||
attachment.is_publish = 0
|
||||
end
|
||||
attachment.description = params[:description]
|
||||
attachment.save
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1658,6 +1658,9 @@ class UsersController < ApplicationController
|
|||
attach_copied_obj.attachtype = 4
|
||||
end
|
||||
if attach_copied_obj.save
|
||||
# 更新引用次数
|
||||
quotes = ori.quotes.to_i + 1
|
||||
ori.update_attribute(:quotes, quotes) unless ori.nil?
|
||||
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
||||
end
|
||||
@save_message = attach_copied_obj.errors.full_messages
|
||||
|
@ -1670,10 +1673,11 @@ class UsersController < ApplicationController
|
|||
@flag = false
|
||||
end
|
||||
send_ids.each do |send_id|
|
||||
quotes = 0
|
||||
ori = Attachment.find_by_id(send_id)
|
||||
|
||||
unless course_ids.nil?
|
||||
course_ids.each do |id|
|
||||
quotes = 0
|
||||
next if ori.blank?
|
||||
@exist = false
|
||||
Course.find(id).attachments.each do |att| #如果课程中包含该资源
|
||||
|
@ -1696,6 +1700,9 @@ class UsersController < ApplicationController
|
|||
attach_copied_obj.attachtype = 4
|
||||
end
|
||||
if attach_copied_obj.save
|
||||
# 更新引用次数
|
||||
quotes = ori.quotes.to_i + 1
|
||||
ori.update_attribute(:quotes, quotes) unless ori.nil?
|
||||
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
||||
end
|
||||
@save_message = attach_copied_obj.errors.full_messages
|
||||
|
@ -1756,6 +1763,9 @@ class UsersController < ApplicationController
|
|||
attach_copied_obj.attachtype = 1
|
||||
end
|
||||
if attach_copied_obj.save
|
||||
# 更新引用次数
|
||||
quotes = ori.quotes.to_i + 1
|
||||
ori.update_attribute(:quotes, quotes) unless ori.nil?
|
||||
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
||||
end
|
||||
unless Project.find(project_id).project_score.nil?
|
||||
|
@ -1771,10 +1781,11 @@ class UsersController < ApplicationController
|
|||
@flag = false
|
||||
end
|
||||
send_ids.each do |send_id|
|
||||
|
||||
quotes = 0
|
||||
ori = Attachment.find_by_id(send_id)
|
||||
unless project_ids.nil?
|
||||
project_ids.each do |project_id|
|
||||
quotes = 0
|
||||
next if ori.blank?
|
||||
@exist = false
|
||||
Project.find(project_id).attachments.each do |att| #如果课程中包含该资源
|
||||
|
@ -1797,6 +1808,9 @@ class UsersController < ApplicationController
|
|||
attach_copied_obj.attachtype = 1
|
||||
end
|
||||
if attach_copied_obj.save
|
||||
# 更新引用次数
|
||||
quotes = ori.quotes.to_i + 1
|
||||
ori.update_attribute(:quotes, quotes) unless ori.nil?
|
||||
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
||||
end
|
||||
unless Project.find(project_id).project_score.nil?
|
||||
|
@ -1856,6 +1870,9 @@ class UsersController < ApplicationController
|
|||
attach_copied_obj.attachtype = 1
|
||||
end
|
||||
if attach_copied_obj.save
|
||||
# 更新引用次数
|
||||
quotes = ori.quotes.to_i + 1
|
||||
ori.update_attribute(:quotes, quotes) unless ori.nil?
|
||||
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
||||
end
|
||||
end
|
||||
|
@ -1867,7 +1884,7 @@ class UsersController < ApplicationController
|
|||
@flag = false
|
||||
end
|
||||
send_ids.each do |send_id|
|
||||
|
||||
quotes = 0
|
||||
ori = Attachment.find_by_id(send_id)
|
||||
unless subfield_id.nil?
|
||||
next if ori.blank?
|
||||
|
@ -1892,6 +1909,9 @@ class UsersController < ApplicationController
|
|||
attach_copied_obj.attachtype = 1
|
||||
end
|
||||
if attach_copied_obj.save
|
||||
# 更新引用次数
|
||||
quotes = ori.quotes.to_i + 1
|
||||
ori.update_attribute(:quotes, quotes) unless ori.nil?
|
||||
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
||||
end
|
||||
end
|
||||
|
@ -2253,9 +2273,19 @@ class UsersController < ApplicationController
|
|||
attchments = Attachment.where("(author_id = #{author_id} and container_type = 'Course' and is_publish = 1) or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1) ").order("created_on desc")
|
||||
end
|
||||
|
||||
# 获取公共资源课程
|
||||
def get_course_resources_public user_course_ids
|
||||
attchments = Attachment.where("(container_type = 'Course' and is_publish = 1) or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1) ").order("created_on desc")
|
||||
end
|
||||
|
||||
# 获取我的项目资源
|
||||
def get_project_resources author_id, user_project_ids
|
||||
attchments = Attachment.where("author_id = #{author_id} and container_type = 'Project'").order("created_on desc")
|
||||
attchments = Attachment.where("(author_id = #{author_id} and container_type = 'Project') or (container_type = 'Course' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1) ").order("created_on desc")
|
||||
end
|
||||
|
||||
# 获取公共资源的项目资源
|
||||
def get_project_resources_public user_project_ids
|
||||
attchments = Attachment.where("(container_type = 'Project') or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1) ").order("created_on desc")
|
||||
end
|
||||
|
||||
# 获取我上传的附件
|
||||
|
@ -2263,11 +2293,21 @@ class UsersController < ApplicationController
|
|||
attchments = Attachment.where("author_id = #{author_id} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc")
|
||||
end
|
||||
|
||||
# 获取公共资源中我上传的附件
|
||||
def get_attch_resources_public
|
||||
attchments = Attachment.where("container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc")
|
||||
end
|
||||
|
||||
# 获取我的用户类型资源
|
||||
def get_principal_resources author_id
|
||||
attchments = Attachment.where("author_id = #{author_id} and container_type = 'Principal'").order("created_on desc")
|
||||
end
|
||||
|
||||
# 获取我的用户类型资源
|
||||
def get_principal_resources_public
|
||||
attchments = Attachment.where("container_type = 'Principal'").order("created_on desc")
|
||||
end
|
||||
|
||||
# 资源库 分为全部 课程资源 项目资源 附件
|
||||
def user_resource
|
||||
# 别人的资源库是没有权限去看的
|
||||
|
@ -2280,7 +2320,18 @@ class UsersController < ApplicationController
|
|||
# user_org_ids = User.current.organizations.map {|o| o.id}
|
||||
if(params[:type].blank? || params[:type] == "1") # 我的资源
|
||||
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
|
||||
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
|
||||
if params[:status] == 2
|
||||
@attachments = get_course_resources(params[:id], user_course_ids)
|
||||
elsif params[:status] == "3"
|
||||
@attachments = get_project_resources(params[:id], user_project_ids)
|
||||
elsif params[:status] == "4"
|
||||
@attachments = get_attch_resources params[:id]
|
||||
elsif params[:status] == "5"
|
||||
@attachments = get_principal_resources params[:id]
|
||||
else
|
||||
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
|
||||
end
|
||||
elsif params[:type] == "2" # 课程资源
|
||||
@attachments = get_course_resources(params[:id], user_course_ids)
|
||||
elsif params[:type] == "3" # 项目资源
|
||||
|
@ -2290,9 +2341,20 @@ class UsersController < ApplicationController
|
|||
elsif params[:type] == "5" #用户资源
|
||||
@attachments = get_principal_resources params[:id]
|
||||
elsif params[:type] == "6" # 公共资源
|
||||
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||
@attachments = get_public_resources(user_course_ids, user_project_ids)
|
||||
if params[:status] == "2"
|
||||
@attachments = get_course_resources_public( user_course_ids)
|
||||
elsif params[:status] == "3"
|
||||
@attachments = get_project_resources_public(user_project_ids)
|
||||
elsif params[:status] == "4"
|
||||
@attachments = get_attch_resources_public
|
||||
elsif params[:status] == "5"
|
||||
@attachments = get_principal_resources_public
|
||||
else
|
||||
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||
@attachments = get_public_resources(user_course_ids, user_project_ids)
|
||||
end
|
||||
end
|
||||
@status = params[:status]
|
||||
@type = params[:type]
|
||||
@limit = 25
|
||||
@is_remote = true
|
||||
|
@ -2338,27 +2400,55 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def import_resources_search
|
||||
search = "%#{params[:search].strip.downcase}%"
|
||||
# 别人的资源库是没有权限去看的
|
||||
if User.current.id.to_i != params[:id].to_i
|
||||
render_403
|
||||
return
|
||||
end
|
||||
user_course_ids = User.current.courses.map { |c| c.id}
|
||||
user_project_ids = User.current.projects.map {|p| p.id}
|
||||
# user_org_ids = User.current.organizations.map {|o| o.id}
|
||||
if(params[:type].blank? || params[:type] == "1") # 我的资源
|
||||
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
|
||||
user_course_ids = User.current.courses.map { |c| c.id}
|
||||
user_project_ids = User.current.projects.map {|p| p.id}
|
||||
# user_org_ids = User.current.organizations.map {|o| o.id}
|
||||
@attachments = Attachment.where("((author_id = #{params[:id]} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" +
|
||||
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)) and (filename like :p)" ,:p => search).order("created_on desc")
|
||||
elsif params[:type] == "6" # 公共资源
|
||||
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||
@attachments = get_public_resources(user_course_ids, user_project_ids)
|
||||
end
|
||||
@type = params[:type]
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@atta_count = @attachments.count
|
||||
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
|
||||
@offset ||= @atta_pages.offset
|
||||
#@curse_attachments_all = @all_attachments[@offset, @limit]
|
||||
@attachments = paginateHelper @attachments,10
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'new_base'}
|
||||
end
|
||||
end
|
||||
|
||||
# 内容导入到对象中
|
||||
def import_into_container
|
||||
# attachments = Attachment.where("id in (#{params[:checkbox1].join(',')})")
|
||||
# if params[:mul_type] == "Project"
|
||||
#
|
||||
# elsif params[:mul_type] == "Course"
|
||||
# Attachment.create(:container_id => params[:mul_id], :container_type => "Course", :name => attachment.name)
|
||||
# elsif params[:mul_type] == "SubfieldFile"
|
||||
# end
|
||||
|
||||
send_ids = params[:checkbox1]
|
||||
# mul_id为当前课程id、项目id、组织id的多种形态
|
||||
mul_id = params[:mul_id]
|
||||
if params[:mul_type] == "Course"
|
||||
mul_container = Course.find(mul_id)
|
||||
elsif params[:mul_type] == "Project"
|
||||
mul_container = Project.find(mul_id)
|
||||
elsif params[:mul_type] == "SubfieldFile"
|
||||
mul_container = OrgSubfield.find(mul_id)
|
||||
end
|
||||
unless params[:checkbox1].blank?
|
||||
send_ids = params[:checkbox1]
|
||||
# mul_id为当前课程id、项目id、组织id的多种形态
|
||||
mul_id = params[:mul_id]
|
||||
if params[:mul_type] == "Course"
|
||||
mul_container = Course.find(mul_id)
|
||||
elsif params[:mul_type] == "Project"
|
||||
mul_container = Project.find(mul_id)
|
||||
elsif params[:mul_type] == "SubfieldFile"
|
||||
mul_container = OrgSubfield.find(mul_id)
|
||||
end
|
||||
send_ids.each do |send_id|
|
||||
ori = Attachment.find_by_id(send_id)
|
||||
# 如果该附件已经存课程中,则只更新附件创建时间
|
||||
|
@ -2388,11 +2478,11 @@ class UsersController < ApplicationController
|
|||
respond_to do |format|
|
||||
format.html {
|
||||
if params[:mul_type] == "Course"
|
||||
redirect_to course_files_url(mul_container)
|
||||
redirect_to course_files_url(mul_container) unless mul_container.nil?
|
||||
elsif params[:mul_type] == "Project"
|
||||
redirect_to project_files_url(mul_container)
|
||||
redirect_to project_files_url(mul_container) unless mul_container.nil?
|
||||
elsif params[:mul_type] == "SubfieldFile"
|
||||
redirect_to org_subfield_files_url(mul_container)
|
||||
redirect_to org_subfield_files_url(mul_container) unless mul_container.nil?
|
||||
end
|
||||
}
|
||||
end
|
||||
|
@ -2401,11 +2491,15 @@ class UsersController < ApplicationController
|
|||
# 根据资源关键字进行搜索
|
||||
def resource_search
|
||||
search = "%#{params[:search].strip.downcase}%"
|
||||
user_course_ids = User.current.courses.map { |c| c.id}
|
||||
user_project_ids = User.current.projects.map {|p| p.id}
|
||||
# user_org_ids = User.current.organizations.map {|o| o.id}
|
||||
if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 取交集并查询
|
||||
@attachments = Attachment.where("((author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
" or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))) and (filename like :p) ",:p=>search).order("created_on desc")
|
||||
|
||||
@attachments = Attachment.where("((author_id = #{params[:id]} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" +
|
||||
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)) and (filename like :p)" ,:p => search).order("created_on desc")
|
||||
else
|
||||
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中
|
||||
@attachments = Attachment.where("((author_id = #{params[:id]} and is_public = 1 and container_type in" +
|
||||
|
@ -2443,8 +2537,9 @@ class UsersController < ApplicationController
|
|||
end
|
||||
elsif params[:type] == "6" #全部资源
|
||||
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||
@attachments = Attachment.where("((is_public =1 and is_publish = 1 and container_id is not null)" +
|
||||
"or (author_id = #{params[:id]} and is_publish = 0)) and (filename like :p) ", :p => search).order("created_on desc")
|
||||
@attachments = Attachment.where("((is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course')) "+
|
||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" +
|
||||
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)) and (filename like :p)" ,:p => search).order("created_on desc")
|
||||
end
|
||||
@type = params[:type]
|
||||
@limit = 25
|
||||
|
|
|
@ -288,7 +288,7 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
if self.jour_type == "Course"
|
||||
course_member_score(self.jour_id, self.user_id, "JournalForMessage")
|
||||
elsif self.jour_type == "HomeworkCommon"
|
||||
course_member_score(self.jour_id, self.user_id, "HomeworkCommon")
|
||||
course_member_score(self.jour.course_id, self.user_id, "HomeworkCommon")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
<%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search",:remote=>true) do %>
|
||||
<%= text_field_tag 'name', params[:name], name: "name", :class => 'researchBox fl',:style=>"padding: 0px"%>
|
||||
<%= submit_tag "课内搜索", :class => "blueBtn mr5 fl",:name => "incourse",:id => "incourse" %>
|
||||
<%= submit_tag "全站搜索", :class => "blueBtn mr5 fl",:name => "insite",:id => "insite" %>
|
||||
<%#= submit_tag "全站搜索", :class => "blueBtn mr5 fl",:name => "insite",:id => "insite" %>
|
||||
<% if is_course_teacher(User.current,@course) || (@course.publish_resource==1 && User.current.member_of_course?(@course) ) %>
|
||||
<input class="blueBtn fr mr5" value="上传资源" onclick="course_files_upload();">
|
||||
<%= link_to("导入资源", import_resources_user_path(User.current, :type => 6, :course_id => @course.id), :class => "blue-btn fr mr5", :remote => true) %>
|
||||
|
|
|
@ -27,6 +27,10 @@
|
|||
<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>
|
||||
<% unless file.description.blank? %>
|
||||
<div class="cl"></div>
|
||||
<div class="fontGrey2 mb4">资源描述:<%= file.description %></div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<div class="tag_h">
|
||||
<!-- container_type = 1 代表是课程里的资源 -->
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<%= form_tag( search_files_in_subfield_org_subfield_files_path(@org_subfield), method: 'get',:class => "re_search",:remote=>true) do %>
|
||||
<%= text_field_tag 'name', params[:name], name: "name", :class => 'researchBox fl',:style=>"padding: 0px"%>
|
||||
<%= submit_tag "栏目内搜索", :class => "blueBtn mr5 fl",:style => 'width:72px;',:name => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %>
|
||||
<%= submit_tag "全站搜索", :class => "blueBtn mr5 fl",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
|
||||
<%#= submit_tag "全站搜索", :class => "blueBtn mr5 fl",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
|
||||
<input class="blueBtn fr mr5" value="上传资源" onclick="org_upload_files(<%= org_subfield.id %>);">
|
||||
<%= link_to("导入资源", import_resources_user_path(User.current, :type => 6, :subfield_file_id => @org_subfield.id), :class => "blue-btn fr mr5", :remote => true) %>
|
||||
<%#= link_to "上传资源",subfield_upload_file_org_subfield_files_path(@org_subfield.id, :in_org => 1),:method => "post",:class=>"blueBtn fr mr5",:remote => true %>
|
||||
|
|
|
@ -22,6 +22,14 @@
|
|||
<%= render :partial => 'files/new_style_attachment_list',:locals => {:container => course} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mb5">
|
||||
<label class="fl c_dark f14" style="margin-top: 4px;">附件描述:</label>
|
||||
<div class="fl">
|
||||
<input type="text" name="description" placeholder="文件描述" class="fl W120 ">
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<% if User.current.allowed_to?(:as_teacher,course) %>
|
||||
<div class="mb5">
|
||||
<label class="fl c_dark f14" style="margin-top: 4px;">延迟发布:</label>
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
<script type='text/javascript'>
|
||||
var slideHeight = 29;
|
||||
function readmore(aNode) {
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".subjectChoose").click(function(){
|
||||
$(".subjectChoose").removeClass("chooseActive");
|
||||
$(this).addClass("chooseActive");
|
||||
<% if type == "1" %>
|
||||
$("#my_resources_choose").addClass("choose-active");
|
||||
$("#public_resources_choose").removeClass("choose-active");
|
||||
<% end %>
|
||||
|
||||
$(".subject-choose").click(function(){
|
||||
$(".subject-choose").removeClass("choose-active");
|
||||
$(this).addClass("choose-active");
|
||||
});
|
||||
$(".popupClose").click(function(){
|
||||
$(".popupWrap").hide();
|
||||
|
@ -12,20 +17,20 @@
|
|||
<div class="f16 fb fontBlue mb10">选用资源库中的资源</div>
|
||||
<div class="subjectList fl mr10">
|
||||
<% if !params[:course_id].nil? %>
|
||||
<a href="<%= import_resources_user_path(User.current, :type => '6', :course_id => params[:course_id]) %>" class="subjectChoose chooseActive fl" data-remote="true">公共资源</a>
|
||||
<a href="<%= import_resources_user_path(User.current, :type => '1', :course_id => params[:course_id]) %>" class="subjectChoose fl" data-remote="true">我的资源</a>
|
||||
<a href="<%= import_resources_user_path(User.current, :type => '6', :course_id => params[:course_id]) %>" id="public_resources_choose" class="subject-choose choose-active fl" data-remote="true">公共资源</a>
|
||||
<a href="<%= import_resources_user_path(User.current, :type => '1', :course_id => params[:course_id]) %>" id="my_resources_choose" class="subject-choose fl" data-remote="true">我的资源</a>
|
||||
<% elsif !params[:project_id].nil? %>
|
||||
<a href="<%= import_resources_user_path(User.current, :type => '6', :project_id => params[:project_id]) %>" class="subjectChoose chooseActive fl" data-remote="true">公共资源</a>
|
||||
<a href="<%= import_resources_user_path(User.current, :type => '1', :project_id => params[:project_id]) %>" class="subjectChoose fl" data-remote="true">我的资源</a>
|
||||
<a href="<%= import_resources_user_path(User.current, :type => '6', :project_id => params[:project_id]) %>" id="public_resources_choose" class="subject-choose choose-active fl" data-remote="true">公共资源</a>
|
||||
<a href="<%= import_resources_user_path(User.current, :type => '1', :project_id => params[:project_id]) %>" id="my_resources_choose" class="subject-choose fl" data-remote="true">我的资源</a>
|
||||
<% elsif !params[:subfield_file_id].nil? %>
|
||||
<a href="<%= import_resources_user_path(User.current, :type => '6', :subfield_file_id => params[:subfield_file_id]) %>" class="subjectChoose chooseActive fl" data-remote="true">公共资源</a>
|
||||
<a href="<%= import_resources_user_path(User.current, :type => '1', :subfield_file_id => params[:subfield_file_id]) %>" class="subjectChoose fl" data-remote="true">我的资源</a>
|
||||
<a href="<%= import_resources_user_path(User.current, :type => '6', :subfield_file_id => params[:subfield_file_id]) %>" id="public_resources_choose" class="subject-choose choose-active fl" data-remote="true">公共资源</a>
|
||||
<a href="<%= import_resources_user_path(User.current, :type => '1', :subfield_file_id => params[:subfield_file_id]) %>" id="my_resources_choose" class="subject-choose fl" data-remote="true">我的资源</a>
|
||||
<% end %>
|
||||
<%= form_tag( url_for(:controller => 'users', :action => 'resource_search', :id => User.current.id),
|
||||
<%#= form_tag( url_for(:controller => 'users', :action => 'import_resources_search', :id => User.current.id, :type => 1),
|
||||
:remote => true , :method => 'get', :id => 'resource_search_form') do %>
|
||||
<input type="text" name="search" placeholder="输入资源关键词进行搜索" class="subjectSearch fr" />
|
||||
<%= hidden_field_tag(:type,type.nil? ? 1 : type) %>
|
||||
<% end %>
|
||||
<!--<input type="text" name="search" placeholder="输入资源关键词进行搜索" class="subjectSearch fr" />-->
|
||||
<%#= hidden_field_tag(:type,type.nil? ? 1 : type) %>
|
||||
<%# end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
|
||||
|
@ -50,7 +55,7 @@
|
|||
</label>
|
||||
</li>
|
||||
<li class="subjectType fl"><%= get_resource_type(attach.container_type)%></li>
|
||||
<li class="subjectCount fl"><%= number_to_human_size(attach.filesize) %></li>
|
||||
<li class="subjectCount fl hidden"><%= number_to_human_size(attach.filesize) %></li>
|
||||
<li class="subjectPublisher fl"><%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %></li>
|
||||
<li class="fl subjectDate"><%= format_date(attach.created_on) %></li>
|
||||
</ul>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<% if params[:project_id] %>
|
||||
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :project_id => params[:project_id]} ) %>');
|
||||
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :project_id => params[:project_id]} ) %>');
|
||||
<% elsif params[:course_id] %>
|
||||
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :course_id => params[:course_id]} ) %>');
|
||||
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :course_id => params[:course_id]} ) %>');
|
||||
<% elsif params[:subfield_file_id] %>
|
||||
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :subfield_file_id => params[:subfield_file_id]} ) %>');
|
||||
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => @type, :subfield_file_id => params[:subfield_file_id]} ) %>');
|
||||
<% end %>
|
||||
showModal('ajax-modal', '615px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
//$("#resources_list").html('<%#= escape_javascript( render :partial => 'users/import_resource_info' ,:locals=>{ :attachments => @attachments, :type => @type})%>');
|
||||
//$("#pages").html('<%#= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
||||
//$("#res_all_count").html(<%#= @atta_count%>);
|
||||
//$("#res_count").html(0);
|
||||
//$("#checkboxAll").attr('checked',false);
|
||||
|
||||
|
||||
<% if params[:project_id] %>
|
||||
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :project_id => params[:project_id]} ) %>');
|
||||
<% elsif params[:course_id] %>
|
||||
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :course_id => params[:course_id]} ) %>');
|
||||
<% elsif params[:subfield_file_id] %>
|
||||
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :subfield_file_id => params[:subfield_file_id]} ) %>');
|
||||
<% end %>
|
||||
showModal('ajax-modal', '615px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 580px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||
<% if params[:project_id] %>
|
||||
$('#ajax-modal').parent().css("top","10%").css("left","34%").css("border","3px solid #269ac9");
|
||||
<% else %>
|
||||
$('#ajax-modal').parent().css("top","20%").css("left","42%").css("border","3px solid #269ac9");
|
||||
<% end %>
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
}
|
||||
$(document).ready(function(){
|
||||
$(".resource-switch").click(function(){
|
||||
$(".resource-switch").click(function(){
|
||||
$(".resource-switch").children().removeClass("resource-tab-active");
|
||||
$(this).children().addClass("resource-tab-active");
|
||||
});
|
||||
|
@ -69,14 +69,13 @@
|
|||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<ul class="resource-banner">
|
||||
<li class="fl resource-switch">
|
||||
<a href="<%= user_resource_user_path(@user, :type => '6') %>" class="resource-tab resource-tab-active" data-remote="true">公共资源</a>
|
||||
<a href="<%= user_resource_user_path(@user, :type => '6', :status => @status) %>" class="resource-tab resource-tab-active" id="public_resource_list" data-remote="true">公共资源</a>
|
||||
</li>
|
||||
<li class="fl resource-switch">
|
||||
<a href="<%= user_resource_user_path(@user, :type => '1') %>" class="resource-tab" data-remote="true">我的资源</a>
|
||||
<a href="<%= user_resource_user_path(@user, :type => '1', :status => @status) %>" class="resource-tab" id="my_resource_list" data-remote="true">我的资源</a>
|
||||
</li>
|
||||
<li class="fl w770 border-bottom h34"> </li>
|
||||
<li class="fr resource-banner-li border-bottom h34">
|
||||
|
@ -84,19 +83,23 @@
|
|||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
<ul class="resourcesType">
|
||||
<li>
|
||||
<%= link_to '全部' ,user_resource_user_path(:id => @user.id, :type => 1), :remote => true, :method => 'get', :class => 'resourcesTypeAll resourcesGrey' %>
|
||||
<a href="<%= user_resource_user_path(:id => @user.id, :type => @type, :status => 1)%>" id="resource_type_all" class="resourcesTypeAll resourcesGrey" data-method="get" data-remote="true">全部 </a>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to '课程资源' ,user_resource_user_path(:id => @user.id, :type => 2), :remote => true, :method => 'get', :class=> 'homepagePostTypeAssignment postTypeGrey' %>
|
||||
<a href="<%= user_resource_user_path(:id => @user.id, :type => @type, :status => 2) %>" id="resource_type_course" class="homepagePostTypeAssignment postTypeGrey'" data-method="get" data-remote="true">课程资源 </a>
|
||||
<%#= link_to '课程资源' ,user_resource_user_path(:id => @user.id, :type => 2), id="resource_type_course", :remote => true, :method => 'get', :class=> 'homepagePostTypeAssignment postTypeGrey' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to '项目资源' ,user_resource_user_path(:id => @user.id, :type => 3), :remote => true, :method => 'get', :class => 'homepagePostTypeQuiz postTypeGrey' %>
|
||||
<a href="<%= user_resource_user_path(:id => @user.id, :type => @type, :status => 3) %>" id="resource_type_project" class="homepagePostTypeQuiz postTypeGrey" data-method="get" data-remote="true">项目资源 </a>
|
||||
<%#= link_to '项目资源' ,user_resource_user_path(:id => @user.id, :type => 3), id="resource_type_project", :remote => true, :method => 'get', :class => 'homepagePostTypeQuiz postTypeGrey' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to '用户资源' ,user_resource_user_path(:id=>@user.id,:type=>5),:remote=>true,:method => 'get', :class=>'resourcesTypeUser resourcesGrey' %>
|
||||
<a href="<%= user_resource_user_path(:id => @user.id, :type => @type, :status => 5) %>" id="resource_type_user" class="resourcesTypeUser resourcesGrey" data-method="get" data-remote="true">用户资源 </a>
|
||||
<%#= link_to '用户资源' ,user_resource_user_path(:id=>@user.id,:type=>5), id="resource_type_user", :remote=>true,:method => 'get', :class=>'resourcesTypeUser resourcesGrey' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to '附件' ,user_resource_user_path(:id=>@user.id,:type=>4),:remote=>true,:method => 'get',:class=>'resourcesTypeAtt resourcesGrey' %>
|
||||
<a href="<%= user_resource_user_path(:id => @user.id, :type => @type, :status => 4) %>" id="resource_type_file" class="resourcesTypeAtt resourcesGrey" data-method="get" data-remote="true">附件 </a>
|
||||
<%#= link_to '附件' ,user_resource_user_path(:id=>@user.id,:type=>4), id="resource_type_file", :remote=>true,:method => 'get',:class=>'resourcesTypeAtt resourcesGrey' %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -3,4 +3,13 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_
|
|||
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
||||
$("#res_count").html(0);
|
||||
$("#checkboxAll").attr('checked',false);
|
||||
$("#res_all_count").html(<%= @atta_count%>);
|
||||
$("#res_all_count").html(<%= @atta_count %>);
|
||||
|
||||
$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6', :status => @status) %>');
|
||||
$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1', :status => @status) %>');
|
||||
|
||||
$("#resource_type_all").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 1) %>');
|
||||
$("#resource_type_course").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 2) %>');
|
||||
$("#resource_type_project").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 3) %>');
|
||||
$("#resource_type_user").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 5) %>');
|
||||
$("#resource_type_file").attr('href','<%= user_resource_user_path(@user,:type => @type, :status => 4) %>');
|
||||
|
|
|
@ -538,6 +538,7 @@ RedmineApp::Application.routes.draw do
|
|||
get 'edit_brief_introduction'
|
||||
get "user_resource"
|
||||
get "import_resources"
|
||||
get "import_resources_search"
|
||||
post "import_into_container"
|
||||
get "resource_search"
|
||||
post "user_resource_create"
|
||||
|
|
Loading…
Reference in New Issue