Merge branch 'dai_ao' of https://git.trustie.net/jacknudt/trustieforge into dai_ao
Conflicts: Gemfile app/controllers/pull_requests_controller.rb
This commit is contained in:
commit
79fc4b7752
14
Gemfile
14
Gemfile
|
@ -63,22 +63,18 @@ group :development do
|
|||
if RUBY_PLATFORM =~ /w32/
|
||||
gem 'win32console'
|
||||
end
|
||||
|
||||
if RUBY_PLATFORM =~ /darwin/
|
||||
gem 'puma'
|
||||
end
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
unless RUBY_PLATFORM =~ /w32/
|
||||
gem 'pry-rails'
|
||||
if RUBY_VERSION >= '2.0.0'
|
||||
gem 'pry-byebug'
|
||||
gem "test-unit", "~>3.0"
|
||||
end
|
||||
gem 'pry-stack_explorer'
|
||||
if RUBY_PLATFORM =~ /darwin/
|
||||
gem 'puma'
|
||||
end
|
||||
end
|
||||
|
||||
gem 'rspec-rails', '~> 3.0'
|
||||
gem 'factory_girl_rails'
|
||||
end
|
||||
|
||||
# Gems used only for assets and not required
|
||||
|
|
|
@ -17,17 +17,18 @@ module Mobile
|
|||
end
|
||||
else
|
||||
case field
|
||||
when :download_url
|
||||
"attachments/download/#{f.try(:id)}"
|
||||
when :file_dir
|
||||
"attachments/download/" << f.send(:id).to_s << '/'
|
||||
when :attafile_size
|
||||
(number_to_human_size(f.filesize)).gsub("ytes", "").to_s
|
||||
when :coursename
|
||||
f.course.nil? ? "" : f.course.name
|
||||
f.try(:course).try(:name) || ''
|
||||
when :syllabus_title
|
||||
f.course.nil? ? "" : f.course.syllabus.nil? ? "" : f.course.syllabus.title
|
||||
f.try(:course).try(:syllabus).try(:title) || ''
|
||||
when :course_id
|
||||
f.course.nil? ? 0 : f.course.id
|
||||
|
||||
f.try(:course).try(:id) || 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -50,6 +51,8 @@ module Mobile
|
|||
current_user_is_teacher = is_course_teacher(current_user,instance.course)
|
||||
current_user_is_teacher
|
||||
end
|
||||
|
||||
attachment_expose :download_url
|
||||
end
|
||||
end
|
||||
end
|
|
@ -180,6 +180,8 @@ module Mobile
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
expose :attachments, using: Mobile::Entities::Attachment
|
||||
end
|
||||
end
|
||||
end
|
|
@ -175,8 +175,10 @@ class AdminController < ApplicationController
|
|||
def courses
|
||||
@name = params[:name].to_s.strip.downcase
|
||||
if @name && @name != ""
|
||||
@courses = Course.select{ |course| course.teacher && ((course.teacher.show_name).include?(@name) || course.name.include?(@name))}
|
||||
@courses = @courses.sort{|x, y| y.created_at <=> x.created_at}
|
||||
all_user_ids = Course.all.map{|course| course.tea_id}
|
||||
user_str_ids = search_user_by_name all_user_ids, @name
|
||||
user_ids = user_str_ids.empty? ? "(-1)" : "(" + user_str_ids.join(",") + ")"
|
||||
@courses = Course.where("tea_id in #{user_ids} or name like '%#{@name}%'").reorder("created_at desc")
|
||||
else
|
||||
@courses = Course.order('created_at desc')
|
||||
end
|
||||
|
|
|
@ -117,6 +117,9 @@ class ApplicationController < ActionController::Base
|
|||
elsif params[:format] == 'atom' && params[:key] && request.get? && accept_rss_auth?
|
||||
# RSS key authentication does not start a session
|
||||
user = User.find_by_rss_key(params[:key])
|
||||
elsif session[:wechat_openid]
|
||||
uw = UserWechat.find_by_openid(session[:wechat_openid])
|
||||
user = uw.user if uw
|
||||
end
|
||||
end
|
||||
if user.nil? && Setting.rest_api_enabled? && accept_api_auth?
|
||||
|
@ -509,8 +512,7 @@ class ApplicationController < ActionController::Base
|
|||
# render_404
|
||||
# end
|
||||
|
||||
def self.
|
||||
model_object(model)
|
||||
def self.model_object(model)
|
||||
self.model_object = model
|
||||
end
|
||||
|
||||
|
|
|
@ -72,8 +72,10 @@ class AttachmentsController < ApplicationController
|
|||
|
||||
def direct_download
|
||||
@attachment.increment_download
|
||||
file_type = detect_content_type(@attachment)
|
||||
|
||||
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
|
||||
:type => detect_content_type(@attachment),
|
||||
:type => file_type,
|
||||
:disposition => 'attachment' #inline can open in browser
|
||||
end
|
||||
|
||||
|
@ -130,11 +132,7 @@ class AttachmentsController < ApplicationController
|
|||
def download
|
||||
# modify by nwb
|
||||
# 下载添加权限设置
|
||||
if (params[:type] && params[:type] == "wechat" )
|
||||
candown = true
|
||||
else
|
||||
candown = attachment_candown @attachment
|
||||
end
|
||||
candown = attachment_candown @attachment
|
||||
|
||||
if candown || User.current.admin? || User.current.id == @attachment.author_id
|
||||
if stale?(:etag => @attachment.digest)
|
||||
|
|
|
@ -32,6 +32,13 @@ class CoursesController < ApplicationController
|
|||
before_filter :require_login, :only => [:join, :unjoin]
|
||||
#before_filter :allow_join, :only => [:join]
|
||||
|
||||
# 邀请码停用/启用
|
||||
def set_invite_code_halt
|
||||
if User.current.allowed_to?(:as_teacher, @course) || User.current.admin?
|
||||
@course.update_attribute('invite_code_halt', @course.invite_code_halt == 0 ? 1 : 0)
|
||||
end
|
||||
end
|
||||
|
||||
#查找组织
|
||||
def search_public_orgs_not_in_course
|
||||
condition = '%%'
|
||||
|
|
|
@ -6,7 +6,7 @@ class HomeworkCommonController < ApplicationController
|
|||
|
||||
include StudentWorkHelper
|
||||
before_filter :find_course, :only => [:index,:new,:create]
|
||||
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works]
|
||||
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works,:set_score_open,:alert_score_open_modal]
|
||||
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works]
|
||||
before_filter :member_of_course, :only => [:index]
|
||||
|
||||
|
@ -82,6 +82,27 @@ class HomeworkCommonController < ApplicationController
|
|||
@homework.publish_time = params[:homework_common][:publish_time]
|
||||
end
|
||||
homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
|
||||
param_end_time = Time.parse(params[:homework_common][:end_time]).strftime("%Y-%m-%d")
|
||||
homework_end_time = Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d")
|
||||
if homework_end_time != param_end_time
|
||||
if homework_end_time > param_end_time
|
||||
@homework.student_works.where("work_status = 1").each do |st|
|
||||
if param_end_time < Time.parse(st.commit_time.to_s).strftime("%Y-%m-%d")
|
||||
st.late_penalty = @homework.late_penalty
|
||||
st.work_status = 2
|
||||
st.save
|
||||
end
|
||||
end
|
||||
else
|
||||
@homework.student_works.where("work_status = 2").each do |st|
|
||||
if param_end_time >= Time.parse(st.commit_time.to_s).strftime("%Y-%m-%d")
|
||||
st.late_penalty = 0
|
||||
st.work_status = 1
|
||||
st.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@homework.end_time = params[:homework_common][:end_time] || Time.now
|
||||
@homework.course_id = params[:course_id]
|
||||
if params[:homework_type] && params[:homework_type].to_i != @homework.homework_type
|
||||
|
@ -198,6 +219,23 @@ class HomeworkCommonController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 成绩公开范围弹框
|
||||
def alert_score_open_modal
|
||||
if params[:user_activity_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
else
|
||||
@user_activity_id = -1
|
||||
end
|
||||
@hw_status = params[:hw_status].to_i
|
||||
end
|
||||
|
||||
def set_score_open
|
||||
@homework.update_attribute('score_open', params[:score_open].to_i)
|
||||
@user_activity_id = params[:user_activity_id].to_i
|
||||
@hw_status = params[:hw_status].to_i
|
||||
@is_teacher = User.current.admin? || User.current.allowed_to?(:as_teacher, @course)
|
||||
end
|
||||
|
||||
#开启匿评
|
||||
#statue 1:启动成功,2:启动失败,作业总数大于等于2份时才能启动匿评,3:已开启匿评,请务重复开启,4:没有开启匿评的权限
|
||||
def start_anonymous_comment
|
||||
|
@ -257,26 +295,25 @@ class HomeworkCommonController < ApplicationController
|
|||
def stop_anonymous_comment
|
||||
@homework_detail_manual.update_column('comment_status', 3)
|
||||
@homework_detail_manual.update_column('evaluation_end', Date.today)
|
||||
#计算缺评扣分
|
||||
# 计算缺评扣分
|
||||
work_ids = "(" + @homework.student_works.has_committed.map(&:id).join(",") + ")"
|
||||
if @homework.homework_type != 3
|
||||
@homework.student_works.has_committed.each do |student_work|
|
||||
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
|
||||
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
|
||||
student_work.save
|
||||
end
|
||||
else
|
||||
@homework.student_works.has_committed.each do |student_work|
|
||||
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
|
||||
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
|
||||
student_work.save
|
||||
pros = student_work.student_work_projects.where("is_leader = 0")
|
||||
user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
|
||||
student_works = @homework.student_works.where("user_id in #{user_ids}")
|
||||
student_works.each do |st_work|
|
||||
absence_penalty_count = st_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - st_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
|
||||
st_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
|
||||
st_work.save
|
||||
|
||||
# 参与匿评的缺评计算
|
||||
@homework.student_works.where("work_status != 0").each do |student_work|
|
||||
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
|
||||
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
|
||||
student_work.save
|
||||
end
|
||||
|
||||
# 未参与匿评的缺评计算
|
||||
if @homework_detail_manual.no_anon_penalty == 0
|
||||
all_dis_eva = StudentWorksEvaluationDistribution.where("student_work_id IN #{work_ids}")
|
||||
has_sw_count = all_dis_eva.select("distinct user_id").count
|
||||
anon_count = all_dis_eva.count / has_sw_count
|
||||
@homework.student_works.where("work_status != 0").each do |student_work|
|
||||
if student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count == 0
|
||||
student_work.absence_penalty = @homework_detail_manual.absence_penalty * anon_count
|
||||
student_work.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,9 +22,9 @@ class IssuesController < ApplicationController
|
|||
before_filter :authorize1, :only => [:show]
|
||||
before_filter :find_issue, :only => [:show, :edit, :update,:add_journal, :add_journal_in_org]
|
||||
before_filter :find_issues, :only => [:bulk_edit, :bulk_update, :destroy]
|
||||
before_filter :find_project, :only => [:new, :create, :update_form]
|
||||
before_filter :find_project, :only => [:new, :create, :update_form, :issue_commits, :commit_for_issue, :issue_commit_delete]
|
||||
#before_filter :authorize, :except => [:index, :show]
|
||||
before_filter :authorize, :except => [:index,:add_journal, :add_journal_in_org,:delete_journal,:reply,:add_reply]
|
||||
before_filter :authorize, :except => [:index,:add_journal, :add_journal_in_org,:delete_journal,:reply,:add_reply, :issue_commits, :commit_for_issue, :issue_commit_delete]
|
||||
|
||||
before_filter :find_optional_project, :only => [:index]
|
||||
before_filter :check_for_default_issue_status, :only => [:new, :create]
|
||||
|
@ -57,6 +57,57 @@ class IssuesController < ApplicationController
|
|||
helper :project_score
|
||||
include ApplicationHelper
|
||||
|
||||
# issue和代码提交id关联模块 --> over
|
||||
# 获取某个项目的commit_ids
|
||||
def issue_commits
|
||||
begin
|
||||
return render_404 if @project.gpid.nil?
|
||||
@issue_commit_ids = (params[:issue_commit_ids].is_a?(Array) ? params[:issue_commit_ids] : params[:issue_commit_ids].split(",")) unless params[:issue_commit_ids].nil?
|
||||
search = params[:search].to_s.strip
|
||||
@type = params[:type]
|
||||
limit = 15
|
||||
g = Gitlab.client
|
||||
g_project = g.project(@project.gpid)
|
||||
rev = params[:branch].nil? ? g_project.default_branch : params[:branch]
|
||||
@project_branches = g.branches(@project.gpid)
|
||||
@branch_names = @project_branches.map{|b| b.name}
|
||||
@default_branch = g_project.default_branch
|
||||
# 搜索的分页需要单独处理,因为搜索不容易获取总数
|
||||
if search.present?
|
||||
@commits = g.commits(@project.gpid, ref_name:rev, :search => search)
|
||||
@commits_count = @commits.count
|
||||
@commits_pages = Paginator.new @commits_count, limit, params['page'] || 1
|
||||
@offset ||= @commits_pages.offset
|
||||
@commits = paginateHelper @commits,limit
|
||||
else
|
||||
@commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s, ref_name:rev, :search => search)
|
||||
@commits_count = g.user_static(@project.gpid, :rev => rev).count
|
||||
@commits_pages = Redmine::Pagination::Paginator.new @commits_count, limit, params[:page]
|
||||
end
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
end
|
||||
|
||||
# 选择对应的Commit
|
||||
def commit_for_issue
|
||||
history_commit_ids = params[:issue_for_commit_ids].split(",") unless params[:issue_for_commit_ids].nil?
|
||||
@issue_commit_ids = (history_commit_ids.blank? ? params[:checkbox1] : params[:checkbox1] | history_commit_ids).uniq
|
||||
end
|
||||
|
||||
def issue_commit_delete
|
||||
commit_id = params[:commit_id].split(",")
|
||||
issue_commit_ids = params[:issue_commit_ids]
|
||||
# issue_id存在则为issue详情或者编辑的时候,否则为新建Issue
|
||||
# 编辑和详情的时候需要在数据库中删除记录,新建的时候在内存中删除
|
||||
if params[:issue_id]
|
||||
commit_issue = CommitIssues.where(:commit_id => commit_id, :issue_id => params[:issue_id], :project_id => @project.id).first
|
||||
commit_issue.delete if commit_issue
|
||||
end
|
||||
@issue_commit_ids = issue_commit_ids - commit_id
|
||||
end
|
||||
# over
|
||||
|
||||
def index
|
||||
# 顶部导航
|
||||
@project_menu_type = 2
|
||||
|
@ -163,14 +214,14 @@ class IssuesController < ApplicationController
|
|||
def show
|
||||
# 顶部导航
|
||||
@project_menu_type = 2
|
||||
|
||||
# 打开编辑内容
|
||||
@is_edit = true unless params[:edit].nil?
|
||||
|
||||
# 当前用户查看指派给他的缺陷消息,则设置消息为已读
|
||||
query = ForgeMessage.where("forge_message_type =? and user_id =? and forge_message_id =?", "Issue", User.current, @issue).first
|
||||
query.update_attribute(:viewed, true) unless query.nil?
|
||||
|
||||
# issue 关联的commit
|
||||
commit_issues = CommitIssues.where(:issue_id => @issue.id, :project_id => @issue.project_id)
|
||||
@issue_commit_ids = commit_issues.map{|commit_issue| commit_issue.commit_id}
|
||||
# issue 新建的at消息
|
||||
User.current.at_messages.unviewed('Issue', @issue.id).each {|x| x.viewed!}
|
||||
# 回复的at消息
|
||||
|
@ -238,6 +289,8 @@ class IssuesController < ApplicationController
|
|||
@issue.fixed_version_id = nil if @issue.fixed_version_id == 0
|
||||
@issue.assigned_to_id = nil if @issue.assigned_to_id == 0
|
||||
if @issue.save
|
||||
# 关联commmit
|
||||
update_issue_commit params[:commit_ids]
|
||||
#params[:issue][:assigned_to_id] = nil if params[:issue][:assigned_to_id].to_i == 0
|
||||
senduser = User.find(params[:issue][:assigned_to_id])
|
||||
issue_id = @issue.id
|
||||
|
@ -276,6 +329,9 @@ class IssuesController < ApplicationController
|
|||
def edit
|
||||
# 修改实例变量的值
|
||||
return unless update_issue_from_params
|
||||
# issue 关联的commit
|
||||
commit_issues = CommitIssues.where(:issue_id => @issue.id, :project_id => @issue.project_id)
|
||||
@issue_commit_ids = commit_issues.map{|commit_issue| commit_issue.commit_id}
|
||||
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'base_projects' }#added by young
|
||||
|
@ -309,9 +365,9 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if @saved
|
||||
# 更新commit关联情况
|
||||
update_issue_commit params[:commit_ids]
|
||||
#修改界面增加跟踪者
|
||||
watcherlist = @issue.watcher_users
|
||||
select_users = []
|
||||
|
@ -356,6 +412,26 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 保存issue的时候相关的commit操作
|
||||
# commit_ids => "9b9845ff,poor56el"
|
||||
def update_issue_commit commit_ids
|
||||
# 关联commmit
|
||||
commit_ids = params[:commit_ids]
|
||||
unless commit_ids.blank?
|
||||
commit_ids = commit_ids.split(",").uniq
|
||||
if params[:action] == "update"
|
||||
exist_commit_ids = CommitIssues.where(:issue_id => @issue, :project_id => @issue.project_id)
|
||||
unless exist_commit_ids.blank?
|
||||
exist_commit_ids = exist_commit_ids.map{|commit| commit.commit_id}
|
||||
commit_ids = commit_ids - exist_commit_ids
|
||||
end
|
||||
end
|
||||
commit_ids.each do |commit_id|
|
||||
CommitIssues.create(:commit_id => commit_id, :project_id => @issue.project_id, :issue_id => @issue.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update_user_issue_detail(issue, params)
|
||||
case params[:type]
|
||||
when "status"
|
||||
|
@ -794,7 +870,6 @@ class IssuesController < ApplicationController
|
|||
|
||||
# 更新issue状态时,journal表产生记录,返回@current_journal
|
||||
@issue.init_journal(User.current)
|
||||
|
||||
issue_attributes = params[:issue]
|
||||
if issue_attributes && params[:conflict_resolution]
|
||||
case params[:conflict_resolution]
|
||||
|
@ -809,18 +884,18 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
senduser = User.find(params[:issue][:assigned_to_id])
|
||||
|
||||
if senduser.id != User.current.id && @issue.assigned_to_id != params[:issue][:assigned_to_id].to_i
|
||||
issue_id = @issue.id
|
||||
issue_title = params[:issue][:subject]
|
||||
priority_id = params[:issue][:priority_id]
|
||||
ps = ProjectsService.new
|
||||
ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
|
||||
if params[:action] == "update"
|
||||
senduser = User.find(params[:issue][:assigned_to_id])
|
||||
if senduser.id != User.current.id && @issue.assigned_to_id != params[:issue][:assigned_to_id].to_i
|
||||
issue_id = @issue.id
|
||||
issue_title = params[:issue][:subject]
|
||||
priority_id = params[:issue][:priority_id]
|
||||
ps = ProjectsService.new
|
||||
ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
|
||||
end
|
||||
end
|
||||
|
||||
@issue.safe_attributes = issue_attributes
|
||||
|
||||
@priorities = IssuePriority.active
|
||||
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
|
||||
true
|
||||
|
|
|
@ -14,17 +14,17 @@ class MemosController < ApplicationController
|
|||
# layout 'base_memos'
|
||||
|
||||
def quote
|
||||
@subject = @memo.subject
|
||||
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
|
||||
|
||||
@content = "#{ll(Setting.default_language, :text_user_wrote, @memo.author)} <br/> "
|
||||
@content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "</blockquote>\n\n<br/>"
|
||||
@content = "<blockquote style='word-break: break-all;word-wrap: break-word;'>" << @content
|
||||
#@content = "> #{ll(Setting.default_language, :text_user_wrote, @memo.author)}\n> "
|
||||
#@content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||
#@content_html = textilizable(@content)
|
||||
@temp = Memo.new
|
||||
@temp.content = @content
|
||||
# @subject = @memo.subject
|
||||
# @subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
|
||||
#
|
||||
# @content = "#{ll(Setting.default_language, :text_user_wrote, @memo.author)} <br/> "
|
||||
# @content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "</blockquote>\n\n<br/>"
|
||||
# @content = "<blockquote style='word-break: break-all;word-wrap: break-word;'>" << @content
|
||||
# #@content = "> #{ll(Setting.default_language, :text_user_wrote, @memo.author)}\n> "
|
||||
# #@content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||
# #@content_html = textilizable(@content)
|
||||
# @temp = Memo.new
|
||||
# @temp.content = @content
|
||||
end
|
||||
|
||||
def new
|
||||
|
@ -47,6 +47,8 @@ class MemosController < ApplicationController
|
|||
@quote = params[:quote]
|
||||
end
|
||||
|
||||
|
||||
|
||||
#unless params[:quote].nil?
|
||||
# @quote = params[:quote][:quote]
|
||||
#end
|
||||
|
@ -55,6 +57,10 @@ class MemosController < ApplicationController
|
|||
@memo.forum_id = params[:forum_id]
|
||||
@memo.author_id = User.current.id
|
||||
|
||||
if params[:memo][:parent_id]
|
||||
@memo.root_id = (Memo.find params[:memo][:parent_id]).root_id.nil? ? params[:memo][:parent_id].to_i : (Memo.find params[:memo][:parent_id]).root_id
|
||||
end
|
||||
|
||||
@memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads]))
|
||||
@memo.content = @quote + @memo.content
|
||||
respond_to do |format|
|
||||
|
@ -111,32 +117,37 @@ class MemosController < ApplicationController
|
|||
@memo = @memo.root # 取出楼主,防止输入帖子id让回复作为主贴显示
|
||||
@memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1))
|
||||
|
||||
page = params[:page]
|
||||
if params[:r] && page.nil?
|
||||
offset = @memo.children.where("#{Memo.table_name}.id < ?", params[:r].to_i).count
|
||||
page = 1 + offset / pre_count
|
||||
else
|
||||
# page = params[:page]
|
||||
# if params[:r] && page.nil?
|
||||
# offset = @memo.children.where("#{Memo.table_name}.id < ?", params[:r].to_i).count
|
||||
# page = 1 + offset / pre_count
|
||||
# else
|
||||
# end
|
||||
|
||||
end
|
||||
@reply_count = @memo.children.count
|
||||
@reply_pages = Paginator.new @reply_count, pre_count, page
|
||||
@replies = @memo.children.
|
||||
includes(:author, :attachments).
|
||||
reorder("#{Memo.table_name}.created_at DESC").
|
||||
limit(@reply_pages.per_page).
|
||||
offset(@reply_pages.offset).
|
||||
all
|
||||
# @reply_count = @memo.children.count
|
||||
# @reply_pages = Paginator.new @reply_count, pre_count, page
|
||||
# @replies = @memo.children.
|
||||
# includes(:author, :attachments).
|
||||
# reorder("#{Memo.table_name}.created_at DESC").
|
||||
# limit(@reply_pages.per_page).
|
||||
# offset(@reply_pages.offset).
|
||||
# all
|
||||
|
||||
@replies = Memo.where("root_id = #{@memo.id}").reorder("created_at desc")
|
||||
@reply_count = @replies.count
|
||||
@replies = get_no_children_comments_all @replies
|
||||
@limit_count = @replies.count
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
@limit = 10
|
||||
@replies = @replies[@page * @limit..@page * @limit + 9]
|
||||
|
||||
@memo_new = Memo.new
|
||||
|
||||
@my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is null").count
|
||||
@my_replies_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is not null").count
|
||||
# @memo = Memo.find_by_id(params[:id])
|
||||
# @forum = Forum.find(params[:forum_id])
|
||||
# @replies = @memo.replies
|
||||
# @mome_new = Memo.new
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout=> 'base_forums'}#:layout=> 'base_forums',
|
||||
format.json { render json: @memo }
|
||||
format.xml { render xml: @memo }
|
||||
|
|
|
@ -270,6 +270,7 @@ class PollController < ApplicationController
|
|||
|
||||
#发布问卷
|
||||
def publish_poll
|
||||
@index = params[:index]
|
||||
@poll.polls_status = 2
|
||||
@poll.published_at = Time.now
|
||||
@poll.show_result = params[:show_result].to_i if params[:show_result]
|
||||
|
@ -508,6 +509,7 @@ class PollController < ApplicationController
|
|||
|
||||
#重新发布问卷
|
||||
def republish_poll
|
||||
@index = params[:index]
|
||||
@poll.poll_questions.each do |poll_question|
|
||||
poll_question.poll_votes.destroy_all
|
||||
end
|
||||
|
@ -530,6 +532,7 @@ class PollController < ApplicationController
|
|||
|
||||
#关闭问卷
|
||||
def close_poll
|
||||
@index = params[:index]
|
||||
@poll.polls_status = 3
|
||||
@poll.closed_at = Time.now
|
||||
if @poll.save
|
||||
|
|
|
@ -543,12 +543,12 @@ class ProjectsController < ApplicationController
|
|||
@users -= watched.watcher_users if @watched
|
||||
end
|
||||
@watchers = @project.watcher_users
|
||||
@limit = 20
|
||||
@limit = 32
|
||||
@is_remote = true
|
||||
@watchers_count = @watchers.count
|
||||
@watcher_pages = Paginator.new @watchers_count, @limit, params['page'] || 1
|
||||
@offset ||= @watcher_pages.offset
|
||||
@watchers = paginateHelper @watchers, 20
|
||||
@watchers = paginateHelper @watchers, @limit
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -611,14 +611,14 @@ class ProjectsController < ApplicationController
|
|||
@applied_members = appied_project_members(@project, @members)
|
||||
end
|
||||
end
|
||||
@members = paginateHelper @members
|
||||
@members = paginateHelper @members, 32
|
||||
|
||||
end
|
||||
|
||||
def member_forked
|
||||
@forked_projects = Project.where(:forked_from_project_id => @project.id)
|
||||
|
||||
@limit = 20
|
||||
@limit = 32
|
||||
@is_remote = true
|
||||
@forked_count = @forked_projects.count
|
||||
@forked_pages = Paginator.new @forked_count, @limit, params['page'] || 1
|
||||
|
|
|
@ -38,12 +38,12 @@ class PullRequestsController < ApplicationController
|
|||
@requests_merged_count = merge_requests.select{|request| request.state == "merged"}.count
|
||||
@requests_closed_count = merge_requests.select{|request| request.state == "closed"}.count
|
||||
|
||||
@limit = 10
|
||||
@limit = 20
|
||||
@is_remote = true
|
||||
@count = type_count(type, @requests_opened_count, @requests_merged_count, @requests_closed_count)
|
||||
@pages = Paginator.new @count, @limit, params['page'] || 1
|
||||
@offset ||= @pages.offset
|
||||
@requests = paginateHelper @requests, 10
|
||||
@requests = paginateHelper @requests, 20
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
|
@ -101,16 +101,16 @@ class PullRequestsController < ApplicationController
|
|||
request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch, :target_project_id => target_project_id)
|
||||
@fork_project_name = Project.find(params[:target_project_id]).try(:name)
|
||||
@fork_pr_message = true if @fork_project_name
|
||||
# 发送消息
|
||||
send_message(User.current.id, target_project_id, request.id)
|
||||
# 创建Trustie数据
|
||||
PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => target_project_id)
|
||||
# 向管理员发送消息
|
||||
send_message_to_manager(params[:target_project_id].to_i, request.id, 1)
|
||||
PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => target_project_id, :title => title)
|
||||
else
|
||||
@project_member = Member.where(:project_id => @project.id)
|
||||
request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch)
|
||||
# 发送消息
|
||||
send_message(User.current.id, @project.id, request.id)
|
||||
send_message_to_manager(@project.id, request.id, 1)
|
||||
# 创建Trustie数据
|
||||
PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => @project.id)
|
||||
PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => @project.id, :title => title)
|
||||
respond_to do |format|
|
||||
format.js{redirect_to project_pull_request_path(request.id, :project_id => @project.id)}
|
||||
end
|
||||
|
@ -189,7 +189,9 @@ class PullRequestsController < ApplicationController
|
|||
def accept_pull_request
|
||||
begin
|
||||
status = @g.accept_merge_rquest(@project.gpid, params[:id], User.current.gid)
|
||||
PullRequest.create(:pull_request_id => status.id, :user_id => User.current.id, :gpid => status.project_id)
|
||||
# 接受后,给用户发消息
|
||||
send_message_to_author(@project.id, status.author.try(:username), params[:id], 2)
|
||||
|
||||
respond_to do |format|
|
||||
format.js{redirect_to project_pull_request_path(status.id, :project_id => @project.id)}
|
||||
end
|
||||
|
@ -214,7 +216,13 @@ class PullRequestsController < ApplicationController
|
|||
# @return [Gitlab::ObjectifiedHash] Information about updated merge request.
|
||||
def update_pull_request
|
||||
begin
|
||||
@g.update_merge_request(@project.gpid, params[:id], User.current.gid, :state_event => params[:state])
|
||||
request = @g.update_merge_request(@project.gpid, params[:id], User.current.gid, :state_event => params[:state])
|
||||
user = User.find_by_login(request.author.try(:username))
|
||||
status = params[:state] == "close" ? 4 : 3
|
||||
send_message_to_manager(@project.id, params[:id], status)
|
||||
if is_project_manager?(User.current.id, @project.id)
|
||||
send_message_to_author(@project.id, user.login, request.id, status)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html{redirect_to project_pull_request_path(params[:id], :project_id => @project.id)}
|
||||
end
|
||||
|
@ -288,33 +296,14 @@ class PullRequestsController < ApplicationController
|
|||
# id (required) - The ID of a project
|
||||
# merge_request_id (required) - The ID of MR
|
||||
def pull_request_changes
|
||||
|
||||
@type = params[:type]
|
||||
@changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes)
|
||||
logger.info("###############################{@changes}")
|
||||
diff = ActiveSupport::JSON.decode(@changes).first
|
||||
diff = OpenStruct.new(diff)
|
||||
diff_file = Trustie::Gitlab::Diff::File.new(diff)
|
||||
logger.info("##############################")
|
||||
output = ''
|
||||
diff_file.diff_lines.each_with_index do |line, index|
|
||||
type = line.type
|
||||
last_line = line.new_pos
|
||||
line_old = line.old_pos.to_s
|
||||
|
||||
|
||||
if type == 'match'
|
||||
## 表示没有修改,两个都要显示行号
|
||||
output += "|#{line_old.center(4)}|#{last_line.to_s.center(4)}|#{line.text}\n"
|
||||
else
|
||||
old_line = type == 'new' ? ' '*4: line_old
|
||||
new_line = type == 'old' ? ' '*4: last_line
|
||||
output += "|#{old_line.to_s.center(4)}|#{new_line.to_s.center(4)}|#{line.text}\n"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@changes_count = @changes.count
|
||||
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@count = @changes_count
|
||||
@pages = Paginator.new @count, @limit, params['page'] || 1
|
||||
|
@ -344,6 +333,33 @@ class PullRequestsController < ApplicationController
|
|||
:forge_message_id => pull_request_id, :forge_message_type => "PullRequest", :viewed => true)
|
||||
end
|
||||
|
||||
def send_message_to_manager project_id, pull_request_id, status
|
||||
project = Project.find(project_id)
|
||||
project.members.each do |member|
|
||||
if is_project_manager?(member.user_id, project_id) && User.current.id != member.user_id
|
||||
add_message(member.user_id, project_id, pull_request_id, status)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def send_message_to_author(project_id, user_login, request_id, status)
|
||||
user = get_user_by_login_and(user_login)
|
||||
if user.id != User.current.id
|
||||
add_message(user.id, project_id, request_id, status)
|
||||
end
|
||||
end
|
||||
|
||||
def add_message(user_id, project_id, pull_request_id, status)
|
||||
ForgeMessage.create(:user_id => user_id,
|
||||
:project_id => project_id,
|
||||
:forge_message_id => pull_request_id,
|
||||
:forge_message_type => "PullRequest",
|
||||
:viewed => true,
|
||||
:status => status,
|
||||
:operate_user_id => User.current.id,
|
||||
)
|
||||
end
|
||||
|
||||
def authorize_logged
|
||||
if !User.current.logged?
|
||||
redirect_to signin_path
|
||||
|
|
|
@ -430,29 +430,21 @@ update
|
|||
|
||||
end
|
||||
|
||||
# 注:由于考虑到性能所以commits api每次返回20条记录
|
||||
def changes
|
||||
# 顶部导航
|
||||
@project_menu_type = 5
|
||||
|
||||
@entry = @repository.entry(@path, @rev)
|
||||
(show_error_not_found; return) unless @entry
|
||||
g = Gitlab.client
|
||||
limit = 20
|
||||
#每次页面的换回值从1开始,但是gitlab的页面查询是从0开始,所以先改变page的类型减一在改回来
|
||||
limit = 10
|
||||
# 每次页面的换回值从1开始,但是gitlab的页面查询是从0开始,所以先改变page的类型减一在改回来
|
||||
@commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s, ref_name:@rev)
|
||||
@commits_count = params[:commit_count].nil? ? @g.user_static(@project.gpid, :rev => @rev).count : params[:commit_count].to_i
|
||||
@commits_pages = Paginator.new @commits_count, limit, params[:page]
|
||||
# @offset ||= @commits_pages.offset
|
||||
# @commits = paginateHelper @commits, limit
|
||||
|
||||
#add by hx
|
||||
#rep_count = commit_count(@project)
|
||||
|
||||
#页面传递必须要str类型,但是Paginator的初始化必须要num类型,需要类型转化
|
||||
@commits_count = params[:commit_count].to_i
|
||||
@commits_pages = Redmine::Pagination::Paginator.new @commits_count,limit,params[:page]
|
||||
|
||||
@commit = g.commit(@project.gpid,@rev)
|
||||
# @changesets = g.get ("/projects/#{@project.gpid}/repository/commits?#{@rev}")
|
||||
#@changesets = @repository.latest_changesets(@path, @rev, Setting.repository_log_display_limit.to_i)
|
||||
@properties = @repository.properties(@path, @rev)
|
||||
@changeset = @repository.find_changeset_by_name(@rev)
|
||||
render :layout => 'base_projects'
|
||||
end
|
||||
|
||||
|
@ -581,28 +573,12 @@ update
|
|||
def commit_diff
|
||||
# 顶部导航
|
||||
@project_menu_type = 5
|
||||
|
||||
@commit_diff = @g.commit_diff(@project.gpid, params[:changeset])
|
||||
diff = @commit_diff.first
|
||||
diff = ActiveSupport::JSON.decode(@commit_diff.to_json).first
|
||||
diff = OpenStruct.new(diff)
|
||||
logger.info("######################{diff}")
|
||||
@diff_file = Trustie::Gitlab::Diff::File.new(diff)
|
||||
|
||||
# diff_file.diff_lines.each_with_index do |line, index|
|
||||
# type = line.type
|
||||
# last_line = line.new_pos
|
||||
# line_old = line.old_pos.to_s
|
||||
#
|
||||
#
|
||||
# if type == 'match'
|
||||
# ## 表示没有修改,两个都要显示行号
|
||||
# output += "|#{line_old.center(4)}|#{last_line.to_s.center(4)}|#{line.text}\n"
|
||||
# else
|
||||
# old_line = type == 'new' ? ' '*4: line_old
|
||||
# new_line = type == 'old' ? ' '*4: last_line
|
||||
# output += "|#{old_line.to_s.center(4)}|#{new_line.to_s.center(4)}|#{line.text}\n"
|
||||
# end
|
||||
# end
|
||||
|
||||
@commit_details = @g.commit(@project.gpid, params[:changeset])
|
||||
render :layout => 'base_projects'
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ class StudentWorkController < ApplicationController
|
|||
require "base64"
|
||||
before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex,
|
||||
:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,
|
||||
:search_course_students,:work_canrepeat,:add_group_member]
|
||||
:search_course_students,:work_canrepeat,:add_group_member,:change_project]
|
||||
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work,:revise_attachment]
|
||||
before_filter :member_of_course, :only => [:new, :create, :show, :add_score, :praise_student_work]
|
||||
before_filter :author_of_work, :only => [:edit, :update, :destroy]
|
||||
|
@ -587,6 +587,14 @@ class StudentWorkController < ApplicationController
|
|||
if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
|
||||
student_work.late_penalty = @homework.late_penalty
|
||||
student_work.work_status = 2
|
||||
# 缺评扣分
|
||||
if @homework.homework_detail_manual.no_anon_penalty == 0 && @homework.homework_detail_manual.comment_status == 3 && @homework.anonymous_comment == 0
|
||||
work_ids = "(" + @homework.student_works.has_committed.map(&:id).join(",") + ")"
|
||||
all_dis_eva = StudentWorksEvaluationDistribution.where("student_work_id IN #{work_ids}")
|
||||
has_sw_count = all_dis_eva.select("distinct user_id").count
|
||||
anon_count = all_dis_eva.count / has_sw_count
|
||||
student_work.absence_penalty = @homework.homework_detail_manual.absence_penalty * anon_count
|
||||
end
|
||||
else
|
||||
student_work.late_penalty = 0
|
||||
student_work.work_status = 1
|
||||
|
@ -691,7 +699,11 @@ class StudentWorkController < ApplicationController
|
|||
def show
|
||||
@score = student_work_score @work,User.current
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||
@student_work_scores = student_work_score_record(@work)
|
||||
if @homework.homework_detail_manual.comment_status == 2 && !@is_teacher && @work.user != User.current
|
||||
@student_work_scores = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").order("updated_at desc")
|
||||
else
|
||||
@student_work_scores = student_work_score_record(@work)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
@ -867,6 +879,7 @@ class StudentWorkController < ApplicationController
|
|||
@score = StudentWorksScore.find params[:score_id]
|
||||
@is_last = params[:is_last] == "true"
|
||||
@jour = @score.journals_for_messages.new(:user_id => User.current.id,:notes =>params[:message], :reply_id => 0)
|
||||
@show_real_name = User.current.allowed_to?(:as_teacher, @score.student_work.homework_common.course) || User.current.admin? || @score.reviewer_role != 3 || @jour.user == User.current
|
||||
if @jour.save
|
||||
@status = 1
|
||||
else
|
||||
|
@ -982,33 +995,38 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
if params[:absence_penalty] && homework_detail_manual.absence_penalty.to_s != params[:absence_penalty].to_s
|
||||
homework_detail_manual.absence_penalty = params[:absence_penalty]
|
||||
no_anon_penalty = params[:no_anon_penalty] ? 0 : 1
|
||||
if no_anon_penalty != homework_detail_manual.no_anon_penalty
|
||||
homework_detail_manual.no_anon_penalty = no_anon_penalty
|
||||
if homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值
|
||||
work_ids = "(" + @homework.student_works.has_committed.map(&:id).join(",") + ")"
|
||||
if @homework.homework_type != 3
|
||||
@homework.student_works.has_committed.each do |student_work|
|
||||
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
|
||||
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
|
||||
student_work.save
|
||||
end
|
||||
else
|
||||
@homework.student_works.has_committed.each do |student_work|
|
||||
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
|
||||
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
|
||||
student_work.save
|
||||
pros = student_work.student_work_projects.where("is_leader = 0")
|
||||
user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
|
||||
student_works = @homework.student_works.where("user_id in #{user_ids}")
|
||||
student_works.each do |st_work|
|
||||
absence_penalty_count = st_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - st_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
|
||||
st_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
|
||||
st_work.save
|
||||
all_dis_eva = StudentWorksEvaluationDistribution.where("student_work_id IN #{work_ids}")
|
||||
has_sw_count = all_dis_eva.select("distinct user_id").count
|
||||
anon_count = all_dis_eva.count / has_sw_count
|
||||
@homework.student_works.where("work_status != 0").each do |student_work|
|
||||
if student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count == 0
|
||||
if no_anon_penalty == 0
|
||||
student_work.absence_penalty = homework_detail_manual.absence_penalty * anon_count
|
||||
else
|
||||
student_work.absence_penalty = 0
|
||||
end
|
||||
student_work.save
|
||||
end
|
||||
end
|
||||
end
|
||||
homework_detail_manual.save if homework_detail_manual
|
||||
end
|
||||
|
||||
if (params[:absence_penalty] && homework_detail_manual.absence_penalty.to_s != params[:absence_penalty].to_s)
|
||||
homework_detail_manual.absence_penalty = params[:absence_penalty]
|
||||
if homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值
|
||||
work_ids = "(" + @homework.student_works.has_committed.map(&:id).join(",") + ")"
|
||||
@homework.student_works.where("work_status != 0").each do |student_work|
|
||||
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
|
||||
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
|
||||
student_work.save
|
||||
end
|
||||
end
|
||||
homework_detail_manual.save if homework_detail_manual
|
||||
end
|
||||
|
||||
|
@ -1042,7 +1060,7 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
|
||||
def forbidden_anonymous_comment
|
||||
@homework.update_column('anonymous_comment', 1)
|
||||
@homework.update_column('anonymous_comment', @homework.anonymous_comment == 0 ? 1 : 0)
|
||||
homework_detail_manual = @homework.homework_detail_manual
|
||||
homework_detail_programing = @homework.homework_detail_programing
|
||||
if homework_detail_programing
|
||||
|
@ -1074,6 +1092,7 @@ class StudentWorkController < ApplicationController
|
|||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
@homework = @work.homework_common
|
||||
end
|
||||
|
||||
def new_student_work_project
|
||||
|
@ -1120,6 +1139,26 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 作品更换关联项目
|
||||
def change_project
|
||||
work = @homework.student_works.has_committed.where("user_id = #{User.current.id}").first
|
||||
project = Project.find params[:projectName].to_i
|
||||
if work && project
|
||||
relate_user_ids = work.student_work_projects.map{|pro| pro.user_id}
|
||||
member_ids = project.members.map{|mem| mem.user_id}
|
||||
if (relate_user_ids & member_ids) == relate_user_ids
|
||||
work.student_work_projects.update_all(:project_id => params[:projectName].to_i)
|
||||
student_works = @homework.student_works.where("user_id in #{'(' + relate_user_ids.join(',') + ')'}")
|
||||
student_works.update_all(:project_id => params[:projectName].to_i)
|
||||
else
|
||||
@remain_user_ids = relate_user_ids - (relate_user_ids & member_ids)
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
#查找课程的学生
|
||||
def search_course_students
|
||||
name = ""
|
||||
|
|
|
@ -35,14 +35,14 @@ class UsersController < ApplicationController
|
|||
|
||||
#
|
||||
before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
|
||||
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses,
|
||||
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :unsolved_issues_list,
|
||||
:user_homeworks,:student_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
|
||||
:watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
||||
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
|
||||
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,
|
||||
:user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction,
|
||||
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list,
|
||||
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses,:homepage, :user_issues]
|
||||
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses,:homepage, :user_issues, :course_community, :project_community]
|
||||
before_filter :auth_user_extension, only: :show
|
||||
#before_filter :rest_user_score, only: :show
|
||||
#before_filter :select_entry, only: :user_projects
|
||||
|
@ -164,6 +164,8 @@ class UsersController < ApplicationController
|
|||
@comment = Comment.find params[:comment].to_i
|
||||
when 'Journal','is_project_issue'
|
||||
@comment = Journal.find params[:comment].to_i
|
||||
when 'Memo'
|
||||
@comment = Memo.find params[:comment].to_i
|
||||
end
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@parent_id = params[:parent_id] if params[:parent_id]
|
||||
|
@ -308,6 +310,15 @@ class UsersController < ApplicationController
|
|||
@root.update_column('updated_at', Time.now)
|
||||
@count = @root.journals_for_messages.count
|
||||
@comments = @root.journals_for_messages.reorder("created_on desc").limit(3)
|
||||
when 'Memo'
|
||||
@root = reply.root
|
||||
comment = Memo.new
|
||||
comment.author = User.current
|
||||
comment.forum = reply.forum
|
||||
comment.content = params[:reply_message]
|
||||
comment.subject = "#{@root.subject}"
|
||||
comment.root_id = reply.root_id
|
||||
reply.children << comment
|
||||
end
|
||||
update_course_activity(@root.class.to_s,@root.id)
|
||||
update_user_activity(@root.class.to_s,@root.id)
|
||||
|
@ -422,7 +433,8 @@ class UsersController < ApplicationController
|
|||
render_404
|
||||
return
|
||||
end
|
||||
@message_alls = paginateHelper @message_alls,25
|
||||
|
||||
@message_alls = paginateHelper @message_alls, 25
|
||||
respond_to do |format|
|
||||
format.html{render :layout=>'new_base_user'}
|
||||
end
|
||||
|
@ -1175,10 +1187,18 @@ class UsersController < ApplicationController
|
|||
student_work = StudentWork.where(homework_common_id: homework.id, user_id: User.current.id).first
|
||||
if student_work
|
||||
|
||||
#提交作品时,计算是否迟交
|
||||
# 提交作品时,计算是否迟交
|
||||
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
|
||||
student_work.late_penalty = homework.late_penalty
|
||||
student_work.work_status = 2
|
||||
# 缺评扣分
|
||||
if homework.homework_detail_manual.no_anon_penalty == 0 && homework.homework_detail_manual.comment_status == 3 && homework.anonymous_comment == 0
|
||||
work_ids = "(" + homework.student_works.has_committed.map(&:id).join(",") + ")"
|
||||
all_dis_eva = StudentWorksEvaluationDistribution.where("student_work_id IN #{work_ids}")
|
||||
has_sw_count = all_dis_eva.select("distinct user_id").count
|
||||
anon_count = all_dis_eva.count / has_sw_count
|
||||
student_work.absence_penalty = homework.homework_detail_manual.absence_penalty * anon_count
|
||||
end
|
||||
else
|
||||
student_work.late_penalty = 0
|
||||
student_work.work_status = 1
|
||||
|
@ -1795,22 +1815,197 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
#更新用户申请成为课程老师或教辅消息的状态
|
||||
if is_current_user
|
||||
# 自己的主页显示消息
|
||||
# 系统消息为管理员发送,我的消息中包含有系统消息
|
||||
@message_alls = []
|
||||
messages = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user.id, "SystemMessage", "SystemMessage").includes(:message).order("created_at desc")
|
||||
messages.each do |message_all|
|
||||
mess = message_all.message
|
||||
unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
|
||||
@message_alls << mess
|
||||
end
|
||||
end
|
||||
@message_count = @message_alls.count
|
||||
@message_alls = paginateHelper @message_alls, 20
|
||||
# 用户待解决的issue
|
||||
=begin
|
||||
@unsolved_issues = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).includes(:author, :project).order("updated_on desc")
|
||||
@unsolved_issues_count = @unsolved_issues.count
|
||||
@unsolved_issue_pages = Paginator.new @unsolved_issues_count, 20, params['page'] || 1
|
||||
@unsolved_issues = paginateHelper @unsolved_issues, 20
|
||||
=end
|
||||
@unsolved_issues_count = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).includes(:author, :project).order("updated_on desc").count
|
||||
# 用户待完成的作业
|
||||
my_course_ids = StudentsForCourse.where(:student_id => @user.id).blank? ? "(-1)" : "(" + StudentsForCourse.where(:student_id => @user.id).map{|sc| sc.course_id}.join(",") + ")"
|
||||
homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Date.today}'")
|
||||
homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
|
||||
student_works = StudentWork.where("user_id = #{@user.id} and homework_common_id in #{homework_ids} and work_status != 0")
|
||||
@unfinished_homework_count = homeworks.count - student_works.count
|
||||
# 用户待完成的测验
|
||||
exercises = Exercise.where("course_id in #{my_course_ids} and exercise_status = 2")
|
||||
exercise_ids = exercises.blank? ? "(-1)" : "(" + exercises.map{|ex| ex.id}.join(",") + ")"
|
||||
exercise_users = ExerciseUser.where("user_id = #{@user.id} and exercise_id in #{exercise_ids}")
|
||||
@unfinished_test_count = exercises.count - exercise_users.count
|
||||
# 用户待完成的问卷
|
||||
polls = Poll.where("polls_type = 'Course' and polls_group_id in #{my_course_ids} and polls_status = 2")
|
||||
poll_ids = polls.blank? ? "(-1)" : "(" + polls.map{|poll| poll.id}.join(",") + ")"
|
||||
poll_users = PollUser.where("user_id = #{@user.id} and poll_id in #{poll_ids}")
|
||||
@unfinished_poll_count = polls.count - poll_users.count
|
||||
# 用户待匿评的作品
|
||||
student_work_evaluations = @user.student_works_evaluation_distributions
|
||||
student_work_ids = student_work_evaluations.blank? ? "(-1)" : "(" + student_work_evaluations.map{|st| st.student_work_id}.join(",") + ")"
|
||||
student_work_scores = @user.student_works_scores.where("student_work_id in #{student_work_ids} and reviewer_role = 3")
|
||||
@anonymous_evaluation_count = student_work_evaluations.count - student_work_scores.count
|
||||
# 待评阅的作业 暂不做
|
||||
@unreview_homework = 1
|
||||
# 待审批的作业
|
||||
@unapproval_homework = 1
|
||||
else
|
||||
# 看别人的主页显示动态
|
||||
#更新用户申请成为课程老师或教辅消息的状态
|
||||
if params[:course_id] != nil
|
||||
join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?",
|
||||
params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false)
|
||||
join_course_messages.update_all(:viewed => true)
|
||||
end
|
||||
shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
|
||||
shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
user_project_ids = (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
|
||||
user_course_ids = (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")"
|
||||
course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')"
|
||||
project_types = "('Message','Issue','Project')"
|
||||
principal_types = "JournalsForMessage"
|
||||
container_type = ''
|
||||
act_type = ''
|
||||
# 他的动态
|
||||
sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
|
||||
if params[:type].present?
|
||||
case params[:type]
|
||||
when "course_homework"
|
||||
container_type = 'Course'
|
||||
act_type = 'HomeworkCommon'
|
||||
when "course_news"
|
||||
container_type = 'Course'
|
||||
act_type = 'News'
|
||||
when "course_message"
|
||||
container_type = 'Course'
|
||||
act_type = 'Message'
|
||||
when "course_poll"
|
||||
container_type = 'Course'
|
||||
act_type = 'Poll'
|
||||
when "course_journals"
|
||||
container_type = 'Course'
|
||||
act_type = 'JournalsForMessage'
|
||||
when "project_issue"
|
||||
container_type = 'Project'
|
||||
act_type = 'Issue'
|
||||
when "project_message"
|
||||
container_type = 'Project'
|
||||
act_type = 'Message'
|
||||
when "user_journals"
|
||||
container_type = 'Principal'
|
||||
act_type = 'JournalsForMessage'
|
||||
when "current_user"
|
||||
container_type = 'Principal'
|
||||
act_type = 'Principal'
|
||||
when "all"
|
||||
container_type = 'all'
|
||||
act_type = 'all'
|
||||
end
|
||||
end
|
||||
if container_type != '' && container_type != 'all'
|
||||
if container_type == 'Course'
|
||||
sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'"
|
||||
elsif container_type == 'Project'
|
||||
sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'"
|
||||
elsif container_type == 'Principal' && act_type == 'JournalsForMessage'
|
||||
sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}"
|
||||
elsif container_type == 'Principal' && act_type == 'Principal'
|
||||
sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
|
||||
end
|
||||
if User.current != @user
|
||||
sql += " and user_id = #{@user.id}"
|
||||
end
|
||||
else
|
||||
if User.current != @user
|
||||
blog_ids = "("+@user.blog.id.to_s+")"
|
||||
else
|
||||
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
|
||||
end
|
||||
sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
|
||||
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
|
||||
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
|
||||
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})"
|
||||
if container_type != 'all' && User.current != @user
|
||||
sql = "user_id = #{@user.id} and(" + sql + ")"
|
||||
end
|
||||
end
|
||||
@user_activities_count = UserActivity.where("#{sql}").order('updated_at desc').count
|
||||
@user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10)
|
||||
@type = params[:type]
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'new_base_user'}
|
||||
end
|
||||
end
|
||||
|
||||
# 待解决的Issue
|
||||
def unsolved_issues_list
|
||||
@unsolved_issues = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).includes(:author, :project).order("updated_on desc")
|
||||
@unsolved_issues_count = @unsolved_issues.count
|
||||
@limit = 20
|
||||
@is_remote = true
|
||||
@unsolved_issues_pages = Paginator.new @unsolved_issues_count, @limit, params['page'] || 1
|
||||
@offset ||= @unsolved_issues_pages.offset
|
||||
@unsolved_issues = paginateHelper @unsolved_issues, @limit
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# 待完成的作业
|
||||
def unfinished_homework_list
|
||||
|
||||
end
|
||||
|
||||
# 待完成的测验
|
||||
def unfinished_test_list
|
||||
|
||||
end
|
||||
|
||||
# 待完成的问卷
|
||||
def unfinished_poll_list
|
||||
|
||||
end
|
||||
|
||||
# 待匿评的作业
|
||||
def anonymous_evaluation_list
|
||||
|
||||
end
|
||||
|
||||
# 待审批的申请
|
||||
def unapproval_homework_list
|
||||
|
||||
end
|
||||
|
||||
# 课程社区
|
||||
def course_community
|
||||
if params[:course_id] != nil
|
||||
join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?",
|
||||
params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false)
|
||||
join_course_messages.update_all(:viewed => true)
|
||||
end
|
||||
shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
|
||||
shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
user_project_ids = (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
|
||||
user_course_ids = (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")"
|
||||
course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')"
|
||||
project_types = "('Message','Issue','Project')"
|
||||
principal_types = "JournalsForMessage"
|
||||
container_type = ''
|
||||
act_type = ''
|
||||
|
||||
if params[:type].present?
|
||||
case params[:type]
|
||||
when "course_homework"
|
||||
|
@ -1828,6 +2023,63 @@ class UsersController < ApplicationController
|
|||
when "course_journals"
|
||||
container_type = 'Course'
|
||||
act_type = 'JournalsForMessage'
|
||||
when "user_journals"
|
||||
container_type = 'Principal'
|
||||
act_type = 'JournalsForMessage'
|
||||
when "current_user"
|
||||
container_type = 'Principal'
|
||||
act_type = 'Principal'
|
||||
when "all"
|
||||
container_type = 'all'
|
||||
act_type = 'all'
|
||||
end
|
||||
end
|
||||
if container_type != '' && container_type != 'all'
|
||||
if container_type == 'Course'
|
||||
sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'"
|
||||
elsif container_type == 'Principal' && act_type == 'JournalsForMessage'
|
||||
sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}"
|
||||
elsif container_type == 'Principal' && act_type == 'Principal'
|
||||
sql = "user_id = #{@user.id} and (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})"
|
||||
end
|
||||
if User.current != @user
|
||||
sql += " and user_id = #{@user.id}"
|
||||
end
|
||||
else
|
||||
if User.current != @user
|
||||
blog_ids = "("+@user.blog.id.to_s+")"
|
||||
else
|
||||
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
|
||||
end
|
||||
sql = "(container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})" +
|
||||
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
|
||||
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})"
|
||||
if container_type != 'all' && User.current != @user
|
||||
sql = "user_id = #{@user.id} and(" + sql + ")"
|
||||
end
|
||||
end
|
||||
@user_activities_count = UserActivity.where("#{sql}").order('updated_at desc').count
|
||||
@user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10)
|
||||
@type = params[:type]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'base_course_community'}
|
||||
end
|
||||
end
|
||||
|
||||
# 项目社区
|
||||
def project_community
|
||||
# 看别人的主页显示动态
|
||||
#更新用户申请成为课程老师或教辅消息的状态
|
||||
shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
user_project_ids = (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
|
||||
project_types = "('Message','Issue','Project')"
|
||||
principal_types = "JournalsForMessage"
|
||||
container_type = ''
|
||||
act_type = ''
|
||||
if params[:type].present?
|
||||
case params[:type]
|
||||
when "project_issue"
|
||||
container_type = 'Project'
|
||||
act_type = 'Issue'
|
||||
|
@ -1846,14 +2098,12 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
if container_type != '' && container_type != 'all'
|
||||
if container_type == 'Course'
|
||||
sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'"
|
||||
elsif container_type == 'Project'
|
||||
if container_type == 'Project'
|
||||
sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'"
|
||||
elsif container_type == 'Principal' && act_type == 'JournalsForMessage'
|
||||
sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}"
|
||||
elsif container_type == 'Principal' && act_type == 'Principal'
|
||||
sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
|
||||
sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}))"
|
||||
end
|
||||
if User.current != @user
|
||||
sql += " and user_id = #{@user.id}"
|
||||
|
@ -1865,19 +2115,18 @@ class UsersController < ApplicationController
|
|||
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
|
||||
end
|
||||
sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
|
||||
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
|
||||
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
|
||||
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})"
|
||||
if container_type != 'all' && User.current != @user
|
||||
sql = "user_id = #{@user.id} and(" + sql + ")"
|
||||
end
|
||||
end
|
||||
|
||||
@user_activities_count = UserActivity.where("#{sql}").order('updated_at desc').count
|
||||
@user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10)
|
||||
@type = params[:type]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'new_base_user'}
|
||||
format.html {render :layout => 'base_project_community'}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -3528,7 +3777,7 @@ class UsersController < ApplicationController
|
|||
# @syllabus = paginateHelper @syllabus,@limit
|
||||
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'new_base_user'}
|
||||
format.html {render :layout => 'base_course_community'}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -3672,7 +3921,7 @@ class UsersController < ApplicationController
|
|||
@my_joined_projects_count = @my_joined_projects.count
|
||||
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'new_base_user'}
|
||||
format.html {render :layout => 'base_project_community'}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#coding=utf-8
|
||||
|
||||
require 'base64'
|
||||
class WechatsController < ActionController::Base
|
||||
wechat_responder
|
||||
|
||||
|
@ -105,6 +107,7 @@ class WechatsController < ActionController::Base
|
|||
end
|
||||
|
||||
on :event, with: 'unsubscribe' do |request|
|
||||
unBind(request)
|
||||
request.reply.success # user can not receive this message
|
||||
end
|
||||
|
||||
|
@ -272,12 +275,18 @@ class WechatsController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
def unBind(request)
|
||||
uw = user_binded?(request[:FromUserName])
|
||||
uw.try(:subscribe!)
|
||||
end
|
||||
|
||||
def sendBind(request)
|
||||
tmpurl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities'}&response_type=code&scope=snsapi_base&state=login&connect_redirect=1#wechat_redirect"
|
||||
logger.info "tmpurl!!!!!!!!!!!!!!"
|
||||
logger.info tmpurl
|
||||
news = (1..1).each_with_object([]) { |n, memo| memo << { title: '绑定登录', content: "欢迎使用Trustie创新实践服务平台!
|
||||
在这里您可以随时了解您的课程和项目动态,随时点赞和回复。
|
||||
在这里您可以随时了解您的课程和项目动态,随时点赞和回复。交作业、代码提交等更多功能,请前往 www.trustie.net
|
||||
|
||||
我们将会与微信不断结合,为您提供更有价值的服务。
|
||||
|
||||
您还未绑定确实的用户,请先绑定,谢谢!" } }
|
||||
|
@ -485,9 +494,33 @@ class WechatsController < ActionController::Base
|
|||
end
|
||||
|
||||
|
||||
# 用于权限跳转
|
||||
def auth
|
||||
state = params[:state]
|
||||
url = "#{ROOT_URL}/wechat/auth_callback"
|
||||
authorize_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{url}&response_type=code&scope=snsapi_base&state=#{state}&connect_redirect=1#wechat_redirect"
|
||||
redirect_to authorize_url
|
||||
end
|
||||
|
||||
def auth_callback
|
||||
path = Base64.urlsafe_decode64(params[:state])
|
||||
open_id = get_openid_from_code(params[:code])
|
||||
unless open_id
|
||||
render 'wechats/open_wechat', layout: nil and return
|
||||
end
|
||||
|
||||
redirect_to "/wechat/user_activities##{path}"
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
def get_openid_from_code(code)
|
||||
return 'oCnvgvz8R7QheXE-R9Kkr39j8Ndg' if code =='only-for-test'
|
||||
if code =='only-for-test'
|
||||
openid = 'o3ss_wHOOnHkz1khBJxH8RF4SfPY'
|
||||
session[:wechat_openid] = openid
|
||||
return openid
|
||||
end
|
||||
|
||||
openid = session[:wechat_openid]
|
||||
unless openid
|
||||
if code
|
||||
|
|
|
@ -37,11 +37,21 @@ module ApplicationHelper
|
|||
# super
|
||||
# end
|
||||
|
||||
# 获取多种类型的user用户名
|
||||
def user_message_username user
|
||||
user.try(:show_name)
|
||||
end
|
||||
|
||||
# 超出1w后用k+形式显示
|
||||
def switch_integer_into_k number
|
||||
number > 10000 ? (number.to_f / 1000).round.to_s + "k" : number
|
||||
end
|
||||
|
||||
# 判断某个课程是否包含仅对自己可见的作业
|
||||
def course_has_score_open_common_homework course
|
||||
course.homework_commons.select{|hc| hc.score_open == 0}.count > 0 ? true : false
|
||||
end
|
||||
|
||||
# 隐藏项目以外的信息
|
||||
# return: true 显示,false 不显示
|
||||
def hidden_unproject_infos
|
||||
|
@ -72,12 +82,36 @@ module ApplicationHelper
|
|||
user.nil? ? User.find(2) : user
|
||||
end
|
||||
|
||||
# 通过邮件查找用户,能查到返回用户,否则返回邮件地址
|
||||
def user_by_mail mail
|
||||
user = User.find_by_mail(mail)
|
||||
user.nil? ? mail : user.try(:show_name)
|
||||
end
|
||||
|
||||
def link_to_user_mail(mail, css_class)
|
||||
user = User.find_by_mail(mail)
|
||||
user = user.nil? ? mail : user
|
||||
if user.is_a?(User)
|
||||
name = user.show_name
|
||||
link_to name, {:controller=> 'users', :action => 'show', id: user.id}, :class => css_class, :target => "_blank"
|
||||
else
|
||||
"<a class='#{css_class}'>#{h(user.to_s)}</a>".html_safe
|
||||
end
|
||||
end
|
||||
|
||||
# 通过系统外部用户名查找用户,如果用户不存在则用邮箱替换
|
||||
def get_user_by_login_and login
|
||||
user = User.find_by_login(login)
|
||||
(user.nil? || login == "root") ? User.find(2) : user
|
||||
end
|
||||
|
||||
# 登录名来自外部系统
|
||||
# 通过登录名查找用户,如果用户存在则显示用户姓名,否则显示登录名
|
||||
def get_user_by_login login
|
||||
user = User.find_by_login(login)
|
||||
user.nil? ? login : user.show_name
|
||||
end
|
||||
|
||||
# 重置user_path,目的是将id转换成用户名
|
||||
def user_path(resource, parameters = {})
|
||||
if Fixnum === resource
|
||||
|
@ -2786,6 +2820,37 @@ module ApplicationHelper
|
|||
end
|
||||
technical_title
|
||||
end
|
||||
# 用户项目总数
|
||||
def user_project_count
|
||||
@my_projects = @user.projects.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS updatetime").order("updatetime DESC")
|
||||
@my_project_total = @my_projects.count
|
||||
end
|
||||
|
||||
# 用户的课程总数
|
||||
def user_course_count
|
||||
@my_course_count = @user.syllabuses.count
|
||||
|
||||
sy_courses = @user.courses.visible.not_deleted
|
||||
syllabus_ids = sy_courses.empty? ? '(-1)' : "(" + sy_courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")"
|
||||
syllabus_members = SyllabusMember.where("user_id = #{@user.id}")
|
||||
syllabus_member_ids = syllabus_members.empty? ? "(-1)" : "(" + syllabus_members.map{|syl_mem| syl_mem.syllabus_id}.join(',') + ")"
|
||||
@join_syllabuses = Syllabus.where("(id in #{syllabus_ids} or id in #{syllabus_member_ids}) and user_id != #{@user.id}")
|
||||
@my_joined_course_count = @join_syllabuses.count
|
||||
|
||||
@user_course_total = @my_joined_course_count + @my_course_count
|
||||
end
|
||||
|
||||
# 用户发布的issue数
|
||||
def issues_author_is_self_count
|
||||
@issues = Issue.where( :author_id => @user.id )
|
||||
@issues_author_is_self_count = @issues.count
|
||||
end
|
||||
|
||||
# 用户收到的issue数
|
||||
def issues_assigned_is_self_count
|
||||
@issues = Issue.where( :assigned_to_id => @user.id )
|
||||
@issues_assigned_is_self_count = @issues.count
|
||||
end
|
||||
|
||||
def get_user_roll user
|
||||
technical_title = ""
|
||||
|
@ -2855,18 +2920,18 @@ module ApplicationHelper
|
|||
#获取匿评相关连接代码
|
||||
def homework_anonymous_comment (homework, hw_status, user_activity_id = -1)
|
||||
if homework.homework_detail_manual.comment_status == 0 ||Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
||||
link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "作业截止日期之前不可以启动匿评"
|
||||
link = link_to "启动匿评","javascript:void(0)", :class => "wpostOptionLink", :title => "作业截止日期之前不可以启动匿评"
|
||||
elsif homework.student_works.has_committed.count >= 2 && homework.homework_detail_manual#作业份数大于2
|
||||
case homework.homework_detail_manual.comment_status
|
||||
when 1
|
||||
link = link_to '启动匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink'
|
||||
link = link_to '启动匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'wpostOptionLink'
|
||||
when 2
|
||||
link = link_to '关闭匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink'
|
||||
link = link_to '关闭匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'wpostOptionLink'
|
||||
when 3
|
||||
# link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束"
|
||||
end
|
||||
else
|
||||
link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "学生提交作业数大于等于2时才可以启动匿评"
|
||||
link = link_to "启动匿评","javascript:void(0)", :class => "wpostOptionLink", :title => "学生提交作业数大于等于2时才可以启动匿评"
|
||||
end
|
||||
link
|
||||
end
|
||||
|
@ -3422,6 +3487,8 @@ def get_reply_by_type type, reply_id
|
|||
reply = Journal.find reply_id
|
||||
when 'Syllabus'
|
||||
reply = JournalsForMessage.find reply_id
|
||||
when 'Memo'
|
||||
reply = Memo.find reply_id
|
||||
end
|
||||
reply
|
||||
end
|
||||
|
@ -3703,7 +3770,9 @@ def get_hw_status homework_common
|
|||
end
|
||||
if Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
||||
str += '<span class="green_homework_btn_cir ml5">作品提交中</span>'
|
||||
elsif Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d")
|
||||
elsif Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && homework_common.anonymous_comment == 1 && User.current.allowed_to?(:as_teacher, homework_common.course)
|
||||
str += '<span class="green_homework_btn_cir ml5" title="目前教师和教辅正在评阅">教师评阅中</span>'
|
||||
else
|
||||
str += '<span class="red_homework_btn_cir ml5">作品补交中</span>'
|
||||
end
|
||||
elsif homework_common.homework_detail_manual.comment_status == 2
|
||||
|
|
|
@ -27,6 +27,21 @@ module RepositoriesHelper
|
|||
REPO_IP_ADDRESS = Setting.host_repository
|
||||
REPO_GITLAB_ADDRESS = "git.trustie.net"
|
||||
|
||||
# 获取某次提交的关联Issue
|
||||
# REDO:一次关联查询
|
||||
# type为true则为详情页面,全部显示
|
||||
def get_commit_issues commit_id, project_id, type
|
||||
commit_issues = CommitIssues.where(:commit_id => commit_id, :project_id => project_id)
|
||||
unless commit_issues.blank?
|
||||
if commit_issues.count > 2 && type != 1
|
||||
result = commit_issues.map{|commit_issue| commit_issue.issue_id}.first(2) << "more"
|
||||
else
|
||||
result = commit_issues.map{|commit_issue| commit_issue.issue_id}
|
||||
end
|
||||
end
|
||||
return result unless result.blank?
|
||||
end
|
||||
|
||||
# 因为gitlab的提交总数不是实时同步的,说以取总数用两种方法
|
||||
def choise_commit_count git_count, pro_count
|
||||
git_count > pro_count ? git_count : pro_count
|
||||
|
|
|
@ -94,13 +94,13 @@ module UsersHelper
|
|||
def pull_request_message_status ma
|
||||
case ma.status
|
||||
when 1
|
||||
"创建了PullRequest:"
|
||||
"创建了PullRequest:"
|
||||
when 2
|
||||
"接受了您的PullRequest:"
|
||||
"接受了PullRequest:"
|
||||
when 3
|
||||
"重新打开了PullRequest:"
|
||||
"重新打开了PullRequest:"
|
||||
when 4
|
||||
"关闭了您的PullRequest:"
|
||||
"关闭了PullRequest:"
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -135,11 +135,11 @@ module UsersHelper
|
|||
def applied_project_tip applied_message
|
||||
case applied_message.status
|
||||
when 4
|
||||
"拒绝申请加入项目:"
|
||||
"拒绝申请加入:"
|
||||
when 5,3,2,1,7
|
||||
"申请加入项目:"
|
||||
"申请加入:"
|
||||
when 6
|
||||
"同意申请加入项目"
|
||||
"同意申请加入:"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -159,6 +159,10 @@ module UsersHelper
|
|||
end
|
||||
end
|
||||
|
||||
def is_current_user
|
||||
is_current_user = (User.current == @user)
|
||||
end
|
||||
|
||||
def applied_project_tip_header applied_message
|
||||
case applied_message.status
|
||||
when 4
|
||||
|
|
|
@ -397,7 +397,7 @@ class Attachment < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def course
|
||||
container
|
||||
Course === container ? container : nil
|
||||
end
|
||||
|
||||
def visible?(user=User.current)
|
||||
|
|
|
@ -40,7 +40,7 @@ class Comment < ActiveRecord::Base
|
|||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
validates_presence_of :commented, :author, :comments
|
||||
safe_attributes 'comments','parent_id','reply_id','comments_count'
|
||||
after_create :send_mail, :act_as_system_message, :act_as_student_score
|
||||
after_create :act_as_system_message, :act_as_student_score #:send_mail,
|
||||
after_destroy :down_course_score
|
||||
|
||||
def act_as_system_message
|
||||
|
@ -55,11 +55,11 @@ class Comment < ActiveRecord::Base
|
|||
# end
|
||||
end
|
||||
else # 项目相关
|
||||
if self.author_id != self.commented.author_id
|
||||
self.forge_messages << ForgeMessage.new(:user_id => self.commented.author_id, :project_id => self.commented.project.id, :viewed => false)
|
||||
#content = strip_html self.comments.html_safe, 200
|
||||
#ws.comment_template self.commented.author_id, "blog_comment", self.id, "#{l(:label_news_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
|
||||
end
|
||||
# if self.author_id != self.commented.author_id
|
||||
# self.forge_messages << ForgeMessage.new(:user_id => self.commented.author_id, :project_id => self.commented.project.id, :viewed => false)
|
||||
# #content = strip_html self.comments.html_safe, 200
|
||||
# #ws.comment_template self.commented.author_id, "blog_comment", self.id, "#{l(:label_news_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class CommitIssues < ActiveRecord::Base
|
||||
attr_accessible :commit_id, :issue_id, :project_id
|
||||
# 之所以没建立关联表,主要是应为commit_id是直接通过api获取的,不存在trustie端
|
||||
has_many :issues
|
||||
end
|
|
@ -1,7 +1,7 @@
|
|||
class ForgeMessage < ActiveRecord::Base
|
||||
# status在不同的类中,作用不同
|
||||
# Isseu: satus nil:发布了缺陷;:1:缺陷计划完成日志到了提醒
|
||||
attr_accessible :forge_message_id, :forge_message_type, :project_id, :user_id, :viewed, :secret_key, :status
|
||||
attr_accessible :forge_message_id, :forge_message_type, :project_id, :user_id, :viewed, :secret_key, :status, :operate_user_id
|
||||
|
||||
belongs_to :forge_message ,:polymorphic => true
|
||||
belongs_to :project
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#手动评分作业表
|
||||
#comment_status: 1:未开启匿评,2:开启匿评,3:匿评结束
|
||||
class HomeworkDetailManual < ActiveRecord::Base
|
||||
attr_accessible :ta_proportion, :comment_status, :evaluation_start, :evaluation_end, :evaluation_num, :absence_penalty, :homework_common_id
|
||||
attr_accessible :ta_proportion, :comment_status, :evaluation_start, :evaluation_end, :evaluation_num, :absence_penalty, :homework_common_id, :no_anon_penalty
|
||||
|
||||
belongs_to :homework_common
|
||||
end
|
||||
|
|
|
@ -56,6 +56,8 @@ class Issue < ActiveRecord::Base
|
|||
has_one :praise_tread_cache, as: :object, dependent: :destroy
|
||||
# ForgeMessage虚拟关联(多态)
|
||||
has_many :forge_messages, :class_name => 'ForgeMessage',:as =>:forge_message ,:dependent => :destroy
|
||||
# 该关联不能关联删除,因为commit记录没有存在Trustie数据库中
|
||||
has_many :commit_issueses
|
||||
|
||||
has_many :at_messages, class_name: 'AtMessage', as: :at_message ,:dependent => :destroy
|
||||
|
||||
|
@ -133,6 +135,10 @@ class Issue < ActiveRecord::Base
|
|||
after_save :after_create_from_copy
|
||||
after_destroy :update_parent_attributes
|
||||
|
||||
def user
|
||||
self.author
|
||||
end
|
||||
|
||||
#动态的更新
|
||||
def update_activity
|
||||
update_user_activity(self.class, self.id)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Added by young
|
||||
class JournalsForMessageObserver < ActiveRecord::Observer
|
||||
def after_create(journals_for_message)
|
||||
Mailer.run.journals_for_message_add(User.current, journals_for_message)
|
||||
# Mailer.run.journals_for_message_add(User.current, journals_for_message)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -109,40 +109,40 @@ class Mailer < ActionMailer::Base
|
|||
# 邀请未注册用户加入项目
|
||||
# 功能: 在加入项目的同时自动注册用户
|
||||
def send_invite_in_project(email, project, invitor, first_name, last_name, gender)
|
||||
@email = email
|
||||
@subject = "#{invitor.name} #{l(:label_invite_project)} #{project.name} "
|
||||
@password = newpass(6)
|
||||
|
||||
login = email
|
||||
login = login.sub(/%40/,'@')
|
||||
us = UsersService.new
|
||||
# 自动激活用户
|
||||
user = us.register_auto(login, email, @password, first_name, last_name, gender)
|
||||
InviteList.create(:user_id => user.id, :project_id => project.id, :mail =>email)
|
||||
User.current = user unless User.current.nil?
|
||||
@user = user
|
||||
@token = Token.get_token_from_user(user, 'autologin')
|
||||
@project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :mail => true, :token => @token.value)
|
||||
mail :to => email, :subject => @subject
|
||||
# @email = email
|
||||
# @subject = "#{invitor.name} #{l(:label_invite_project)} #{project.name} "
|
||||
# @password = newpass(6)
|
||||
#
|
||||
# login = email
|
||||
# login = login.sub(/%40/,'@')
|
||||
# us = UsersService.new
|
||||
# # 自动激活用户
|
||||
# user = us.register_auto(login, email, @password, first_name, last_name, gender)
|
||||
# InviteList.create(:user_id => user.id, :project_id => project.id, :mail =>email)
|
||||
# User.current = user unless User.current.nil?
|
||||
# @user = user
|
||||
# @token = Token.get_token_from_user(user, 'autologin')
|
||||
# @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :mail => true, :token => @token.value)
|
||||
# mail :to => email, :subject => @subject
|
||||
end
|
||||
|
||||
# 邀请已注册的用户加入项目
|
||||
def request_member_to_project(email, project, invitor)
|
||||
@subject = "#{invitor.name} #{l(:label_invite_project)}: #{project.name} "
|
||||
user = User.find_by_mail(email.to_s)
|
||||
@invitor_name = "#{invitor.name}"
|
||||
@project_name = "#{project.name}"
|
||||
@user = user
|
||||
@project = project
|
||||
if InviteList.where("project_id= ? and user_id =? and mail =?", project.id, @user.id, email).first.nil?
|
||||
InviteList.create(:user_id => user.id, :project_id => project.id, :mail => email)
|
||||
end
|
||||
@token = Token.get_token_from_user(user, 'autologin')
|
||||
@project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true, :token => @token.value)
|
||||
# 发送消息邀请
|
||||
send_message_request_member(user,project)
|
||||
# @subject = "#{invitor.name} #{l(:label_invite_project)}: #{project.name} "
|
||||
# user = User.find_by_mail(email.to_s)
|
||||
# @invitor_name = "#{invitor.name}"
|
||||
# @project_name = "#{project.name}"
|
||||
# @user = user
|
||||
# @project = project
|
||||
# if InviteList.where("project_id= ? and user_id =? and mail =?", project.id, @user.id, email).first.nil?
|
||||
# InviteList.create(:user_id => user.id, :project_id => project.id, :mail => email)
|
||||
# end
|
||||
mail :to => email, :subject => @subject
|
||||
# @token = Token.get_token_from_user(user, 'autologin')
|
||||
# @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true, :token => @token.value)
|
||||
# # 发送消息邀请
|
||||
# send_message_request_member(user,project)
|
||||
# # end
|
||||
# mail :to => email, :subject => @subject
|
||||
end
|
||||
|
||||
# 邀请信息消息 注:forge_message_id 为邀请人ID(特殊情况)
|
||||
|
@ -293,23 +293,23 @@ class Mailer < ActionMailer::Base
|
|||
|
||||
# 公共讨论区发帖、回帖添加邮件发送信息
|
||||
def forum_message_added(memo)
|
||||
@memo = memo
|
||||
redmine_headers 'Memo' => memo.id
|
||||
@forum = memo.forum
|
||||
@author = memo.author
|
||||
@forum_url = url_for(:controller => 'forums', :action => 'show', :id => @forum.id)
|
||||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
recipients ||= []
|
||||
#将帖子创建者邮箱地址加入数组
|
||||
recipients << @forum.creator.mail
|
||||
#回复人邮箱地址加入数组
|
||||
recipients << @author.mail
|
||||
# cc = wiki_content.page.wiki.watcher_recipients - recipients
|
||||
|
||||
@memo_url = url_for(forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id)))
|
||||
mail :to => recipients,
|
||||
:subject => "[ #{l(:label_message_plural)} : #{memo.subject} #{l(:label_memo_create_succ)}]",
|
||||
:filter => true
|
||||
# @memo = memo
|
||||
# redmine_headers 'Memo' => memo.id
|
||||
# @forum = memo.forum
|
||||
# @author = memo.author
|
||||
# @forum_url = url_for(:controller => 'forums', :action => 'show', :id => @forum.id)
|
||||
# @issue_author_url = url_for(user_activities_url(@author))
|
||||
# recipients ||= []
|
||||
# #将帖子创建者邮箱地址加入数组
|
||||
# recipients << @forum.creator.mail
|
||||
# #回复人邮箱地址加入数组
|
||||
# recipients << @author.mail
|
||||
# # cc = wiki_content.page.wiki.watcher_recipients - recipients
|
||||
#
|
||||
# @memo_url = url_for(forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id)))
|
||||
# mail :to => recipients,
|
||||
# :subject => "[ #{l(:label_message_plural)} : #{memo.subject} #{l(:label_memo_create_succ)}]",
|
||||
# :filter => true
|
||||
end
|
||||
# Builds a Mail::Message object used to email recipients of the added journals for message.
|
||||
|
||||
|
@ -318,64 +318,64 @@ class Mailer < ActionMailer::Base
|
|||
# 直接留言后 reply_id,m_parent_id 为空,相对应的at_user取值为nil
|
||||
|
||||
def journals_for_message_add(user, journals_for_message)
|
||||
@user = journals_for_message.user # 留言人
|
||||
@mail = journals_for_message.jour if journals_for_message.at_user.nil? # 留言
|
||||
@mail = journals_for_message.at_user if journals_for_message.at_user
|
||||
@message = journals_for_message.notes
|
||||
@title = "#@user #{t(:label_leave_your_message, :locale => 'zh')}"
|
||||
@issue_author_url = url_for(user_activities_url(@user))
|
||||
@url = case journals_for_message.jour.class.to_s.to_sym # 判断留言的对象所属类型
|
||||
# when :Bid
|
||||
# course_for_bid_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
when :Project
|
||||
return -1 if journals_for_message.jour.project_type == Project::ProjectType_project
|
||||
project_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
when :Course
|
||||
course_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
when :Contest
|
||||
show_contest_contest_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
when :User
|
||||
user_newfeedback_user_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
else
|
||||
Rails.logger.error "[Builds a Mail::Message ERROR] journalsForMessage's jour is unkown type, journalsForMessage.id = #{journals_for_message.id}"
|
||||
return -1
|
||||
end
|
||||
|
||||
# 验证用户的收取邮件的方式
|
||||
recipients ||= []
|
||||
recipients1 ||= []
|
||||
recipients1 = @mail.mail
|
||||
recipients = journals_for_message.jour.author.mail
|
||||
|
||||
# modify by nwb
|
||||
#如果是直接留言并且留言对象是课程
|
||||
if !journals_for_message.at_user && journals_for_message.jour.class.to_s.to_sym == :Course
|
||||
course = journals_for_message.jour
|
||||
@author = journals_for_message.user
|
||||
#课程的教师
|
||||
@members = course_all_member journals_for_message.jour
|
||||
#收件人邮箱
|
||||
@recipients ||= []
|
||||
@members.each do |teacher|
|
||||
@recipients << teacher.user.mail
|
||||
end
|
||||
mail :to => @recipients,
|
||||
:subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} ",
|
||||
:filter => true
|
||||
# elsif journals_for_message.jour.class.to_s.to_sym == :Bid
|
||||
# @user = journals_for_message.user # 留言人
|
||||
# @mail = journals_for_message.jour if journals_for_message.at_user.nil? # 留言
|
||||
# @mail = journals_for_message.at_user if journals_for_message.at_user
|
||||
# @message = journals_for_message.notes
|
||||
# @title = "#@user #{t(:label_leave_your_message, :locale => 'zh')}"
|
||||
# @issue_author_url = url_for(user_activities_url(@user))
|
||||
# @url = case journals_for_message.jour.class.to_s.to_sym # 判断留言的对象所属类型
|
||||
# # when :Bid
|
||||
# # course_for_bid_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
# when :Project
|
||||
# return -1 if journals_for_message.jour.project_type == Project::ProjectType_project
|
||||
# project_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
# when :Course
|
||||
# course_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
# when :Contest
|
||||
# show_contest_contest_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
# when :User
|
||||
# user_newfeedback_user_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
# else
|
||||
# Rails.logger.error "[Builds a Mail::Message ERROR] journalsForMessage's jour is unkown type, journalsForMessage.id = #{journals_for_message.id}"
|
||||
# return -1
|
||||
# end
|
||||
#
|
||||
# # 验证用户的收取邮件的方式
|
||||
# recipients ||= []
|
||||
# recipients1 ||= []
|
||||
# recipients1 = @mail.mail
|
||||
# recipients = journals_for_message.jour.author.mail
|
||||
#
|
||||
# # modify by nwb
|
||||
# #如果是直接留言并且留言对象是课程
|
||||
# if !journals_for_message.at_user && journals_for_message.jour.class.to_s.to_sym == :Course
|
||||
# course = journals_for_message.jour
|
||||
# @author = journals_for_message.user
|
||||
# #课程的教师
|
||||
# @members = course_all_member journals_for_message.jour
|
||||
# #收件人邮箱
|
||||
# @recipients ||= []
|
||||
# @members.each do |teacher|
|
||||
# @recipients << teacher.user.mail
|
||||
# end
|
||||
# mail :to => @recipients,
|
||||
# :subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} ",
|
||||
# :filter => true
|
||||
# # elsif journals_for_message.jour.class.to_s.to_sym == :Bid
|
||||
# # if !journals_for_message.jour.author.notify_about? journals_for_message
|
||||
# # return -1
|
||||
# # end
|
||||
# #
|
||||
# # mail :to => recipients, :subject => @title,:filter => true
|
||||
# elsif journals_for_message.jour.class.to_s.to_sym == :Contest
|
||||
# if !journals_for_message.jour.author.notify_about? journals_for_message
|
||||
# return -1
|
||||
# end
|
||||
#
|
||||
# mail :to => recipients, :subject => @title,:filter => true
|
||||
elsif journals_for_message.jour.class.to_s.to_sym == :Contest
|
||||
if !journals_for_message.jour.author.notify_about? journals_for_message
|
||||
return -1
|
||||
end
|
||||
mail :to => recipients, :subject => @title,:filter => true
|
||||
else
|
||||
mail :to => recipients1, :subject => @title,:filter => true
|
||||
end
|
||||
# else
|
||||
# mail :to => recipients1, :subject => @title,:filter => true
|
||||
# end
|
||||
|
||||
|
||||
end
|
||||
|
@ -485,16 +485,16 @@ class Mailer < ActionMailer::Base
|
|||
|
||||
# 用户申请加入项目邮件通知
|
||||
def applied_project(applied)
|
||||
@project =applied.project
|
||||
redmine_headers 'Project' => @project,
|
||||
'User' => applied.user
|
||||
@user = applied.user
|
||||
recipients = @project.manager_recipients
|
||||
s = l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name)
|
||||
@token = Token.get_token_from_user(@user, 'autologin')
|
||||
@applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members')
|
||||
mail :to => recipients,
|
||||
:subject => s
|
||||
# @project =applied.project
|
||||
# redmine_headers 'Project' => @project,
|
||||
# 'User' => applied.user
|
||||
# @user = applied.user
|
||||
# recipients = @project.manager_recipients
|
||||
# s = l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name)
|
||||
# @token = Token.get_token_from_user(@user, 'autologin')
|
||||
# @applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members')
|
||||
# mail :to => recipients,
|
||||
# :subject => s
|
||||
end
|
||||
|
||||
def reminder(user, issues, days)
|
||||
|
@ -555,14 +555,14 @@ class Mailer < ActionMailer::Base
|
|||
# document_added(document) => Mail::Message object
|
||||
# Mailer.document_added(document).deliver => sends an email to the document's project recipients
|
||||
def document_added(document)
|
||||
redmine_headers 'Project' => document.project.identifier
|
||||
@author = User.current
|
||||
@document = document
|
||||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
@document_url = url_for(:controller => 'documents', :action => 'show', :id => document)
|
||||
mail :to => document.recipients,
|
||||
:subject => "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}",
|
||||
:filter => true
|
||||
# redmine_headers 'Project' => document.project.identifier
|
||||
# @author = User.current
|
||||
# @document = document
|
||||
# @issue_author_url = url_for(user_activities_url(@author))
|
||||
# @document_url = url_for(:controller => 'documents', :action => 'show', :id => document)
|
||||
# mail :to => document.recipients,
|
||||
# :subject => "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}",
|
||||
# :filter => true
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email recipients of a project when an attachements are added.
|
||||
|
@ -571,54 +571,54 @@ class Mailer < ActionMailer::Base
|
|||
# attachments_added(attachments) => Mail::Message object
|
||||
# Mailer.attachments_added(attachments).deliver => sends an email to the project's recipients
|
||||
def attachments_added(attachments)
|
||||
container = attachments.first.container
|
||||
added_to = ''
|
||||
added_to_url = ''
|
||||
@author = attachments.first.author
|
||||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
case container.class.name
|
||||
when 'Project'
|
||||
added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container)
|
||||
added_to = "#{l(:label_project)}: #{container}"
|
||||
recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail }
|
||||
when 'Course'
|
||||
added_to_url = url_for(:controller => 'files', :action => 'index', :course_id => container)
|
||||
added_to = "#{l(:label_course)}: #{container.name}"
|
||||
recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail }
|
||||
when 'Version'
|
||||
added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container.project)
|
||||
added_to = "#{l(:label_version)}: #{container.name}"
|
||||
recipients = container.project.notified_users.select { |user| user.allowed_to?(:view_files, container.project) }.collect { |u| u.mail }
|
||||
when 'Document'
|
||||
added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id)
|
||||
added_to = "#{l(:label_document)}: #{container.title}"
|
||||
recipients = container.recipients
|
||||
end
|
||||
if container.class.name == 'Course'
|
||||
redmine_headers 'Course' => container.id
|
||||
@attachments = attachments
|
||||
@added_to = added_to
|
||||
@added_to_url = added_to_url
|
||||
mail :to => recipients,
|
||||
:subject => "[#{container.name}] #{l(:label_attachment_new)}",
|
||||
:filter => true
|
||||
elsif container.class.name == 'Project'
|
||||
redmine_headers 'Project' => container.id
|
||||
@attachments = attachments
|
||||
@added_to = added_to
|
||||
@added_to_url = added_to_url
|
||||
mail :to => recipients,
|
||||
:subject => "[#{container.name}] #{l(:label_attachment_new)}",
|
||||
:filter => true
|
||||
else
|
||||
redmine_headers 'Project' => container.project.identifier
|
||||
@attachments = attachments
|
||||
@added_to = added_to
|
||||
@added_to_url = added_to_url
|
||||
mail :to => recipients,
|
||||
:subject => "[#{container.project.name}] #{l(:label_attachment_new)}",
|
||||
:filter => true
|
||||
end
|
||||
# container = attachments.first.container
|
||||
# added_to = ''
|
||||
# added_to_url = ''
|
||||
# @author = attachments.first.author
|
||||
# @issue_author_url = url_for(user_activities_url(@author))
|
||||
# case container.class.name
|
||||
# when 'Project'
|
||||
# added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container)
|
||||
# added_to = "#{l(:label_project)}: #{container}"
|
||||
# recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail }
|
||||
# when 'Course'
|
||||
# added_to_url = url_for(:controller => 'files', :action => 'index', :course_id => container)
|
||||
# added_to = "#{l(:label_course)}: #{container.name}"
|
||||
# recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail }
|
||||
# when 'Version'
|
||||
# added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container.project)
|
||||
# added_to = "#{l(:label_version)}: #{container.name}"
|
||||
# recipients = container.project.notified_users.select { |user| user.allowed_to?(:view_files, container.project) }.collect { |u| u.mail }
|
||||
# when 'Document'
|
||||
# added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id)
|
||||
# added_to = "#{l(:label_document)}: #{container.title}"
|
||||
# recipients = container.recipients
|
||||
# end
|
||||
# if container.class.name == 'Course'
|
||||
# redmine_headers 'Course' => container.id
|
||||
# @attachments = attachments
|
||||
# @added_to = added_to
|
||||
# @added_to_url = added_to_url
|
||||
# mail :to => recipients,
|
||||
# :subject => "[#{container.name}] #{l(:label_attachment_new)}",
|
||||
# :filter => true
|
||||
# elsif container.class.name == 'Project'
|
||||
# redmine_headers 'Project' => container.id
|
||||
# @attachments = attachments
|
||||
# @added_to = added_to
|
||||
# @added_to_url = added_to_url
|
||||
# mail :to => recipients,
|
||||
# :subject => "[#{container.name}] #{l(:label_attachment_new)}",
|
||||
# :filter => true
|
||||
# else
|
||||
# redmine_headers 'Project' => container.project.identifier
|
||||
# @attachments = attachments
|
||||
# @added_to = added_to
|
||||
# @added_to_url = added_to_url
|
||||
# mail :to => recipients,
|
||||
# :subject => "[#{container.project.name}] #{l(:label_attachment_new)}",
|
||||
# :filter => true
|
||||
# end
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email recipients of a course when an homework are posted.
|
||||
|
@ -650,15 +650,15 @@ class Mailer < ActionMailer::Base
|
|||
def news_added(news)
|
||||
|
||||
if news.project
|
||||
redmine_headers 'Project' => news.project.identifier
|
||||
@author = news.author
|
||||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
message_id news
|
||||
@news = news
|
||||
@news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
mail :to => news.recipients,
|
||||
:subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||
:filter => true
|
||||
# redmine_headers 'Project' => news.project.identifier
|
||||
# @author = news.author
|
||||
# @issue_author_url = url_for(user_activities_url(@author))
|
||||
# message_id news
|
||||
# @news = news
|
||||
# @news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
# mail :to => news.recipients,
|
||||
# :subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||
# :filter => true
|
||||
elsif news.course
|
||||
redmine_headers 'Course' => news.course.id
|
||||
@author = news.author
|
||||
|
@ -681,17 +681,17 @@ class Mailer < ActionMailer::Base
|
|||
def news_comment_added(comment)
|
||||
news = comment.commented
|
||||
if news.project
|
||||
redmine_headers 'Project' => news.project.identifier
|
||||
@author = comment.author
|
||||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
message_id comment
|
||||
@news = news
|
||||
@comment = comment
|
||||
@news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
mail :to => news.recipients,
|
||||
:cc => news.watcher_recipients,
|
||||
:subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||
:filter => true
|
||||
# redmine_headers 'Project' => news.project.identifier
|
||||
# @author = comment.author
|
||||
# @issue_author_url = url_for(user_activities_url(@author))
|
||||
# message_id comment
|
||||
# @news = news
|
||||
# @comment = comment
|
||||
# @news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
# mail :to => news.recipients,
|
||||
# :cc => news.watcher_recipients,
|
||||
# :subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||
# :filter => true
|
||||
elsif news.course
|
||||
redmine_headers 'Course' => news.course.id
|
||||
@author = comment.author
|
||||
|
@ -714,37 +714,37 @@ class Mailer < ActionMailer::Base
|
|||
# message_posted(message) => Mail::Message object
|
||||
# Mailer.message_posted(message).deliver => sends an email to the recipients
|
||||
def message_posted(message)
|
||||
if message.project
|
||||
redmine_headers 'Project' => message.project.identifier,
|
||||
'Topic-Id' => (message.parent_id || message.id)
|
||||
@author = message.author
|
||||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
message_id message
|
||||
references message.parent unless message.parent.nil?
|
||||
recipients = message.recipients
|
||||
cc = ((message.root.watcher_recipients + message.board.watcher_recipients).uniq - recipients)
|
||||
@message = message
|
||||
@message_url = url_for(message.event_url)
|
||||
mail :to => recipients,
|
||||
:cc => cc,
|
||||
:subject => "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}",
|
||||
:filter => true
|
||||
elsif message.course
|
||||
redmine_headers 'Course' => message.course.id,
|
||||
'Topic-Id' => (message.parent_id || message.id)
|
||||
@author = message.author
|
||||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
message_id message
|
||||
references message.parent unless message.parent.nil?
|
||||
recipients = message.course.notified_users.select { |user| user.allowed_to?(:view_files, message.course) }.collect { |u| u.mail }
|
||||
cc = ((message.root.watcher_recipients + message.board.watcher_recipients).uniq - recipients)
|
||||
@message = message
|
||||
@message_url = url_for(message.event_url)
|
||||
mail :to => recipients,
|
||||
:cc => cc,
|
||||
:subject => "[#{message.board.course.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}",
|
||||
:filter => true
|
||||
end
|
||||
# if message.project
|
||||
# redmine_headers 'Project' => message.project.identifier,
|
||||
# 'Topic-Id' => (message.parent_id || message.id)
|
||||
# @author = message.author
|
||||
# @issue_author_url = url_for(user_activities_url(@author))
|
||||
# message_id message
|
||||
# references message.parent unless message.parent.nil?
|
||||
# recipients = message.recipients
|
||||
# cc = ((message.root.watcher_recipients + message.board.watcher_recipients).uniq - recipients)
|
||||
# @message = message
|
||||
# @message_url = url_for(message.event_url)
|
||||
# mail :to => recipients,
|
||||
# :cc => cc,
|
||||
# :subject => "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}",
|
||||
# :filter => true
|
||||
# elsif message.course
|
||||
# redmine_headers 'Course' => message.course.id,
|
||||
# 'Topic-Id' => (message.parent_id || message.id)
|
||||
# @author = message.author
|
||||
# @issue_author_url = url_for(user_activities_url(@author))
|
||||
# message_id message
|
||||
# references message.parent unless message.parent.nil?
|
||||
# recipients = message.course.notified_users.select { |user| user.allowed_to?(:view_files, message.course) }.collect { |u| u.mail }
|
||||
# cc = ((message.root.watcher_recipients + message.board.watcher_recipients).uniq - recipients)
|
||||
# @message = message
|
||||
# @message_url = url_for(message.event_url)
|
||||
# mail :to => recipients,
|
||||
# :cc => cc,
|
||||
# :subject => "[#{message.board.course.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}",
|
||||
# :filter => true
|
||||
# end
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email the recipients of a project of the specified wiki content was added.
|
||||
|
@ -753,20 +753,20 @@ class Mailer < ActionMailer::Base
|
|||
# wiki_content_added(wiki_content) => Mail::Message object
|
||||
# Mailer.wiki_content_added(wiki_content).deliver => sends an email to the project's recipients
|
||||
def wiki_content_added(wiki_content)
|
||||
redmine_headers 'Project' => wiki_content.project.identifier,
|
||||
'Wiki-Page-Id' => wiki_content.page.id
|
||||
@author = wiki_content.author
|
||||
message_id wiki_content
|
||||
recipients = wiki_content.recipients
|
||||
cc = wiki_content.page.wiki.watcher_recipients - recipients
|
||||
@wiki_content = wiki_content
|
||||
@wiki_content_url = url_for(:controller => 'wiki', :action => 'show',
|
||||
:project_id => wiki_content.project,
|
||||
:id => wiki_content.page.title)
|
||||
mail :to => recipients,
|
||||
:cc => cc,
|
||||
:subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}",
|
||||
:filter => true
|
||||
# redmine_headers 'Project' => wiki_content.project.identifier,
|
||||
# 'Wiki-Page-Id' => wiki_content.page.id
|
||||
# @author = wiki_content.author
|
||||
# message_id wiki_content
|
||||
# recipients = wiki_content.recipients
|
||||
# cc = wiki_content.page.wiki.watcher_recipients - recipients
|
||||
# @wiki_content = wiki_content
|
||||
# @wiki_content_url = url_for(:controller => 'wiki', :action => 'show',
|
||||
# :project_id => wiki_content.project,
|
||||
# :id => wiki_content.page.title)
|
||||
# mail :to => recipients,
|
||||
# :cc => cc,
|
||||
# :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}",
|
||||
# :filter => true
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email the recipients of a project of the specified wiki content was updated.
|
||||
|
@ -775,23 +775,23 @@ class Mailer < ActionMailer::Base
|
|||
# wiki_content_updated(wiki_content) => Mail::Message object
|
||||
# Mailer.wiki_content_updated(wiki_content).deliver => sends an email to the project's recipients
|
||||
def wiki_content_updated(wiki_content)
|
||||
redmine_headers 'Project' => wiki_content.project.identifier,
|
||||
'Wiki-Page-Id' => wiki_content.page.id
|
||||
@author = wiki_content.author
|
||||
message_id wiki_content
|
||||
recipients = wiki_content.recipients
|
||||
cc = wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients
|
||||
@wiki_content = wiki_content
|
||||
@wiki_content_url = url_for(:controller => 'wiki', :action => 'show',
|
||||
:project_id => wiki_content.project,
|
||||
:id => wiki_content.page.title)
|
||||
@wiki_diff_url = url_for(:controller => 'wiki', :action => 'diff',
|
||||
:project_id => wiki_content.project, :id => wiki_content.page.title,
|
||||
:version => wiki_content.version)
|
||||
mail :to => recipients,
|
||||
:cc => cc,
|
||||
:subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}",
|
||||
:filter => true
|
||||
# redmine_headers 'Project' => wiki_content.project.identifier,
|
||||
# 'Wiki-Page-Id' => wiki_content.page.id
|
||||
# @author = wiki_content.author
|
||||
# message_id wiki_content
|
||||
# recipients = wiki_content.recipients
|
||||
# cc = wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients
|
||||
# @wiki_content = wiki_content
|
||||
# @wiki_content_url = url_for(:controller => 'wiki', :action => 'show',
|
||||
# :project_id => wiki_content.project,
|
||||
# :id => wiki_content.page.title)
|
||||
# @wiki_diff_url = url_for(:controller => 'wiki', :action => 'diff',
|
||||
# :project_id => wiki_content.project, :id => wiki_content.page.title,
|
||||
# :version => wiki_content.version)
|
||||
# mail :to => recipients,
|
||||
# :cc => cc,
|
||||
# :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}",
|
||||
# :filter => true
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email the specified user their account information.
|
||||
|
|
|
@ -79,9 +79,10 @@ class Memo < ActiveRecord::Base
|
|||
"lock",
|
||||
"sticky",
|
||||
"parent_id",
|
||||
"replies_count"
|
||||
"replies_count",
|
||||
"root_id"
|
||||
|
||||
after_create :add_author_as_watcher, :reset_counters!, :send_mail, :send_message,:create_memo_ealasticsearch_index
|
||||
after_create :add_author_as_watcher, :reset_counters!, :send_message,:create_memo_ealasticsearch_index
|
||||
after_update :update_memo_ealasticsearch_index
|
||||
after_destroy :reset_counters!,:delete_kindeditor_assets,:delete_memo_ealasticsearch_index#,:down_user_score -- 公共区发帖暂不计入得分,
|
||||
# after_create :send_notification
|
||||
|
@ -126,6 +127,18 @@ class Memo < ActiveRecord::Base
|
|||
Mailer.run.forum_message_added(self) if Setting.notified_events.include?('forum_message_added')
|
||||
end
|
||||
|
||||
def creator_user
|
||||
self.author
|
||||
end
|
||||
|
||||
def created_time
|
||||
self.created_on
|
||||
end
|
||||
|
||||
def content_detail
|
||||
self.content
|
||||
end
|
||||
|
||||
# 公共贴吧消息记录
|
||||
# 原则:贴吧创始人;发帖人,wanglingchun(特殊用户)
|
||||
def send_message
|
||||
|
|
|
@ -106,6 +106,10 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
}
|
||||
|
||||
def description
|
||||
self.content
|
||||
end
|
||||
|
||||
def topic?
|
||||
parent_id.nil?
|
||||
end
|
||||
|
|
|
@ -65,7 +65,7 @@ class News < ActiveRecord::Base
|
|||
:author_key => :author_id
|
||||
acts_as_watchable
|
||||
|
||||
after_create :act_as_forge_activity, :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score, :act_as_system_message,:delay_news_wechat_send,:delay_news_send
|
||||
after_create :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score,:delay_news_wechat_send, :delay_news_send
|
||||
after_update :update_activity
|
||||
after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
class ProfessionalLevel < ActiveRecord::Base
|
||||
attr_accessible :level
|
||||
end
|
|
@ -1,6 +1,6 @@
|
|||
class PullRequest < ActiveRecord::Base
|
||||
# status 1:创建 2:接受 3:重新打开 4:关闭
|
||||
attr_accessible :gpid, :pull_request_id, :user_id, :status
|
||||
attr_accessible :gpid, :pull_request_id, :user_id, :project_id, :title
|
||||
validates_uniqueness_of :pull_request_id
|
||||
|
||||
has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy
|
||||
|
|
|
@ -82,7 +82,7 @@ class User < Principal
|
|||
#每日一报、一事一报、不报
|
||||
MAIL_NOTIFICATION_OPTIONS = [
|
||||
#['week', :label_user_mail_option_week],
|
||||
['day', :label_user_mail_option_day],
|
||||
# ['day', :label_user_mail_option_day],
|
||||
['all', :label_user_mail_option_all],
|
||||
['none', :label_user_mail_option_none]
|
||||
]
|
||||
|
|
|
@ -24,4 +24,9 @@ class UserWechat < ActiveRecord::Base
|
|||
BlogComment.where(author_id: old_user).update_all(author_id: u.id)
|
||||
UserActivity.where(user_id: old_user).update_all(user_id: u.id)
|
||||
end
|
||||
|
||||
|
||||
def unsubscribe!
|
||||
self.delete
|
||||
end
|
||||
end
|
||||
|
|
|
@ -584,6 +584,8 @@ class CoursesService
|
|||
@state = 2
|
||||
elsif course[:is_delete] == 1
|
||||
@state = 11
|
||||
elsif course[:invite_code_halt] == 1
|
||||
@state = 14
|
||||
else
|
||||
if current_user.member_of_course?(course) #如果已经是成员
|
||||
@state = 3
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<div class="orig_reply mb10 mt-10">
|
||||
<div class="reply">
|
||||
<span class="reply-right">
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<span class="reply_praise_count_<%=comment.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
</span>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<% if @course %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/course_news_post_reply', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
<% elsif @project %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'projects/project_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
<% else %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'organizations/course_news_post_reply', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
<% end %>
|
||||
sd_create_editor_from_data('<%= @user_activity_id%>',"","100%", "UserActivity");
|
||||
|
|
|
@ -62,17 +62,17 @@
|
|||
<% when 'HomeworkCommon' %>
|
||||
<%= render :partial => 'users/course_homework', :locals => {:activity => act, :user_activity_id => activity.id, :hw_status => 2} %>
|
||||
<% when 'News' %>
|
||||
<%= render :partial => 'users/course_news', :locals => {:activity => act, :user_activity_id => activity.id} %>
|
||||
<%= render :partial => 'users/course_news', :locals => {:activity => act, :user_activity_id => activity.id, :is_course => 1} %>
|
||||
<% when 'Message' %>
|
||||
<%= render :partial => 'users/course_message', :locals => {:activity => act, :user_activity_id => activity.id,:is_course=>1,:is_board=>0} %>
|
||||
<% when 'Poll' %>
|
||||
<%= render :partial => 'users/course_poll', :locals => {:activity => act, :user_activity_id => activity.id} %>
|
||||
<%= render :partial => 'users/course_poll', :locals => {:activity => act, :user_activity_id => activity.id, :is_course => 1} %>
|
||||
<% when 'JournalsForMessage' %>
|
||||
<%= render :partial => 'users/course_journalsformessage', :locals => {:activity => act, :user_activity_id => activity.id} %>
|
||||
<%= render :partial => 'users/course_journalsformessage', :locals => {:activity => act, :user_activity_id => activity.id, :is_course => 1} %>
|
||||
<% when 'Attachment' %>
|
||||
<%= render :partial => 'users/course_attachment', :locals => {:activity => act, :user_activity_id => activity.id} %>
|
||||
<% when 'Course' %>
|
||||
<%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => activity.id} %>
|
||||
<%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => activity.id, :is_course => 1} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
<% unless contributor_course_scor(course.id).count == 0 %>
|
||||
<% count = contributor_course_scor(course.id).select{|ccs| ccs.con_score != 0 && !ccs.con_score.nil?}.count %>
|
||||
<% unless count == 0 %>
|
||||
<div>
|
||||
<ul class="rankList">
|
||||
<h3 style="font-size: 14px; font-weight: normal;">
|
||||
<% if (User.current.logged? && course.open_student == 1) || (User.current.member_of_course?(course)) || User.current.admin? %>
|
||||
<%= link_to "班级活跃度", course_member_path(course, :role => 2, :sort_type => 'act_score'), :class => 'fontGrey3' %>
|
||||
<%= link_to "活跃度", course_member_path(course, :role => 2, :sort_type => 'act_score'), :class => 'fontGrey3' %>
|
||||
<% else %>
|
||||
<span class="fontGrey7"> 班级活跃度 </span>
|
||||
<span class="fontGrey7"> 活跃度 </span>
|
||||
<% end %>
|
||||
<a class="sy_cmore fr" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor: pointer; position:relative;">积分规则</a>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
<ul class="rankList">
|
||||
<h4 style="font-size: 14px; font-weight: normal;">
|
||||
<% if (User.current.logged? && course.open_student == 1) || (User.current.member_of_course?(course)) || User.current.admin? %>
|
||||
<%= link_to "班级英雄榜", course_member_path(course, :role => 2), :class => 'fontGrey3' %>
|
||||
<%= link_to "英雄榜", course_member_path(course, :role => 2), :class => 'fontGrey3' %>
|
||||
<% else %>
|
||||
<span class="fontGrey7">班级英雄榜</span>
|
||||
<span class="fontGrey7">英雄榜</span>
|
||||
<% end %>
|
||||
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor:pointer;">积分规则</a></h4>
|
||||
<div style="cursor:pointer;" class="numIntro undis">
|
||||
|
@ -15,9 +15,15 @@
|
|||
</div>
|
||||
<% hero_homework_scores.each do |student_score| %>
|
||||
<% if student_score.score.to_i != 0 %>
|
||||
<li> <a href="javascript:void:(0);"><%=link_to image_tag(url_to_avatar(student_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(student_score.user) %></a>
|
||||
<p><a href="javascript:void:(0);"><%=link_to student_score.user.show_name, user_path(student_score.user), :title => student_score.user.show_name %></a></p>
|
||||
<p><span class="c_red" style="cursor:pointer" ><%= student_score.score<0 ? 0 : student_score.score.to_i %></span></p>
|
||||
<li> <a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(student_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(student_score.user) %></a>
|
||||
<p><a href="javascript:void(0);"><%=link_to student_score.user.show_name, user_path(student_score.user), :title => student_score.user.show_name %></a></p>
|
||||
<p><span class="c_red" style="cursor:pointer" >
|
||||
<% if !(User.current.allowed_to?(:as_teacher, @course) || User.current.admin?) && User.current.id != student_score.user.id && course_has_score_open_common_homework(@course) %>
|
||||
<%= "**" %>
|
||||
<% else %>
|
||||
<%= student_score.score<0 ? 0 : student_score.score.to_i %>
|
||||
<% end %>
|
||||
</span></p>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,23 +1,26 @@
|
|||
<div class="st_list">
|
||||
<div class="st_box">
|
||||
<a href="javascript:void(0)" class="fr fb mb5" >加入时间</a>
|
||||
<a href="javascript:void(0)" class="fr fb mb5 mr70" >角色</a>
|
||||
<div class="cl"></div><!--st_box_top end-->
|
||||
<div class="sy_class_fenban clear">
|
||||
<div class="mt5">
|
||||
<div style="border-bottom: 1px solid #CCC">
|
||||
<span href="javascript:void(0)" class="c_grey f14 fl fb mb5 ml65" >姓名</span>
|
||||
<span href="javascript:void(0)" class="c_grey f14 fr fb mb5 mr20">加入时间</span>
|
||||
<span href="javascript:void(0)" class="c_grey f14 fr fb mb5 mr70" >角色</span>
|
||||
<div class="cl"></div><!--st_box_top end-->
|
||||
</div>
|
||||
|
||||
<div class="mt10">
|
||||
<% members.each do |member| %>
|
||||
<div class="st_boxlist">
|
||||
<%= link_to image_tag(url_to_avatar(member.user), :width => "32", :height => "32", :style => "display:block;"), user_path(member.user_id),:target => '_blank', :class => 'st_img' ,:alt => "用户头像" %>
|
||||
<span class="fl ml10 c_grey"><%= l(:label_username)%></span>
|
||||
<%= link_to(member.user.show_name, user_path(member.user),:class => "ml10 c_blue02") %>
|
||||
<span class="fr c_grey"><%= format_date(member.created_on)%></span>
|
||||
<span class="fr c_grey mr30 w45"><%= zh_course_role(h member.roles.sort.collect(&:to_s).first)%></span>
|
||||
<div class="teacher_st_boxlist">
|
||||
<%= link_to image_tag(url_to_avatar(member.user), :width => "50", :height => "50", :style => "display:block;", :class =>'teacher_member_img'), user_path(member.user_id), :class => 'fl' ,:alt => "用户头像" %>
|
||||
<div class="fl">
|
||||
<%= link_to(member.user.show_name, user_path(member.user),:class => "ml10 mt5 mb10 link-blue db") %>
|
||||
<span class="c_grey ml10"><%= l(:label_username)%><%= member.user.login%></span>
|
||||
</div>
|
||||
<span class="fr c_grey mr15"><%= format_date(member.created_on)%></span>
|
||||
<span class="fr c_grey mr55 w45" style="text-align: center"><%= zh_course_role(h member.roles.sort.collect(&:to_s).first)%></span>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end%>
|
||||
|
||||
<ul class="wlist">
|
||||
<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
|
@ -25,7 +25,7 @@
|
|||
<div class="ping_disfoot f14">
|
||||
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
||||
|
||||
<span id="reply_praise_count_<%=journal.id %>">
|
||||
<span class="reply_praise_count_<%=journal.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>journal, :user_activity_id=>journal.id,:type=>"reply"}%>
|
||||
</span>
|
||||
<% if reply_allow %>
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
<li>
|
||||
<label>班级邀请码:</label>
|
||||
<input class=" sy_input_txt fl" name="invite_code" placeholder="请输入五位班级邀请码">
|
||||
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -18,14 +17,13 @@
|
|||
<input type="checkbox" name="role[]" value="9" id="join_course_role_9" class="ml5 mr5 "/><span class="mr10">教师</span>
|
||||
<input type="checkbox" name="role[]" value="7" id="join_course_role_7" class="ml5 mr5"/><span class="mr10">助教</span>
|
||||
<input type="checkbox" name="role[]" value="10" id="join_course_role_10" class="ml5 mr5"/><span class="mr10">学生</span>
|
||||
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li>
|
||||
<p id="none_checked_notice" class="c_red none f12" style="margin-left: 42px;">请至少选择一个身份</p>
|
||||
<li class="mt10">
|
||||
<label> </label>
|
||||
<a href="javascript:void(0);" class="sy_btn_blue fl" onclick="$('#new-watcher-form').submit();hideModal()">确 定</a>
|
||||
<a href="javascript:void(0);" class="sy_btn_blue fl" onclick="submit_join_course();">确 定</a>
|
||||
<a href="javascript:void(0);" class="sy_btn_grey fl ml20" onclick="hideModal()">取 消</a>
|
||||
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -33,6 +31,16 @@
|
|||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function submit_join_course(){
|
||||
if ($("input[name='role[]']:checked").length >= 1){
|
||||
$("#none_checked_notice").hide();
|
||||
$('#new-watcher-form').submit();
|
||||
hideModal();
|
||||
}else{
|
||||
$("#none_checked_notice").show();
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$("#join_course_role_7").on('click', function(){
|
||||
if($("#join_course_role_7").is(":checked")) {
|
||||
|
|
|
@ -79,29 +79,39 @@
|
|||
<% sum = hw_score + ex_score + act_score %>
|
||||
<td><%= (@page - 1) * @limit + i + 1 %></td>
|
||||
<td>
|
||||
<%= link_to image_tag(url_to_avatar(user), :width => "30", :height => "30", :style => "display:block;"), user_path(member.user_id), :class => 'sy_class_users_st fl mt5 mr5' ,:alt => "用户头像" %>
|
||||
<span class="fl sy_class_users_st_name" title="<%= user.show_name %>"><%= user.show_name %></span>
|
||||
<%= link_to image_tag(url_to_avatar(user), :width => "30", :height => "30", :style => "display:block;"), user_path(user), :class => 'sy_class_users_st fl mt5 mr5' ,:alt => "用户头像" %>
|
||||
<%= link_to user.show_name, user_path(user), :class => 'fl sy_class_users_st_name' ,:title => "#{user.show_name}" %>
|
||||
</td>
|
||||
<td>
|
||||
<span class="sy_class_users_st_num" title="<%= user.user_extensions.student_id %>"><%= user.user_extensions.student_id %></span>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to format("%0.2f", hw_score), {
|
||||
:action => 'show_member_score',
|
||||
:member_id => member.id,
|
||||
:remote => true},
|
||||
:class => "" %>
|
||||
<% if !is_teacher && User.current.id != member.user_id && course_has_score_open_common_homework(@course) %>
|
||||
<a>**</a>
|
||||
<% else %>
|
||||
<%= link_to format("%0.2f", hw_score), {
|
||||
:action => 'show_member_score',
|
||||
:member_id => member.id,
|
||||
:remote => true},
|
||||
:class => "" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= ex_score %></td>
|
||||
<td>
|
||||
<%= link_to act_score, {
|
||||
:action => 'show_member_act_score',
|
||||
:member_id => member.id,
|
||||
:remote => true},
|
||||
:class => '' %>
|
||||
:action => 'show_member_act_score',
|
||||
:member_id => member.id,
|
||||
:remote => true},
|
||||
:class => '' %>
|
||||
</td>
|
||||
<td class="pr">
|
||||
<span class="sum_score_tip"><%= format("%0.2f", sum) %></span>
|
||||
<span class="sum_score_tip">
|
||||
<% if !is_teacher && User.current.id != member.user_id && course_has_score_open_common_homework(@course) %>
|
||||
<a>**</a>
|
||||
<% else %>
|
||||
<%= format("%0.2f", sum) %>
|
||||
<% end %>
|
||||
</span>
|
||||
<div class="sy_tips_box_inner undis" style="left: <%=is_teacher ? '230px' : '215px' %>; top: -60px; text-align: left;">
|
||||
<span style="top: 75px;"></span>
|
||||
<p >
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
hideModal();
|
||||
$("#member_li_<%=params[:member_id] %>").html("");
|
||||
var all_indexes = $("#member_li_<%=params[:member_id] %>").nextAll().find("td:first-child");
|
||||
for(var i = 0; i < all_indexes.length; i++){
|
||||
$(all_indexes[i]).html(parseInt($(all_indexes[i]).html()) - 1);
|
||||
}
|
||||
$("#member_li_<%=params[:member_id] %>").remove();
|
||||
$("#st_groups").html("<%=escape_javascript(render :partial => 'new_groups_name', :locals => {:course_groups => @course_groups}) %>");
|
||||
$("#group_children_list").html("<%= escape_javascript( render :partial => 'layouts/group_children_list', :locals => {:course => @course})%>");
|
||||
$("#student_number").html("<%= studentCount(@course) %>");
|
||||
|
|
|
@ -1,20 +1,8 @@
|
|||
<div class="sy_class_r sy_class_nobg fr ml10">
|
||||
<div class="sy_class_r_head mb10">
|
||||
<h3>学生列表(<%=@group.name %>)</h3>
|
||||
<div class="hw_more_box">
|
||||
<ul>
|
||||
<li class="hw_more_icons">
|
||||
<ul class="hw_more_txt">
|
||||
<li><%= link_to l(:label_export_excel), export_course_member_excel_course_path(@course,:group_id => @group.id ,:format => 'xls'), :class => 'hw_more_li'%></li>
|
||||
<% if @canShowCode %>
|
||||
<li>
|
||||
<%=link_to "成员管理", {:controller => 'courses', :action => 'settings', :id => @course.id, :tab => 'member'}, :class => 'hw_more_li' %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<h3 class="fl">学生列表(<%=@group.name %>)</h3>
|
||||
<%= link_to "导出成绩", export_course_member_excel_course_path(@course,:group_id => @group.id ,:format => 'xls'), :class => 'link-blue fr mt5'%>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div class="sy_class_fenban clear">
|
||||
|
|
|
@ -5,77 +5,82 @@
|
|||
<% if @state == 0 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">加入成功</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 1 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">密码错误</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 2 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">班级已过期<br/>请联系班级管理员重启班级。(在配置班级处)</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 3 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您已经加入了班级</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 4 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您输入的邀请码错误</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 5 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您还未登录</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 6 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">申请成功,请等待审核</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 7%>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您已经发送过申请了,请耐心等待</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 8%>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您已经是该班级的教师了</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 9%>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您已经是该班级的教辅了</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 10%>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您已经是该班级的管理员了</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 11%>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">该班级已被删除</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
'<div class="clear mt15"><p class="text_c f14">该班级已归档,请联系老师</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 12 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您已经发送过申请了,请耐心等待</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 13 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">申请成功,请等待审核</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 14 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">此二维码已停用,请与老师联系</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% else %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">未知错误,请稍后再试</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
<% if @role.to_i == 1 %>
|
||||
<div class="courseRSide fl" id="homework_page_right">
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2 fl"><%= @subPage_title%></h2>
|
||||
<div class="sy_class_r sy_class_nobg fr ml10">
|
||||
<div class="sy_class_r_head mb10">
|
||||
<h3 class="fl"><%= @subPage_title %></h3>
|
||||
<% if User.current.allowed_to?(:as_teacher,@course) %>
|
||||
<span class="fr f14 fontGrey2" style="height: 40px; line-height: 40px; margin-right: 15px;">
|
||||
<%=link_to "成员管理", {:controller => 'courses', :action => 'settings', :id => @course.id, :tab=>'member'}, :class => 'hw_more_li' %>
|
||||
</span>
|
||||
<%=link_to "成员管理", {:controller => 'courses', :action => 'settings', :id => @course.id, :tab=>'member'}, :class => 'link-blue fr mt5' %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<%= render :partial => 'course_teacher', :locals => {:members => @members} %>
|
||||
</div>
|
||||
|
@ -17,7 +16,7 @@
|
|||
<% if User.current.allowed_to?(:as_teacher,@course) %>
|
||||
<%=link_to "成员管理", {:controller => 'courses', :action => 'settings', :id => @course.id, :tab => 'member'}, :class => 'link-blue ml10 fr mt5' %>
|
||||
<% end %>
|
||||
<%= link_to l(:label_export_excel), export_course_member_excel_course_path(@course,:format => 'xls'), :class => 'link-blue fr mt5'%>
|
||||
<%= link_to "导出成绩", export_course_member_excel_course_path(@course,:format => 'xls'), :class => 'link-blue fr mt5'%>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<%= render :partial => 'course_student', :locals => {:members => @members} %>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
$("#project_info_<%=@course.id %>").html("<%= escape_javascript(render :partial => 'layouts/course_base_info') %>");
|
||||
hideModal();
|
|
@ -2,13 +2,13 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th class="newupload_td01"> </th>
|
||||
<th class="pr">
|
||||
<%= link_to "试卷标题", search_exercises_exercise_index_path(:course_id => course_id, :order => "exercise_name", :sort => @r_sort), :remote => true%>
|
||||
<th class="pr tl">
|
||||
<%= link_to "试卷标题", search_exercises_exercise_index_path(:course_id => course_id, :order => "exercise_name", :sort => @r_sort), :remote => true, :class => "ml5"%>
|
||||
<% if order == "exercise_name" %>
|
||||
<%= link_to "", search_exercises_exercise_index_path(:course_id => course_id, :order => "exercise_name", :sort => @r_sort), :class => "#{@r_sort == 'desc' ? 'sortupbtn' : 'sortdownbtn'}", :style => "position: absolute; top: 8px; left: 172px;", :remote => true %>
|
||||
<% end %>
|
||||
</th>
|
||||
<th class="newupload_td03" style="color: #7f7f7f;">来源</th>
|
||||
<th class="newupload_td03 tl" style="color: #7f7f7f;"><span class="ml5">来源</span></th>
|
||||
<th class="newupload_td04 pr">
|
||||
<%= link_to "创建时间", search_exercises_exercise_index_path(:course_id => course_id, :order => "created_at", :sort => @r_sort), :remote => true%>
|
||||
<% if order == "created_at" %>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<span class="c_grey fl mr15">测试时长:<%= exercise.time.nil? || exercise.time == -1 ? '不限' : exercise.time.to_s + "分钟" %></span>
|
||||
<span class="c_grey fl mr15">截止时间:<%= exercise.end_time.nil? ? '未设置' : format_time(exercise.end_time) %></span>
|
||||
<span class="c_grey fl mr15">发布时间:<%= exercise.publish_time.nil? ? '未设置' : format_time(exercise.publish_time) %></span>
|
||||
<% if @is_teacher && exercise.exercise_status > 1 %>
|
||||
<% if exercise.exercise_status > 1 %>
|
||||
<span class="c_grey fl mr15">已提交:<span class="c_blue"><%= exercise.exercise_users.where("commit_status = 1").count %></span></span>
|
||||
<span class="c_grey fl mr15">未提交:<span class="c_blue"><%= exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count %></span></span>
|
||||
<% end %>
|
||||
|
|
|
@ -94,6 +94,7 @@
|
|||
<%= render :partial => "files/tag_yun_project", :locals => {:tag_list => @tag_list,:project => @project, :tag_name => @tag_name}%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% if @tip_all_attachments > 0 %>
|
||||
<div class="re_con_top">
|
||||
<p class="f_l fontBlue f_b f_14" id="tip_attachment_count">
|
||||
<%= render :partial => "files/tip_attachment_count" %>
|
||||
|
@ -124,5 +125,8 @@
|
|||
<div id="course_list">
|
||||
<%= render :partial => 'project_list',:locals => {project: @project, all_attachments: @all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments} %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => "projects/no_data" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%# html_title(l(:label_attachment_plural)) -%>
|
|
@ -18,7 +18,8 @@
|
|||
</div>
|
||||
<div class="postDetailReply fr">
|
||||
<a href="<%= forum_memo_path(topic.forum, topic)%>" class="postReplyIcon mr5" target="_blank"></a>
|
||||
<%= link_to (topic.replies_count), forum_memo_path(topic.forum, topic),:target =>'_blank',:class=>'linkGrey2' %>
|
||||
<% replies_count = Memo.where("root_id = #{topic.id}").count %>
|
||||
<%= link_to (replies_count), forum_memo_path(topic.forum, topic),:target =>'_blank',:class=>'linkGrey2' %>
|
||||
<a href="javascript:void(0);" class="linkGrey2 disablePostLikeIcon ml10" style="cursor: default" title="点赞人数" > <%= get_praise_num(topic)%></a>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<div id="muban_popup_box" style="width:400px;">
|
||||
<div class="muban_popup_top">
|
||||
<h3 class="fl">成绩公开范围</h3>
|
||||
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<%= form_for('new_form',:url =>{:controller => 'homework_common',:action => 'set_score_open',:id => @homework.id,:user_activity_id => @user_activity_id, :hw_status => @hw_status},
|
||||
:method => "post", :remote => true) do |f|%>
|
||||
<div class="muban_popup_con clear">
|
||||
<div class="clear mt15 ml20">
|
||||
<ul class="pro_newsetting_con fl">
|
||||
<li class="mb10 clear">
|
||||
<ul class="fl">
|
||||
<li class="clear">
|
||||
<label class="fl ml5">请选择作品成绩的公开范围</label>
|
||||
</li>
|
||||
<li class="clear ml20">
|
||||
<input type="radio" class="fl" id="open_to_all" <%= @homework.score_open == 1 ? "checked" : "" %> value="1" name="score_open"/>
|
||||
<label for="open_to_all" class="fl ml5 fontGrey2">成绩对所有学生可见</label>
|
||||
</li>
|
||||
<li class="clear ml20">
|
||||
<input type="radio" class="fl" id="open_to_me" <%= @homework.score_open == 0 ? "checked" : "" %> value="0" name="score_open"/>
|
||||
<label for="open_to_me" class="fl ml5 fontGrey2">成绩仅对自己可见</label>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="fl ml20">
|
||||
<div class="popup_tip_box fontGrey2">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p>老师和助教始终能看到所有成绩</p>
|
||||
</div>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class="fr sy_btn_blue mr20" onclick="$(this).parent().parent().parent().submit();">确定</a>
|
||||
<a href="javascript:void(0);" class="fr sy_btn_grey mr5" onclick="hideModal();">取消</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% end%>
|
||||
</div>
|
|
@ -17,6 +17,10 @@
|
|||
<input type="text" name="absence_penalty" id="absence_penalty_num" placeholder="0-50" class="fl issues_calendar_input" value="<%= homework.homework_detail_manual.absence_penalty%>" onkeyup="check_late_penalty('absence_penalty_num')"/>
|
||||
</li>
|
||||
<li class="mb10 clear">
|
||||
<input type="checkbox" class="fl ml100" id="no_anon_penalty" name="no_anon_penalty" <%=homework.homework_detail_manual.no_anon_penalty == 0 ? 'checked' : '' %> value="<%=homework.homework_detail_manual.no_anon_penalty%>"/>
|
||||
<label class="pop_box_label fl ml10" for="no_anon_penalty" style="text-align: left; width: 120px;">扣分(不参加匿评)</label>
|
||||
</li>
|
||||
<li class="mb10 clear mt30">
|
||||
<label class="pop_box_label fl">最终得分 : </label>
|
||||
<input type="radio" class="fl" value="1" id="teacher_score" name="teacher_priority"/><label for="teacher_score" class=" fl ml5">教师评分</label>
|
||||
</li>
|
||||
|
@ -38,7 +42,7 @@
|
|||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="fl mt5 ml20" >
|
||||
<ul class="fl ml20">
|
||||
<div class="popup_tip_box fontGrey2 mb10">
|
||||
<em></em>
|
||||
<span></span>
|
||||
|
@ -49,6 +53,11 @@
|
|||
<span></span>
|
||||
<p >请输入数值0-50</p>
|
||||
</div>
|
||||
<div class="popup_tip_box fontGrey2 mb10">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p>匿评开启后提交的作品,未能参加<br/>匿评,按照全部缺评扣分</p>
|
||||
</div>
|
||||
<div class="popup_tip_box fontGrey2 mb10">
|
||||
<em></em>
|
||||
<span></span>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<label for="other_score" class="fl ml5">助教评分</label>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="fl mt5 ml20" >
|
||||
<ul class="fl ml20" >
|
||||
<div class="popup_tip_box fontGrey2 mb10">
|
||||
<em></em>
|
||||
<span></span>
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
<input type="text" name="absence_penalty" id="absence_penalty_num" placeholder="0-50" class="fl w180" value="<%= homework.homework_detail_manual.absence_penalty%>" onkeyup="check_late_penalty('absence_penalty_num')"/>
|
||||
</li>
|
||||
<li class="mb10 clear">
|
||||
<input type="checkbox" class="fl ml100" id="no_anon_penalty" name="no_anon_penalty" <%=homework.homework_detail_manual.no_anon_penalty == 0 ? 'checked' : '' %> value="<%=homework.homework_detail_manual.no_anon_penalty%>"/>
|
||||
<label class="pop_box_label fl ml10" for="no_anon_penalty" style="text-align: left; width: 120px;">扣分(不参加匿评)</label>
|
||||
</li>
|
||||
<li class="mb10 clear mt30">
|
||||
<label class="pop_box_label fl">最终得分 : </label>
|
||||
<input type="radio" class="fl" value="1" id="teacher_score" name="teacher_priority"/><label for="teacher_score" class=" fl ml5">教师评分</label>
|
||||
</li>
|
||||
|
@ -42,7 +46,7 @@
|
|||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="fl ml20 mt5">
|
||||
<ul class="fl ml20">
|
||||
<div class="popup_tip_box fontGrey2 mb10">
|
||||
<em></em>
|
||||
<span></span>
|
||||
|
@ -53,6 +57,11 @@
|
|||
<span></span>
|
||||
<p id="absence_penalty_notice" class="">请输入数值0-50</p>
|
||||
</div>
|
||||
<div class="popup_tip_box fontGrey2 mb10">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p>匿评开启后提交的作品,未能参加<br/>匿评,按照全部缺评扣分</p>
|
||||
</div>
|
||||
<div class="popup_tip_box fontGrey2 mb10">
|
||||
<em></em>
|
||||
<span></span>
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="fl ml20 mt5">
|
||||
<ul class="fl ml20">
|
||||
<div class="popup_tip_box fontGrey2 mb10">
|
||||
<em></em>
|
||||
<span></span>
|
||||
|
|
|
@ -1,6 +1,2 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/alert_forbidden_anonymous', :locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>');
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed").css("border","3px solid #269ac9");
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'student_work/alert_forbidden_anonymous', :locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>";
|
||||
pop_box_new(htmlvalue, 400, 178);
|
|
@ -0,0 +1,2 @@
|
|||
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/alert_score_open_modal') %>";
|
||||
pop_box_new(htmlvalue, 400, 200);
|
|
@ -0,0 +1,11 @@
|
|||
hideModal();
|
||||
<% if @hw_status != 5 %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
|
||||
<% if @user_activity_id != @homework.id %>
|
||||
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
|
||||
<% else %>
|
||||
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
|
||||
<% end %>
|
||||
<% else %>
|
||||
$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>");
|
||||
<% end %>
|
|
@ -2,5 +2,6 @@
|
|||
<%#= watcher_link_issue(@issue, User.current) %>
|
||||
<%= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'talk_edit fr' if User.current.allowed_to?(:add_issues, @project) %>
|
||||
<%= link_to l(:button_delete), issue_path(@issue.id), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'talk_edit fr' if User.current.allowed_to?(:delete_issues, @project) %>
|
||||
<%= link_to l(:button_edit), 'javascript:void(0);', :onclick => 'issueEditShow();', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:edit_issues, @project) %>
|
||||
<%#= link_to l(:button_edit), 'javascript:void(0);', :onclick => 'issueEditShow();', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:edit_issues, @project) %>
|
||||
<%= link_to l(:button_edit), edit_issue_path(@issue), :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:edit_issues, @project) %>
|
||||
<%#= link_to l(:label_user_newfeedback), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("update", "issue_journal_kind_reply"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:add_issue_notes, @project) %>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div id="issue_edit" style="display: none">
|
||||
<div id="issue_edit">
|
||||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
|
||||
<% end %>
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
<% end %>
|
||||
<!--<a href="javascript:void(0);" class="sy_btn_blue mr5 fr"> 保存并继续</a>-->
|
||||
<!--<a href="javascript:void(0);" onclick="issue_desc_editor.sync();$('#issue-form').submit();" class="sy_btn_blue mr5 fr" id="issue_confirm"> 保存</a>-->
|
||||
<input onclick="issue_desc_editor.sync();$('#issue-form').submit();" class="sy_btn_blue fr mr5" onfocus="this.blur()" id="issue_confirm" style="width: 28px;color: #FFF" value="保存">
|
||||
<input onclick="issue_create();" class="sy_btn_blue fr mr5" onfocus="this.blur()" id="issue_confirm" style="width: 28px;color: #FFF" value="保存">
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="fl pro_new_conbox_right ml10 mb10">
|
||||
|
@ -74,28 +74,28 @@
|
|||
<label class="fl ml5" for="issue_is_private" id="issue_is_private_tips"><%= l(:field_set_private_tips)%></label>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class=" clear" id="versions_assigned_id">
|
||||
<li class="clear" id="versions_assigned_id">
|
||||
<% if @issue.safe_attribute? 'assigned_to_id' %>
|
||||
<%= f.select :assigned_to_id, assigned_options_for_select(@issue.assignable_users, @issue.assigned_to),
|
||||
{:required => @issue.required_attribute?('assigned_to_id'), :no_label => true},
|
||||
{:onchange => "change_assigned_tip();",:class => "w150"} %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class=" clear" id="assigned_to_tips">
|
||||
<li class="clear" id="assigned_to_tips">
|
||||
<%= @issue.assigned_to.nil? ? "未指派" : "已指派" %>
|
||||
</li>
|
||||
<li class=" clear" >
|
||||
<li class="clear" >
|
||||
<%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version),
|
||||
{:include_blank => true, :required => @issue.required_attribute?('fixed_version_id'), :no_label => true},
|
||||
{:onchange => "change_milestone_tip();", :class => "w150"} %>
|
||||
</li>
|
||||
<li class=" clear" id="milestone_option_tips">
|
||||
<li class="clear" id="milestone_option_tips">
|
||||
<%= @issue.fixed_version.nil? ? "未选择里程碑" : "已选择里程碑" %>
|
||||
<% if params[:action] == "new" %>
|
||||
<%= link_to "", new_project_version_path(@project, :is_issue => true, :issue_project_id => @project.id), :class => "pic_add mt5 ml5 fr", :remote => true %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class=" clear" style="border:1px solid #c8c8c8;">
|
||||
<li class="clear" style="border:1px solid #c8c8c8;">
|
||||
<% if @issue.safe_attribute? 'start_date' %>
|
||||
<%= f.text_field :start_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true,
|
||||
:required => @issue.required_attribute?('start_date'), :onchange => "issue_start_date_change();",
|
||||
|
@ -103,41 +103,98 @@
|
|||
<%= calendar_for('issue_start_date', 'start_date') if @issue.leaf? %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class=" clear" id="option_start_date_tips">
|
||||
<li class="clear" id="option_start_date_tips">
|
||||
<%= @issue.start_date.nil? ? "未选择开始日期" : "已选择开始日期" %>
|
||||
</li>
|
||||
<li class=" clear" style="border:1px solid #c8c8c8;">
|
||||
<li class="clear" style="border:1px solid #c8c8c8;">
|
||||
<label class="label02" ></label>
|
||||
<% if @issue.safe_attribute? 'due_date' %>
|
||||
<%= f.text_field :due_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true,
|
||||
:required => @issue.required_attribute?('due_date'), :onchange => "issue_end_date_change();",
|
||||
:class => "fl calendar_input",:style => "width: 170px;", :placeholder => "请选择结束日期" %>
|
||||
:required => @issue.required_attribute?('due_date'), :onchange => "issue_end_date_change();",
|
||||
:class => "fl calendar_input",:style => "width: 170px;", :placeholder => "请选择结束日期" %>
|
||||
<%= calendar_for('issue_due_date', 'start_date') if @issue.leaf? %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class=" clear " id="option_end_date_tips">
|
||||
<li class="clear " id="option_end_date_tips">
|
||||
<%= @issue.due_date.nil? ? "未选择结束日期" : "已选择结束日期" %>
|
||||
</li>
|
||||
<li class=" clear">
|
||||
<li class="clear">
|
||||
<% if @issue.safe_attribute? 'estimated_hours' %>
|
||||
<%= f.text_field :estimated_hours, :size => 22, :disabled => !@issue.leaf?, :no_label => true,
|
||||
:required => @issue.required_attribute?('estimated_hours'), :placeholder => "请填写预计工时" %>
|
||||
:required => @issue.required_attribute?('estimated_hours'), :placeholder => "请填写预计工时" %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class=" clear"><%= l(:field_estimated_hours) %></li>
|
||||
<li class="clear"><%= l(:field_estimated_hours) %></li>
|
||||
|
||||
<li class=" clear">
|
||||
<li class="clear">
|
||||
<% if @issue.safe_attribute?('done_ratio') && @issue.leaf? && Issue.use_field_for_done_ratio? %>
|
||||
<%= f.select :done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }),
|
||||
{:required => @issue.required_attribute?('done_ratio'), :no_label => true},
|
||||
:onchange => "PrecentChange(this.value)",
|
||||
:class => "w150" %>
|
||||
{:required => @issue.required_attribute?('done_ratio'), :no_label => true},
|
||||
:onchange => "PrecentChange(this.value)",
|
||||
:class => "w150" %>
|
||||
<% end %>
|
||||
<li class=" clear">完成度</li>
|
||||
</li>
|
||||
<li class="clear">完成度</li>
|
||||
<% if @project.gpid %>
|
||||
<%#= hidden_field_tag @issue_commit_ids %>
|
||||
<input value="" name="commit_ids" id="commit_ids" type="hidden">
|
||||
<% if @issue %>
|
||||
<% if is_project_manager?(User.current.id, @project.id)|| User.current.id == @issue.author_id || User.current.admin? %>
|
||||
<li class="clear"><span>关联Commit</span>
|
||||
<a href="javascript:void(0)" onclick="get_issue_commit_ids('issue_commit_ids','<%= @project.id %>');">
|
||||
<span class='btn-commit btn-blue mt-2 fr'>+</span>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<li class="clear"><span>关联Commit</span>
|
||||
<a href="javascript:void(0)" onclick="get_issue_commit_ids('issue_commit_ids','<%= @project.id %>');">
|
||||
<span class='btn-commit btn-blue mt-2 fr'>+</span>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div id="issue_commit_ids">
|
||||
<%= render :partial => "issues/issue_commit_ids", :locals => {:f => f} %>
|
||||
</div>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
<script>
|
||||
function issue_create(){
|
||||
var issue_commit_ids = $("#issue_commit_ids .commit_id_value");
|
||||
var str = "";
|
||||
for(var i=0; i < issue_commit_ids.length; i++){
|
||||
str += $(issue_commit_ids[i]).html();
|
||||
if(i != issue_commit_ids.length -1){
|
||||
str += ",";
|
||||
}
|
||||
}
|
||||
issue_desc_editor.sync();
|
||||
$('#commit_ids').val(str);
|
||||
$('#issue-form').submit();
|
||||
}
|
||||
|
||||
function get_issue_commit_ids(id, project_id){
|
||||
var issue_commit_ids = $("#issue_commit_ids .commit_id_value");
|
||||
var str = "";
|
||||
for(var i=0; i < issue_commit_ids.length; i++){
|
||||
str += $(issue_commit_ids[i]).html();
|
||||
if(i != issue_commit_ids.length -1){
|
||||
str += ",";
|
||||
}
|
||||
}
|
||||
$.ajax({
|
||||
url: '<%= url_for(:controller => 'issues', :action => 'issue_commits') %>',
|
||||
type:'get',
|
||||
data:{
|
||||
project_id: project_id,
|
||||
issue_commit_ids: str
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function change_assigned_tip() {
|
||||
if( document.getElementById('issue_assigned_to_id').options[document.getElementById('issue_assigned_to_id').selectedIndex].value == 0 ){
|
||||
$('#assigned_to_tips').html("未指派");
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<% if @issue_commit_ids %>
|
||||
<% @issue_commit_ids.each do |commit_id| %>
|
||||
<div class="btn btn-blue mb5">
|
||||
<%= link_to commit_id[0,8], {:controller => 'repositories', :action => 'commit_diff', :id => @project.id, :changeset => commit_id}, :target => "_blank", :class => "commit_id_value" %>
|
||||
<% if @issue %>
|
||||
<% if User.current.admin? || is_project_manager?(User.current.id, @project.id) || User.current.id == @issue.author_id %>
|
||||
<%= link_to "×", issue_commit_delete_issues_path(:commit_id => commit_id, :project_id => @project.id, :issue_commit_ids => @issue_commit_ids, :issue_id => @issue.try(:id)), :remote => true, :style => "color:#fff;" %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "×", issue_commit_delete_issues_path(:commit_id => commit_id, :project_id => @project.id, :issue_commit_ids => @issue_commit_ids, :issue_id => @issue.try(:id)), :remote => true, :style => "color:#fff;" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="c_grey">暂无</div>
|
||||
<% end %>
|
|
@ -0,0 +1,42 @@
|
|||
<div style="width:745px;">
|
||||
<div class="muban_popup_top">
|
||||
<h3 class="fl">关联Commit</h3>
|
||||
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="muban_popup_con " >
|
||||
<div class="newupload_conbox " >
|
||||
<% if @commits.blank? %>
|
||||
<%= render :partial => "projects/no_data" %>
|
||||
<% else %>
|
||||
<div class=" clear">
|
||||
<div class="cl"></div>
|
||||
<%= form_tag(url_for(:controller => 'issues', :action => 'issue_commits', :project_id => @project.id, :type => "search"),
|
||||
:remote => true, :method => 'get', :id => 'issue_commit_form', :class => "fl") do %>
|
||||
<ul class="clear lightheight28 fl mr100">
|
||||
<li class="mb10 clear fl">
|
||||
<span class=" fl"> 分支 : </span>
|
||||
<%= select_tag :branch, options_for_select(["#{@default_branch}"]+ @branch_names, @rev),
|
||||
:class => "fl newupload_select", :style => "width:180px;height:28px;",
|
||||
:onchange => "$('#issue_commit_form').submit();" %>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="hw_search_box fr mb10" >
|
||||
<input type="text" name="search" placeholder="输入描述内容进行搜索" class="hw_search-input" style="width:300px;">
|
||||
<%= submit_tag '', :class => 'hw_btn_search', :onfocus => 'this.blur();', :style => 'border-style:none' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div id="issue_commit_list">
|
||||
<%= render :partial => "issues/issue_commits_list" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function remote_function(id) {
|
||||
$(id).submit();
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<%= form_tag(url_for(:controller => 'issues', :action => 'commit_for_issue', :project_id => @project.id), :remote => true, :method => 'get', :id => 'commit_for_issue', :class => "fl") do %>
|
||||
<table class="newupload_table " cellspacing="0" cellpadding="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="newupload_td01"> </th>
|
||||
<th class="newupload_td04">修订号</th>
|
||||
<th>描述</th>
|
||||
<th class="newupload_td04">提交者</th>
|
||||
<th class="newupload_td05">提交日期</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @commits.each do |commit| %>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox" value="<%= commit.short_id %>" name="checkbox1[]"> </td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">
|
||||
<%= link_to commit.id[0,8], {:controller => 'repositories', :action => 'commit_diff', :id => @project.id, :changeset => commit.id}, :target => "_blank" %></span>
|
||||
</td>
|
||||
<td class="newupload_td02"><p><%= commit.title %></p></td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name"><%= link_to_user_mail(commit.author_email, "") %></span></td>
|
||||
<td class="newupload_td05"><%= format_date(commit.created_at) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
<input value="" name="issue_for_commit_ids" id="issue_for_commit_ids" type="hidden">
|
||||
</table>
|
||||
<div class="clear">
|
||||
<div class="clear fl mt10 mb10">
|
||||
<a href="javascript:void(0);" class="sy_btn_blue fl" onclick="search_and_branch_for_commit_ids();">确 定</a>
|
||||
<a href="javascript:void(0);" class="sy_btn_grey fl ml10" onclick="hideModal()">取 消</a>
|
||||
</div>
|
||||
<div style="text-align:center;">
|
||||
<div class="pages" style="width:auto; display:inline-block;">
|
||||
<ul id="homework_pository_ref_pages">
|
||||
<%= pagination_links_full @commits_pages, @commits_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<script>
|
||||
function search_and_branch_for_commit_ids(){
|
||||
var issue_commit_ids = $("#issue_commit_ids .commit_id_value");
|
||||
var str = "";
|
||||
for(var i=0; i < issue_commit_ids.length; i++){
|
||||
str += $(issue_commit_ids[i]).html();
|
||||
if(i != issue_commit_ids.length -1){
|
||||
str += ",";
|
||||
}
|
||||
}
|
||||
$('#issue_for_commit_ids').val(str);
|
||||
$('#commit_for_issue').submit();
|
||||
hideModal();
|
||||
}
|
||||
</script>
|
|
@ -24,7 +24,7 @@
|
|||
<div class="orig_reply mb10 mt-10">
|
||||
<div class="reply">
|
||||
<span class="reply-right">
|
||||
<span id="reply_praise_count_<%= comment.id %>">
|
||||
<span class="reply_praise_count_<%= comment.id %>">
|
||||
<%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %>
|
||||
</span>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
</div>
|
||||
<div class="clear">
|
||||
<div>
|
||||
<ul class="new_roadmap_nav fl" >
|
||||
<ul class="new_roadmap_nav fl" style="margin-left: 0px">
|
||||
<li class="new_roadmap_nav_hover" id="new_roadmap_nav_1" onclick="HoverLi(1);">
|
||||
<%= link_to "所有<span class='new_roadmap_nav_taghover ml5' id='new_roadmap_num_1'>#{@issues_filter.count}</span>".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_1" %>
|
||||
</li>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
$("#issue_commit_ids").html('<%= escape_javascript(render :partial => 'issues/issue_commit_ids') %>');
|
|
@ -1,6 +1,7 @@
|
|||
<h3><%=h "#{@issue.tracker.name} ##{@issue.id}" %></h3>
|
||||
<div id="issue_edit_show" class="mt10 pro_newissue_con">
|
||||
<%= render :partial => 'issues/edit' %>
|
||||
<% content_for :header_tags do %>
|
||||
<%= robot_exclusion_tag %>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => 'edit' %>
|
||||
<% content_for :header_tags do %>
|
||||
<%= robot_exclusion_tag %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -214,6 +214,9 @@
|
|||
</div><!--issues_statistics end-->
|
||||
<a href="<%= new_project_issue_path(@project)%>" class="sy_btn_green fr " >新建</a>
|
||||
</div>
|
||||
<% if @issues.empty? %>
|
||||
<%= render :partial => "projects/no_data" %>
|
||||
<% else %>
|
||||
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
|
||||
<%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project},:remote=>'xls', :method => :get,:id=>"issue_query_form", :class => 'query_form') do %>
|
||||
<%= hidden_field_tag 'set_filter', '1' %>
|
||||
|
@ -236,7 +239,6 @@
|
|||
<%= calendar_for('issue_create_date_start_show')%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="issues_con_list" style="position: relative;">
|
||||
<ul id="issues_list_nav" >
|
||||
<li id="issues_list_nav_1" onclick="HoverLi(1);all_reset_form();" class="issues_nav_hover">
|
||||
|
@ -309,9 +311,7 @@
|
|||
</div><!--issues_filter end-->
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if @issues.empty? %>
|
||||
<p class="nodata mt10"><%= l(:label_no_data) %></p>
|
||||
<% else %>
|
||||
|
||||
<div id="issue_list">
|
||||
<%= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
$("#issue_commit_ids").html('<%= escape_javascript(render :partial => 'issues/issue_commit_ids') %>');
|
|
@ -0,0 +1,13 @@
|
|||
var checked = $("input[name='checkbox1[]']:checked").size();
|
||||
if(checked > 0)
|
||||
{
|
||||
alert('翻页或搜索后将丢失当前选择的提交记录!');
|
||||
}
|
||||
|
||||
<% if @type %>
|
||||
$("#issue_commit_list").html('<%= escape_javascript(render :partial => 'issues/issue_commits_list') %>');
|
||||
<% else %>
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'issues/issue_commits') %>";
|
||||
pop_box_new(htmlvalue,760,600);
|
||||
<% end %>
|
||||
|
|
@ -5,16 +5,7 @@
|
|||
<script>
|
||||
sd_create_editor_from_data(<%= @issue.id%>, null, "100%", "<%= @issue.class.name %>");
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
is_edit = <%= @is_edit.present? && @is_edit == true %>
|
||||
if(is_edit) {
|
||||
issueEditShow();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="mt10 mb10" id =issue_show_total"">
|
||||
<div class="banner-big f16 fontGrey3">
|
||||
问题跟踪
|
||||
|
@ -46,9 +37,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="issue_edit_show" class="mt10 pro_newissue_con">
|
||||
<%= render :partial => 'issues/edit'%>
|
||||
</div>
|
||||
<ul class="fr pro_new_conbox_right" id="project_issue_info_show">
|
||||
<li class="clear">
|
||||
<span class="pro_new_conbox_leftspan fl">当前状态</span>
|
||||
|
@ -86,6 +74,11 @@
|
|||
<span class="pro_new_conbox_rightspan fl ml10"><%= @issue.done_ratio %>%</span>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="clear"><span class="pro_new_conbox_leftspan mb5">关联Commit</span>
|
||||
<div id="issue_commit_ids">
|
||||
<%= render :partial => "issues/issue_commit_ids" %>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -54,14 +54,23 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="sy_class_id fl">
|
||||
<p>邀 请 码<br />
|
||||
<p style="margin: <%=is_teacher ? '8px auto' : '24px auto 0px' %>">邀 请 码<br />
|
||||
<span class="sy_corange">
|
||||
<% if User.current.admin? || User.current.member_of_course?(@course) %>
|
||||
<%=@course.generate_invite_code %>
|
||||
<% if @course.invite_code_halt == 0 %>
|
||||
<% if User.current.admin? || User.current.member_of_course?(@course) %>
|
||||
<%=@course.generate_invite_code %>
|
||||
<% else %>
|
||||
<span class="f12">请询问老师</span>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<span class="f12">请询问老师</span>
|
||||
已停用
|
||||
<% end %>
|
||||
</span>
|
||||
<% if is_teacher && @course.invite_code_halt == 0 %>
|
||||
<a href="javascript:void(0);" class="btn_grey_mid" style="margin-bottom: 12px;" onclick="alert_halt_code();">停 用</a>
|
||||
<% elsif is_teacher && @course.invite_code_halt == 1 %>
|
||||
<a href="<%=set_invite_code_halt_course_path(@course) %>" data-remote="true" class="btn_grey_mid" style="margin-bottom: 12px;">启 用</a>
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="sy_class_info fl ml15">
|
||||
|
@ -102,10 +111,10 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
<% if is_teacher %>
|
||||
<div class="invite_code_tip_box fontGrey2">
|
||||
<div class="invite_code_tip_box fontGrey2" id="invite_code_tip_box">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p class="mt10 mb5">请将邀请码告诉学生和教辅</p>
|
||||
<p class="mb10">他们可以主动加入班级</p>
|
||||
<p class="mt10 mb5"><%= @course.invite_code_halt == 0 ? "请将邀请码告诉学生和教辅" : "邀请码已停用,学生和教辅" %></p>
|
||||
<p class="mb10"><%= @course.invite_code_halt == 0 ? "他们可以主动加入班级" : "不可以主动加入班级了" %></p>
|
||||
</div>
|
||||
<% end %>
|
|
@ -7,13 +7,19 @@
|
|||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "首页",user_activities_path(User.current), :class => "c_white f16 db p10", :title => "回到个人首页"%>
|
||||
</li>
|
||||
<!-- <li class="navHomepageMenu fl">
|
||||
<%#= link_to "资源库", user_resource_user_path(User.current, :type => 1), :class => "c_white f16 db p10" %>
|
||||
</li>-->
|
||||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "资源库", user_resource_user_path(User.current, :type => 1), :class => "c_white f16 db p10" %>
|
||||
<%= link_to "课程", user_course_community_path(User.current), :class => "c_white f16 db p10" %>
|
||||
</li>
|
||||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "项目", user_project_community_path(User.current), :class => "c_white f16 db p10" %>
|
||||
</li>
|
||||
<% if hidden_unproject_infos %>
|
||||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "题库", user_homeworks_user_path(User.current), :class => "c_white f16 db p10"%>
|
||||
</li>
|
||||
<!-- <li class="navHomepageMenu fl">
|
||||
<%#= link_to "题库", user_homeworks_user_path(User.current), :class => "c_white f16 db p10"%>
|
||||
</li>-->
|
||||
<% memo = Memo.where(:id => 1168).first %>
|
||||
<% unless memo.nil? %>
|
||||
<li class="navHomepageMenu fl mr30">
|
||||
|
@ -72,10 +78,10 @@
|
|||
</li>
|
||||
<% end %>
|
||||
<li>
|
||||
<%= link_to "我的组织", user_organizations_user_path(:id => User.current), :class => "menuGrey"%>
|
||||
<%= link_to '我的项目', {:controller => "users", :action => "user_projectlist", :id => @user}, :id => 'user_project_list', :class => "menuGrey" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "新建组织", new_organization_path, :class => "menuGrey"%>
|
||||
<%= link_to "我的组织", user_organizations_user_path(:id => User.current), :class => "menuGrey"%>
|
||||
</li>
|
||||
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
|
||||
<li>
|
||||
|
|
|
@ -147,7 +147,7 @@
|
|||
<% end %>
|
||||
<% elsif ma.class == OrgMessage %>
|
||||
<% if ma.message_type == 'ApplySubdomain' && ma.organization %>
|
||||
<li><a href="<%=agree_apply_subdomain_organizations_path( :organization_id => ma.organization_id, :org_domain => ma.content, :user_id => ma.sender_id, :act_id => ma.id ) %>" target="_blank" title="<%=ma.organization.name %> 申请子域名:<%= (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count == 0 || (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count > 0 && Secdomain.where("sub_type=2 and pid=?", ma.organization.id).first.subname != ma.content)) ? "同意申请":"申请已批准"%>"><span class="shadowbox_news_user"><%=ma.organization.name %> </span>申请子域名:<%= (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count == 0 || (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count > 0 && Secdomain.where("sub_type=2 and pid=?", ma.organization.id).first.subname != ma.content)) ? "同意申请":"申请已批准"%></a></li>
|
||||
<li><a href="<%=organization_path(ma.organization_id) %>" target="_blank" title="<%=ma.organization.name %> 申请子域名:<%= ma.content%>"><span class="shadowbox_news_user"><%=ma.organization.name %> </span>申请子域名:<%= ma.content%></a></li>
|
||||
<% elsif ma.message_type == 'AgreeApplySubdomain' %>
|
||||
<li><a href="javascript:void(0)" target="_blank" title="系统提示 管理员同意了您的子域名申请:<%= ma.content%>"><span class="shadowbox_news_user">系统提示 </span>管理员同意了您的子域名申请:<%= ma.content%></a></li>
|
||||
<% end %>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<span>
|
||||
<% if user.user_extensions && user.user_extensions.brief_introduction && !user.user_extensions.brief_introduction.empty? %>
|
||||
<%= user.user_extensions.brief_introduction %>
|
||||
<% else%>
|
||||
这个小伙伴很懒,什么都没留下~
|
||||
<div class="user_info_intro">
|
||||
<% if !user.user_extensions.school_id.blank? %>
|
||||
<%= user.user_extensions.school.name %>
|
||||
<% end %>
|
||||
</div>
|
||||
</span>
|
||||
<% if User.current == user%>
|
||||
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);", :onclick => "show_edit_user_introduction();"%>
|
||||
<% end %>
|
||||
<%# if User.current == user%>
|
||||
<%#= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);", :onclick => "show_edit_user_introduction();"%>
|
||||
<%# end %>
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<ul>
|
||||
<% if User.current.logged?%>
|
||||
<% if User.current == target%>
|
||||
<li style="width: 119px; float: left; border-right: 1px solid #ddd;"><%= link_to("个人资料", my_account_path, :class => "user_editinfo") %></li>
|
||||
<li style="width: 118px; float: left;"><%= link_to '个人主页', homepage_user_path(@user), :class => "user_editinfo", :target => '_blank' %></li>
|
||||
<!-- <li style="width: 119px; float: left; border-right: 1px solid #ddd;"><%#= link_to("个人资料", my_account_path, :class => "user_editinfo") %></li>-->
|
||||
<li><%= link_to '个人主页', homepage_user_path(@user), :class => "user_editinfo", :target => '_blank' %></li>
|
||||
<li class="cl"></li>
|
||||
<% else%>
|
||||
<li style="width: 119px; float: left; border-right: 1px solid #ddd;">
|
||||
<% if target.base_homepage.nil? %>
|
||||
<!-- <li style="width: 119px; float: left; border-right: 1px solid #ddd;">
|
||||
<%# if target.base_homepage.nil? %>
|
||||
<a href="javascript:void(0)" class ="user_editinfo" style="color: #cccccc" title="该用户暂未设置主页">主页</a>
|
||||
<% else %>
|
||||
<%=link_to "主页", homepage_user_path(@user.login), :class => 'user_editinfo', :target => '_blank' %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li style="width: 118px; float: left;">
|
||||
<%# else %>
|
||||
<%#=link_to "主页", homepage_user_path(@user.login), :class => 'user_editinfo', :target => '_blank' %>
|
||||
<%# end %>
|
||||
</li>-->
|
||||
<li>
|
||||
<%if(target.watched_by?(User.current))%>
|
||||
<%= link_to "取消关注",watch_path(:object_type=> 'user',:object_id=>target.id,:target_id=>target.id),:class => "user_editinfo", :method => "delete",:remote => "true", :title => "取消关注"%>
|
||||
<% else %>
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><%= h html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus','css/moduel', 'css/user', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= yield :header_tags -%>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript"
|
||||
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
<!-- 配置 : 在生成的公式图片上去掉Math定义的右键菜单,$$ $$ \( \) \[ \] 中的公式给予显示-->
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
|
||||
showMathMenu: false,
|
||||
showMathMenuMSIE: false,
|
||||
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint();">
|
||||
<div class="navContainer">
|
||||
<% is_current_user = User.current.logged? && User.current == @user%>
|
||||
<% if User.current.logged? %>
|
||||
<%= render :partial => 'layouts/logined_header' %>
|
||||
<% else%>
|
||||
<%= render :partial => 'layouts/unlogin_header' %>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepageContentContainer">
|
||||
<!--div class="homepageRightBannerImg"></div-->
|
||||
<div class="cl"></div>
|
||||
<div class="homepageContent">
|
||||
<div class="homepageLeft mt10" id="LSide">
|
||||
<div class="user_leftnav ">
|
||||
<% if hidden_unproject_infos %>
|
||||
<ul class="users_accordion mb10">
|
||||
<li id="user_01" class="user_icons_course">
|
||||
<%= link_to '班级',{:controller => "users", :action => "user_courselist", :id => @user}, :id => "user_course_list" %>
|
||||
<font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_courselist", :id => @user}, :style => "color:#aaa;" %></font>
|
||||
<% courses = @user.favorite_courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %>
|
||||
<div class="<%= courses.empty? ? 'none' : ''%>" id="homepage_left_course_list">
|
||||
<%=render :partial => 'layouts/homepage_left_course_list', :locals => {:courses => courses} %>
|
||||
</div>
|
||||
</li>
|
||||
<% if is_current_user %>
|
||||
<li id="user_02" class="user_icons_new">
|
||||
<%= link_to "新建课程", new_syllabus_path(:host=> Setting.host_course), :target => "_blank", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<li id="user_03" class="user_icons_new">
|
||||
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course), :target => "_blank", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<li id="user_04" class="user_icons_addclass">
|
||||
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true, :method => "post", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
<ul class="users_accordion mb10">
|
||||
<% if @user == User.current %>
|
||||
<li id="user_05" class="user_icons_myhw">
|
||||
<%=link_to '我的作业', my_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<li id="user_06" class="icons-doc clear">
|
||||
<%= link_to "题库", user_homeworks_user_path(User.current), :target => "_blank", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<li id="user_07" class="icons-download clear">
|
||||
<%= link_to "资源库", user_resource_user_path(User.current, :type => 1), :target => "_blank",:style => "font-size:14px;" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="user_leftnav ">
|
||||
<ul class="users_accordion mb10">
|
||||
<li id="user_10" class="user_icons_mes">
|
||||
<%= link_to '留言', feedback_path(@user, :host=> Setting.host_user)%>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%# 更新访问数,刷新的时候更新访问次数 %>
|
||||
<% update_visiti_count @user %>
|
||||
<div class="fontGrey5 mt10 ml20">访问计数 <%= @user.visits.to_i %> (自2016年5月)</div>
|
||||
</div>
|
||||
<div class="homepageRight">
|
||||
<%= yield %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<%= render :partial => 'layouts/footer' %>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
|
||||
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @user} %>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -147,7 +147,7 @@
|
|||
<%# 课程英雄榜 %>
|
||||
<%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %>
|
||||
<div class="sy_class_leftbox" >
|
||||
<h3 class="fontGrey7">班级推荐</h3>
|
||||
<h3 class="fontGrey7">推荐</h3>
|
||||
<%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
|
||||
</div>
|
||||
<%# 更新访问数,刷新的时候更新访问次数 %>
|
||||
|
@ -279,10 +279,19 @@
|
|||
|
||||
function delete_confirm(){
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您确认要退出该班级吗?</p><div class="cl"></div><a href="<%=join_path(:object_id => @course.id) %>" class="fr sy_btn_blue mr85 mt10" data-method="delete" data-remote="true">确 定</a>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您确认要退出该班级吗?</p><div class="cl"></div>'+
|
||||
'<a href="<%=join_path(:object_id => @course.id) %>" class="fr sy_btn_blue mr85 mt10" data-method="delete" data-remote="true">确 定</a>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取 消</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
}
|
||||
|
||||
function alert_halt_code(){
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">邀请码停用后,用户不能主动加入该班级了</p><p class="text_c mt10 f14">您是否确认停用</p><div class="cl"></div>'+
|
||||
'<a href="<%=set_invite_code_halt_course_path(@course) %>" class="fr sy_btn_blue mr135 mt10" data-remote="true">确 定</a>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取 消</a></div></div>';
|
||||
pop_box_new(htmlvalue, 400, 180);
|
||||
}
|
||||
</script>
|
||||
|
||||
</html>
|
|
@ -7,13 +7,10 @@
|
|||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','application','prettify', 'nyan', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','application','prettify', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_include_tag('jquery-1.8.3-ui-1.9.2-ujs-2.0.3', 'application', 'jquery.colorbox-min') %>
|
||||
|
||||
<%= import_ke(enable_at: false, prettify: true, init_activity: false) %>
|
||||
|
||||
|
||||
<%= heads_for_theme %>
|
||||
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><%= h html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus','css/moduel', 'css/user', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= yield :header_tags -%>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript"
|
||||
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
<!-- 配置 : 在生成的公式图片上去掉Math定义的右键菜单,$$ $$ \( \) \[ \] 中的公式给予显示-->
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
|
||||
showMathMenu: false,
|
||||
showMathMenuMSIE: false,
|
||||
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint();">
|
||||
<div class="navContainer">
|
||||
<% is_current_user = User.current.logged? && User.current == @user%>
|
||||
<% if User.current.logged? %>
|
||||
<%= render :partial => 'layouts/logined_header' %>
|
||||
<% else%>
|
||||
<%= render :partial => 'layouts/unlogin_header' %>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepageContentContainer">
|
||||
<!--div class="homepageRightBannerImg"></div-->
|
||||
<div class="cl"></div>
|
||||
<div class="homepageContent">
|
||||
<div class="homepageLeft mt10" id="LSide">
|
||||
<div class="user_leftnav ">
|
||||
<ul class="users_accordion mb10">
|
||||
<li id="user_06" class="user_icons_project">
|
||||
<%= link_to '项目',{:controller => "users", :action => "user_projectlist", :id => @user}, :id => 'user_project_list'%>
|
||||
<font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_projectlist", :id => @user}, :style => "color:#aaa;" %></font>
|
||||
<% projects = @user.favorite_projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10)%>
|
||||
<div class="<%= projects.empty? ? 'none' : ''%>" id="homepage_left_project_list">
|
||||
<%=render :partial => 'layouts/homepage_left_project_list', :locals => {:projects => projects} %>
|
||||
</div>
|
||||
</li>
|
||||
<% if is_current_user %>
|
||||
<li id="user_07" class="user_icons_new">
|
||||
<%= link_to "新建项目", new_project_path(:host=> Setting.host_name), :target => "_blank", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<li id="user_08" class="user_icons_addproject">
|
||||
<%= link_to "加入项目", applied_join_project_path, :remote => true, :method => "post", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<li id="user_09" class="user_icons_myissues">
|
||||
<%= link_to "我的Issue", user_issues_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<ul class="users_accordion mb10">
|
||||
<li id="user_10" class="user_icons_mes">
|
||||
<%= link_to '留言', feedback_path(@user, :host=> Setting.host_user)%>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%# 更新访问数,刷新的时候更新访问次数 %>
|
||||
<% update_visiti_count @user %>
|
||||
<div class="fontGrey5 mt10 ml20">访问计数 <%= @user.visits.to_i %> (自2016年5月)</div>
|
||||
</div>
|
||||
<div class="homepageRight">
|
||||
<%= yield %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<%= render :partial => 'layouts/footer' %>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
|
||||
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @user} %>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -7,7 +7,7 @@
|
|||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus','css/moduel',:media => 'all' %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus','css/moduel', 'css/user', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
|
||||
|
@ -88,7 +88,7 @@
|
|||
|
||||
<body onload="prettyPrint();">
|
||||
<div class="navContainer">
|
||||
<% is_current_user = User.current.logged? && User.current == @user%>
|
||||
<% is_current_user = User.current.logged? && User.current == @user %>
|
||||
<% if User.current.logged? %>
|
||||
<%= render :partial => 'layouts/logined_header' %>
|
||||
<% else%>
|
||||
|
@ -104,7 +104,8 @@
|
|||
<div class="user_leftinfo mb10">
|
||||
<% if User.current.logged? && User.current == @user%>
|
||||
<div class="pr" style="width: 80px; margin:0 auto;">
|
||||
<%=link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id=>'nh_source_tx'), my_clear_user_avatar_temp_path, :class => "user_leftinfo_img", :remote => true%>
|
||||
<%=link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id => 'nh_source_tx'),
|
||||
my_clear_user_avatar_temp_path, :class => "user_leftinfo_img", :remote => true %>
|
||||
<div class="homepageEditProfile undis">
|
||||
<%=link_to '', my_clear_user_avatar_temp_path, :class => 'homepageEditProfileIcon', :remote => true, :title => '点击编辑Logo' %>
|
||||
</div>
|
||||
|
@ -130,23 +131,23 @@
|
|||
<%= render :partial => 'layouts/user_brief_introduction', :locals => {:user => @user} %>
|
||||
</div>
|
||||
</div>
|
||||
<textarea class="homepageSignatureTextarea none" placeholder="请编辑签名" id="user_brief_introduction_edit" onblur="edit_user_introduction('<%= edit_brief_introduction_user_path(@user.id)%>');"><%= @user.user_extensions.brief_introduction %></textarea>
|
||||
<!-- <textarea class="homepageSignatureTextarea none" placeholder="请编辑签名" id="user_brief_introduction_edit" onblur="edit_user_introduction('<%#= edit_brief_introduction_user_path(@user.id)%>');"><%#= @user.user_extensions.brief_introduction %></textarea>-->
|
||||
</div>
|
||||
<ul class="user_atten clear">
|
||||
<li>
|
||||
<a href="<%=user_blogs_path(:user_id => @user) %>">
|
||||
<a href="<%= user_blogs_path(:user_id => @user) %>">
|
||||
<strong>博客</strong><br />
|
||||
<span class="sy_cgrey"><%=@user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count %></span>
|
||||
<span class="sy_cgrey"><%= @user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count %></span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<%=user_watchlist_user_path(@user) %>">
|
||||
<a href="<%= user_watchlist_user_path(@user) %>">
|
||||
<strong>关注</strong><br />
|
||||
<span class="sy_cgrey"><%=User.watched_by(@user).count %></span>
|
||||
<span class="sy_cgrey"><%= User.watched_by(@user).count %></span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<%=user_fanslist_user_path(@user) %>">
|
||||
<a href="<%= user_fanslist_user_path(@user) %>">
|
||||
<strong>粉丝</strong><br />
|
||||
<span id="user_fans_number" class="sy_cgrey"><%= @user.watcher_users.count %></span>
|
||||
</a>
|
||||
|
@ -157,64 +158,110 @@
|
|||
<%= render :partial => 'layouts/user_watch_btn', :locals => {:target => @user} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="user_leftnav ">
|
||||
<% if hidden_unproject_infos %>
|
||||
<ul class="users_accordion mb10">
|
||||
<li id="user_01" class="user_icons_course">
|
||||
<%= link_to '班级',{:controller => "users", :action => "user_courselist", :id => @user}, :id => "user_course_list" %>
|
||||
<font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_courselist", :id => @user}, :style => "color:#aaa;" %></font>
|
||||
<% courses = @user.favorite_courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %>
|
||||
<div class="<%= courses.empty? ? 'none' : ''%>" id="homepage_left_course_list">
|
||||
<%=render :partial => 'layouts/homepage_left_course_list', :locals => {:courses => courses} %>
|
||||
</div>
|
||||
</li>
|
||||
<% if is_current_user %>
|
||||
<li id="user_02" class="user_icons_new">
|
||||
<%= link_to "新建课程", new_syllabus_path(:host=> Setting.host_course), :target => "_blank", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<li id="user_03" class="user_icons_new">
|
||||
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course), :target => "_blank", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<li id="user_04" class="user_icons_addclass">
|
||||
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true, :method => "post", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<% if @user == User.current %>
|
||||
<li id="user_05" class="user_icons_myhw">
|
||||
<%=link_to '我的作业', my_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
|
||||
<% if is_current_user %>
|
||||
<div class="home-user-leftnav">
|
||||
<h3 >
|
||||
<%= link_to "课程社区", user_course_community_path(User.current), :class => "fl" %>
|
||||
</h3>
|
||||
<%# if hidden_unproject_infos %>
|
||||
<ul>
|
||||
<li class="home-user-leftnav-li icons-class clear">
|
||||
<%= link_to user_course_count > 0 ? "课程<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top: 9px;'>#{user_course_count}</span>".html_safe : "课程",
|
||||
{:controller => "users", :action => "user_courselist", :id => @user}, :id => "user_course_list" %>
|
||||
<!-- <div class="user_navmore_box" >
|
||||
<ul>
|
||||
<li class="user_navmore_icons">
|
||||
<ul class="user_navmore_txt02" >
|
||||
<%# if is_current_user %>
|
||||
<li>
|
||||
<%#= link_to "新建课程", new_syllabus_path(:host=> Setting.host_course), :target => "_blank", :class => "user_navmore_li" %>
|
||||
</li>
|
||||
<li>
|
||||
<%#= link_to "新建班级", new_course_path(:host=> Setting.host_course), :target => "_blank", :class => "user_navmore_li" %>
|
||||
</li>
|
||||
<li>
|
||||
<%#= link_to "加入班级", join_private_courses_courses_path, :remote => true, :method => "post", :class => "user_navmore_li" %>
|
||||
</li>
|
||||
<#% end %>
|
||||
</ul>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>-->
|
||||
</li>
|
||||
<li class="home-user-leftnav-li icons-homework clear">
|
||||
<%=link_to '我的作业', my_homeworks_user_path(@user), :target => "_blank", :class => "fl" %>
|
||||
</li>
|
||||
<li class="home-user-leftnav-li icons-doc clear">
|
||||
<%= link_to "题库", user_homeworks_user_path(User.current), :target => "_blank", :class => "fl" %>
|
||||
</li>
|
||||
<li class="home-user-leftnav-li icons-download clear">
|
||||
<%= link_to "资源库", user_resource_user_path(User.current, :type => 1), :target => "_blank", :class => "fl" %>
|
||||
</li>
|
||||
</ul>
|
||||
<%# end %>
|
||||
</div>
|
||||
|
||||
<ul class="users_accordion mb10">
|
||||
<li id="user_06" class="user_icons_project">
|
||||
<%= link_to '项目',{:controller => "users", :action => "user_projectlist", :id => @user}, :id => 'user_project_list'%>
|
||||
<font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_projectlist", :id => @user}, :style => "color:#aaa;" %></font>
|
||||
<% projects = @user.favorite_projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10)%>
|
||||
<div class="<%= projects.empty? ? 'none' : ''%>" id="homepage_left_project_list">
|
||||
<%=render :partial => 'layouts/homepage_left_project_list', :locals => {:projects => projects} %>
|
||||
</div>
|
||||
</li>
|
||||
<% if is_current_user %>
|
||||
<li id="user_07" class="user_icons_new">
|
||||
<%= link_to "新建项目", new_project_path(:host=> Setting.host_name), :target => "_blank", :style => "font-size:14px;" %>
|
||||
<div class="home-user-leftnav">
|
||||
<h3 >
|
||||
<%= link_to "项目社区", user_project_community_path(User.current), :class => "fl" %>
|
||||
</h3>
|
||||
<ul>
|
||||
<li class="home-user-leftnav-li icons-project clear">
|
||||
<%= link_to user_project_count > 0 ? "项目<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top: 9px;'>#{user_project_count}</span>".html_safe : "项目",
|
||||
{:controller => "users", :action => "user_projectlist", :id => @user}, :id => 'user_project_list' %>
|
||||
<!-- <div class="user_navmore_box" >
|
||||
<ul>
|
||||
<li class="user_navmore_icons">
|
||||
<ul class="user_navmore_txt02">
|
||||
<li>
|
||||
<%#= link_to "新建项目", new_project_path(:host => Setting.host_name), :target => "_blank", :class => "user_navmore_li" %>
|
||||
</li>
|
||||
<li>
|
||||
<%#= link_to "加入项目", applied_join_project_path, :remote => true, :method => "post", :class => "user_navmore_li" %>
|
||||
</li>
|
||||
<li>
|
||||
<%#= link_to "我的关注", user_watchlist_user_path(@user), :remote => true, :method => "post", :class => "user_navmore_li" %>
|
||||
</li>
|
||||
<!–<li><a href="javascript:void(0);" class="user_navmore_li">发现更多</a></li>–>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>-->
|
||||
</li>
|
||||
<li id="user_08" class="user_icons_addproject">
|
||||
<%= link_to "加入项目", applied_join_project_path, :remote => true, :method => "post", :style => "font-size:14px;" %>
|
||||
<li class="home-user-leftnav-li icons-issue clear">
|
||||
<%= link_to issues_author_is_self_count > 0 ? "我发布的issue<span class='issues_nav_tag mr10 fr'style='line-height:18px;margin-top: 9px;'>#{issues_author_is_self_count}</span>".html_safe : "我发布的issue",
|
||||
user_issues_user_path(@user) %>
|
||||
</li>
|
||||
<li id="user_09" class="user_icons_myissues">
|
||||
<%= link_to "我的Issue", user_issues_user_path(@user), :style => "font-size:14px;" %>
|
||||
<li class="home-user-leftnav-li icons-issue clear">
|
||||
<%= link_to issues_assigned_is_self_count > 0 ? "我收到的issue<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top: 9px;'>#{issues_assigned_is_self_count}</span>".html_safe : "我收到的issue",
|
||||
user_issues_user_path(@user) %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="home-user-leftnav">
|
||||
<h3 >Ta在确实
|
||||
<span class="fr mr5" style="font-size:12px;color: #7f7f7f;"><%= time_tag(@user.created_on).html_safe %></span>
|
||||
</h3>
|
||||
<ul>
|
||||
<li class="home-user-leftnav-li icons-class clear">
|
||||
<%= link_to user_course_count > 0 ? "课程<span class='issues_nav_tag ml140'>#{user_course_count}</span>".html_safe : "课程",
|
||||
{:controller => "users", :action => "user_courselist", :id => @user}, :id => "user_course_list", :class => "fl" %>
|
||||
</li>
|
||||
<li class="home-user-leftnav-li icons-project clear">
|
||||
<%= link_to user_project_count > 0 ? "项目<span class='issues_nav_tag ml140'>#{user_project_count}</span>".html_safe : "项目",
|
||||
{:controller => "users", :action => "user_projectlist", :id => @user}, :id => 'user_project_list', :class => "fl" %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="user_leftnav ">
|
||||
<ul class="users_accordion mb10">
|
||||
<li id="user_10" class="user_icons_mes">
|
||||
<%= link_to '留言', feedback_path(@user, :host=> Setting.host_user)%>
|
||||
<%= link_to "留言", feedback_path(@user, :host=> Setting.host_user)%>
|
||||
</li>
|
||||
</ul>
|
||||
</div><!--sy_class_leftnav end-->
|
||||
</div>
|
||||
|
||||
<%# 更新访问数,刷新的时候更新访问次数 %>
|
||||
<% update_visiti_count @user %>
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
<% @replies.each do |reply| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#activity_description_<%= reply.id %> p,#activity_description_<%= reply.id %> span,#activity_description_<%= reply.id %> em").each(function(){
|
||||
var postContent = $(this).html();
|
||||
postContent = postContent.replace(/ /g," ");
|
||||
postContent= postContent.replace(/ {2}/g," ");
|
||||
postContent=postContent.replace(/ /g," ");
|
||||
postContent=postContent.replace(/ /g," ");
|
||||
postContent = postContent.replace(/<script>*/g, "<script>");
|
||||
postContent = postContent.replace(/<html>*/g, "<html>");
|
||||
$(this).html(postContent);
|
||||
});
|
||||
autoUrl('activity_description_<%= reply.id %>');
|
||||
description_show_hide(<%= reply.id %>);
|
||||
});
|
||||
|
||||
$(".homepagePostReplyDes").mouseover(function(){
|
||||
$(this).find("a[id*='delete_memo_reply']").show();
|
||||
}).mouseout(function(){
|
||||
$(this).find("a[id*='delete_memo_reply']").hide();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="homepagePostReplyContainer" >
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=reply.id %>').show();" onmouseout="$('#delete_reply_<%=reply.id %>').hide();">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<%= render :partial => 'users/message_contents', :locals => {:comment => reply, :type => 'Memo', :user_activity_id => @memo.id}%>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word" style="margin-bottom:15px;" id="activity_description_<%= reply.id %>">
|
||||
<p><%= reply.content.gsub(/\/script/, "script").gsub(/script/, " script").html_safe %></p>
|
||||
</div>
|
||||
<div class="orig_reply mb10 mt-10">
|
||||
<div class="reply">
|
||||
<span class="reply-right">
|
||||
<span class="reply_praise_count_<%= reply.id %>">
|
||||
<%= render :partial => "praise_tread/praise", :locals => {:activity => reply, :user_activity_id => reply.id, :type => "reply"} %>
|
||||
</span>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:action => 'quote', :id => reply},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_reply)) %>
|
||||
<span id="reply_iconup_<%= reply.id %>" class="reply_iconup02" style="display: none"> ︿</span>
|
||||
</span>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
forum_memo_path(@memo.forum, reply),
|
||||
:method => :delete,
|
||||
:id => "delete_reply_#{reply.id}",
|
||||
:class => 'fr mr20 undis',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if @memo.author.id == User.current.id || User.current.admin? %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= reply.id%>"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @limit_count > @page * @limit + 10 %>
|
||||
<div id="more_memo_replies">
|
||||
<div class="detail_cont_hide clearfix">
|
||||
<span class="orig_icon" >↓ </span>
|
||||
<span class="orig_icon" style="display:none;" > ↑</span>
|
||||
<%= link_to '点击展开更多回复', forum_memo_path(@memo.forum_id, @memo, :page => @page),:remote=>true %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -0,0 +1,31 @@
|
|||
<div class="ReplyToMessageContainer borderBottomNone" id="reply_to_message_<%= reply.id%>">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>">
|
||||
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="ReplyToMessageInputContainer mb10">
|
||||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= reply.id%>'>
|
||||
<%= form_for('memo',:url=>forum_memos_path,:method => "post") do |f|%>
|
||||
<%= f.hidden_field :subject, :required => true, value: reply.subject %>
|
||||
<%= f.hidden_field :forum_id, :required => true, value: reply.forum_id %>
|
||||
<%= f.hidden_field :parent_id, :required => true, value: reply.id %>
|
||||
<%= hidden_field_tag :quote,"",:required => false,:style => 'display:none' %>
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="memo[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => "users/show_unlogged" %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<script>
|
||||
$(function(){
|
||||
sd_create_editor_from_data(<%= reply.id%>,null,"100%", "<%=reply.class.to_s%>");
|
||||
});
|
||||
</script>
|
|
@ -1,5 +1,5 @@
|
|||
//ckeditor.setData("<%= raw escape_javascript(@content) %>");
|
||||
$('#message_quote').html("<%= raw escape_javascript(@temp.content.html_safe) %>");
|
||||
$('#quote').val("<%= raw escape_javascript(@content) %>");
|
||||
showAndScrollTo("new_memo", "cke_editor01");
|
||||
$("img").removeAttr("align");
|
||||
if($("#reply_message_<%= @memo.id%>").length > 0) {
|
||||
$("#reply_message_<%= @memo.id%>").replaceWith("<%= escape_javascript(render :partial => 'memos/reply_message', :locals => {:reply => @memo}) %>");
|
||||
}else if($("#reply_to_message_<%= @memo.id%>").length >0) {
|
||||
$("#reply_to_message_<%= @memo.id%>").replaceWith("<p id='reply_message_<%= @memo.id%>'></p>");
|
||||
}
|
|
@ -4,22 +4,6 @@
|
|||
<% end %>
|
||||
|
||||
<script>
|
||||
function expand_reply(container,btnid){
|
||||
var target = $(container).children();
|
||||
var btn = $(btnid);
|
||||
if(btn.data('init')=='0'){
|
||||
btn.data('init',1);
|
||||
btn.html('收起回复');
|
||||
target.show();
|
||||
}else{
|
||||
btn.data('init',0);
|
||||
btn.html('展开更多');
|
||||
target.hide();
|
||||
target.eq(0).show();
|
||||
target.eq(1).show();
|
||||
target.eq(2).show();
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
sd_create_editor_from_data(<%= @memo.id%>,null,"100%", "<%=@memo.class.to_s%>");
|
||||
});
|
||||
|
@ -82,46 +66,8 @@
|
|||
<div class="homepagePostReplyBannerCount">回复(<%=@reply_count %>)</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
</div>
|
||||
<div class="" id="reply_div_<%= @memo.id %>">
|
||||
<% @replies.each_with_index do |reply,i| %>
|
||||
<div class="homepagePostReplyContainer" >
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher"><a href="<%=user_path(reply.author)%>" class="newsBlue mr10 f14"><%= reply.author.show_name%></a><%= format_date(reply.created_at) %></div>
|
||||
<div class="homepagePostReplyContent break_word" style="margin-bottom:25px;" id="activity_description_<%= reply.id %>"><p><%= reply.content.gsub(/script/, "script ").html_safe %></p>
|
||||
<% if @memo.author.id == User.current.id || User.current.admin? %>
|
||||
<%= link_to "删除", forum_memo_path(@memo.forum, reply), :class => "fr undis", :method => "delete", :confirm => l(:text_are_you_sure), :id => "delete_memo_reply_#{reply.id}" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#activity_description_<%= reply.id %> p,#activity_description_<%= reply.id %> span,#activity_description_<%= reply.id %> em").each(function(){
|
||||
var postContent = $(this).html();
|
||||
postContent = postContent.replace(/ /g," ");
|
||||
postContent= postContent.replace(/ {2}/g," ");
|
||||
postContent=postContent.replace(/ /g," ");
|
||||
postContent=postContent.replace(/ /g," ");
|
||||
postContent = postContent.gsub(/<script>*/, "<script>");
|
||||
postContent = postContent.gsub(/<html>*/, "<html>");
|
||||
$(this).html(postContent);
|
||||
});
|
||||
autoUrl('activity_description_<%= reply.id %>');
|
||||
description_show_hide(<%= reply.id %>);
|
||||
});
|
||||
|
||||
$(".homepagePostReplyDes").mouseover(function(){
|
||||
$(this).find("a[id*='delete_memo_reply']").show();
|
||||
}).mouseout(function(){
|
||||
$(this).find("a[id*='delete_memo_reply']").hide();
|
||||
});
|
||||
</script>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="" id="reply_div_<%= @memo.id %>">
|
||||
<%= render :partial => 'memos/memo_all_replies' %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
$("#more_memo_replies").replaceWith("<%= escape_javascript(render :partial => 'memos/memo_all_replies')%>");
|
|
@ -18,7 +18,7 @@
|
|||
<div class="orig_reply mb10 mt-10">
|
||||
<div class="reply">
|
||||
<span class="reply-right">
|
||||
<span id="reply_praise_count_<%= reply.id %>">
|
||||
<span class="reply_praise_count_<%= reply.id %>">
|
||||
<%= render :partial => "praise_tread/praise", :locals => {:activity => reply, :user_activity_id => reply.id, :type => "reply"} %>
|
||||
</span>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<div class="orig_reply mb10 mt-10">
|
||||
<div class="reply">
|
||||
<span class="reply-right">
|
||||
<span id="reply_praise_count_<%= reply.id %>">
|
||||
<span class="reply_praise_count_<%= reply.id %>">
|
||||
<%= render :partial => "praise_tread/praise", :locals => {:activity => reply, :user_activity_id => reply.id, :type => "reply"} %>
|
||||
</span>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<div class="orig_reply mb10 mt-10">
|
||||
<div class="reply">
|
||||
<span class="reply-right">
|
||||
<span id="reply_praise_count_<%= reply.id %>">
|
||||
<span class="reply_praise_count_<%= reply.id %>">
|
||||
<%= render :partial => "praise_tread/praise", :locals => {:activity => reply, :user_activity_id => reply.id, :type => "reply"} %>
|
||||
</span>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<div class="orig_reply mb10 mt-10">
|
||||
<div class="reply">
|
||||
<span class="reply-right">
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<span class="reply_praise_count_<%=comment.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
</span>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<div class="orig_reply mb10 mt-10">
|
||||
<div class="reply">
|
||||
<span class="reply-right">
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<span class="reply_praise_count_<%=comment.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
</span>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
|
|
|
@ -356,7 +356,7 @@
|
|||
<div class="orig_reply mb10 mt-10">
|
||||
<div class="reply">
|
||||
<span class="reply-right">
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<span class="reply_praise_count_<%=comment.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
</span>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
|
|
|
@ -112,7 +112,7 @@
|
|||
<%= link_to reply.try(:author).try(:realname), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(reply.created_on) %>
|
||||
<span id="reply_praise_count_<%=reply.id %>">
|
||||
<span class="reply_praise_count_<%=reply.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
<%= link_to comment.try(:author).try(:realname), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(comment.created_on) %>
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<span class="reply_praise_count_<%=comment.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
<%= link_to reply.try(:user).try(:realname), user_url_in_org(reply.user_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(reply.created_on) %>
|
||||
<span id="reply_praise_count_<%=reply.id %>">
|
||||
<span class="reply_praise_count_<%=reply.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
|
||||
</span>
|
||||
</div>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue