diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 9ce76dca8..fd43977ee 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -185,7 +185,6 @@ class AttachmentsController < ApplicationController end @attachment.filename = params[:filename].presence || Redmine::Utils.random_hex(16) saved = @attachment.save - respond_to do |format| format.js format.api { @@ -198,12 +197,43 @@ class AttachmentsController < ApplicationController end end + def upload_attachment_version + @flag = false + Attachment.transaction do + @old_attachment = Attachment.find params[:old_attachment_id] + #取出当前上传的文件 + @attachment = Attachment.find(params[:attachments ].first[1][:attachment_id]) + #将需要修改的记录保存到历史记录 + @history = AttachmentHistory.new + @history.attributes = @old_attachment.attributes.dup.except("id") + @history.attachment_id = params[:old_attachment_id] + #需要更新版本号,需要拿到原来该文件最大的历史版本号 + @old_history = @old_attachment.attachment_histories.reorder('version desc').first + @history.version = @old_history.nil? ? 1 : @old_history.version + 1 + @history.save #历史记录保存完毕 + #将最新保存的记录 数据替换到 需要修改的文件记录 + @old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public") + @old_attachment.save + #删除当前记录 + @attachment.delete + @flag = true + end + + respond_to do |format| + format.js + end + end + def destroy if @attachment.container.respond_to?(:init_journal) @attachment.container.init_journal(User.current) end if @attachment.container - @attachment.container.attachments.delete(@attachment) + if @attachment.container_type == "Issue" + @attachment.destroy + else + @attachment.container.attachments.delete(@attachment) + end else @attachment.destroy end @@ -255,7 +285,7 @@ class AttachmentsController < ApplicationController format.js end end - + def delete_homework @bid = @attachment.container.bid # Make sure association callbacks are called @@ -318,13 +348,13 @@ class AttachmentsController < ApplicationController end respond_to do |format| - format.js + format.js end rescue NoMethodError @save_flag = false @save_message = [] << l(:error_attachment_empty) respond_to do |format| - format.js + format.js end end @@ -494,6 +524,15 @@ class AttachmentsController < ApplicationController end end + #找到文件的所有的历史版本 + def attachment_versions + @attachment = Attachment.find(params[:id]) + @attachment_histories = @attachment.attachment_histories + respond_to do |format| + format.js + end + end + private def find_project @attachment = Attachment.find(params[:id]) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index c5f5c0fc2..ef195712e 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -748,7 +748,16 @@ class FilesController < ApplicationController q = "%#{@q.strip}%" @result = find_course_attache q,@course,sort @result = visable_attachemnts @result - @result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} unless @tag_name.blank? + 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 diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 46362c2d3..d345fba5f 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -63,7 +63,7 @@ class HomeworkCommonController < ApplicationController end @homework.end_time = params[:homework_common][:end_time] || Time.now @homework.course_id = params[:course_id] - @homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 1 + @homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0 homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0 diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 77dc1a9aa..c3f926867 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -85,7 +85,7 @@ class IssuesController < ApplicationController params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1 @offset ||= @issue_pages.offset @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], - :order => sort_clause, + :order => 'issues.updated_on desc', :offset => @offset, :limit => @limit) if params[:set_filter] diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index de9ec9852..72bffa06c 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -211,6 +211,8 @@ class MessagesController < ApplicationController end if params[:user_activity_id] @user_activity_id = params[:user_activity_id] + @is_course = params[:is_course] + @is_board = params[:is_board] respond_to do |format| format.js end @@ -241,38 +243,42 @@ class MessagesController < ApplicationController if request.post? && @message.save attachments = Attachment.attach_files(@message, params[:attachments]) render_attachment_warning_if_needed(@message) - flash[:notice] = l(:notice_successful_update) + #flash[:notice] = l(:notice_successful_update) @message.reload - if params[:is_board] + if params[:is_course] && params[:is_course].to_i == 0 + redirect_to user_activities_path(User.current.id) + elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 0 if @project - redirect_to project_boards_path(@project) + redirect_to project_path(@project) elsif @course - redirect_to course_boards_path(@course) + redirect_to course_activity_path(@course) end - else - redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)) - end - elsif request.get? || request.post? - if params[:is_board] + elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 1 if @project redirect_to project_boards_path(@project) elsif @course redirect_to course_boards_path(@course) end else - respond_to do |format| - format.html { - if @project - layout_file = 'base_projects' - elsif @course - layout_file = 'base_courses' - elsif @org_subfield - @organization = @org_subfield.organization - layout_file = 'base_org' - end - render :layout => layout_file - } - end + redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)) + end + elsif request.get? || request.post? + if params[:is_course] && params[:is_board] + @is_course = params[:is_course] + @is_board = params[:is_board] + end + respond_to do |format| + format.html { + if @project + layout_file = 'base_projects' + elsif @course + layout_file = 'base_courses' + elsif @org_subfield + @organization = @org_subfield.organization + layout_file = 'base_org' + end + render :layout => layout_file + } end end end @@ -290,25 +296,28 @@ class MessagesController < ApplicationController @message.destroy # modify by nwb if @project - if params[:is_board] - redirect_to project_boards_url(@project) + if params[:is_course] && params[:is_course].to_i == 0 + redirect_to user_activities_path(User.current.id) + elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 0 + redirect_to project_path(@project) + elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 1 + redirect_to project_boards_path(@project) + elsif @message.parent + redirect_to board_message_url(@board, @message.parent, :r => r) else - if @message.parent - redirect_to board_message_url(@board, @message.parent, :r => r) - else - redirect_to project_board_url(@project, @board) - end - # redirect_to board_message_url(@board, @topic, :r => @reply) + redirect_to project_board_url(@project, @board) end elsif @course - if params[:is_board] - redirect_to course_boards_url(@course) + if params[:is_course] && params[:is_course].to_i == 0 + redirect_to user_activities_path(User.current.id) + elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 0 + redirect_to course_activity_path(@course) + elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 1 + redirect_to course_boards_path(@course) + elsif @message.parent + redirect_to board_message_url(@board, @message.parent, :r => r) else - if @message.parent - redirect_to board_message_url(@board, @message.parent, :r => r) - else - redirect_to course_board_url(@course, @board) - end + redirect_to course_boards_path(@course) end elsif @org_subfield if params[:is_board] diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 3c5266f79..ba017579f 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -292,6 +292,13 @@ class OrganizationsController < ApplicationController @org_subfield.update_attribute(:hide, 0) end + def org_resources_subfield + @org = Organization.find(params[:id]) + @subfield = @org.org_subfields.where('field_type = "Resource" ') + respond_to do | format| + format.js + end + end def apply_subdomain @organization = Organization.find(params[:id]) admins = User.where("admin=1") diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 78d8e2b46..d28837858 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -522,7 +522,7 @@ class UsersController < ApplicationController else homework.publish_time = params[:homework_common][:publish_time] end - homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 1 + homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0 homework.homework_type = params[:homework_type].to_i || 1 homework.late_penalty = 10 homework.teacher_priority = 1 @@ -619,7 +619,7 @@ class UsersController < ApplicationController end if(params[:type].blank? || params[:type] == "1") #全部 user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + @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(',')}))").order("created_on desc") elsif params[:type] == "2" #课程资源 user_course_ids = User.current.courses.map { |c| c.id} @@ -875,7 +875,7 @@ class UsersController < ApplicationController #显示更多用户课程 def user_courses4show @page = params[:page].to_i + 1 - @courses = @user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5) + @courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5) end #显示更多用户项目 @@ -1327,12 +1327,12 @@ class UsersController < ApplicationController if(params[:type].blank?|| params[:type] == "1") #全部 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','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + @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(',')}))").order("created_on desc") else user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话,应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源 @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " + - "and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + + "and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") end elsif params[:type] == "2" #课程资源 @@ -1389,12 +1389,12 @@ class UsersController < ApplicationController 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','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + @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(',')}))").order("created_on desc") else user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话,应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源 @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " + - "and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + + "and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") end elsif params[:type] == "2" #课程资源 @@ -1489,11 +1489,23 @@ class UsersController < ApplicationController unless course_ids.nil? course_ids.each do |id| 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 + att.created_on = Time.now + att.save + @exist = true + break + end + end + next if @exist 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 if attach_copied_obj.attachtype == nil attach_copied_obj.attachtype = 4 end @@ -1513,11 +1525,23 @@ class UsersController < ApplicationController unless course_ids.nil? course_ids.each do |id| 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 + att.created_on = Time.now + att.save + @exist = true + break + end + end + next if @exist 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 if attach_copied_obj.attachtype == nil attach_copied_obj.attachtype = 4 end @@ -1530,7 +1554,7 @@ class UsersController < ApplicationController @flag = false end user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + @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(',')}))").order("created_on desc") @type = params[:type] @limit = 25 @@ -1559,11 +1583,23 @@ class UsersController < ApplicationController unless project_ids.nil? project_ids.each do |project_id| next if ori.blank? + @exist = false + Project.find(project_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 + att.created_on = Time.now + att.save + @exist = true + break + end + end + next if @exist attach_copied_obj = ori.copy attach_copied_obj.tag_list.add(ori.tag_list) # tag关联 attach_copied_obj.container = Project.find(project_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 if attach_copied_obj.attachtype == nil attach_copied_obj.attachtype = 1 end @@ -1582,11 +1618,23 @@ class UsersController < ApplicationController unless project_ids.nil? project_ids.each do |project_id| next if ori.blank? + @exist = false + Project.find(project_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 + att.created_on = Time.now + att.save + @exist = true + break + end + end + next if @exist attach_copied_obj = ori.copy attach_copied_obj.tag_list.add(ori.tag_list) # tag关联 attach_copied_obj.container = Project.find(project_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 if attach_copied_obj.attachtype == nil attach_copied_obj.attachtype = 1 end @@ -1598,7 +1646,94 @@ class UsersController < ApplicationController @flag=true end user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + @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(',')}))").order("created_on desc") + @type = params[:type] + @limit = 25 + @user = User.current + @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,25 + respond_to do |format| + format.js + end + end + + def add_exist_file_to_org + @flag = true + if params[:send_id].present? + send_id = params[:send_id] + subfield_id = params[:subfield] + if subfield_id.nil? + @flag = false + end + ori = Attachment.find_by_id(send_id) + unless subfield_id.nil? + attach_copied_obj = ori.copy + @exist = false + OrgSubfield.find(subfield_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 + att.created_on = Time.now + att.save + @exist = true + break + end + end + if @exist == false #如果不存在该资源 + attach_copied_obj.tag_list.add(ori.tag_list) # tag关联 + attach_copied_obj.container = OrgSubfield.find(subfield_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 + if attach_copied_obj.attachtype == nil + attach_copied_obj.attachtype = 1 + end + attach_copied_obj.save + end + end + elsif params[:send_ids].present? + send_ids = params[:send_ids].split(" ") + subfield_id = params[:subfield] + if subfield_id.nil? + @flag = false + end + send_ids.each do |send_id| + + ori = Attachment.find_by_id(send_id) + unless subfield_id.nil? + next if ori.blank? + @exist = false + OrgSubfield.find(subfield_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 + att.created_on = Time.now + att.save + @exist = true + break + end + end + next if @exist + attach_copied_obj = ori.copy + attach_copied_obj.tag_list.add(ori.tag_list) # tag关联 + attach_copied_obj.container = OrgSubfield.find(subfield_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 + if attach_copied_obj.attachtype == nil + attach_copied_obj.attachtype = 1 + end + attach_copied_obj.save + end + end + else + @flag=true + end + 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(',')}))").order("created_on desc") @type = params[:type] @limit = 25 @@ -1614,6 +1749,10 @@ class UsersController < ApplicationController end end + def change_org_subfield + + end + # 资源预览 def resource_preview preview_id = params[:resource_id] @@ -1826,12 +1965,12 @@ class UsersController < ApplicationController if(params[:type].blank? || params[:type] == "1") #全部 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','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + @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(',')}))").order("created_on desc") else user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话,应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源 @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " + - "and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + + "and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") end elsif params[:type] == "2" #课程资源 @@ -1882,7 +2021,7 @@ class UsersController < ApplicationController 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','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + @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") else user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 @@ -1955,6 +2094,23 @@ class UsersController < ApplicationController end end + def search_user_org + @user = User.current + if !params[:search].nil? #发送到有栏目类型为资源的组织中 + search = "%#{params[:search].to_s.strip.downcase}%" + @orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0} + else + @orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0} + end + @search = params[:search] + #这里仅仅是传递需要发送的资源id + @send_id = params[:send_id] + @send_ids = params[:checkbox1] || params[:send_ids] + respond_to do |format| + format.js + end + end + private def find_user diff --git a/app/helpers/api_helper.rb b/app/helpers/api_helper.rb index f73cc87e6..8324951f9 100644 --- a/app/helpers/api_helper.rb +++ b/app/helpers/api_helper.rb @@ -180,7 +180,7 @@ module ApiHelper if timePassed < 0 updateAtValue = "时间有问题" elsif timePassed < ONE_MINUTE - updateAtValue = "一分钟前" + updateAtValue = "1分钟前" elsif timePassed < ONE_HOUR timeIntoFormat = timePassed / ONE_MINUTE updateAtValue = timeIntoFormat.to_s + "分钟前" diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4bdffb9dc..55a017019 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2588,6 +2588,12 @@ module ApplicationHelper end end + def file_preview_eye(file, html_options={}) + if %w(pdf pptx doc docx xls xlsx).any?{|x| file.filename.downcase.end_with?(x)} + link_to '', download_named_attachment_path(file.id, file.filename, preview: true),html_options + end + end + #将文本内的/n转换为
def text_format text text.gsub("&","&").gsub("<","<").gsub(">",">").gsub("\n","
").html_safe diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 963284f7f..d1ab6661a 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -49,6 +49,8 @@ module UsersHelper '批改附件' when 'Principal' '用户资源' + when 'OrgSubfield' + '组织资源' end end diff --git a/app/models/attachment.rb b/app/models/attachment.rb index ad5655b02..c8fe0811e 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -32,6 +32,7 @@ class Attachment < ActiveRecord::Base has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy # end include UserScoreHelper + has_many :attachment_histories validates :filename, presence: true, length: {maximum: 254} validates :author, presence: true @@ -348,11 +349,18 @@ class Attachment < ActiveRecord::Base # Deletes the file from the file system if it's not referenced by other attachments def delete_from_disk - if Attachment.where("disk_filename = ? AND id <> ?", disk_filename, id).empty? + #资源存在,且历史记录为0 且 该资源没有存在任何拷贝才能删除资源 + if Attachment.where("disk_filename = ? AND id <> ?", disk_filename, id).empty? && self.attachment_histories.count == 0 && Attachment.where('copy_from = ?',self.id) .count == 0 delete_from_disk! end end + #有了历史记录的数据记录是不能被删除的。 + #true 能被删除 false 不能被删除 + def destroyable + self.attachment_histories.count == 0 + end + # Returns file's location on disk def diskfile File.join(self.class.storage_path, disk_directory.to_s, disk_filename.to_s) diff --git a/app/models/attachment_history.rb b/app/models/attachment_history.rb new file mode 100644 index 000000000..2160d242d --- /dev/null +++ b/app/models/attachment_history.rb @@ -0,0 +1,3 @@ +class AttachmentHistory < ActiveRecord::Base + belongs_to :attachment,foreign_key: 'attachment_id' +end diff --git a/app/models/journal.rb b/app/models/journal.rb index 638a98006..a66c4327a 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -17,10 +17,10 @@ class Journal < ActiveRecord::Base include UserScoreHelper - belongs_to :journalized, :polymorphic => true + belongs_to :journalized, :polymorphic => true,:touch => true # added as a quick fix to allow eager loading of the polymorphic association # since always associated to an issue, for now - belongs_to :issue, :foreign_key => :journalized_id + belongs_to :issue, :foreign_key => :journalized_id,:touch => true belongs_to :user has_many :details, :class_name => "JournalDetail", :dependent => :delete_all diff --git a/app/models/message.rb b/app/models/message.rb index 6d108e607..3bb08f481 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -199,8 +199,7 @@ class Message < ActiveRecord::Base def act_as_forge_activity # 如果project为空,那么就是课程相关的消息 if self.board.project_id != -1 && self.parent_id.nil? - self.forge_acts << ForgeActivity.new(:user_id => self.author_id, - :project_id => self.board.project.id) + self.forge_acts << ForgeActivity.new(:user_id => self.author_id, :project_id => self.board.project.id) end end diff --git a/app/models/organization.rb b/app/models/organization.rb index 350dc3080..fcb777fb6 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -9,9 +9,15 @@ class Organization < ActiveRecord::Base has_many :org_subfields, :dependent => :destroy has_many :users, :through => :org_members validates_uniqueness_of :name - after_create :save_as_org_activity + after_create :save_as_org_activity, :add_default_subfields def save_as_org_activity OrgActivity.create(:user_id => User.current.id, :org_act_id => self.id, :org_act_type => 'CreateOrganization', :container_id => self.id, :container_type => 'Organization') end + + def add_default_subfields + OrgSubfield.create(:organization_id => self.id, :name => 'activity', :field_type => 'default') + OrgSubfield.create(:organization_id => self.id, :name => 'course', :field_type => 'default') + OrgSubfield.create(:organization_id => self.id, :name => 'project', :field_type => 'default') + end end diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 5d60238bf..aabe1a921 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -196,6 +196,8 @@ class CoursesService @course.tea_id = current_user.id @course.term = params[:term] @course.time = params[:time] + @course.end_term = params[:end_term] + @course.end_time = params[:end_time] #@course.school_id = params[:occupation] @course.school_id = current_user.user_extensions.school_id @course.setup_time = params[:setup_time] diff --git a/app/views/attachments/_show_attachment_history.html.erb b/app/views/attachments/_show_attachment_history.html.erb new file mode 100644 index 000000000..c1a6464e8 --- /dev/null +++ b/app/views/attachments/_show_attachment_history.html.erb @@ -0,0 +1,54 @@ + +更新资源版本 + +
+
+
当前版本 + + + +
+ <% unless @attachment_histories.empty? %> + +
历史版本
+
+ <% @attachment_histories.each do |history| %> + + + 版本号:<%= history.version %> + + + <% end %> +
+ <% end %> + +
+ <%= form_tag(upload_attachment_version_path, :multipart => true,:remote => !ie8?,:name=>"upload_form",:id=>'upload_form') do %> + <%= hidden_field_tag :old_attachment_id,@attachment.id %> +
+ + +
+
+ + <%= render :partial => 'attachments/upload_attachment_new_version' %> +
+ + +
+
+
(未选择文件)
+
您可以上传小于50MB的文件
+
+
+
+
+
+ + <%= submit_tag '确定',:onclick=>'upload_attachment_version(event);',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %> +
+
取消
+
+ <% end %> +
+ \ No newline at end of file diff --git a/app/views/attachments/_upload_attachment_new_version.html.erb b/app/views/attachments/_upload_attachment_new_version.html.erb new file mode 100644 index 000000000..cd35535c0 --- /dev/null +++ b/app/views/attachments/_upload_attachment_new_version.html.erb @@ -0,0 +1,23 @@ + + + + + 选择文件 +<%= file_field_tag 'attachments[dummy][file]', + :id => '_file', + :class => ie8? ? '':'file_selector', + :multiple => true, + :onchange => 'addInputFiles(this,"'+'upload_files_submit_btn'+'");', + :style => ie8? ? '': 'display:none', + :data => { + :max_file_size => Setting.attachment_max_size.to_i.kilobytes, + :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), + :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, + :upload_path => uploads_path(:format => 'js',:old_attachment_id=>@attachment.id), + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :lebel_file_uploding => l(:lebel_file_uploding), + :delete_all_files => l(:text_are_you_sure_all) + } %> diff --git a/app/views/attachments/attachment_versions.js.erb b/app/views/attachments/attachment_versions.js.erb new file mode 100644 index 000000000..4f3bf41c3 --- /dev/null +++ b/app/views/attachments/attachment_versions.js.erb @@ -0,0 +1,7 @@ +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'attachments/show_attachment_history' )%>'); +showModal('ajax-modal', '452px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","40%").css("left","46%"); +$('#ajax-modal').parent().addClass("resourceUploadPopup"); +$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); \ No newline at end of file diff --git a/app/views/attachments/update_file_dense.js.erb b/app/views/attachments/update_file_dense.js.erb index d99481d08..747024dec 100644 --- a/app/views/attachments/update_file_dense.js.erb +++ b/app/views/attachments/update_file_dense.js.erb @@ -1,2 +1,12 @@ +<% if @attachment.container_type == 'Course' %> +$("#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) %>"); +<%else%> $("#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) %>"); +<%end %> +<%if @attachment.is_public? %> + $("#image_private_<%= @attachment.id%>").html('') +<%else%> +$("#image_private_<%= @attachment.id%>").html('私有') +<%end%> \ No newline at end of file diff --git a/app/views/attachments/upload.js.erb b/app/views/attachments/upload.js.erb index 970c5b22d..62db5ebfd 100644 --- a/app/views/attachments/upload.js.erb +++ b/app/views/attachments/upload.js.erb @@ -11,4 +11,5 @@ fileSpan.find('a.remove-upload') }) .off('click'); $('', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan); +$('',{type:'hidden',name:'attachments[<%= j params[:attachment_id] %>][attachment_id]'}).val('<%= @attachment.id %>').appendTo(fileSpan); <% end %> diff --git a/app/views/attachments/upload_attachment_version.js.erb b/app/views/attachments/upload_attachment_version.js.erb new file mode 100644 index 000000000..eb5559563 --- /dev/null +++ b/app/views/attachments/upload_attachment_version.js.erb @@ -0,0 +1,7 @@ +<% if @flag %> + hideModal(); + alert('更新成功') + $(".re_search").submit(); +<%else%> + $("#upload_file_count").html('(更新失败)') +<%end %> \ No newline at end of file diff --git a/app/views/blog_comments/reply.js.erb b/app/views/blog_comments/reply.js.erb index 06adca74d..fe46d870c 100644 --- a/app/views/blog_comments/reply.js.erb +++ b/app/views/blog_comments/reply.js.erb @@ -1,7 +1,24 @@ <% if @in_user_center%> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>"); - init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity'); +// init_activity_KindEditor_data(<%#= @user_activity_id%>,"","87%", 'UserActivity'); <% else%> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/article', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>"); +//init_activity_KindEditor_data(<%#= @user_activity_id%>,"","87%", 'UserActivity'); +<% end %> init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity'); -<% end %> \ No newline at end of file +showNormalImage('activity_description_<%= @user_activity_id %>'); +if($("#intro_content_<%= @user_activity_id %>").height() > 810) { + $("#intro_content_show_<%= @user_activity_id %>").show(); +} +$("#intro_content_show_<%= @user_activity_id %>").click(function(){ + $("#activity_description_<%= @user_activity_id %>").toggleClass("maxh360"); + $("#activity_description_<%= @user_activity_id%>").toggleClass("lh18"); + $("#intro_content_show_<%= @user_activity_id %>").hide(); + $("#intro_content_hide_<%= @user_activity_id %>").show(); +}); +$("#intro_content_hide_<%= @user_activity_id %>").click(function(){ + $("#activity_description_<%= @user_activity_id %>").toggleClass("maxh360"); + $("#activity_description_<%= @user_activity_id%>").toggleClass("lh18"); + $("#intro_content_hide_<%= @user_activity_id %>").hide(); + $("#intro_content_show_<%= @user_activity_id %>").show(); +}); \ No newline at end of file diff --git a/app/views/blogs/_article.html.erb b/app/views/blogs/_article.html.erb index 33a3201c0..99c743a96 100644 --- a/app/views/blogs/_article.html.erb +++ b/app/views/blogs/_article.html.erb @@ -57,13 +57,14 @@
发帖时间:<%= format_time(activity.created_on) %>
- -
- <% if activity.parent_id.nil? %> - <%= activity.content.to_s.html_safe%> - <% else %> - <%= activity.parent.content.to_s.html_safe%> - <% end %> +
+
+ <% if activity.parent_id.nil? %> + <%= activity.content.to_s.html_safe%> + <% else %> + <%= activity.parent.content.to_s.html_safe%> + <% end %> +
@@ -72,6 +73,11 @@ <%= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => activity.attachments, :options => options, :is_float => true} %> <% end %>
+
+ + +
+
diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index a0cb419b2..9513baab0 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -1,4 +1,9 @@ + -
-
-
- <%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search f_l",:remote=>true) do %> - <%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%> - <%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %> - <%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %> +
+
+
资源库
+ +
+
+
+ <%= 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" %> + <% if is_course_teacher(User.current,@course) || (@course.publish_resource==1 && User.current.member_of_course?(@course) ) %> + + <% end %> <% end %> - <% if is_course_teacher(User.current,@course) || (@course.publish_resource==1 && User.current.member_of_course?(@course) ) %> - -

