Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
cxt 2016-05-20 15:39:16 +08:00
commit 7b0fd246ff
35 changed files with 468 additions and 74 deletions

View File

@ -256,6 +256,13 @@ class FilesController < ApplicationController
@order = ""
@is_remote = false
if params[:project_id]
# 更新资源申请消息为已读
# ar_ids = ApplyResource.where("user_id =? and container_id =? and container_type =?", User.current.id, params[:project_id].to_i, "Project").map{|ar| ar.id}
# cms = CourseMessage.where("course_message_type =? and user_id =? and course_message_id in (#{ar_ids.empty? ? '0': ar_ids.join(',')})", "ApplyResource", User.current.id)
# cms.each do |cm|
# cm.update_column(:viewed, true)
# end
# over
@page = params[:page] ? params[:page].to_i + 1 : 2
@container_type = 0
if params[:sort]

View File

@ -164,7 +164,7 @@ class OrganizationsController < ApplicationController
return
end
q = params[:search].nil? ? "" : "#{params[:search].strip}"
@field = OrgSubfield.find(params[:org_subfield_id])
@field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Comptec").first : OrgSubfield.find(params[:org_subfield_id])
@type = params[:type]
if @type == "courses" || @type.nil?
@org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count

View File

@ -362,6 +362,8 @@ update
# project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT
# ip = RepositoriesHelper::REPO_IP_ADDRESS
gitlab_address = Redmine::Configuration['gitlab_address']
# REDO:需优化,仅测试用
@zip_path = gitlab_address.to_s + "/api/v3/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=YTyCv4978MXmdL2B9C62"
if @repository.type.to_s == "Repository::Gitlab"
@repos_url = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+@repository.identifier+"."+"git"
else

View File