- 上传: - 课件 |  - 软件 |  - 媒体 |  - 代码 |  - 论文 |  - 其他 + + + +

+
+
+ <%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @tag_name}%> +
+
+
+

共有 <%= @all_attachments.count%> 个资源

+

+ <% 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"} %> /  + <%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> /  + <%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序 + <% else %> + 按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /  + <%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %>  /  + <%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序 + <% end %>

- <% end %> -
+
+
- -
- <%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %> -
- +
+
+ <%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
<% html_title(l(:label_attachment_plural)) -%> \ No newline at end of file diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index f04d70577..08e23fb19 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -1,79 +1,90 @@ -<% delete_allowed = User.current.allowed_to?(:manage_files, course) %> -
-

共有 <%= all_attachments.count%> 个资源

-

- <% 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"} %> /  - <%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /  - <%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 - <% else %> - 按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /  - <%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>  /  - <%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 - <% end %> -

-
-
- -
- <%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course,:tag_name => @tag_name}%> -
-
-
+<% 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? %> -
-
- <%= 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 => "c_dblue f_14 f_b f_l" %> - <% if User.current.logged? %> - <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> - <%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> +
+
+
+ <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %> +
+
+
+ <%= 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') %> + + <% if file.is_public? == false%> + 私有 + <%end %> + +
+
+ 上传时间:<%= format_date(file.created_on)%> + <% if file.tag_list.length > 0%> + 上传类型:<%= file.tag_list[0] %> + <% end %> +