@ -311,6 +311,28 @@ class UsersController < ApplicationController
end
end
# 处理资源引用请求
# status
def deal_with_apply_resource
@msg = CourseMessage.find(params[:msg_id])
ar = ApplyResource.where("id = ?", @msg.course_message_id).first
unless ar.nil?
case params[:agree]
when 'Y'
ar.update_column('status', 2)
@msg.update_attributes(:apply_result => 1, :viewed => 1)
ar.course_messages << CourseMessage.new(:user_id => ar.user_id, :course_id => -1, :viewed => false, :apply_result => 2, :status => 1)
when 'N'
ar.update_column('status', 3)
@msg.update_attributes(:apply_result => 2, :viewed => 1)
ar.course_messages << CourseMessage.new(:user_id => ar.user_id, :course_id => -1, :viewed => false, :apply_result => 3, :status => 1)
end
end
respond_to do |format|
format.js
end
end
#处理引用作业的请求
#status 1 同意 2 拒绝
def dealwith_apply_homework
@ -419,6 +441,19 @@ class UsersController < ApplicationController
end
# end
# 资源分享请求弹框
def apply_resource
if User.current.logged?
@attachment = Attachment.find params[:attachment_id]
@state = 2
else
@state = 1
end
respond_to do |format|
format.js
end
end
#引用作业请求弹框
def apply_homework
if User.current.logged?
@ -432,6 +467,27 @@ class UsersController < ApplicationController
end
end
# 申请引用资源
def apply_for_resource
if User.current.logged?
@attachment = Attachment.where("id =?", params[:attachment_id].to_i).first
unless @attachment.nil?
ar = ApplyResource.where("user_id = ? and attachment_id = ?", User.current.id, params[:attacment_id].to_i)
if ar.empty?
ApplyResource.create(:user_id => params[:id].to_i, :attachment_id => params[:attachment_id].to_i, :status => true, :container_id => @attachment.container_id, :container_type => @attachment.container_type, :content => params[:content], :apply_user_id => @attachment.author_id)
@state = 2
else
@state = 3
end
end
else
@state = 1
end
respond_to do |format|
format.js
end
end
#申请引用非公开作业
def apply_for_homework
if User.current.logged?
@ -1886,7 +1942,7 @@ class UsersController < ApplicationController
# 将资源发送到对应的课程,分为发送单个,或者批量发送
def add_exist_file_to_course
@flag = true
if params[:send_id].present?
if params[:send_id].present?
send_id = params[:send_id]
@ori = Attachment.find_by_id(send_id)
course_ids = params[:course_ids]
@ -1933,14 +1989,14 @@ class UsersController < ApplicationController
end
send_ids.each do |send_id|
quotes = 0
ori = Attachment.find_by_id(send_id)
@ori = Attachment.find_by_id(send_id)
unless course_ids.nil?
course_ids.each do |id|
quotes = 0
next if ori.blank?
next if @ori.blank?
@exist = false
Course.find(id).attachments.each do |att| #如果课程中包含该资源
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
if att.id == @ori.id || (!att.copy_from.nil? && !@ori.copy_from.nil? && att.copy_from == @ori.copy_from) || att.copy_from == @ori.id || att.id == @ori.copy_from
att.created_on = Time.now
att.save
@exist = true
@ -1948,21 +2004,21 @@ class UsersController < ApplicationController
end
end
next if @exist
attach_copied_obj = ori.copy
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
attach_copied_obj = @ori.copy
attach_copied_obj.tag_list.add(@ori.tag_list) # tag关联
attach_copied_obj.container = Course.find(id)
attach_copied_obj.created_on = Time.now
attach_copied_obj.author_id = User.current.id
attach_copied_obj.is_public = 0
attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from
attach_copied_obj.copy_from = @ori.copy_from.nil? ? @ori.id : @ori.copy_from #发送要添加copy_from
if attach_copied_obj.attachtype == nil
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)
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
end
@ -2002,6 +2058,18 @@ class UsersController < ApplicationController
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
elsif params[:type] == "2"
apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id}
if params[:status] == "2"
resource_type = "'Course'"
elsif params[:status] == "3"
resource_type = "'Project'"
elsif params[:status] == "5"
resource_type = "'Principal'"
else
resource_type = "'Project','OrgSubfield','Principal','Course'"
end
@attachments = get_my_private_resources(apply_ids, resource_type, @order, @score)
end
@type = params[:type]
@limit = 25
@ -2143,6 +2211,18 @@ class UsersController < ApplicationController
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
elsif params[:type] == "2"
apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id}
if params[:status] == "2"
resource_type = "'Course'"
elsif params[:status] == "3"
resource_type = "'Project'"
elsif params[:status] == "5"
resource_type = "'Principal'"
else
resource_type = "'Project','OrgSubfield','Principal','Course'"
end
@attachments = get_my_private_resources(apply_ids, resource_type, @order, @score)
end
@status = params[:status]
@type = params[:type]
@ -2272,6 +2352,18 @@ class UsersController < ApplicationController
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
elsif params[:type] == "2"
apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id}
if params[:status] == "2"
resource_type = "'Course'"
elsif params[:status] == "3"
resource_type = "'Project'"
elsif params[:status] == "5"
resource_type = "'Principal'"
else
resource_type = "'Project','OrgSubfield','Principal','Course'"
end
@attachments = get_my_private_resources(apply_ids, resource_type, @order, @score)
end
@type = params[:type]
@limit = 25
@ -2608,7 +2700,7 @@ class UsersController < ApplicationController
# 获取公共资源
def get_public_resources user_course_ids, user_project_ids, order, score
attachments = Attachment.where("(is_publish = 1 and is_public =1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course')) ").order("#{order.nil? ? 'created_on' : order} #{score}")
attachments = Attachment.where("(is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course')) ").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取公共资源搜索
@ -2637,6 +2729,16 @@ class UsersController < ApplicationController
and is_publish = 1 and container_id is not null)" ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的私有资源分享结果
def get_my_private_resources apply_ids, resource_type, order, score
attachments = Attachment.where("id in (#{apply_ids.empty? ? '0': apply_ids.join(',')}) and container_type in(#{resource_type})").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的私有资源分享搜索结果
def get_my_private_resources_search apply_ids, resource_type, order, score, search
attachments = Attachment.where("id in (#{apply_ids.empty? ? '0': apply_ids.join(',')}) and container_type in(#{resource_type}) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的课程资源中搜索结果
def get_course_resources_search author_id, user_course_ids, order, score, search
attchments = Attachment.where("((author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Course')"+
@ -2646,12 +2748,12 @@ class UsersController < ApplicationController
# 获取公共资源中课程资源
def get_course_resources_public user_course_ids, order, score
attchments = Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1 and is_public =1)").order("#{order.nil? ? 'created_on' : order} #{score}")
attchments = Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1)").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取公共资源中课程资源搜索结果
def get_course_resources_public_search user_course_ids, order, score, search
attchments = Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1 and is_public =1) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
attchments = Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的项目资源
@ -2670,12 +2772,12 @@ class UsersController < ApplicationController
# 获取公共资源的项目资源
def get_project_resources_public user_project_ids, order, score
attchments = Attachment.where("container_type = 'Project' and container_id is not null and is_public =1").order("#{order.nil? ? 'created_on' : order} #{score}")
attchments = Attachment.where("container_type = 'Project' and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取公共资源的项目资源搜索
def get_project_resources_public_search user_project_ids, order, score, search
attchments = Attachment.where("(container_type = 'Project' and container_id is not null and is_public =1) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
attchments = Attachment.where("(container_type = 'Project' and container_id is not null) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我上传的附件
@ -2693,13 +2795,13 @@ class UsersController < ApplicationController
# 获取公共资源中我上传的附件
def get_attch_resources_public order, score
attchments = Attachment.where("container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')
and container_id is not null and is_public =1").order("#{order.nil? ? 'created_on' : order} #{score}")
and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取公共资源中我上传的附件
def get_attch_resources_public_search order, score, search
attchments = Attachment.where("(container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')
and container_id is not null and is_public =1) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
and container_id is not null) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的用户类型资源
@ -2714,12 +2816,12 @@ class UsersController < ApplicationController
# 获取我的用户类型资源
def get_principal_resources_public order, score
attchments = Attachment.where("container_type = 'Principal'and container_id is not null and is_public =1").order("#{order.nil? ? 'created_on' : order} #{score}")
attchments = Attachment.where("container_type = 'Principal'and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的用户类型资源
def get_principal_resources_public_search order, score, search
attchments = Attachment.where("(container_type = 'Principal'and container_id is not null and is_public =1) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
attchments = Attachment.where("(container_type = 'Principal'and container_id is not null) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 资源库 分为全部 课程资源 项目资源 附件
@ -2734,7 +2836,7 @@ class UsersController < ApplicationController
user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id}
user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id }
# user_org_ids = User.current.organizations.map {|o| o.id}
if(params[:type].blank? || params[:type] == "1") # 我的资源
if( params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
if params[:status] == "2"
@attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
@ -2748,7 +2850,7 @@ class UsersController < ApplicationController
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
end
elsif params[:type] == "6" # 公共资源
elsif (params[:type].blank? || params[:type] == "6") # 公共资源
if params[:status] == "2"
@attachments = get_course_resources_public( user_course_ids, @order, @score)
elsif params[:status] == "3"
@ -2761,6 +2863,18 @@ class UsersController < ApplicationController
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
elsif params[:type] == "2" # 私有资源
apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id}
if params[:status] == "2"
resource_type = "'Course'"
elsif params[:status] == "3"
resource_type = "'Project'"
elsif params[:status] == "5"
resource_type = "'Principal'"
else
resource_type = "'Project','OrgSubfield','Principal','Course'"
end
@attachments = get_my_private_resources(apply_ids, resource_type, @order, @score)
end
@status = params[:status]
@type = params[:type]
@ -2780,8 +2894,7 @@ class UsersController < ApplicationController
# 导入资源
def import_resources
# 别人的资源库是没有权限去看的
@user = User.find_by_login(params[:id])
if User.current != @user
if User.current.id != params[:id].to_i
render_403
return
end
@ -2941,6 +3054,19 @@ class UsersController < ApplicationController
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_public_resources_search(user_course_ids, user_project_ids, @order, @score, search)
end
elsif params[:type] == "2" # 私有资源
apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id}
if params[:status] == "2"
resource_type = "'Course'"
elsif params[:status] == "3"
resource_type = "'Project'"
elsif params[:status] == "5"
resource_type = "'Principal'"
else
resource_type = "'Project','OrgSubfield','Principal','Course'"
end
@attachments = get_my_private_resources_search(apply_ids, resource_type, @order, @score, search)
@attachments
end
@status = params[:status]
@type = params[:type]

View File

@ -0,0 +1,19 @@
class ApplyResource < ActiveRecord::Base
# status1. 等待回复 2.审核通过 3.已拒绝
attr_accessible :attachment_id, :status, :user_id, :container_type, :container_id, :apply_user_id, :content
belongs_to :user
belongs_to :attachment
has_many :course_messages, :class_name => 'CourseMessage', :as => :course_message, :dependent => :destroy
after_create :act_as_apply_resource_message
def act_as_apply_resource_message
self.course_messages << CourseMessage.new(:user_id => self.apply_user_id, :course_id => -1, :viewed => false, :status => 0, )
# REDO:发送邮件
# Mailer.run.apply_for_resource_request(self.container_id, User.current)
end
def find_attachment attachment_id
Attachment.find(attachment_id)
end
end

View File

@ -35,6 +35,7 @@ class Attachment < ActiveRecord::Base
# end
include UserScoreHelper
has_many :attachment_histories
has_many :apply_resources, :dependent => :destroy
validates :filename, presence: true, length: {maximum: 254}
validates :author, presence: true
@ -139,6 +140,11 @@ class Attachment < ActiveRecord::Base
}
)
end
def get_apply_resource_status attachment_id, author_id
ApplyResource.where("attachment_id =? and apply_user_id =?", attachment_id, author_id).first.try(:status)
end
# add by nwb
# 公开的项目id列表
def self.public_project_id
@ -536,6 +542,11 @@ class Attachment < ActiveRecord::Base
end
end
# 获取资源申请状态
def get_status_by_attach user_id
ApplyResource.where("user_id =? and attachment_id =?", user_id, self.id).first.try(:status)
end
private
# Physically deletes the file from the file system

View File

@ -1,5 +1,7 @@
class CourseMessage < ActiveRecord::Base
# status说明 status在课程不同的类型区分不同的功能 status = 9 作品的提交记录
# ApplyResource status:
# 0: 发送申请 1回复允许申请 2拒绝申请消息
# HomeworkCommonstatus
# nil发布了作业 1作业截止时间到了提醒2:开启匿评; 3关闭匿评 4匿评开始失败 5申请引用作业, 6:申请结果
# apply_user_id: 申请者的用户id

View File

@ -109,6 +109,7 @@ class User < Principal
has_many :student_works_scores, :dependent => :destroy
has_many :student_work_projects, :dependent => :destroy
has_many :apply_homeworks, :dependent => :destroy
has_many :apply_resources, :dependent => :destroy
#end
has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)},

View File

@ -9,8 +9,7 @@
</div>
<div class="resources mt10">
<div class="function-row" id="org_teacher_search">
<%= form_tag( url_for(:controller => 'organizations', :action => 'teachers', :type => @type),
:remote => true , :method => 'get', :id => 'resource_search_form') do %>
<%= form_tag(url_for(:controller => 'organizations', :action => 'teachers', :type => @type), :remote => true , :method => 'get', :id => 'resource_search_form') do %>
<input type="text" name="search" placeholder="输入教师名进行搜索" class="teacher-list-search fl" />
<%= submit_tag '', :class => 'homepageSearchIcon', :onfocus => 'this.blur();', :class => "teacher-search-icon fl" %>
<!--<a href="javascript:void(0);" onclick='this.parent.submit();return false;' class="searchIcon"></a>-->

View File

@ -1,7 +1,7 @@
<%= call_hook(:view_repositories_show_contextual, {:repository => @repository, :project => @project}) %>
<div class="project_r_h">
<div class="fl"><h2 class="project_h2_repository"><%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %></h2></div>
<!--<a href="javascript:void(0);" class="btn_zipdown fr" onclick="">ZIP下载</a>-->
<a href="<%= @zip_path %>" class="btn_zipdown fr" onclick="">ZIP下载</a>
</div>
<div class="repository_con" style="line-height:1.9;">

View File