文件大小:<%= number_to_human_size(file.filesize) %>

+

下载<%= file.downloads%>  |  引用<%= file.quotes.nil? ? 0:file.quotes %>

+
+
+
+ + <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> + <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> +
+
+ +
    +
  • + <% if User.current.logged? %> - <% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %> - <% if @course.is_public? %> - - <%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open c_blue",:method => :post %> - - <% else %> - - 私有 - - <% end %> + <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> + <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %> +
      - <% else %> - - <% end %> - <% else %> - <%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> - <% end %> - <%= file_preview_tag(file, class: 'f_l re_open') %> - <% else %> - <% end %> -
-
-
-

文件大小:<%= number_to_human_size(file.filesize) %>

- <%= link_to( l(:button_delete), attachment_path(file), - :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course"%> -

<%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>  |  下载<%= file.downloads %>  |  引用<%= file.quotes.nil? ? 0:file.quotes %>

-
-
-
- - <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> - <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> -
-
-
+
  • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %>
  • +
  • <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
  • + <% if @course.is_public? %> +
  • + + <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %> + +
  • + <%end%> +
  • + <%= 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" && file.destroyable %> +
  • + + + <% end %> + <%else%> +
      +
    • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %>
    • +
    + <% end %> + <% end %> + + + +
    +
    +
    +
    +
    +
    <% else %>
    <%= file.filename %>是私有资源
    <% end %> <% end %> -
    -
      - <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%> -
    -
    + +<% if curse_attachments.count == 10%> + <% if params[:action] == 'search' %> + <%=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 => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %> + <%else%> + + <%=link_to "点击展开更多", course_files_path({:course_id => course.id,:page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %> + <%end%> +<% end%> + diff --git a/app/views/files/_tag_yun.html.erb b/app/views/files/_tag_yun.html.erb index 3d1ded552..f9c6c1666 100644 --- a/app/views/files/_tag_yun.html.erb +++ b/app/views/files/_tag_yun.html.erb @@ -8,12 +8,12 @@ <% tag_list.each do |k,v|%> <% if tag_name && tag_name == k%> - <%= k%>(<%= v%>) + <%= k%> x<%= v%> <% else%> <%= k%>(<%= v%>) + ondblclick="rename_tag($(this),'<%= k %>','',<%= 6 %>);"><%= k%> x<%= v%> <% end%> <% end%> <% end%> \ No newline at end of file diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 8b199ab4e..383ea155e 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -1,12 +1,18 @@ -
    + <% if @container_type == 0 %> - <%= render :partial => 'project_file_new', locals: {project: @project} %> +
    + <%= render :partial => 'project_file_new', locals: {project: @project} %> +
    <% elsif @container_type == 1 %> - <%= render :partial => 'course_file', locals: {course: @course} %> +
    + <%= render :partial => 'course_file', locals: {course: @course} %> +
    <% elsif @container_type == 2 %> - <%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %> +
    + <%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %> +
    <% end %> -
    + diff --git a/app/views/files/index.js.erb b/app/views/files/index.js.erb new file mode 100644 index 000000000..e4f38f7d9 --- /dev/null +++ b/app/views/files/index.js.erb @@ -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 %> \ No newline at end of file diff --git a/app/views/files/search.js.erb b/app/views/files/search.js.erb index 50f46d2f5..fd88b3f9e 100644 --- a/app/views/files/search.js.erb +++ b/app/views/files/search.js.erb @@ -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})%>"); \ No newline at end of file +<% 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 %> \ No newline at end of file diff --git a/app/views/files/search_tag_attachment.js.erb b/app/views/files/search_tag_attachment.js.erb index 50f46d2f5..4b1e9734d 100644 --- a/app/views/files/search_tag_attachment.js.erb +++ b/app/views/files/search_tag_attachment.js.erb @@ -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})%>"); \ No newline at end of file +$("#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%>") \ No newline at end of file diff --git a/app/views/messages/edit.html.erb b/app/views/messages/edit.html.erb index 6e54a88e1..89fe71c65 100644 --- a/app/views/messages/edit.html.erb +++ b/app/views/messages/edit.html.erb @@ -1,6 +1,6 @@ <% if @message.project %> <%= form_for @message, {:as => :message, - :url => {:action => 'edit'}, + :url => {:action => 'edit',:is_course=>@is_course,:is_board=>@is_board}, :html => {:multipart => true, :id => 'message-form', :method => :post} @@ -14,7 +14,7 @@ <% elsif @message.course %> <%= form_for @message, { :as => :message, - :url => {:action => 'edit'}, + :url => {:action => 'edit',:is_course=>@is_course,:is_board=>@is_board}, :html => {:multipart => true, :id => 'message-form', :method => :post} diff --git a/app/views/messages/reply.js.erb b/app/views/messages/reply.js.erb index c0da5ab9b..ea848439f 100644 --- a/app/views/messages/reply.js.erb +++ b/app/views/messages/reply.js.erb @@ -1,8 +1,24 @@ <%if @project%> - $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>"); + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>"); <%elsif @course%> - $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>"); + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>"); <% elsif @org_subfield %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>"); <%end%> -init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); \ No newline at end of file +init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", "UserActivity"); +showNormalImage('activity_description_<%= @user_activity_id %>'); +if($("#intro_content_<%= @user_activity_id %>").height() > 810) { + $("#intro_content_show_<%= @user_activity_id %>").show(); +} +$("#intro_content_show_<%= @user_activity_id %>").click(function(){ + $("#activity_description_<%= @user_activity_id %>").toggleClass("maxh360"); + $("#activity_description_<%= @user_activity_id %>").toggleClass("lh18"); + $("#intro_content_show_<%= @user_activity_id %>").hide(); + $("#intro_content_hide_<%= @user_activity_id %>").show(); +}); +$("#intro_content_hide_<%= @user_activity_id %>").click(function(){ + $("#activity_description_<%= @user_activity_id %>").toggleClass("maxh360"); + $("#activity_description_<%= @user_activity_id %>").toggleClass("lh18"); + $("#intro_content_hide_<%= @user_activity_id %>").hide(); + $("#intro_content_show_<%= @user_activity_id %>").show(); +}); \ No newline at end of file diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 56cf4b915..9cca5da5c 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -44,9 +44,7 @@ - + diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 9699eff5f..22b0b2cb4 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -44,7 +44,27 @@ 教师评阅中 <% end%> <% end%> +
    + <% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1%> + 系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合! + <% elsif activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 0%> + 系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合! + <% end %>
    + <% if activity.homework_type == 3 && !is_teacher && activity.homework_detail_group.base_on_project == 1 && User.current.member_of_course?(activity.course)%> + <% projects = cur_user_projects_for_homework activity %> + <% works = cur_user_works_for_homework activity %> + <% if works.nil? && projects.nil? %> +
    + <%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %> + <%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %> +
    + <% elsif works.nil? %> +
    + <%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %> +
    + <% end %> + <% end %>
    <% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %> <%= user_for_homework_common activity,is_teacher %> @@ -61,8 +81,16 @@ <%= activity.language_name%>
    <% end %> - -
    截止时间:<%= activity.end_time.to_s %> 23:59
    + <% if activity.homework_type == 3 && activity.homework_detail_group%> +
    + 分组人数:<%=activity.homework_detail_group.min_num %>-<%=activity.homework_detail_group.max_num %> 人 +
    + <% end %> + <% if activity.homework_detail_manual && activity.homework_detail_manual.comment_status < 2 %> +
    提交截止时间:<%= activity.end_time.to_s %> 23:59
    + <% elsif activity.homework_detail_manual && activity.homework_detail_manual.comment_status >= 2 %> +
    匿评截止时间:<%= activity.homework_detail_manual.evaluation_end.to_s %> 23:59
    + <% end %>
    @@ -73,10 +101,88 @@
    +
    +
    + 迟交扣分:<%= activity.late_penalty%>分 +
    + <% if activity.anonymous_comment == 0%> +
    + 匿评开启时间:<%= activity.homework_detail_manual.evaluation_start%> 00:00 +
    + <% end %> +
    +
    +
    +
    + 缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品 +
    + <% if activity.anonymous_comment == 0%> +
    + 匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%> 23:59 +
    + <% end %> +
    +
    + <% if activity.student_works.count != 0 %> + <% sw = activity.student_works.reorder("created_at desc").first %> +
    + <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品 +
    + <% end %> +
    + <% if activity.student_works.count != 0 %> + <% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %> + <% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %> + <% unless student_work_scores.empty? %> + <% last_score = student_work_scores.first %> +
    + <%=time_from_now last_score.created_at %><%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品 +
    + <% end %> + <% end %> +
    <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => activity.attachments} %>
    + <% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %> +
    + <% projects = activity.student_work_projects.where("is_leader = 1") %> +
    + 已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %> +
    + <% projects.each do |pro| %> + <% project = Project.find pro.project_id %> + + +
    + <% if project.is_public || User.current.member_of?(project) || User.current.admin? %> + <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %> + <% else %> + <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %> + <% end %> + <% time=project.updated_on %> + <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> +

    <%=(User.find project.user_id).show_name %>(组长)

    +

    <%=time_from_now time %>

    +
    + 项目名称:<%=project.name %>
    + 创建者:<%=(User.find project.user_id).show_name %>(组长)
    + 更新时间:<%=time_from_now time %> +
    +
    + <% end %> +
    + <% end %> +
    <% if is_teacher%> <% comment_status = activity.homework_detail_manual.comment_status %>
    diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb index 8a092f7e2..de837c66f 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -11,7 +11,7 @@
  • <%= name %>
  • 默认
  • 默认
  • - <%= field.hide==0?"设为隐藏":"设为显示" %> + <%= field.hide==0?"设为隐藏":"设为可见" %>
    <% end %> @@ -27,7 +27,7 @@
  • 新增
  • <%= field.field_type == "Post" ? "帖子" : "资源" %>
  • <%#= link_to "隐藏", hide_org_subfield_organizations_path(field), :method => 'post', :remote => true, :id => "hide_#{field.id}", :class => "linkBlue fr mr5" %> - <%= field.hide==0?"设为隐藏":"设为显示" %> + <%= field.hide==0?"设为隐藏":"设为可见" %> <%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr10" %> 编辑 diff --git a/app/views/organizations/hide_org_subfield.js.erb b/app/views/organizations/hide_org_subfield.js.erb index 09ed3c280..18241c269 100644 --- a/app/views/organizations/hide_org_subfield.js.erb +++ b/app/views/organizations/hide_org_subfield.js.erb @@ -1,2 +1,2 @@ -$("#hide_<%= @org_subfield.id %>").text("设为显示"); +$("#hide_<%= @org_subfield.id %>").text("设为可见"); $("#org_subfield_<%= @org_subfield.id %>").css("display", "none"); \ No newline at end of file diff --git a/app/views/organizations/org_resources_subfield.js.erb b/app/views/organizations/org_resources_subfield.js.erb new file mode 100644 index 000000000..6c1f2d690 --- /dev/null +++ b/app/views/organizations/org_resources_subfield.js.erb @@ -0,0 +1,2 @@ +$(".columnContent").html('<%= escape_javascript( render :partial => 'users/org_resources_subfield',:locals => {:subfield=>@subfield})%>') +$(".orgDirection").text('目标地址:'+'<%= @org.name.html_safe%>') \ No newline at end of file diff --git a/app/views/projects/_project_activities.html.erb b/app/views/projects/_project_activities.html.erb index b46522fa1..781b65810 100644 --- a/app/views/projects/_project_activities.html.erb +++ b/app/views/projects/_project_activities.html.erb @@ -34,7 +34,7 @@ $(function () { init_activity_KindEditor_data(<%= activity.id%>, null, "87%", "<%= activity.class.to_s %>"); showNormalImage('activity_description_<%= activity.id %>'); - if ($("#intro_content_<%= activity.id %>").height() > 360) { + if ($("#intro_content_<%= activity.id %>").height() > 810) { $("#intro_content_show_<%= activity.id %>").show(); } $("#intro_content_show_<%= activity.id %>").click(function () { @@ -61,7 +61,7 @@ <% when "Message" %> - <%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act,:user_activity_id =>activity.id} %> + <%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act,:user_activity_id =>activity.id,:is_course=>1,:is_board=>0} %> <% when "News" %> <% if !activity.forge_act.nil? and activity.forge_act.project %> diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index a0ce84795..db276d88b 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -124,6 +124,24 @@ <% end %>
    + <% if activity.student_works.count != 0 %> + <% sw = activity.student_works.reorder("created_at desc").first %> +
    + <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品 +
    + <% end %> +
    + <% if activity.student_works.count != 0 %> + <% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %> + <% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %> + <% unless student_work_scores.empty? %> + <% last_score = student_work_scores.first %> +
    + <%=time_from_now last_score.created_at %><%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品 +
    + <% end %> + <% end %> +
    <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => activity.attachments} %>
    @@ -131,7 +149,7 @@ <% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
    <% projects = activity.student_work_projects.where("is_leader = 1") %> -
    +
    已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %>
    <% projects.each do |pro| %> @@ -154,7 +172,7 @@ <% end %> <% time=project.updated_on %> <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> -

    <%=(User.find project.user_id).show_name %>(组长)

    +

    <%=(User.find project.user_id).show_name %>(组长)

    <%=time_from_now time %>

    项目名称:<%=project.name %>
    diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index 4996f7730..22a4bcf57 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -1,4 +1,4 @@ -
    +
    <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %> @@ -43,17 +43,38 @@
    -
    @@ -120,7 +141,7 @@
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    - <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> + <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => is_board,is_course=>is_course},:method => "post", :remote => true) do |f|%> diff --git a/app/views/users/_org_resources_subfield.html.erb b/app/views/users/_org_resources_subfield.html.erb new file mode 100644 index 000000000..989191dc7 --- /dev/null +++ b/app/views/users/_org_resources_subfield.html.erb @@ -0,0 +1,10 @@ +
  • 请选择栏目:
  • +<% unless subfield.nil? || subfield.empty? %> + <% subfield.each do |field| %> +
  • + +
  • + <%end %> +<%end %> \ No newline at end of file diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index b9ebc2135..5a9f7e398 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -1,4 +1,4 @@ -
    +
    <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> @@ -44,6 +44,36 @@
    + +
    @@ -56,9 +86,7 @@
    -
    回复( - <%=count %> - )
    +
    回复(<%=count %>)
    <%#=format_date(activity.updated_on)%>
    <%if count>3 %> diff --git a/app/views/users/_resource_share_for_orgs.html.erb b/app/views/users/_resource_share_for_orgs.html.erb new file mode 100644 index 000000000..9da439c8e --- /dev/null +++ b/app/views/users/_resource_share_for_orgs.html.erb @@ -0,0 +1,58 @@ +
    +
    发送到
    +
    + +
    + <%= form_tag search_user_org_user_path(user),:method => 'get', + :remote=>true,:id=>'search_user_org_form' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> + + + <% end %> +
    +
    +<%= form_tag add_exist_file_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
    +
      + <% unless @orgs.empty? %> + <% @orgs.each do |org|%> +
    • + +
    • + <%end%> + <%end%> +
    +
    +
    +
      + + + <%= render :partial => 'users/org_resources_subfield',:locals => {:subfield=>nil}%> + + + + + +
    +
    +
    +
    目标地址:
    +
    + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %> +
    +
    + 取消 +
    +
    + <%end %> \ No newline at end of file diff --git a/app/views/users/_resource_share_for_project_popup.html.erb b/app/views/users/_resource_share_for_project_popup.html.erb index ba136899c..10df82feb 100644 --- a/app/views/users/_resource_share_for_project_popup.html.erb +++ b/app/views/users/_resource_share_for_project_popup.html.erb @@ -2,11 +2,12 @@
    -
    将资源发送至
    +
    发送到
    @@ -47,7 +48,7 @@ <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
    - +
    <% end %> diff --git a/app/views/users/_resource_share_popup.html.erb b/app/views/users/_resource_share_popup.html.erb index 53fb6673b..a12a02683 100644 --- a/app/views/users/_resource_share_popup.html.erb +++ b/app/views/users/_resource_share_popup.html.erb @@ -2,11 +2,12 @@
    -
    将资源发送至
    +
    发送到
    @@ -47,7 +48,7 @@ <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
    - +
    <% end %> diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index ef6397ec0..a0a1377f1 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -7,7 +7,7 @@ <% attachments.each do |attach| %>
    • - +
    • diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index 5cadcddd6..bb1a42f58 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -69,7 +69,7 @@ <% when 'News' %> <%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> <% when 'Message'%> - <%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> + <%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %> <% when 'Poll' %> <%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %> <% when 'Course'%> @@ -82,7 +82,7 @@ <% when 'Issue' %> <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> <% when 'Message' %> - <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> + <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %> <% when 'ProjectCreateInfo'%> <%= render :partial => 'project_create', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> <% end %> diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 0472613e4..6cb502d77 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -127,6 +127,24 @@ <% end %>
    + <% if homework_common.student_works.count != 0 %> + <% sw = homework_common.student_works.reorder("created_at desc").first %> +
    + <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品 +
    + <% end %> +
    + <% if homework_common.student_works.count != 0 %> + <% sw_id = "("+homework_common.student_works.map{|sw| sw.id}.join(",")+")" %> + <% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %> + <% unless student_work_scores.empty? %> + <% last_score = student_work_scores.first %> +
    + <%=time_from_now last_score.created_at %><%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品 +
    + <% end %> + <% end %> +
    <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework_common.attachments} %>
    @@ -134,7 +152,7 @@ <% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 %>
    <% projects = homework_common.student_work_projects.where("is_leader = 1") %> -
    +
    已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %>
    <% projects.each do |pro| %> @@ -156,7 +174,7 @@ <% end %> <% time=project.updated_on %> <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> -

    <%=(User.find project.user_id).show_name %>(组长)

    +

    <%=(User.find project.user_id).show_name %>(组长)

    <%=time_from_now time %>

    项目名称:<%=project.name %>
    diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 29be69a23..d145dab90 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -5,9 +5,9 @@ @@ -53,8 +53,8 @@
    <% if !edit_mode || edit_mode && homework.homework_detail_manual.comment_status < 2 %>
    - - 启用匿评 + + 禁用匿评
    <% end %>
    diff --git a/app/views/users/add_exist_file_to_course.js.erb b/app/views/users/add_exist_file_to_course.js.erb index 95f7784f7..57fe9d42d 100644 --- a/app/views/users/add_exist_file_to_course.js.erb +++ b/app/views/users/add_exist_file_to_course.js.erb @@ -4,7 +4,7 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_ $("#res_count").html(0); $("#checkboxAll").attr('checked',false); $("#res_all_count").html(<%= @atta_count%>); -closePopUp(); +hideModal(); alert("发送成功") <% else%> <% end %> \ No newline at end of file diff --git a/app/views/users/add_exist_file_to_org.js.erb b/app/views/users/add_exist_file_to_org.js.erb new file mode 100644 index 000000000..57fe9d42d --- /dev/null +++ b/app/views/users/add_exist_file_to_org.js.erb @@ -0,0 +1,10 @@ +<% if @flag == true%> +$("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} ) %>'); +$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); +$("#res_count").html(0); +$("#checkboxAll").attr('checked',false); +$("#res_all_count").html(<%= @atta_count%>); +hideModal(); +alert("发送成功") +<% else%> +<% end %> \ No newline at end of file diff --git a/app/views/users/add_exist_file_to_project.js.erb b/app/views/users/add_exist_file_to_project.js.erb index 95f7784f7..57fe9d42d 100644 --- a/app/views/users/add_exist_file_to_project.js.erb +++ b/app/views/users/add_exist_file_to_project.js.erb @@ -4,7 +4,7 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_ $("#res_count").html(0); $("#checkboxAll").attr('checked',false); $("#res_all_count").html(<%= @atta_count%>); -closePopUp(); +hideModal(); alert("发送成功") <% else%> <% end %> \ No newline at end of file diff --git a/app/views/users/change_org_subfield.js.erb b/app/views/users/change_org_subfield.js.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/users/search_user_course.js.erb b/app/views/users/search_user_course.js.erb index 2a0c98cad..f32ed521a 100644 --- a/app/views/users/search_user_course.js.erb +++ b/app/views/users/search_user_course.js.erb @@ -9,10 +9,10 @@ //$("#upload_box").css('left','').css('top',''); //$("#upload_box").html('<%#= escape_javascript( render :partial => "resource_share_popup" ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); //$("#upload_box").css('display','block'); -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); +$('#ajax-modal').before(""); $('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup"); $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); diff --git a/app/views/users/search_user_org.js.erb b/app/views/users/search_user_org.js.erb new file mode 100644 index 000000000..94ac37968 --- /dev/null +++ b/app/views/users/search_user_org.js.erb @@ -0,0 +1,9 @@ +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +showModal('ajax-modal', '452px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().addClass("popbox").addClass("shareDP"); +$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); +var val = $("#search_org_input").val(); +$("#search_org_input").val("").focus().val(val); \ No newline at end of file diff --git a/app/views/users/search_user_project.js.erb b/app/views/users/search_user_project.js.erb index f38d9edc8..b99d36348 100644 --- a/app/views/users/search_user_project.js.erb +++ b/app/views/users/search_user_project.js.erb @@ -8,7 +8,7 @@ $("#ajax-modal").html('<%= escape_javascript( render :partial => 'resource_share_for_project_popup' ,:locals => {:projects=>@projects,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); +$('#ajax-modal').before(""); $('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().addClass("resourceUploadPopup").addClass("popbox") $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index 418809917..2f94e4401 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -41,6 +41,20 @@ function submit_files(){ $("#upload_form").submit(); } + + function check_des(event){ + if($(".sectionContent").find('input[type="radio"]:checked').length <= 0){ + event.preventDefault(); + $(".orgDirection").text('目标地址组织不能为空') + return false; + }else if($(".columnContent").find('input[type="radio"]:checked').length <= 0){ + event.preventDefault(); + $(".orgDirection").text('目标地址栏目不能为空') + return false; + }else{ + return true; + } + }
    资源库
    @@ -294,10 +308,15 @@ //批量删除 function batch_delete(){ var data = $("#resources_list_form").serialize(); + if($("input[type=checkbox][data-has-history=Y]:checked").length != 0){ + alert("您只能删除没有历史记录的资源,请重新选择后再删除。"); + return; + } if($("input[type=checkbox][data-deleteble=N]:checked").length != 0){ alert("您只能删除自己上传的资源,请重新选择后再删除。"); return; } + if(data != "" && confirm('确认要删除这些资源吗?')) { $.post( '<%= user_resource_delete_user_path(@user)%>', @@ -441,6 +460,10 @@ line.children().css("background-color", 'white'); id = line.children().last().html(); user_id = line.children().eq(5).html(); + if(line.children().first().children().data('hasHistory') == 'Y'){ + alert('该资源存在历史版本,不能删除'); + return; + } if(user_id === '<%= User.current.id%>') { if (confirm('确定要删除资源"' + line.children().eq(1).children().attr('title').trim() + '"么?')) { $.ajax({ @@ -467,11 +490,17 @@ type: 'get', url: '<%= search_user_course_user_path(@user)%>' + '?send_id=' + id }); - } else { + } else if(sendType === '2') { $.ajax({ type: 'get', url: '<%= search_user_project_user_path(@user)%>' + '?send_id=' + id }); + }else if(sendType ==='3') + { + $.ajax({ + type: 'get', + url: '<%= search_user_org_user_path(@user)%>' + '?send_id=' + res_id + }); } }else{//如果是多个发送 if (sendType === '1'){ @@ -479,11 +508,16 @@ type: 'get', url: '<%= search_user_course_user_path(@user)%>' + '?'+ $("#resources_list_form").serialize() }); - }else{ + }else if(sendType === '2'){ $.ajax({ type: 'get', url: '<%= search_user_project_user_path(@user)%>' + '?' + $("#resources_list_form").serialize() }); + }else if(sendType === '3'){ + $.ajax({ + type: 'get', + url: '<%= search_user_org_user_path(User.current)%>' + '?'+$("#resources_list_form").serialize() + }); } } } @@ -521,5 +555,12 @@ }); } + function subfield_click(){ + var sendText = $("input[name='org_id']:checked").next().text(); + var orgDirection = "目标地址:" + var sendColumn = $("input[name='subfield']:checked").next().text(); + $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn); + } + diff --git a/config/locales/courses/en.yml b/config/locales/courses/en.yml index fd8ba2366..20d9d112c 100644 --- a/config/locales/courses/en.yml +++ b/config/locales/courses/en.yml @@ -15,7 +15,7 @@ en: label_homework: Task label_course_news: 课程通知 label_main_teacher: 主讲教师 - label_course_term: 开课学期 + label_course_term: 开始学期 label_join_course: 加入 label_exit_course: exit course diff --git a/config/locales/courses/zh.yml b/config/locales/courses/zh.yml index 16d49ea1f..19b979d97 100644 --- a/config/locales/courses/zh.yml +++ b/config/locales/courses/zh.yml @@ -19,7 +19,7 @@ zh: label_course_news: 课程通知 label_course_mail_news_reply: 课程通知回复 label_main_teacher: 主讲教师 - label_course_term: 开课学期 + label_course_term: 开始学期 label_isuue_mail_status: 更新了issue状态! label_join_course: 加入 diff --git a/config/routes.rb b/config/routes.rb index 3f2aa51c6..37eda17e9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -48,6 +48,7 @@ RedmineApp::Application.routes.draw do post 'join_projects' post 'logout' post 'apply_subdomain' + get 'org_resources_subfield' end collection do get 'check_uniq' @@ -71,6 +72,7 @@ RedmineApp::Application.routes.draw do end get '/', to: 'organizations#show', defaults: { id: 5 }, constraints: {subdomain: 'micros'} get '/', to: 'organizations#show', defaults: { id: 23 }, constraints: {subdomain: 'nubot'} + get '/', to: 'organizations#show', defaults: { id: 1 }, constraints: {subdomain: 'team'} resources :org_member do member do @@ -420,12 +422,12 @@ RedmineApp::Application.routes.draw do match 'boards/:id/join_to_org_subfields', :to => 'boards#join_to_org_subfields' get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message' match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post] - get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' + get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit',:as=>'edit_board_message' post 'boards/:board_id/topics/preview', :to => 'messages#preview', :as => 'preview_board_message' post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply' post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' - post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy' + post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy',:as=>'delete_board_message' match 'messages/join_org_subfield', :to => 'messages#join_org_subfield' match 'messages/get_subfield_on_click_org', :to => 'messages#get_subfield_on_click_org' match 'messages/join_org_subfields', :to => 'messages#join_org_subfields' @@ -517,6 +519,7 @@ RedmineApp::Application.routes.draw do get "search_user_course" post "add_exist_file_to_course" post "add_exist_file_to_project" + post 'add_exist_file_to_org' get 'resource_preview' get 'rename_resource' get 'search_user_project' @@ -527,6 +530,8 @@ RedmineApp::Application.routes.draw do get 'store_selected_resource' get 'user_organizations' get 'search_user_orgs' + get 'search_user_org' #for send resource + # end end #resources :blogs @@ -818,6 +823,8 @@ RedmineApp::Application.routes.draw do # additional routes for having the file name at the end of url get 'attachments/:id/:filename', :to => 'attachments#show', :id => /\d+/, :filename => /.*/, :as => 'named_attachment' + get 'attachments/attachment_versions/:id',:to=>'attachments#attachment_versions',:as=>'attachments_versions' + post 'attachments/upload_attachment_version',:to=>'attachments#upload_attachment_version',:as=>'upload_attachment_version' get 'attachments/download/:id/:filename', :to => 'attachments#download', :id => /\d+/, :filename => /.*/, :as => 'download_named_attachment' get 'attachments/download/:id', :to => 'attachments#download', :id => /\d+/ get 'attachments/thumbnail/:id(/:size)', :to => 'attachments#thumbnail', :id => /\d+/, :size => /\d+/, :as => 'thumbnail' diff --git a/db/migrate/20151229045505_create_attachment_histories.rb b/db/migrate/20151229045505_create_attachment_histories.rb new file mode 100644 index 000000000..21b599a96 --- /dev/null +++ b/db/migrate/20151229045505_create_attachment_histories.rb @@ -0,0 +1,24 @@ +class CreateAttachmentHistories < ActiveRecord::Migration + def change + create_table :attachment_histories do |t| + t.integer :container_id + t.string :container_type + t.string :filename , :default => "" + t.string :disk_filename, :default => "" + t.integer :filesize, :default => 0 + t.string :content_type, :default => "" + t.string :digest , :default => "",:limit=>40 + t.integer :downloads, :default => 0 + t.integer :author_id + t.datetime :created_on + t.string :description + t.string :disk_directory + t.integer :attachtype + t.integer :is_public + t.integer :copy_from + t.integer :quotes + t.integer :version + t.integer :version_id + end + end +end diff --git a/db/migrate/20151230022443_rename_attachment_histories_column_version_id_to_attachment_id.rb b/db/migrate/20151230022443_rename_attachment_histories_column_version_id_to_attachment_id.rb new file mode 100644 index 000000000..15d0837d3 --- /dev/null +++ b/db/migrate/20151230022443_rename_attachment_histories_column_version_id_to_attachment_id.rb @@ -0,0 +1,8 @@ +class RenameAttachmentHistoriesColumnVersionIdToAttachmentId < ActiveRecord::Migration + def up + rename_column :attachment_histories,:version_id,:attachment_id + end + + def down + end +end diff --git a/db/migrate/20151231012634_add_last_term_to_course.rb b/db/migrate/20151231012634_add_last_term_to_course.rb new file mode 100644 index 000000000..1b342eaaf --- /dev/null +++ b/db/migrate/20151231012634_add_last_term_to_course.rb @@ -0,0 +1,17 @@ +class AddLastTermToCourse < ActiveRecord::Migration + def change + add_column :courses, :end_time, :integer + add_column :courses, :end_term, :string + + count = Course.all.count / 30 + 2 + transaction do + for i in 1 ... count do + Course.page(i).per(30).each do |course| + course.end_time = course.time + course.end_term = course.term + course.save + end + end + end + end +end diff --git a/db/migrate/20160105073350_drop_message_for_forge_activities.rb b/db/migrate/20160105073350_drop_message_for_forge_activities.rb new file mode 100644 index 000000000..b4fa5e36a --- /dev/null +++ b/db/migrate/20160105073350_drop_message_for_forge_activities.rb @@ -0,0 +1,14 @@ +class DropMessageForForgeActivities < ActiveRecord::Migration + def up + forge_activities = ForgeActivity.where("forge_act_type =?", "Message") + forge_activities.each do |fa| + # 删除项目动态中,讨论区也会多一条记录问题 + if fa.forge_act && !fa.forge_act.parent_id.nil? + fa.delete + end + end + end + + def down + end +end diff --git a/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb b/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb index a2fef6174..50fc50b38 100644 --- a/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb +++ b/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb @@ -14,7 +14,7 @@ module RailsKindeditor output = ActiveSupport::SafeBuffer.new output << text_area_tag(name, content, input_html) output << javascript_tag(js_replace(id, options.merge(window_onload: 'true', - :autoHeightMode=>true, + :autoHeightMode=>false, afterCreate: eval_str(at_id, at_type), emotionsBasePath: 'http://' + Setting.host_name ))) @@ -29,7 +29,7 @@ module RailsKindeditor output_buffer = ActiveSupport::SafeBuffer.new output_buffer << build_text_area_tag(name, method, self, options, input_html) output_buffer << javascript_tag(js_replace(input_html['id'],options.merge(window_onload: 'true', - :autoHeightMode=>true, + :autoHeightMode=>false, afterCreate: eval_str(at_id, at_type), emotionsBasePath: 'http://' + Setting.host_name ))) diff --git a/public/assets/kindeditor/at/config.js b/public/assets/kindeditor/at/config.js index 2bab7eb67..651f33464 100644 --- a/public/assets/kindeditor/at/config.js +++ b/public/assets/kindeditor/at/config.js @@ -35,7 +35,7 @@ var enableAt = function(_editor) { var at_config = { at: "@", data: names, - insertTpl: '@${name}(${login})', + insertTpl: '@${name}(${login})', displayTpl: "
  • ${name} ${login}
  • ", searchKey: 'searchKey', limit: 200 diff --git a/public/assets/kindeditor/at/jquery.atwho.css b/public/assets/kindeditor/at/jquery.atwho.css index df3ff9d94..13ca0265a 100644 --- a/public/assets/kindeditor/at/jquery.atwho.css +++ b/public/assets/kindeditor/at/jquery.atwho.css @@ -49,4 +49,5 @@ } /* @功能 定义 */ -span.at {color:#269ac9;} \ No newline at end of file +span.at {color:#269ac9;} +span.at a{color:#269ac9;text-decoration: none;} \ No newline at end of file diff --git a/public/assets/kindeditor/plugins/code/previewcode.css b/public/assets/kindeditor/plugins/code/previewcode.css index c106a72f3..c8e5df4e1 100644 --- a/public/assets/kindeditor/plugins/code/previewcode.css +++ b/public/assets/kindeditor/plugins/code/previewcode.css @@ -45,4 +45,5 @@ .ke-content blockquote {margin:15px 10px;border:2px solid #eee;padding:5px 5px 5px 35px;background:#f4f5f7 url('../img/blockquote.gif') no-repeat left top;color:#060;font-size:9pt;} -span.at {color:#269ac9;} \ No newline at end of file +span.at {color:#269ac9;} +span.at a{color:#269ac9;text-decoration: none;} \ No newline at end of file diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 3d9fba942..a0edf85c1 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -978,6 +978,15 @@ $(document).ready(function () { } }); +//点击发送资源弹出框中的组织,要更改选择栏目中的内容 +//@dom 选中的radio,值为org_id +function change_org_subfield(url){ + $.ajax({ + type:'get', + url:url + }) +} + //点击图片即显示大图 function showNormalImage(id) { var description_images=$('div#'+id).find("img"); @@ -991,14 +1000,3 @@ function showNormalImage(id) { } } - -$(function(){ - //at 加链接 - $("span.at").hover(function(){ - $(this).css('cursor', 'pointer'); - }); - $("span.at").live('click', function(){ - var userId = $(this).attr('data-user-id'); - $(window.location).attr('href', '/users/'+userId); - }); -}); \ No newline at end of file diff --git a/public/javascripts/course.js b/public/javascripts/course.js index a0bce3099..df04d857b 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -119,6 +119,46 @@ function regex_course_class_period() return false; } } +//验证开始学期和结束学期 +function regex_time_term(){ + var obj_time = document.getElementById("time"); + var obj_end_time = document.getElementById("end_time"); + var obj_term = document.getElementById("term"); + var obj_end_term = document.getElementById("end_term"); + var time = obj_time.options[obj_time.selectedIndex]; + var end_time = obj_end_time.options[obj_end_time.selectedIndex]; + var term = obj_term.options[obj_term.selectedIndex]; + var end_term = obj_end_term.options[obj_end_term.selectedIndex]; + if(time.value == end_time.value) { + if(set_term_val(term.value) > set_term_val(end_term.value)) { + $("#course_time_term_notice").html("开始学期不能晚于结束学期"); + $("#course_time_term_notice").show(); + return false; + } else { + $("#course_time_term_notice").html(""); + $("#course_time_term_notice").hide(); + return true; + } + } else if(time.value < end_time.value) { + $("#course_time_term_notice").html(""); + $("#course_time_term_notice").hide(); + return true; + } else { + $("#course_time_term_notice").html("开始学期不能晚于结束学期"); + $("#course_time_term_notice").show(); + return false; + } +} +//学期转换为数字 +function set_term_val(val) { + if(val == "春季学期"){ + return 1; + } else if(val == "夏季学期"){ + return 2; + } else if(val == "秋季学期"){ + return 3; + } +} //验证密码 function regex_course_password() { @@ -145,7 +185,7 @@ function regex_course_password() //提交新建课程 function submit_new_course() { - if(regex_course_name()&®ex_course_class_period()&®ex_course_password()) + if(regex_course_name()&®ex_course_class_period()&®ex_time_term()&®ex_course_password()) { $("#new_course").submit(); } diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 9c05ea562..2ce076f37 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -154,9 +154,12 @@ a.postReplyCancel:hover {color:#ffffff;} .homepagePostSetting ul li:hover ul {display:block;} .homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;} .homepagePostSettiongText {width:85px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-68px; top:20px; padding:5px 0px; display:none;} +.resourceSendO {width:65px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-48px; top:20px; padding:2px 0px; display:none;} .homepagePostSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;cursor: pointer} a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px; text-align:center;} a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;} +a.postOptionLink2 {color:#616060; display:block; width:35px; padding:0px 15px;} +a.postOptionLink2:hover {color:#ffffff; background-color:#269ac9;} .homepagePostReplyPortrait {float:left; width:33px;} .imageFuzzy {filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5;opacity: 0.5;} .homepagePostReplyDes {float:left; width:632px; margin-left:15px;} @@ -213,8 +216,8 @@ a.menuGrey:hover {color:#fe7d68;} #navSearchAlert {display:none;} .homepagePostReplyjournal{margin-left: 15px; float: left;} -.lh18 {line-height: 18px;} -.maxh360 {max-height: 360px;} +/*.lh18 {line-height: 18px;}*/ +/*.maxh360 {max-height: 360px;}*/ /*邮件邀请*/ .box_main{ width:345px; margin:0 auto;} @@ -756,7 +759,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作业评分*/ @@ -1210,6 +1220,7 @@ a:hover.blueCir{ background:#3598db; color:#fff;} .hworkPrName {width:110px; max-width:110px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:18px; line-height:18px; font-size:12px; color:#888888; text-align:center;} .mr150 {margin-right:150px;} .relatePInfo {text-align: left; position:absolute; background-color:#ffffff; padding:3px 8px; white-space:nowrap; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); z-index:999; color:#585858; cursor:pointer; display:none;} +.captainName {max-width:40px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block;} /*上传资源弹窗*/ .resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;} @@ -1232,6 +1243,9 @@ div.disable_link {background-color: #c1c1c1 !important;} /*新课程资源库*/ .reCon{ margin:5px; width:710px;} .reTop{width:710px; height:40px; background:#eaeaea; padding:5px;} +.researchBox { width:240px; height:24px; border:1px solid #dddddd; color:#666666; outline:none;} +.blueBtn{ width:60px; height:26px; color:#FFF; border:none; background-color:#269ac9; cursor:pointer; padding-left:0px; text-align:center;} +.blueBtn:hover {background-color:#298fbd;} /*问题状态图片*/ .issues{ background:url(../images/public_icon.png) -66px 5px no-repeat; width:18px; height:21px;} @@ -1240,4 +1254,11 @@ div.disable_link {background-color: #c1c1c1 !important;} .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;} + .boxShadow {box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5);} + +.fn {font-weight:normal} diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 7e3d92023..327efc49a 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -706,7 +706,8 @@ a.gz_btn{display:block; background:url(../images/pic_uersall.png) -318px -25px n a:hover.gz_btn{ color:#ff5722;} .homepagePostReplyjournal{margin-left: 15px; float: left;} .lh18 {line-height: 18px;} -.maxh360 {max-height: 360px;} +/*该高度会写入配置文件*/ +.maxh360 {max-height: 810px;} .courseMenu {width:30px; display:block; float:right;height: 50px;} .courseMenuIcon {display:inline-block; background:url(../images/homepage_icon2.png) -190px -365px no-repeat; width:15px; height:15px; margin-top: 16px; margin-right: 15px; position: relative;line-height:0;} @@ -1387,6 +1388,7 @@ a:hover.blueCir{ background:#3598db; color:#fff;} /* @功能 定义 */ span.at {color:#269ac9;} +span.at a{color:#269ac9;text-decoration: none;} .relatePInfo {text-align: left; position:absolute; background-color:#ffffff; padding:3px 8px; white-space:nowrap; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); z-index:999; color:#585858; cursor:pointer; display:none;} /*问题状态图片*/ @@ -1396,6 +1398,22 @@ span.at {color:#269ac9;} .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;} +/*资源发送到org*/ +.shareDP {width:415px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:relative; 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:205px; min-height:150px; padding-top:5px; border:1px solid #dddddd;} +.columnWrap {float:left; max-height:155px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:178px; min-height:155px; border:1px solid #dddddd;} +.columnWrap li {padding-left:10px; color:#585858; line-height:20px;} +.columnWrap li:hover {background-color:#cccccc;} +.columnWrap span {width:150px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:inline-block; height:20px; vertical-align:top;} +.sectionRow:hover {background-color:#cccccc; cursor:pointer;} +.sectionContent {} +.sectionContent li {padding-left:10px; line-height:20px;} +.sectionContent li:hover {background-color:#cccccc;} +.sectionContent span {width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:20px; vertical-align:top;} +.orgDirection {width:392px; background-color:#f1f1f1; height:30px; vertical-align:middle; line-height:30px; color:#585858; padding-left:10px;} +.orgSendSearch {border:1px solid #dddddd; outline:none; width:262px; height:22px; padding-left:10px; float:left;} + /*151228样式更新*/ .menuSetting {background:url(../images/hwork_icon.png) -79px -132px no-repeat; display:inline-block; width:20px; height:20px;} .boxShadow {box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5);} diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css index b37a38da0..2279f0fe5 100644 --- a/public/stylesheets/org.css +++ b/public/stylesheets/org.css @@ -103,4 +103,8 @@ ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; } .sectionContent span {width:175px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:18px; vertical-align:middle;}.popbox_polls{width:300px;height:100px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-100px 0 0 -150px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;} .org_login_list a {color:#269ac9;} -div.flash {margin-top :0px !important} \ No newline at end of file +div.flash {margin-top :0px !important} + +.w80{ width:80px;} +.relatePInfo {text-align: left; position:absolute; background-color:#ffffff; padding:3px 8px; white-space:nowrap; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); z-index:999; color:#585858; cursor:pointer; display:none;} +.captainName {max-width:40px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block;} \ No newline at end of file diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index 91afb852b..bb63b8c4e 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -962,12 +962,6 @@ a:hover.Reply_pic{border:1px solid #64bdd9;} margin-bottom: 5px; font-weight: bold; } -.maxh360 { - max-height: 360px; -} -.lh18 { - line-height: 18px; -} .homepagePostIntro { font-size: 14px; color: #484848; diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 0020906c9..6e1d528ad 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -413,23 +413,35 @@ a:hover.search_btn{ background: #0fa9bb;} /*发送资源弹窗*/ /*.resourceShareContainer {width:100%; height:100%; background:#666; filter:alpha(opacity=50); opacity:0.5; -moz-opacity:0.5; position:absolute; left:0; top:0; z-index:-999;}*/ +/*发送资源弹窗*/ +/*.resourceShareContainer {width:100%; height:100%; background:#666; filter:alpha(opacity=50); opacity:0.5; -moz-opacity:0.5; position:absolute; left:0; top:0; z-index:-999;}*/ +/*.resourceSharePopup {width:300px; height:auto; border:3px solid #15bccf; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;}*/ .resourceSharePopup {width:300px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;} -.sendText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; width:100px; display:inline-block; font-weight:bold;} +.sendText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; width:110px; display:inline-block; font-weight: bold;} .resourcesSendTo {float:left; height:20px; margin-top:15px;} +.boxContainer {height:33px; line-height:33px; position:relative} .resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;} .resourcePopupClose {width:20px; height:20px; display:inline-block; float:right;} .resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000;} .resourcesSearchBox {border:1px solid #e6e6e6; width:225px; height:25px; background-color:#ffffff; margin-top:12px; margin-bottom:15px;} .searchResourcePopup {border:none; outline:none; background-color:#ffffff; width:184px; height:25px; padding-left:10px; display:inline-block; float:left;} -.courseSend {width:260px; height:15px; line-height:15px; margin-bottom:10px;} +.searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(../images/homepage_icon.png) 5px -394px no-repeat; display:inline-block; float:left; cursor: pointer;} +.searchIconPopup:hover {background:url(../images/homepage_icon.png) 5px -420px no-repeat;} +.courseSend {width:390px; height:15px; line-height:15px; margin-bottom:10px;display:block;white-space:nowrap;} .courseSendCheckbox {padding:0px; margin:0px; width:12px; height:12px; margin-right:10px; display:inline-block; margin-top:2px;} -.sendCourseName {font-size:12px; color:#5f6060;} -.courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#269ac9; margin-right:25px; float:left;} +.sendCourseName {font-size:12px; color:#5f6060;display:inline-block} +.courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#269ac9; margin-right:25px; float:left;cursor: pointer;} .courseSendSubmit:hover {background-color:#297fb8;} .courseSendCancel {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#c1c1c1; float:left} .courseSendCancel:hover {background-color:#717171;} -.courseReferContainer {float:left; max-height:120px; overflow:scroll; overflow-x:hidden; margin-right:16px; margin-bottom:10px;} -a.sendSourceText {font-size:14px; color:#ffffff !important; display:block;} +a.sendSourceText {font-size:14px; color:#ffffff;} +input.sendSourceText {font-size:14px;color:#ffffff;background-color:#269ac9;cursor: pointer; outline: none; border: none; width: 50px; height: 25px;} +input.sendSourceText:hover {background-color:#297fb8;} +/*input.sendSourceText:hover {font-size:14px; color:#ffffff;}*/ +.resourcesSendTo {float:left; height:20px; margin-top:15px;} +.resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;} +.courseReferContainer {float:left; max-height:120px;margin-right:16px;margin-bottom:10px; overflow:auto; overflow-x:hidden;} +.popbox{/* width:300px; *//* height:100px; */position:fixed !important;/* z-index:100; */left:50%;top:50%;margin:-100px 0 0 -150px; /* background:#fff; */ -moz-border-radius:5px; /* -webkit-border-radius:5px; */ /* border-radius:5px; */ /* box-shadow:0px 0px 8px #194a81; */ /* overflow:auto; */} /*上传资源弹窗*/ .resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;} @@ -922,42 +934,31 @@ a.resourcesTypeUser {background:url(images/homepage_icon.png) -178px -453px no-r /* @功能 定义 */ span.at {color:#269ac9;} -.del_line{text-decoration:line-through !important;} -/*转发样式*/ -.shareDP {width:415px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; z-index:1000;} +span.at a{color:#269ac9;text-decoration: none;} + +/*20151217资源库Tim*/ +.preview {background:url(../images/hwork_icon.png) -75px -120px no-repeat; width:20px; height:20px; display:inline-block;} +.mediaIcon {background:url(../images/hwork_icon.png) -5px -160px no-repeat; padding-left:23px;} +.codeIcon {background:url(../images/hwork_icon.png) -78px -160px no-repeat; padding-left:23px;} +.othersIcon {background:url(../images/hwork_icon.png) -3px -210px no-repeat; padding-left:23px;} +.thesisIcon {background:url(../images/hwork_icon.png) -78px -212px no-repeat; padding-left:23px;} +.softwareIcon {background:url(../images/hwork_icon.png) -5px -254px no-repeat; padding-left:23px;} + +.shareDP {width:415px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:relative; 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; background-color:#f1f1f1; 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 li {padding-left:10px; color:#585858;} -.columnWrap span {width:150px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:inline-block;} +.sectionWrap {float:left; max-height:150px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:205px; min-height:150px; padding-top:5px; border:1px solid #dddddd;} +.columnWrap {float:left; max-height:155px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:178px; min-height:155px; border:1px solid #dddddd;} +.columnWrap li {padding-left:10px; color:#585858; line-height:20px;} +.columnWrap li:hover {background-color:#cccccc;} +.columnWrap span {width:150px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:inline-block; height:20px; vertical-align:top;} .sectionRow:hover {background-color:#cccccc; cursor:pointer;} -.sectionContent {display:block;} -.sectionContent li {padding-left:30px;} -.sectionContent li:hover {background-color:#cccccc; cursor:pointer;} -.sectionContent span {width:175px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:18px; vertical-align:middle;} - -/*151228样式更新*/ -.menuSetting {background:url(../images/hwork_icon.png) -5px -132px no-repeat; display:inline-block; width:20px; height:20px;} -.boxShadow {box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5);} -a.greyBtn{ display:inline-block; background:#f2f3f3; padding:0px 5px; height:20px; border:1px solid #d3d3d3; color:#888888; line-height:1.9;-moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px;} -a:hover.greyBtn{border:1px solid #888888; } -a.blueBtn{ display:inline-block; background:#269ac9; padding:0px 5px; height:20px; border:1px solid #269ac9; color:#ffffff; line-height:1.9;-moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px;} -a.blueBtn:hover {background-color:#298fbd;} -a.cancelBtn{ display:inline-block; background:#c1c1c1; padding:0px 5px; height:20px; border:1px solid #d3d3d3; color:#ffffff; line-height:1.9;-moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px;} -a.cancelBtn:hover {background:#888888;} -a.userFollow{ display:inline-block; width:55px; height:20px; border:1px solid #d3d3d3; color:#888888; background:#f2f3f3 url(../images/homepage_icon2.png) -9px -6px no-repeat; padding-left:25px; line-height:1.9;-moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px;} -a:hover.userFollow{border:1px solid #888888; } -a.userCancel{ display:inline-block; width:55px; height:20px; border:1px solid #d3d3d3; color:#888888; background:#f2f3f3 url(../images/homepage_icon2.png) -177px -6px no-repeat; padding-left:25px; line-height:1.9;-moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px;} -a:hover.userCancel{border:1px solid #888888; } -.pAbsolute {position:absolute; z-index:999;} -.userAvatarWrap {width:50px; height:50px; position:relative; border:1px solid #cbcbcb; padding: 2px;} -.userAvatarWrap:hover {border:1px solid #269ac9;} -.mr27 {margin-right:27px;} -.userCard {width:208px; border:1px solid #dddddd; background-color:#ffffff; margin-top:10px; padding:15px; top:-176px; left:-95px; position:absolute; z-index:999; display:none;} -.userCard font {display:block; border-width:8px; position:absolute; bottom:-16px; left:110px; border-style:solid dashed dashed dashed; border-color:#FFF transparent transparent transparent; font-size:0; line-height:0;} -.userCard em {display:block; border-width:8px; position:absolute; bottom:-17px; left:110px; border-style:solid dashed dashed dashed; border-color:#eaeaea transparent transparent transparent; font-size:0; line-height:0;} -a.mesIcon {background:url(../images/mes_icon.png) -5px -73px no-repeat; padding-left:23px;} -a.personalIcon {background:url(../images/mes_icon.png) -6px -16px no-repeat; padding-left:23px;} -.mesType {background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:10px 15px; left:-50px; font-size:12px; color:#888888; display:none; line-height:2; z-index:999; white-space:nowrap;} -a.greyBtn2 {float:right; text-align:center; font-size:12px; color:#ffffff; background-color:#cecece; padding:3px 10px;} -.PMTag {padding:0px 5px; background-color:#555555; border-radius:3px; color:#ffffff;} \ No newline at end of file +.sectionContent {} +.sectionContent li {padding-left:10px; line-height:20px;} +.sectionContent li:hover {background-color:#cccccc;} +.sectionContent span {width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:20px; vertical-align:top;} +.orgDirection {width:392px; background-color:#f1f1f1; height:30px; vertical-align:middle; line-height:30px; color:#585858; padding-left:10px;} +.orgSendSearch {border:1px solid #dddddd; outline:none; width:262px; height:22px; padding-left:10px; float:left;} + +/*文本描述展开高度*/ +.maxh360 {max-height: 810px;} +.lh18 { line-height: 18px;} diff --git a/spec/factories/attachment_histories.rb b/spec/factories/attachment_histories.rb new file mode 100644 index 000000000..3348cbd33 --- /dev/null +++ b/spec/factories/attachment_histories.rb @@ -0,0 +1,6 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :attachment_history do + end +end diff --git a/spec/models/attachment_history_spec.rb b/spec/models/attachment_history_spec.rb new file mode 100644 index 000000000..58e38025d --- /dev/null +++ b/spec/models/attachment_history_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe AttachmentHistory, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end