@ -0,0 +1,16 @@
<div>
<div class="ni_con">
<p class="mt30">
<% if state == 2 %>
请求已发送至<%= attachment.author.show_name %>,希望他同意与你分享:)
<% elsif state == 3 %>
您已发送过分享请求,请勿重复发送。
<% end %>
</p>
<div class="ni_btn">
<a href="javascript:" class="tijiao" onclick="hideModal();" style="margin-bottom: 10px; margin-left: 60px; color: #fff;" >
确&nbsp;&nbsp;定
</a>
</div>
</div>
</div>

View File

@ -0,0 +1,28 @@
<div>
<div class="ni_con">
<%= form_tag(apply_for_resource_user_path(:id => User.current.id, :attachment_id => attachment.id), :multipart => true, :remote => true, :name=>"apply_for_homework_form", :id=>'apply_for_homework_form') do %>
<h2>申请分享</h2>
<p style="color: #000;">
申请说明(必选):
<textarea type="text" name="content" id="apply_content" placeholder="请附言,以增加分享的成功机率。" class="apply_content mt10" style="outline:none;"></textarea>
</p>
<span class="c_red ml5 f12" style="display: none" id="apply_content_notice">为增加分享的成功机率,请务必填写申请说明。</span>
<div class="ni_btn">
<a href="javascript:" class="tijiao" onclick="submit_apply_resource();" style="margin-bottom: 20px; margin-left: 60px; color: #fff">
确&nbsp;&nbsp;定
</a>
</div>
<% end %>
</div>
</div>
<script type="application/javascript">
var first_click_apply = true;
function submit_apply_resource(){
if($.trim($("#apply_content").val()) == ""){
$("#apply_content_notice").show();
} else if(first_click_apply) {
first_click_apply = false;
$('#apply_for_homework_form').submit();
}
}
</script>

View File

@ -0,0 +1,38 @@
<li class="homepageNewsPortrait fl">
<div class="navHomepageLogo fl">
<%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
</div>
</li>
<li class="homepageNewsPubType fl">
<%= link_to ma.course_message.user.show_name, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">申请引用资源:</span>
</li>
<li class="<%=(ma.apply_result == 0 || ma.apply_result.nil?) ? 'homepageHomeworkContent2' : 'homepageHomeworkContent' %> fl">
<% content = ma.course_message.content.nil? ? '' : ''+ ma.course_message.content.to_s %>
<% show_content = ma.course_message.user.show_name + "申请引用资源\""+"#{ma.course_message.find_attachment(ma.course_message.attachment_id).try(:filename)}"+"\"#{content}" %>
<% if ma.course_message.container_type == "Course" %>
<%= link_to show_content, course_files_path(ma.course_message.container_id), :title => show_content, :class => " #{ma.viewed == 0 ? "newsBlack" : "newsGrey "}" %>
<% elsif ma.course_message.container_type == "Project" %>
<%= link_to show_content, project_files_path(ma.course_message.container_id), :title => show_content, :class => " #{ma.viewed == 0 ? "newsBlack" : "newsGrey "}" %>
<% elsif ma.course_message.container_type == "OrgSubfield" %>
<%= link_to show_content, org_subfield_files_path(ma.course_message.container_id), :title => show_content, :class => " #{ma.viewed == 0 ? "newsBlack" : "newsGrey "}" %>
<% else %>
<a title="<%= show_content %>" class = "<%= ma.viewed == 0 ? "newsBlack" : "newsGrey "%>">
<%= show_content %>
</a>
<% end %>
</li>
<li class="<%=(ma.apply_result == 0 || ma.apply_result.nil?) ? 'homepageHomeworkContentWarn2' : 'homepageHomeworkContentWarn' %> fl">
<span id="deal_info_<%= ma.id %>">
<% if ma.apply_result == 0 || ma.apply_result.nil? %>
<%= link_to '同意', deal_with_apply_resource_user_path(User.current, :agree => 'Y', :msg_id => ma.id, :apply_user_id => ma.course_message.apply_user_id), :remote => 'true' %> |
<%= link_to '拒绝', deal_with_apply_resource_user_path(User.current, :agree => 'N', :msg_id => ma.id, :apply_user_id => ma.course_message.apply_user_id), :remote => 'true' %>
<% elsif ma.apply_result == 1 %>
您已经同意了该申请
<% elsif ma.apply_result == 2 %>
您已经拒绝了该申请
<%end %>
</span>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>

View File

@ -0,0 +1,34 @@
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<% owner = User.find(ma.course_message.apply_user_id) %>
<div class="navHomepageLogo fl">
<%= link_to image_tag(url_to_avatar(owner), :width => "30", :height => "30", class: "mt3"), user_path(owner) %>
</div>
</li>
<li class="homepageNewsPubType fl">
<%= link_to owner.show_name, user_path(owner), :class => "newsBlue homepageNewsPublisher" %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.apply_result == 1 ? '同意' : '拒绝'%>引用资源:</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<% link_str = ma.apply_result == 1 ?
'您申请引用资源"'+ ma.course_message.find_attachment(ma.course_message.attachment_id).try(:filename) + '"的申请已通过'
:
'您申请引用资源"'+ ma.course_message.find_attachment(ma.course_message.attachment_id).try(:filename) + '"的申请被婉拒' %>
<% if ma.course_message.container_type == "Course" %>
<%= link_to link_str, course_files_path(ma.course_message.container_id), :title => link_str, :class => " #{ma.viewed == 0 ? "newsBlack" : "newsGrey "}" %>
<% elsif ma.course_message.container_type == "Project" %>
<%= link_to link_str, project_files_path(ma.course_message.container_id), :title => link_str, :class => " #{ma.viewed == 0 ? "newsBlack" : "newsGrey "}" %>
<% elsif ma.course_message.container_type == "OrgSubfield" %>
<%= link_to link_str, org_subfield_files_path(ma.course_message.container_id), :title => link_str, :class => " #{ma.viewed == 0 ? "newsBlack" : "newsGrey "}" %>
<% else %>
<a title="<%= link_str %>" class = "<%= ma.viewed == 0 ? "newsBlack" : "newsGrey "%>">
<%= link_str %>
</a>
<% end %>
<%= link_to link_str, user_resource_user_path(User.current, :type => 2), :title => link_str,:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey "}" %>
</a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>

View File

@ -6,11 +6,34 @@
<% attachments.each do |attach| %>
<ul class="resource-list" onmouseover="if($('#contextMenu').css('display') != 'block')$(this).children().css('background-color', '#e1e1e1')" onmouseout=" if($('#contextMenu').css('display') == 'none')$(this).children().css('background-color', 'white')">
<li class="resource-list-checkbox fl">
<input name="checkbox1[]" type="checkbox" data-has-history="<%= attach.attachment_histories.count == 0 ? 'N' : 'Y' %>" data-deleteble="<%= User.current.id ==attach.author_id ? 'Y' : 'N' %>" onclick="checkAllBox($(this));" value="<%= attach.id%>" class="resourcesCheckbox" />
<% if attach.is_public == 0 && (@type == "6" || @type == "2") && attach.author != User.current %>
<input name="checkbox1[]" type="checkbox" disabled="disabled" data-has-history="<%= attach.attachment_histories.count == 0 ? 'N' : 'Y' %>" data-deleteble="<%= User.current.id ==attach.author_id ? 'Y' : 'N' %>" onclick="checkAllBox($(this));" value="<%= attach.id%>" class="resourcesCheckbox" />
<% else %>
<input name="checkbox1[]" type="checkbox" data-has-history="<%= attach.attachment_histories.count == 0 ? 'N' : 'Y' %>" data-deleteble="<%= User.current.id ==attach.author_id ? 'Y' : 'N' %>" onclick="checkAllBox($(this));" value="<%= attach.id%>" class="resourcesCheckbox" />
<% end %>
<!--<input name="checkbox2" type="checkbox" value="" class="resourcesCheckbox" />-->
</li>
<li class="resource-list-name fl hidden">
<%= link_to truncate(attach.filename, :length => 30), download_named_attachment_path(attach.id, attach.filename), :title => attach.filename, :class => 'resourcesBlack' %>
<li class="resource-list-name fl">
<%= link_to truncate(attach.filename, :length => 30), download_named_attachment_path(attach.id, attach.filename), :title => attach.filename, :class => 'resourcesBlack resource-list-middle hidden mw280' %>
<% if attach.is_public == 0 && (@type == "6" || @type == "2") && attach.author != User.current %>
<img src="/images/locked.png" alt="私有" title="私有" class="resource-list-middle" height="16" width="16">
<% end %>
</li>
<li class="resource-list-apply fr" id="resource_apply_status_<%=attach.id %>">
<% if attach.is_public == 0 && (@type == "6" || @type == "2") && attach.author != User.current %>
<% ah = attach.get_status_by_attach(User.current.id) %>
<% if ah.nil? %>
<%= link_to("请求分享", apply_resource_user_path(User.current.id, :attachment_id => attach.id), :class => 'green_btn_share c_white', :remote => true) %>
<% elsif ah == 1 %>
等待回复
<% elsif ah == 2 %>
可引用
<% elsif ah == 3 %>
已拒绝
<% end %>
<% else %>
--
<% end %>
</li>
<li class="resource-list-time fr"><%= format_date(attach.created_on) %></li>
<li class="resource-list-quote fr"><%= attach.quotes.nil? ? 0 : attach.quotes %></li>
@ -20,6 +43,8 @@
<li class="resource-list-uploader fr hidden"><%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %></li>
<li class="resource-list-type fr"><%= get_resource_type(attach.container_type)%></li>
<li class="resource-list-from fr hidden" title="<%= get_resource_origin(attach) %>"><%= get_resource_origin(attach) %></li>
<li style="display: none"><%= attach.is_public %></li>
<li style="display: none"><%= attach.get_apply_resource_status(attach.id, attach.author_id) %></li>
<li style="display: none"><%= attach.id %></li>
</ul>
<div class="cl"></div>
@ -68,19 +93,27 @@
document.oncontextmenu = function() {return true;}
line.children().css("background-color",'white');
id = line.children().last().html();
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
$.ajax({
type: 'get',
url: '<%= search_user_project_user_path(User.current.id) %>' + "?send_id=" + id + "&type=<%= @type %>",
data:{send_type:'file'}
});
is_public = line.children().eq(11).html();
user_id = line.children().eq(6).html();
apply_status = line.children().eq(12).html();
if(is_public == 0 && user_id != '<%= User.current.id %>' && apply_status != 2){
alert('您无权发送私有资源')
}else{
$.ajax({
type: 'get',
url: '<%= search_user_course_user_path(User.current.id)%>' + "?send_id=" + id + "&type=<%= @type %>",
data:{send_type:'file'}
});
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
$.ajax({
type: 'get',
url: '<%= search_user_project_user_path(User.current.id) %>' + "?send_id=" + id + "&type=<%= @type %>",
data:{send_type:'file'}
});
}else{
$.ajax({
type: 'get',
url: '<%= search_user_course_user_path(User.current.id)%>' + "?send_id=" + id + "&type=<%= @type %>",
data:{send_type:'file'}
});
}
}
}
function batch_send(){
@ -176,7 +209,7 @@
}
line.children().css("background-color", 'white');
id = line.children().last().html();
user_id = line.children().eq(5).html();
user_id = line.children().eq(6).html();
if(line.children().first().children().data('hasHistory') == 'Y'){
alert('该资源存在历史版本,不能删除');
return;

View File

@ -0,0 +1,3 @@
<% if @type != "2" %>
<div class="resourcesUploadBox mt10" ><a href="javascript:void(0);" onclick="show_upload();" class="uploadBoxIcon">上传资源</a></div>
<% end %>

View File

@ -234,6 +234,18 @@
<%= render :partial => 'apply_homework_course_message', :locals => {:ma => ma} %>
</ul>
<% end %>
<!--资源申请-->
<% if ma.course_message_type == "ApplyResource" && ma.status == 0 %>
<ul class="homepageNewsList fl" id="apply_resource_message_<%=ma.id %>">
<%= render :partial => 'apply_resource_course_message', :locals => {:ma => ma} %>
</ul>
<% end %>
<!--资源申请回复-->
<% if ma.course_message_type == "ApplyResource" && ma.status == 1 %>
<ul class="homepageNewsList fl" id="apply_resource_message_<%=ma.id %>">
<%= render :partial => 'apply_resource_course_message_reply', :locals => {:ma => ma} %>
</ul>
<% end %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 6 %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><div class="navHomepageLogo fl"><%= image_tag(url_to_avatar(User.find(ma.apply_user_id)), width: "30px", height: "30px", class: "mt3") %></div></a></li>

View File

@ -1,5 +1,7 @@
<div id="users_setting">
<div class="resourcesUploadBox mt10"><a href="javascript:void(0);" onclick="show_upload();" class="uploadBoxIcon">上传资源</a></div>
<div id="upload_private_resource">
<%= render :partial => "show_new_upload", :locals => {:type => @type, :status => @status} %>
</div>
<div id="search_div">
<%= render :partial => 'users/resource_search_form',:locals => {:user => @user, :type => @type, :order => @order, :sort => @score, :status => @status} %>
</div>
@ -212,7 +214,7 @@
document.oncontextmenu = function() {return true;}
line.children().css("background-color",'white');
id = line.children().last().html();
user_id = line.children().eq(5).html();
user_id = line.children().eq(6).html();
if(user_id === '<%= User.current.id %>') {
res_name = line.children().eq(1).children().attr('title');
res_link = line.children().eq(1).html();

View File

@ -1,6 +1,7 @@
<ul class="resource-list-tab mt10" id="resource_tip_list">
<li class="resource-list-checkbox fl"> </li>
<li class="resource-list-name fl">资源名称</li>
<li class="resource-list-apply fr">操作</li>
<li class="resource-list-time fr">
<%= link_to "上传时间", resource_search_user_path(:type => @type, :status => @status, :sort => @score, :order => "created_on", :search => " "), :class => "fl", :remote => true %>
<% if @order == "created_on" %>

View File

@ -17,7 +17,7 @@
<%#= link_to '用户资源' ,user_resource_user_path(:id=>@user.id,:type=>5), id="resource_type_user", :remote=>true,:method => 'get', :class=>'resourcesTypeUser resourcesGrey' %>
</li>
<div id="my_files_resource">
<% if @type != "6" %>
<% unless (@type == "6" || @type == "2") %>
<li>
<a href="<%= resource_search_user_path(:id => @user.id, :type => @type, :status => 4, :search => @switch_search) %>" 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' %>

View File

@ -1,7 +1,10 @@
<% if @flag == true%>
$("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} ) %>');
$("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form',:locals => {:user => @user, :type => @type} ) %>');
$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>');
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>');
$("#user_resource_type_filter").html('<%= escape_javascript( render :partial => 'user_resource_type_filter' , :locals => {:user => @user, :type => @type, :status => @status}) %>');
$("#upload_private_resource").html('<%= escape_javascript( render :partial => 'show_new_upload' , :locals => {:user => @user, :type => @type, :status => @status}) %>');
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);
$("#res_all_count").html(<%= @atta_count%>);

View File

@ -1,7 +1,10 @@
<% if @flag == true%>
$("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} ) %>');
$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>');
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>');
$("#user_resource_type_filter").html('<%= escape_javascript( render :partial => 'user_resource_type_filter' , :locals => {:user => @user, :type => @type, :status => @status}) %>');
$("#upload_private_resource").html('<%= escape_javascript( render :partial => 'show_new_upload' , :locals => {:user => @user, :type => @type, :status => @status}) %>');
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);
$("#res_all_count").html(<%= @atta_count%>);

View File

@ -0,0 +1,15 @@
<% if @state == 1 %>
hideModal();
alert("您还未登录,请先登录");
<% elsif @state == 2 %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/apply_for_resource', :locals => {:attachment => @attachment, :state => @state}) %>');
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='hideModal();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","30%").css("left","37%").css("position","fixed").css("border","3px solid #269ac9");
$("#resource_apply_status_<%= @attachment.id %>").html("等待回复");
<% elsif @state == 3 %>
hideModal();
alert("您已申请过该资源");
<% end %>

View File

@ -0,0 +1,10 @@
<% if @state == 1 %>
alert("您还未登录");
<% elsif @state == 2 %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/apply_resource', :locals => {:attachment => @attachment}) %>');
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='hideModal();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","30%").css("left","37%").css("position","fixed").css("border","3px solid #269ac9");
<% end %>

View File

@ -0,0 +1 @@
$("#apply_resource_message_<%= @msg.id %>").html('<%= escape_javascript(render :partial => 'users/apply_resource_course_message', :locals => {:ma => @msg}) %>');

View File

@ -55,7 +55,10 @@
<li class="fl resource-switch">
<a href="<%= user_resource_user_path(@user, :type => '1', :status => 6) %>" class="resource-tab" id="my_resource_list" data-remote="true">我的资源</a>
</li>
<li class="fl w770 border-bottom h34">&nbsp;</li>
<li class="fl resource-switch">
<a href="<%= user_resource_user_path(@user, :type => '2', :status => 6) %>" class="resource-tab" id="private_resource_list" data-remote="true">私有资源</a>
</li>
<li class="fl w680 border-bottom h34">&nbsp;</li>
<li class="fr resource-banner-li border-bottom h34">
<div id="user_resource_type_filter">
<%= render :partial => 'user_resource_type_filter' %>

View File

@ -2,6 +2,7 @@ $("#search_div").html('<%= escape_javascript( render :partial => 'resource_searc
$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>');
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' , :locals => { :attachments => @attachments}) %>');
$("#user_resource_type_filter").html('<%= escape_javascript( render :partial => 'user_resource_type_filter' , :locals => {:user => @user, :type => @type, :status => @status}) %>');
$("#upload_private_resource").html('<%= escape_javascript( render :partial => 'show_new_upload' , :locals => {:user => @user, :type => @type, :status => @status}) %>');
$("#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);

View File

@ -561,6 +561,7 @@ RedmineApp::Application.routes.draw do
match 'apply_homework', :to => 'users#apply_homework', :via => :get
match 'user_homeworks', :to => 'users#user_homeworks', :via => :get
match 'student_homeworks', :to => 'users#student_homeworks', :via => :get
get 'apply_resource'
get 'user_import_homeworks'
get 'user_search_homeworks'
get 'choose_user_course'
@ -622,6 +623,7 @@ RedmineApp::Application.routes.draw do
post 'import_resources_to_homework'
get 'dealwith_apply_request'
get 'dealwith_apply_homework'
get 'deal_with_apply_resource'
get 'store_selected_resource'
get 'user_organizations'
get 'search_user_orgs'
@ -630,6 +632,7 @@ RedmineApp::Application.routes.draw do
get 'user_ref_homework_search'
get 'show_homework_detail'
post 'apply_for_homework'
post 'apply_for_resource'
# end
end
#resources :blogs

View File

@ -0,0 +1,11 @@
class CreateApplyResources < ActiveRecord::Migration
def change
create_table :apply_resources do |t|
t.integer :status
t.integer :user_id
t.integer :attachment_id
t.timestamps
end
end
end

View File

@ -0,0 +1,6 @@
class AddColumnToApplyResource < ActiveRecord::Migration
def change
add_column :apply_resources, :container_id, :integer
add_column :apply_resources, :container_type, :string
end
end

View File

@ -0,0 +1,6 @@
class AddColumnContentToApplyResource < ActiveRecord::Migration
def change
add_column :apply_resources, :content, :text
add_column :apply_resources, :apply_user_id, :integer
end
end

View File

@ -109,7 +109,7 @@ ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }
.shareDP {width:415px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; z-index:1000;}
.shareArrow {background:url(../images/arrowList.png) -90px -108px no-repeat; display:inline-block; width:5px; height:10px; margin-right:3px;}
.sectionWrap {float:left; max-height:150px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:220px; min-height:150px; padding-top:5px;}
.columnWrap {float:left; max-height:148px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:178px; background-color:#fffff; min-height:148px; padding-top:5px; border:1px solid #f1f1f1;}
.columnWrap {float:left; max-height:148px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:178px; background-color:#ffffff; min-height:148px; padding-top:5px; border:1px solid #f1f1f1;}
.columnWrap li {padding-left:10px; color:#585858;}
.columnWrap span {width:150px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:inline-block;}
.sectionRow:hover {background-color:#cccccc; cursor:pointer;}

View File

@ -185,6 +185,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.h150{ height:150px;}
.p10 {padding-left:10px; padding-right:10px;}
.mw220 {max-width: 220px !important;}
.mw280 {max-width:280px !important;;}
.mw360 {max-width: 360px !important;}
.mw380 {max-width: 380px !important;}
.mw400 {max-width: 400px !important;}
@ -315,6 +316,7 @@ a:hover.orange_n_btn{background:#d63502;}
.bgreen_n_btn{background:#1abc9c; padding:2px 10px; color:#fff;}
a.bgreen_n_btn{background:#1abc9c; padding:2px 10px; color:#fff;}
a:hover.bgreen_n_btn{background:#08a384;}
.green_btn_share{ background:#28be6c; padding:2px 5px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;}
.nolink_btn{ background:#BCBCBC; color: #fff; padding:2px 5px;}
.more_btn{-moz-border-radius:3px; -webkit-border-radius:3px; border:1px solid #9DCEFF; color:#9DCEFF; border-radius:3px; padding:0px 3px;}
@ -1071,30 +1073,6 @@ a.choose-active {background-color:#269ac9; color:#ffffff;}
.whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;}
.whiteSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;}
/*20160226新资源库*/
.resource-wrapper {width:980px; padding:10px; border:1px solid #ddd; background-color:#fff; float:left;}
.resource-list-tab {width:980px; height:40px; background-color:#f6f6f6; border-bottom:1px solid #eaeaea; font-size:14px; color:#7a7a7a;}
.resource-list-checkbox {width:20px; height:40px; line-height:40px; text-align:center; vertical-align:middle;}
.resource-checkbox {margin-top:14px; width:12px; height:12px;}
.resource-list-name {width:380px; height:40px; line-height:40px; text-align:left;}
.resource-list-from {width:150px; height:40px; line-height:40px; text-align:center;}
.resource-list-size {width:60px; height:40px; line-height:40px; text-align:center;}
.resource-list-type {width:80px; height:40px; line-height:40px; text-align:center;}
.resource-list-uploader {width:80px; height:40px; line-height:40px; text-align:center;}
.resource-list-time {width:70px; height:40px; line-height:40px; text-align:center;}
.resource-list-quote {width:60px; height:40px; line-height:40px; text-align:center;}
.resource-list-download {width:60px; height:40px; line-height:40px; text-align:center;}
.resource-list {width:980px; height:39px; background-color:#ffffff; border-bottom:1px dashed #eaeaea; color:#9a9a9a; font-size:12px; margin-left:auto; margin-right:auto; cursor:pointer;}
.resource-list:hover {background-color:#e1e1e1;}
.resource-list-option {width:980px; height:40px; line-height:40px; vertical-align:middle; margin-left:auto; margin-right:auto; background-color:#f6f6f6;}
.resource-check-all {width:20px; height:40px; line-height:40px; text-align:center; vertical-align:middle; float:left;}
.border-bottom {border-bottom:1px solid #ddd;}
.h34 {height:34px;}
.resource-tab {font-size:16px; color:#4d4d4d; width:70px; padding:5px 10px; display:inline-block; text-align:left; border-bottom:1px solid #ddd;}
a.resource-tab-active {color:#fff; background-color:#269ac9; border-bottom:1px solid #269ac9;}
.inactive-text {color:#888888 !important;}
.inactive-border {border:1px solid #888888 !important;}
/*导入资源样式*/
.popupWrap {border:3px solid #269ac9; padding:15px; background-color:#ffffff; position:relative; z-index:1000;}
.resoure-list {width:705px;}
@ -1121,11 +1099,11 @@ a.resource-tab-active {color:#fff; background-color:#269ac9; border-bottom:1px s
.course-search {border: 1px solid #dddddd; height: 25px; width: 200px;outline: none;}
/*20160226新资源库*/
.resource-wrapper {width:980px; background-color:#fff; float:left;}
.resource-wrapper {width:980px; padding:10px; border:1px solid #ddd; background-color:#fff; float:left;}
.resource-list-tab {width:980px; height:40px; background-color:#f6f6f6; border-bottom:1px solid #eaeaea; font-size:14px; color:#7a7a7a;}
.resource-list-checkbox {width:20px; height:40px; line-height:40px; text-align:center; vertical-align:middle;}
.resource-checkbox {margin-top:14px; width:12px; height:12px;}
.resource-list-name {width:380px; height:40px; line-height:40px; text-align:left;}
.resource-list-name {width:310px; height:40px; line-height:40px; text-align:left;}
.resource-list-from {width:150px; height:40px; line-height:40px; text-align:center;}
.resource-list-size {width:80px; height:40px; line-height:40px; text-align:center;}
.resource-list-type {width:80px; height:40px; line-height:40px; text-align:center;}
@ -1133,6 +1111,8 @@ a.resource-tab-active {color:#fff; background-color:#269ac9; border-bottom:1px s
.resource-list-time {width:70px; height:40px; line-height:40px; text-align:center;}
.resource-list-quote {width:60px; height:40px; line-height:40px; text-align:center;}
.resource-list-download {width:60px; height:40px; line-height:40px; text-align:center;}
.resource-list-apply {width:70px; height:40px; line-height:40px; text-align:center;}
.resource-list-middle {line-height:40px; vertical-align:middle; display:inline-block;}
.resource-list {width:980px; height:39px; background-color:#ffffff; border-bottom:1px dashed #eaeaea; color:#9a9a9a; font-size:12px; margin-left:auto; margin-right:auto; cursor:pointer;}
.resource-list:hover {background-color:#e1e1e1;}
.resource-list-option {width:980px; height:40px; line-height:40px; vertical-align:middle; margin-left:auto; margin-right:auto; background-color:#f6f6f6;}
@ -1141,6 +1121,8 @@ a.resource-tab-active {color:#fff; background-color:#269ac9; border-bottom:1px s
.h34 {height:34px;}
.resource-tab {font-size:16px; color:#4d4d4d; width:70px; padding:5px 10px; display:inline-block; text-align:left; border-bottom:1px solid #ddd;}
a.resource-tab-active {color:#fff; background-color:#269ac9; border-bottom:1px solid #269ac9;}
.inactive-text {color:#888888 !important;}
.inactive-border {border:1px solid #888888 !important;}
a.group-btn{ background: url(../images/course/hwork_icon.png) -2px -58px no-repeat !important; height:20px; display:block; padding-left:23px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
a.program-btn{background: url(../images/homepage_icon.png) -86px -393px no-repeat; width:30px; height:20px; display:block; padding-left:23px; color:#888888;}
@ -1152,3 +1134,6 @@ a.st_down{ display: block; width:8px; float:left; height:13px; background:url(..
.likeText{color: #7f7f7f}
.likeNum{color: #7f7f7f}
/*弹框*/
.apply_content{ border:1px solid #ddd;line-height: 16px; height:80px;width:420px; background:#fff; margin-bottom:10px;}

View File

@ -0,0 +1,8 @@
FactoryGirl.define do
factory :apply_resource do
status 1
user_id 1
attachment_id 1
end
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe ApplyResource, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end