Merge branch 'cxt_course' into 'cxt_course'

未参与匿评的缺评扣分



See merge request !33
This commit is contained in:
陈晓婷 2016-12-02 10:19:52 +08:00
commit e8ea252e6d
108 changed files with 3600 additions and 2895 deletions

1
.gitignore vendored
View File

@ -39,3 +39,4 @@ public/javascripts/wechat/node_modules/
.access_token
tmux*.log
config/wechat.yml
config/oneapm.yml

View File

@ -26,7 +26,7 @@ class BlogsController < ApplicationController
@type = 2
@topics.each do |topic|
topic[:infocount] = get_praise_num(topic) + (topic.parent ? topic.parent.children.count : topic.children.count)
topic[:infocount] = get_praise_num(topic) + BlogComment.where("root_id = #{topic.id}").count
if topic[:infocount] < 0
topic[:infocount] = 0
end

View File

@ -257,26 +257,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

View File

@ -102,6 +102,7 @@ class IssuesController < ApplicationController
@issue_count = @query.issue_count
@test = params[:test]
@project_sort = 'issues.updated_on desc'
if params[:test] != "0"
case @test
when "1"
@ -284,11 +285,11 @@ class IssuesController < ApplicationController
# 用户编辑更改issue
def update
# params[:assigned_to_id] = nil if params[:assigned_to_id].to_i == 0
# params[:assigned_to_id] = nil if params[:assigned_to_id].to_i == 0
# params[:fixed_version_id] = nil if params[:fixed_version_id].to_i == 0
if params[:issue_detail]
issue = Issue.find(params[:id])
issue = update_user_issue_detail(issue, params)
@issue.assigned_to_id = nil if @issue.assigned_to_id == 0
@saved = update_user_issue_detail(issue, params)
return
else
@ -296,6 +297,7 @@ class IssuesController < ApplicationController
return unless update_issue_from_params
@issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
@issue.assigned_to_id = nil if @issue.assigned_to_id == 0
@issue.fixed_version_id = nil if @issue.fixed_version_id == 0
saved = false
begin
@saved = @issue.save_issue_with_child_records(params, @time_entry)
@ -630,7 +632,9 @@ class IssuesController < ApplicationController
end
end
# 搜索结果
@issues_filter = @query.issues(:order => @project_sort)
# SELECT assigned_to_id, count(*) as ac FROM `issues` where project_id = @project.id group by assigned_to_id order by ac desc;
@issues_filter = @query.issues.sort_by{ |i| Issue.where(:project_id => @project.id , :assigned_to_id => i.assigned_to_id).count }.reverse
# @issues_filter = @query.issues(:order => @project_sort)
# if params[:type] == 1 || params[:type].nil?
# @results = @issues_filter
@ -668,7 +672,7 @@ class IssuesController < ApplicationController
@alltotal[issue.tracker_id.to_i] = @alltotal[issue.tracker_id.to_i] + 1
user_id = issue.assigned_to_id
if issue.assigned_to_id.nil?
user_id = issue.author_id
user_id = 0
end
if !@results[user_id].nil?
@ -696,7 +700,7 @@ class IssuesController < ApplicationController
tmpuser = User.find(user_id)
@results[user_id][:name] = tmpuser.nil? ? " " : tmpuser.show_name
@results[user_id][:name] = tmpuser.nil? ? "" : tmpuser.show_name
#所有的
@results[user_id][0] = 1
for i in 1..17 do

View File

@ -1,3 +1,4 @@
# encoding: utf-8
# Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang
#
@ -31,7 +32,7 @@ class ProjectsController < ApplicationController
before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course]
before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches]
before_filter :require_admin, :only => [ :copy, :unarchive, :destroy, :calendar]
before_filter :file, :statistics #:watcherlist
before_filter :file
# 除非项目内人员,不可查看成员, TODO: 完了写报表里去
# before_filter :memberAccess, only: :member
@ -534,6 +535,23 @@ class ProjectsController < ApplicationController
end
end
def project_watcherlist
unless @project.nil?
if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin?
render_403
else
@users -= watched.watcher_users if @watched
end
@watchers = @project.watcher_users
@limit = 20
@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
end
end
# include CoursesHelper
def member
# 消息"同意加入项目"
@ -600,6 +618,13 @@ class ProjectsController < ApplicationController
def member_forked
@forked_projects = Project.where(:forked_from_project_id => @project.id)
@limit = 20
@is_remote = true
@forked_count = @forked_projects.count
@forked_pages = Paginator.new @forked_count, @limit, params['page'] || 1
@offset ||= @forked_pages.offset
@forked_projects = paginateHelper @forked_projects, @limit
# @forked_members = User.find_by_sql("SELECT u.* FROM `projects` p,`users` u where p.user_id = u.id and p.forked_from_project_id = #{@project.id} ;")
end
@ -739,7 +764,7 @@ class ProjectsController < ApplicationController
rescue Exception => e
puts e
end
# 删除Trustie班额本库记录
# 删除Trustie本库记录
repoisitory = Repository.where(:project_id => @project.id, :type => GITLABTYPE).first
repoisitory.delete
@project.update_column(:gpid, nil)
@ -799,6 +824,31 @@ class ProjectsController < ApplicationController
@project = nil
end
REP_TYPE = "Repository::Gitlab"
# Delete @project's repository
def destroy_repository
if is_project_manager?(User.current.id, @project.id)
@gitlab_repository = Repository.where(:project_id => @project, :type => REP_TYPE).first
@is_true = params[:is_true]
if @is_true
begin
g = Gitlab.client
g.delete_project(@project.gpid)
@gitlab_repository.destroy
@gitlab_repository = nil
scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first
@repository = Repository.factory(scm)
@repository.is_default = @project.repository.nil?
@project.update_attribute(:gpid, nil)
rescue Exception => e
puts e
end
end
else
return render_403
end
end
def show_projects_score
respond_to do |format|
format.html { render :layout => "base_projects"}
@ -939,16 +989,6 @@ class ProjectsController < ApplicationController
true
end
def watcherlist
unless @project.nil?
if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin?
render_403
else
@users -= watched.watcher_users if @watched
end
end
end
#gcm
def desc_sort_course_by_avtivity(activity_count,projects)
return projects if activity_count.size<2
@ -962,5 +1002,7 @@ class ProjectsController < ApplicationController
end
return projects
end
#gcmend
end

View File

@ -91,10 +91,11 @@ class PullRequestsController < ApplicationController
# 如果分支有改动
if compare_pull_request(source_branch, target_project_id, target_branch)
# 如果传送了目标项目ID即向fork源项目发送请求
if params[:forked_project_id] && params[:source_project] == "forked_project_name"
# if params[:forked_project_id] && params[:source_project] == "forked_project_name"
if params[:target_project_id].to_i != @project.id
target_project_id = params[:forked_project_id].to_i
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(@project.forked_from_project_id).try(:name)
@fork_project_name = Project.find(params[:target_project_id]).try(:name)
@fork_pr_message = true if @fork_project_name
else
request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch)
@ -108,7 +109,7 @@ class PullRequestsController < ApplicationController
format.js{redirect_to new_project_pull_request_path(:show_tip => tip)}
end
end
rescue Exception => e
rescue Gitlab::Error::Conflict => e
@message = e.message
end
end
@ -226,7 +227,7 @@ class PullRequestsController < ApplicationController
# Gets the comments on a merge request.
#
# @example
# Gitlab.merge_request_comments(5, 1)
# Gitlab.merge_request_comments(5, 1)
def pull_request_comments
begin
@comments = @g.merge_request_comments(@project.gpid, params[:id]).reverse

View File

@ -982,33 +982,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] ? 1 : 0
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

View File

@ -145,7 +145,7 @@ class UsersController < ApplicationController
case params[:type]
when 'JournalsForMessage'
@comment = JournalsForMessage.find params[:comment].to_i
when 'Message'
when 'Message','is_project_message'
@comment = Message.find params[:comment].to_i
when 'BlogComment'
@comment = BlogComment.find params[:comment].to_i
@ -153,9 +153,11 @@ class UsersController < ApplicationController
@comment = OrgDocumentComment.find params[:comment].to_i
when 'Comment'
@comment = Comment.find params[:comment].to_i
when 'Journal'
when 'Journal','is_project_issue'
@comment = Journal.find params[:comment].to_i
end
@user_activity_id = params[:user_activity_id]
@parent_id = params[:parent_id] if params[:parent_id]
end
#二级回复
@ -214,6 +216,7 @@ class UsersController < ApplicationController
def reply_to_comment
@type = params[:type]
@reply = get_reply_by_type @type, params[:reply_id]
@parent_id = params[:parent_id] if params[:parent_id]
@user_activity_id = params[:user_activity_id]
@is_project = params[:is_project] if params[:is_project]
respond_to do |format|
@ -225,8 +228,15 @@ class UsersController < ApplicationController
def reply_detail
@type = params[:type]
reply = get_reply_by_type @type, params[:reply_id]
if @type == 'JournalsForMessage'
if reply.jour_type == "HomeworkCommon"
@type = "HomeworkCommon"
elsif reply.jour_type == "Syllabus"
@type = "Syllabus"
end
end
@user_activity_id = params[:user_activity_id]
case params[:type]
case @type
when 'HomeworkCommon'
@root = HomeworkCommon.find reply.jour_id
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => User.current.id,:m_parent_id => params[:reply_id].to_i,:m_reply_id => params[:reply_id].to_i, :root_id => reply.root_id}
@ -273,11 +283,11 @@ class UsersController < ApplicationController
comment.content = params[:reply_message]
comment.root_id = reply.root_id
reply.children << comment
when 'News'
when 'News','Comment'
@root = News.find reply.commented_id
comment = @root.comments.build(:author_id => User.current.id, :reply_id => params[:reply_id], :comments => params[:reply_message], :parent_id => reply.id)
comment.save
when 'Issue'
when 'Issue', 'Journal'
@root = reply.issue
comment = @root.journals.build(:user_id => User.current.id, :reply_id => params[:reply_id], :notes => params[:reply_message], :parent_id => reply.id)
comment.save
@ -515,13 +525,13 @@ class UsersController < ApplicationController
member.course_group_id = 0
member.save
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1)
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1)
@msg.update_attributes(:status=>1,:viewed=>1)
else
members = []
members << Member.new(:role_ids => integer_ids, :user_id => @msg.course_message_id)
Course.find(@msg.course_id).members << members
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1)
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1)
@msg.update_attributes(:status=>1,:viewed=>1)
if integer_ids.include?(9)
@ -536,7 +546,7 @@ class UsersController < ApplicationController
end
when 'N'
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>2)
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>2)
@msg.update_attributes(:status=>2,:viewed=>1)
if integer_ids.include?(9)
@ -586,13 +596,13 @@ class UsersController < ApplicationController
when 'Y'
unless ah.empty?
ah.first.update_column('status', 2)
CourseMessage.create(:user_id => @msg.apply_user_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>@msg.course_message_id,:content=>@msg.content,:course_message_type=>'HomeworkCommon',:status=>6,:apply_result=>1)
CourseMessage.create(:user_id => @msg.apply_user_id, :course_id => @msg.course_id, :viewed => false,:course_message_id=>@msg.course_message_id,:content=>@msg.content,:course_message_type=>'HomeworkCommon',:status=>6,:apply_result=>1)
@msg.update_attributes(:apply_result=>1,:viewed=>1)
end
when 'N'
unless ah.empty?
ah.first.update_column('status', 3)
CourseMessage.create(:user_id => @msg.apply_user_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>@msg.course_message_id,:content=>@msg.content,:course_message_type=>'HomeworkCommon',:status=>6,:apply_result=>2)
CourseMessage.create(:user_id => @msg.apply_user_id, :course_id => @msg.course_id, :viewed => false,:course_message_id=>@msg.course_message_id,:content=>@msg.content,:course_message_type=>'HomeworkCommon',:status=>6,:apply_result=>2)
@msg.update_attributes(:apply_result=>2,:viewed=>1)
end
end
@ -1454,9 +1464,10 @@ class UsersController < ApplicationController
@jour = jours.limit(10).offset(@page * 10)
@type = params[:type]
if User.current == @user
jours.update_all(:is_readed => true, :status => false)
jours.each do |journal|
fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
@jour.update_all(:is_readed => true, :status => false)
@jour.each do |journal|
# fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
journal.delay.set_children_readed_delay
end
end
@state = false
@ -3483,7 +3494,7 @@ class UsersController < ApplicationController
@my_syllabuses = @user.syllabuses
if @user == User.current
archive_ids = Course.where("tea_id = #{@user.id} and is_delete = 1").blank? ? "(-1)" : "(" + Course.where("tea_id = #{@user.id} and is_delete = 1").map{|course| course.syllabus_id}.join(",") + ")"
archive_ids = Course.where("tea_id = #{@user.id} and is_delete = 1 and syllabus_id is NOT NULL").blank? ? "(-1)" : "(" + Course.where("tea_id = #{@user.id} and is_delete = 1 and syllabus_id is NOT NULL").map{|course| course.syllabus_id}.join(",") + ")"
@archive_syllabuses = Syllabus.where("id in #{archive_ids}")
end
@ -3572,7 +3583,7 @@ class UsersController < ApplicationController
@user = User.current
sort_name = "updated_at"
archive_ids = Course.where("tea_id = #{@user.id} and is_delete = 1").blank? ? "(-1)" : "(" + Course.where("tea_id = #{@user.id} and is_delete = 1").map{|course| course.syllabus_id}.join(",") + ")"
archive_ids = Course.where("tea_id = #{@user.id} and is_delete = 1 and syllabus_id is NOT NULL").blank? ? "(-1)" : "(" + Course.where("tea_id = #{@user.id} and is_delete = 1 and syllabus_id is NOT NULL").map{|course| course.syllabus_id}.join(",") + ")"
@archive_syllabuses = Syllabus.where("id in #{archive_ids}")
if @order.to_i == 1 #根据 班级更新时间排序

View File

@ -125,7 +125,8 @@ class VersionsController < ApplicationController
@issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
# @offset ||= @issue_pages.offset
@issues = paginateHelper @version_issues, @limit
@version_issue_assigned_name = @version_issues.group_by(&:assigned_to_id)
@version_issue_assigned_name = @version_issues.sort_by{ |i| Issue.where(:project_id => @project.id ,
:assigned_to_id => i.assigned_to_id, :fixed_version_id => @version.id).count }.reverse.group_by(&:assigned_to_id)
format.html {
# @issues = @version.fixed_issues.visible.
# includes(:status, :tracker, :priority).

View File

@ -37,7 +37,9 @@ class WatchersController < ApplicationController
@list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all();
@action = 'fans'
else
if params[:target_id]
@user = User.find(params[:target_id])
end
end
if params[:object_type] == 'project'
@ -78,6 +80,9 @@ class WatchersController < ApplicationController
@list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all();
@action = 'fans'
else
if params[:target_id]
@user = User.find(params[:target_id])
end
end
if params[:object_type] == 'project'
@project = Project.find(params[:object_id])

View File

@ -137,7 +137,7 @@ class WechatsController < ActionController::Base
on :fallback, respond: 'fallback message'
on :click, with: 'FEEDBACK' do |request, key|
request.reply.text "如有问题反馈,请您:\n1、直接切换至输入框发微信给我们。\n2、加入QQ群373967360直接互动。\n\n如您有合作事宜洽谈,请联系:\n王林春 老师\n手机13467631747\nQQ494496321"
request.reply.text "如有问题反馈,请您:\n1、直接切换至输入框发微信给我们。\n2、加入QQ群373967360直接互动。\n3、登录网站www.trustie.net给我们留言。\n\n如您有合作事宜洽谈,请联系:\n王林春 老师\n手机13467631747\nQQ494496321"
end
on :click, with: 'MY_NEWS' do |request, key|

View File

@ -2837,6 +2837,12 @@ module ApplicationHelper
tag_list
end
# 获取项目fork成员数
def project_fork_count
@forked_projects = Project.where(:forked_from_project_id => @project.id)
@forked_count = @forked_projects.count
end
def get_org_subfield_tag_list org_subfield
all_attachments = org_subfield.attachments.select{|attachment| attachment.is_public? ||
(attachment.container_type == "OrgSubfield" && User.current.member_of_org?(org_subfield.organization))||
@ -3408,10 +3414,12 @@ def get_reply_by_type type, reply_id
reply = BlogComment.find reply_id
when 'OrgDocumentComment'
reply = OrgDocumentComment.find reply_id
when 'News'
when 'News','Comment'
reply = Comment.find reply_id
when 'Issue'
reply = Journal.find reply_id
when 'Journal'
reply = Journal.find reply_id
when 'Syllabus'
reply = JournalsForMessage.find reply_id
end

View File

@ -267,6 +267,16 @@ module ProjectsHelper
project_name = versions.blank? ? "" : versions.first.project.name
grouped = Hash.new {|h,k| h[k] = []}
grouped[project_name] << ["请选择里程碑", 0]
=begin
unless selected.nil?
if (params[:action] == "show" ) && Version.find(selected.id).status == "closed"
version_name = Version.find(selected.id).name
grouped[project_name] << [version_name, selected.id]
end
end
=end
versions.each do |version|
grouped[version.project.name] << [version.name, version.id]
end
@ -302,6 +312,16 @@ module ProjectsHelper
type << option2
end
# 判断用户是否为项目管理员
def is_project_manager?(user_id, project_id)
@result = false
mem = Member.where("user_id = ? and project_id = ?",user_id, project_id)
unless mem.blank?
@result = mem.first.roles.to_s.include?("Manager") ? true : false
end
return @result
end
# 用来判断用户是否是项目的管理员
# added by william
def is_manager?(user_id,project_id)

View File

@ -2,12 +2,12 @@ module PullRequestsHelper
# 获取diff内容行号
def diff_line_num content
content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.nil? ? "" : content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.join("").to_i
result = content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.nil? ? "" : content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.join("").to_i
end
# 处理内容
def diff_content content
content.gsub!(/.*@@ -\d+,\d+ \+\d+,\d+ @@\n/m,'')
result = content.gsub!(/.*@@.*@@\n/m,'')
end
def get_user_name user_id

View File

@ -100,7 +100,7 @@ module UsersHelper
def applied_project_users applied_message
# case applied_message.status
# when 3,2,1,5,4,7,6
user = User.find(applied_message.applied_user_id)
user = User.find(applied_message.applied_user_id).show_name
# end
end

View File

@ -333,6 +333,7 @@ module WatchersHelper
return '' unless user && user.logged?
objects = Array.wrap(objects)
watched = objects.any? {|object| object.watched_by?(user)}
watched = true if user.id == @project.user_id
@watch_flag = objects.first.instance_of?(Project)
id = watcher_css(objects)
text = @watch_flag ?
@ -340,8 +341,13 @@ module WatchersHelper
url = watch_path(:object_type => objects.first.class.to_s.underscore,
:object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort))
method = watched ? 'delete' : 'post'
link_to text, url, :remote => true, :method => method,
:class => "pro_new_topbtn_left fl" ,:id=>id
if user.id != @project.user_id
link_to text, url, :remote => true, :method => method,
:class => "pro_new_topbtn_left fl" ,:id => id
else
link_to "关注", "javascript:void(0)", :remote => true, :method => method,
:class => "pro_new_grey_topbtn_left fl" , :id => id
end
end
def store_project_link project_id, user_id

View File

@ -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

View File

@ -854,7 +854,8 @@ class Issue < ActiveRecord::Base
return @assignable_versions if @assignable_versions
# versions = project.shared_versions.open.all
versions = Version.where(:project_id => project.id, :status => "open").order("created_on desc")
# versions = Version.where(:project_id => project.id, :status => "open").order("created_on desc")
versions = Version.where(:project_id => project.id).order("created_on desc")
if fixed_version
if fixed_version_id_changed?
# nothing to do

View File

@ -344,4 +344,9 @@ class JournalsForMessage < ActiveRecord::Base
def content_detail
self.notes
end
def set_children_readed_delay
# fetch_user_leaveWord_reply(self).update_all(:is_readed => true, :status => false)
end
end

View File

@ -9,6 +9,7 @@ class Organization < ActiveRecord::Base
has_many :org_subfields, :dependent => :destroy
has_many :users, :through => :org_members
has_many :files
has_many :org_messages, :class_name => 'OrgMessage', :dependent => :destroy
acts_as_attachable
validates_uniqueness_of :name
after_create :save_as_org_activity, :add_default_subfields

View File

@ -30,9 +30,9 @@
<% for attachment in attachments %>
<div style="float:left;">
<p style="height:14px;line-height:12px;width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%if is_float%>
<div style="max-width:55%;white-space: nowrap; overflow: hidden; text-overflow: ellipsis;float: left;">
<% end%>
<% if is_float %>
<div style="max-width:55%;white-space: nowrap; overflow: hidden; text-overflow: ellipsis;float: left;">
<% end %>
<span title="<%= attachment.filename %>" id = "attachment_">
<% if options[:length] %>
<% if User.current.logged? %>
@ -42,15 +42,15 @@
<% end %>
<% else %>
<% if User.current.logged? %>
<%= link_to_short_attachment attachment, :length=> 58,:class => 'hidden link_file_a fl newsBlue mw400', :download => true -%>
<%= link_to_short_attachment attachment, :length => 58,:class => 'hidden link_file_a fl newsBlue mw400 h15', :download => true -%>
<% else %>
<%= link_to(attachment.filename, signin_url_without_domain,:length=> 58, :class => "hidden link_file_a fl newsBlue mw400") %>
<%= link_to(attachment.filename, signin_url_without_domain,:length => 58, :class => "hidden link_file_a fl newsBlue mw400 h15") %>
<% end %>
<% end %>
</span>
<%if is_float%>
<% if is_float %>
</div>
<% end%>
<% end %>
<% if attachment.is_text? %>
<%= link_to image_tag('magnifier.png'),

View File

@ -1,7 +1,7 @@
<div class = "cl"> </div>
<div id="blog-list">
<div class="listbox mt10" >
<h2 class="list-h2">博客列表</h2>
<p class="list-h2">博客列表</p>
<div class="category">
<span class="grayTxt ">排序:</span>
<%= link_to "时间", {:controller => 'blogs', :action => 'index', :id =>@user, :type => @type, :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
@ -21,9 +21,9 @@
<ul class="list-file">
<li><span class="item_list fl"></span>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.title.to_s.html_safe, user_blog_blog_comment_path(:user_id=> activity.author, :blog_id=>activity.blog.id,:id=>activity), :class=> "list-title fl" %>
<%= link_to activity.title.to_s.html_safe, user_blog_blog_comment_path(:user_id=> activity.author, :blog_id=>activity.blog.id,:id=>activity), :class=> "list-title-normal fl" %>
<% else %>
<%= link_to activity.title.subject.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author, :blog_id=>activity.blog.id,:id=>activity), :class=> "list-title fl"%>
<%= link_to activity.title.subject.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author, :blog_id=>activity.blog.id,:id=>activity), :class=> "list-title-normal fl"%>
<% end %>
<%# if activity.blog.homepage_id and activity.id == activity.blog.homepage_id %>
<!--<span class="font_normal ml10 fr">[已设为首页]</span>-->
@ -36,7 +36,8 @@
<% end %>
<div class="cl"></div>
</li>
<% count=BlogComment.where("root_id = #{activity.id}").count%> <li class="ml15">
<% count=BlogComment.where("root_id = #{activity.id}").count%>
<li class="ml15">
<span class="grayTxt">发布:<%= format_time(activity.created_on) %></span>
<span class="grayTxt">更新:<%= format_time(activity.updated_on) %></span>
<p class="list-info fr grayTxt">

View File

@ -4,7 +4,7 @@
<h2 class="project_h2 fl"><%= @subPage_title%></h2>
<% 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' %>
<%=link_to "成员管理", {:controller => 'courses', :action => 'settings', :id => @course.id, :tab=>'member'}, :class => 'hw_more_li' %>
</span>
<% end %>
</div>
@ -13,21 +13,12 @@
<% else %>
<div class="sy_class_r sy_class_nobg fr ml10">
<div class="sy_class_r_head mb10">
<h3><%= @subPage_title %></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,:format => 'xls'), :class => 'hw_more_li'%></li>
<% if User.current.allowed_to?(:as_teacher,@course) %>
<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"><%= @subPage_title %></h3>
<% 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'%>
<div class="cl"></div>
</div>
<%= render :partial => 'course_student', :locals => {:members => @members} %>
</div>

View File

@ -11,8 +11,6 @@
<span>测验时长:<%= exercise.time %>分钟</span>
<% end %>
</div>
<pre class="fontGrey2 font_cus" style="white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:pre-wrap;white-space:-o-pre-wrap;word-break:normal;word-wrap: break-word;">
<%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%>
</pre>
<pre class="fontGrey2 font_cus" style="white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:pre-wrap;white-space:-o-pre-wrap;word-break:normal;word-wrap: break-word;"><%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%></pre>
<div class="cl"></div>
</div>

View File

@ -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" name="no_anon_penalty" <%=homework.homework_detail_manual.no_anon_penalty == 1 ? 'checked' : '' %> value="<%=homework.homework_detail_manual.no_anon_penalty%>"/>
<label class="pop_box_label fl ml10" style="text-align: left">不参加匿评扣分</label>
</li>
<li class="mb10 clear mt30">
<label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</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>

View File

@ -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>

View File

@ -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" name="no_anon_penalty" <%=homework.homework_detail_manual.no_anon_penalty == 1 ? 'checked' : '' %> value="<%=homework.homework_detail_manual.no_anon_penalty%>"/>
<label class="pop_box_label fl ml10" style="text-align: left">不参加匿评扣分</label>
</li>
<li class="mb10 clear mt30">
<label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</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>

View File

@ -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>

View File

@ -98,8 +98,8 @@
<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();",
:class=>"fl calendar_input", :style=>"width:170px;" %>
:required => @issue.required_attribute?('start_date'), :onchange => "issue_start_date_change();",
:class => "fl calendar_input", :style => "width:170px;" %>
<%= calendar_for('issue_start_date', 'start_date') if @issue.leaf? %>
<% end %>
</li>
@ -110,8 +110,8 @@
<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>
@ -121,7 +121,7 @@
<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>
@ -160,9 +160,5 @@
}
// 里程碑添加默认选项
$("#issue_fixed_version_id option[value='']").remove();
<%# if params[:action] == "new" %>
// $('#issue_fixed_version_id').prepend("<option value='0' selected='selected'>选择里程碑</option>");
<%# else %>
// $('#issue_fixed_version_id').prepend("<option value='0'>选择里程碑</option>");
<%# end %>
</script>

View File

@ -12,7 +12,7 @@
<%= link_to "打开<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_2'>#{@issue_open_count}</span>".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_2" %>
</li>
<li id="new_roadmap_nav_3" onclick="HoverLi(3);">
<%= link_to "锁定<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_3'>#{@issue_close_count}</span>".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_3" %>
<%= link_to "关闭<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_3'>#{@issue_close_count}</span>".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_3" %>
</li>
</ul>
</div><!--issues_statistics end-->

View File

@ -11,9 +11,18 @@
</tr>
</thead>
<tbody>
<tr>
<td class="hidden dis p10" style="width:166px;">合计</td>
<td class="w130"><%= @alltotal[0] %></td>
<td class="w130"><%= @alltotal[2] %></td>
<td class="w130"><%= @alltotal[4] %></td>
<td class="w130"><%= @alltotal[1] %></td>
<td class="w130"><%= @alltotal[3] %></td>
<td class="w130"><%= @alltotal[5] %></td>
</tr>
<% @results.each do |k,v|%>
<tr>
<td class="hidden dis p10" style="width:166px;"><%= v[:name] %></td>
<td class="hidden dis p10" style="width:166px;"><%= v[:name] =="Anonymous" ? "未指派" : v[:name] %></td>
<td class="w130"><%= v[0] %></td>
<td class="w130"><%= v[2] %></td>
<td class="w130"><%= v[4] %></td>
@ -22,14 +31,5 @@
<td class="w130"><%= v[5] %></td>
</tr>
<% end %>
<tr>
<td class="hidden dis p10" style="width:166px;">Total</td>
<td class="w130"><%= @alltotal[0] %></td>
<td class="w130"><%= @alltotal[2] %></td>
<td class="w130"><%= @alltotal[4] %></td>
<td class="w130"><%= @alltotal[1] %></td>
<td class="w130"><%= @alltotal[3] %></td>
<td class="w130"><%= @alltotal[5] %></td>
</tr>
</tbody>
</table>

View File

@ -11,10 +11,19 @@
</tr>
</thead>
<tbody>
<tr>
<td class="hidden dis p10" style="width:166px;">合计</td>
<td class="w130"><%= @closetotal[0] %></td>
<td class="w130"><%= @closetotal[2] %></td>
<td class="w130"><%= @closetotal[4] %></td>
<td class="w130"><%= @closetotal[1] %></td>
<td class="w130"><%= @closetotal[3] %></td>
<td class="w130"><%= @closetotal[5] %></td>
</tr>
<% @results.each do |k,v|%>
<% if v[12] > 0 %>
<tr>
<td class="hidden dis p10" style="width:166px;"><%= v[:name] %></td>
<td class="hidden dis p10" style="width:166px;"><%= v[:name] == "Anonymous" ? "未指派" : v[:name] %></td>
<td class="w130"><%= v[12] %></td>
<td class="w130"><%= v[14] %></td>
<td class="w130"><%= v[16] %></td>
@ -24,14 +33,5 @@
</tr>
<% end %>
<% end %>
<tr>
<td class="hidden dis p10" style="width:166px;">Total</td>
<td class="w130"><%= @closetotal[0] %></td>
<td class="w130"><%= @closetotal[2] %></td>
<td class="w130"><%= @closetotal[4] %></td>
<td class="w130"><%= @closetotal[1] %></td>
<td class="w130"><%= @closetotal[3] %></td>
<td class="w130"><%= @closetotal[5] %></td>
</tr>
</tbody>
</table>

View File

@ -11,10 +11,19 @@
</tr>
</thead>
<tbody>
<tr>
<td class="hidden dis p10" style="width:166px;">合计</td>
<td class="w130"><%= @opentotal[0] %></td>
<td class="w130"><%= @opentotal[2] %></td>
<td class="w130"><%= @opentotal[4] %></td>
<td class="w130"><%= @opentotal[1] %></td>
<td class="w130"><%= @opentotal[3] %></td>
<td class="w130"><%= @opentotal[5] %></td>
</tr>
<% @results.each do |k,v|%>
<% if v[6] > 0 %>
<tr>
<td class="hidden dis p10" style="width:166px;"><%= v[:name] %></td>
<td class="hidden dis p10" style="width:166px;"><%= v[:name] =="Anonymous" ? "未指派" : v[:name] %></td>
<td class="w130"><%= v[6] %></td>
<td class="w130"><%= v[8] %></td>
<td class="w130"><%= v[10] %></td>
@ -24,14 +33,5 @@
</tr>
<% end %>
<% end %>
<tr>
<td class="hidden dis p10" style="width:166px;">Total</td>
<td class="w130"><%= @opentotal[0] %></td>
<td class="w130"><%= @opentotal[2] %></td>
<td class="w130"><%= @opentotal[4] %></td>
<td class="w130"><%= @opentotal[1] %></td>
<td class="w130"><%= @opentotal[3] %></td>
<td class="w130"><%= @opentotal[5] %></td>
</tr>
</tbody>
</table>

View File

@ -9,6 +9,7 @@
<div class="pro_new_top clear mb10">
<div class="fl pro_new_name ml15 clear">
<% unless @project.is_public? %><span class="icons_newpro_lock fl "></span><% end %>
<%=link_to "#{@project.owner.try(:show_name)}<span class='ml5 mr5'>/</span>".html_safe, user_path(@project.owner), :class => "pro_new_username" %>
<%=link_to @project.name, project_path(@project), :class => "pro_new_username break_word" %>
</div>
@ -19,8 +20,8 @@
<div class="cl"></div>
<% unless @project.forked_from_project_id.nil? %>
<div class="fl pro_new_name ml15 clear mt5">
<span class="vl_fork fl mr5 mt2">forked from</span> <%=link_to "#{get_fork_from_project(@project.forked_from_project_id).owner.try(:show_name)}<span class='ml5 mr5'>/</span>".html_safe, user_path(get_fork_from_project(@project.forked_from_project_id).owner), :class => "pro_new_username_fork fl" %>
<%=link_to get_fork_from_project(@project.forked_from_project_id).name, project_path(get_fork_from_project(@project.forked_from_project_id)), :class => "pro_new_username_fork fl" %>
<span class="vl_fork fl mr5 mt2">forked from</span> <%=link_to "#{get_fork_from_project(@project.forked_from_project_id).owner.try(:show_name)}<span class='ml5 mr5'>/</span>".html_safe, user_path(get_fork_from_project(@project.forked_from_project_id).owner), :class => "pro_new_username_fork fl", :target => "_blank" %>
<%=link_to get_fork_from_project(@project.forked_from_project_id).name, project_path(get_fork_from_project(@project.forked_from_project_id)), :class => "pro_new_username_fork fl", :target => "_blank" %>
</div>
<div class="cl"></div>
<% end %>

View File

@ -148,7 +148,7 @@
<li>
<a href="<%=user_fanslist_user_path(@user) %>">
<strong>粉丝</strong><br />
<span class="sy_cgrey"><%= @user.watcher_users.count %></span>
<span id="user_fans_number" class="sy_cgrey"><%= @user.watcher_users.count %></span>
</a>
</li>
</ul>

View File

@ -214,7 +214,8 @@
<li>确认密码&nbsp;:&nbsp;</li>
</ul>
<ul class="setting_right ">
<li><input id="password" name="password" class="w210" type="password" required="true" nh_required="1"></li>
<input style="display:none;">
<li><input id="password" name="password" autocomplete="off" class="w210" type="password" required="true" nh_required="1"></li>
<li><input id="new_password" name="new_password" class="w210" type="password" required="true" nh_required="1"><span class="c_red ml5">请输入8-12个字符</span></li>
<li><input id="new_password_confirmation" name="new_password_confirmation" class="w210" type="password" required="true" nh_required="1"></li>
<li class="ml2">

View File

@ -3,7 +3,8 @@
<!--关注项目-->
<li class="mr5 fl">
<%= watcher_link_for_project(@project, User.current) %>
<%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id},:id=>"fans_num", :class => 'pro_new_topbtn fl' %>
<%= link_to "#{@project.watcher_users.count}", {:controller => "projects", :action => "project_watcherlist",
:id => @project.id}, :id => "fans_num", :class => 'pro_new_topbtn fl', :title => "关注成员列表" %>
</li>
<!--加入项目-->
<li class="mr5 fl">
@ -12,15 +13,21 @@
<% else %>
<a style="cursor: default" class="pro_new_topbtn_left fl">等待审批</a>
<% end %>
<%= link_to "#{Member.where(:project_id => @project.id).count}", project_member_path(@project), :class => 'pro_new_topbtn fl', :title => "项目成员" %>
<%= link_to "#{Member.where(:project_id => @project.id).count}", project_member_path(@project), :class => 'pro_new_topbtn fl', :title => "项目成员列表" %>
</li>
<% end %>
<% else %>
<!--项目创建者不能退出项目-->
<% if User.current.id != @project.user_id %>
<% if User.current.login? %>
<li class="mr5 fl">
<a class="pro_new_topbtn_left fl "> 已加入</a>
<a href="<%= project_member_path(@project) %>" class=" pro_new_topbtn fl"><%= Member.where(:project_id => @project.id).count %></a>
<%= watcher_link_for_project(@project, User.current) %>
<%= link_to "#{@project.watcher_users.count}", {:controller => "projects", :action => "project_watcherlist",
:id => @project.id}, :id => "fans_num", :class => 'pro_new_topbtn fl', :title => "关注成员列表" %>
</li>
<li class="mr5 fl">
<a class="pro_new_topbtn_left fl " style="cursor:default;"> 已加入</a>
<!-- <a href="<%= project_member_path(@project) %>" class=" pro_new_topbtn fl"><%= Member.where(:project_id => @project.id).count %></a>-->
<%= link_to "#{Member.where(:project_id => @project.id).count}", project_member_path(@project), :class => 'pro_new_topbtn fl', :title => "项目成员列表" %>
</li>
<%#= link_to "#{Member.where(:project_id => @project.id).count}", project_member_path(@project), :class => 'pro_new_topbtn fl', :title => "项目成员" %>
<% end %>
@ -35,8 +42,17 @@
<!-- <a href="<%#= {:controller => 'repositories', :action => 'forked'} %>" class="pro_new_topbtn_left fl" target="_blank">Fork</a>-->
<%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", forked_pop_project_path(@project),
:class=>"pro_new_topbtn_left fl", :remote => true %>
<a href="<%= member_forked_project_path(@project) %>" class=" pro_new_topbtn fl"><%= @project.forked_count.to_i %></a>
<a href="<%= member_forked_project_path(@project) %>" class=" pro_new_topbtn fl" title="fork成员列表"><%= project_fork_count %></a>
</li>
<% else%>
<li class="mr5 fl">
<%#= link_to "<span class='vl_fork '></span>".html_safe+"Fork","#",
:class=>"pro_new_grey_topbtn_left fl"%>
<a href="javascript:void(0)" class="pro_new_grey_topbtn_left fl" >
<span class='vl_fork'>Fork</span>
</a>
<a href="<%= member_forked_project_path(@project) %>" class=" pro_new_topbtn fl" title="fork成员列表"><%= project_fork_count %></a>
<% end %>

View File

@ -25,7 +25,7 @@
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => 'Message', :user_activity_id => user_activity_id, :is_project => true},
{:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => 'Message', :user_activity_id => user_activity_id, :parent_id => parent_id, :is_project => true},
:remote => true,
:method => 'get',
:title => l(:button_reply)) %>

View File

@ -1,8 +1,8 @@
<div class="orig_cont clearfix">
<% if !comment.parent.nil? && !comment.parent.parent.nil? %>
<div>
<%=render :partial => 'projects/journal_comment_reply', :locals => {:comment => comment.parent, :user_activity_id => user_activity_id} %>
<%=render :partial => 'projects/journal_comment_reply', :locals => {:comment => comment.parent, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
</div>
<% end %>
<%=render :partial => 'projects/comment_reply_detail', :locals => {:comment => comment, :user_activity_id => user_activity_id} %>
<%=render :partial => 'projects/comment_reply_detail', :locals => {:comment => comment, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
</div>

View File

@ -1,8 +1,8 @@
<div class="orig_cont clearfix">
<% unless comment.parent.nil? %>
<div>
<%=render :partial => 'projects/project_issue_comments_reply', :locals => {:comment => comment.parent, :user_activity_id => user_activity_id} %>
<%=render :partial => 'projects/project_issue_comments_reply', :locals => {:comment => comment.parent, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
</div>
<% end %>
<%=render :partial => 'projects/project_issue_comments_reply_detail', :locals => {:comment => comment, :user_activity_id => user_activity_id} %>
<%=render :partial => 'projects/project_issue_comments_reply_detail', :locals => {:comment => comment, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
</div>

View File

@ -25,7 +25,7 @@
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => 'Issue', :user_activity_id => user_activity_id, :is_project => true},
{:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => 'Issue', :user_activity_id => user_activity_id, :parent_id => parent_id, :is_project => true},
:remote => true,
:method => 'get',
:title => l(:button_reply)) %>

View File

@ -8,18 +8,18 @@
<% length = parents_rely.length %>
<div id="comment_reply_<%=comment.id %>">
<% if length <= 2 %>
<%=render :partial => 'projects/project_issue_comments_reply', :locals => {:comment => comment.parent, :user_activity_id => user_activity_id} %>
<%=render :partial => 'projects/project_issue_comments_reply', :locals => {:comment => comment.parent, :user_activity_id => user_activity_id, :parent_id => comment.id} %>
<% else %>
<div class="orig_cont clearfix">
<div class="orig_cont clearfix">
<%=render :partial => 'projects/project_issue_comments_reply_detail', :locals => {:comment => parents_rely[length - 1], :user_activity_id => user_activity_id} %>
<%=render :partial => 'projects/project_issue_comments_reply_detail', :locals => {:comment => parents_rely[length - 1], :user_activity_id => user_activity_id, :parent_id => comment.id} %>
</div>
<div class="orig_cont_hide_issue clearfix">
<span class="orig_icon" >&darr; </span>
<span class="orig_icon" style="display:none;" > &uarr;</span><span class="">已经隐藏<%=(length - 2).to_s %>个楼层</span>
<%= link_to '[点击展开]', show_all_replies_users_path(:comment => comment, :type => comment.class), :remote=>true, :class => 'linkBlue2' %>
<%= link_to '[点击展开]', show_all_replies_users_path(:comment => comment, :type => 'is_project_issue', :user_activity_id => user_activity_id, :parent_id => comment.id), :remote=>true, :class => 'linkBlue2' %>
</div>
<%=render :partial => 'projects/project_issue_comments_reply_detail', :locals => {:comment => parents_rely[0], :user_activity_id => user_activity_id} %>
<%=render :partial => 'projects/project_issue_comments_reply_detail', :locals => {:comment => parents_rely[0], :user_activity_id => user_activity_id, :parent_id => comment.id} %>
</div>
<% end %>
</div>

View File

@ -1,30 +1,31 @@
<div class="st_list2" style="width:970px;">
<div class="st_box">
<a href="#" class="fr fb mb5" >加入时间</a>
<div class="cl"></div><!--st_box_top end-->
<ul class="clear pro_new_users_box">
<% members.each do |member| %>
<div class="st_boxlist">
<a href="javascript:" class="st_img">
<%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 32, :height => 32)) %>
</a>
<span class="fr ml10 c_grey"><%= l(:label_user_for_project_grade) %><span class="c_orange"><%= format("%.2f" ,read_user_project_scores(member.user,@project)).to_i %></span></span>
<li class="clear">
<%= link_to image_tag(url_to_avatar(member.user), :width => "50", :height => "50"), user_path(member.user), :alt => "用户头像", :class => "pro_new_users fl mr5" %>
<div class="fl mt5 clear">
<%= link_to member.user.try(:show_name), user_path(member.user), :class => "pro_new_users mt5 fl" %>
<!--<span class="ml5 mr5 mt5 fl"> / </span>
<%#= link_to project.name, user_path(member.user), :class => "pro_new_users mt5 fl" %>-->
<br/>
<span class=" c_grey mt3 fl"><%= h time_tag(member.created_on) %></span>
</div>
</li>
<% end %>
</ul>
<span class="fl ml10 c_grey"><%= l(:label_username)%></span>
<%= link_to(member.user.name, user_path(member.user),:class => "ml10 c_blue02") %><%= rolesToLanguage(member.roles.sort.collect(&:to_s)).join(', ') %><br/>
</div>
<span class="fr c_grey"><%= format_date(member.created_on)%></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%>
<div style="text-align:center;">
<div class="pages" style="width:auto; display:inline-block;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<div class="cl"></div>

View File

@ -8,18 +8,18 @@
<% length = parents_rely.length %>
<div id="comment_reply_<%=comment.id %>">
<% if length <= 2 %>
<%=render :partial => 'projects/journal_comment_reply', :locals => {:comment => comment.parent, :user_activity_id => user_activity_id} %>
<%=render :partial => 'projects/journal_comment_reply', :locals => {:comment => comment.parent, :user_activity_id => user_activity_id, :parent_id => comment.id} %>
<% else %>
<div class="orig_cont clearfix">
<div class="orig_cont clearfix">
<%=render :partial => 'projects/comment_reply_detail', :locals => {:comment => parents_rely[length - 1], :user_activity_id => user_activity_id} %>
<%=render :partial => 'projects/comment_reply_detail', :locals => {:comment => parents_rely[length - 1], :user_activity_id => user_activity_id, :parent_id => comment.id} %>
</div>
<div class="orig_cont_hide_issue clearfix">
<span class="orig_icon" >&darr; </span>
<span class="orig_icon" style="display:none;" > &uarr;</span><span class="">已经隐藏<%=(length - 2).to_s %>个楼层</span>
<%= link_to '[点击展开]', show_all_replies_users_path(:comment => comment, :type => comment.class), :remote=>true, :class => 'linkBlue2' %>
<%= link_to '[点击展开]', show_all_replies_users_path(:comment => comment, :type => 'is_project_message', :user_activity_id => user_activity_id, :parent_id => comment.id), :remote=>true, :class => 'linkBlue2' %>
</div>
<%=render :partial => 'projects/comment_reply_detail', :locals => {:comment => parents_rely[0], :user_activity_id => user_activity_id} %>
<%=render :partial => 'projects/comment_reply_detail', :locals => {:comment => parents_rely[0], :user_activity_id => user_activity_id, :parent_id => comment.id} %>
</div>
<% end %>
</div>

View File

@ -0,0 +1,22 @@
<div style="width:460px;">
<div class="sy_popup_top">
<h3 class="fl">提示</h3>
<a href="javascript:void(0);" class="sy_icons_close fr" onclick="hideModal()"></a>
<div class="cl"></div>
</div>
<div class="sy_popup_con" style="width:380px;">
<ul class="sy_popup_add" >
<li class="center mb5" style="line-height:20px">
删除操作会彻底删除版本库及源码,一旦删除不能恢复</br>
你确定删除吗?
</li>
<li class="mt10">
<label class="mr27">&nbsp;</label>
<a href="javascript:void(0);" class="sy_btn_grey fl " onclick="hideModal()">取&nbsp;&nbsp;消</a>
<!-- <a href="<%#= {:controller => 'repositories', :action => 'forked'} %>" class="sy_btn_blue fl ml20" onclick="hideModal();">确&nbsp;&nbsp;定</a>-->
<%= link_to "确 定", destroy_repository_project_path(@project, :is_true => true), :remote => true, :class => "sy_btn_blue fl ml20", :onclick => "hideModal();" %>
<div class="cl"></div>
</li>
</ul>
</div>
</div>

View File

@ -0,0 +1,6 @@
<% if @is_true %>
$("#pro_st_tbc_06").html('<%= escape_javascript( render :partial => 'projects/settings/new_repositories') %>');
<% else %>
var htmlvalue = "<%= escape_javascript(render :partial => 'projects/reposistory_destory_pop') %>";
pop_box_new(htmlvalue,460,316);
<% end %>

View File

@ -1,11 +1,12 @@
<div class="container-big mb10">
<div class="project_r_h" style="width:970px;">
<h2 class="project_h2 fl"><%= @subPage_title %></h2>
<div class="pro_new_info mb10">
<div class="project_r_h">
<h2 class="clear"><%= @subPage_title %>
<% if is_project_manager?(User.current, @project) %>
<span class="fr f14 fontGrey2" style="height: 40px; line-height: 40px; margin-right: 15px;">
<%=link_to "成员管理", :controller => 'projects', :action => 'settings', :id => @project.id, :tab => 'members' %>
<%=link_to "成员管理", settings_project_url(@project, :tab => 'members'), :id => @project.id, :class => "sy_cblue", :style => "font-weight: normal;" %>
</span>
<% end %>
</h2>
</div>
<div class="member_content">
<%= error_messages_for 'member' %>

View File

@ -9,9 +9,19 @@
<span class="ml5 mr5 mt5 fl"> / </span>
<%= link_to project.name, project_path(project), :class => "pro_new_users mt5 fl" %>
<br/>
<span class=" c_grey mt3"><%=h time_tag(project.created_on) %></span>
<span class=" c_grey mt3"><%=h time_tag(project.created_on) %></span>
</div>
</li>
<% end %>
</ul>
<div style="text-align:center;">
<div class="pages" style="width:auto; display:inline-block;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @forked_pages, @forked_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<div class="cl"></div>
</div>

View File

@ -0,0 +1,29 @@
<div class="pro_new_info mb10">
<h2 class="clear">成员<span class="fr pro_new_font mr15" > 本页面展示关注了 <%= link_to @project.owner.try(:show_name), user_path(@project.owner) %>/<%= link_to @project.name, project_path(@project) %> 的用户</span></h2>
<ul class="clear pro_new_users_box">
<% @watchers.each do |user| %>
<li class="clear">
<%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_path(user), :alt => "用户头像", :class => "pro_new_users fl mr5" %>
<div class="fl mt5 clear">
<%= link_to user.try(:show_name), user_path(user), :class => "pro_new_users mt5 fl" %>
<!-- <span class="ml5 mr5 mt5 fl"> / </span>
<%#= link_to project.name, project_path(project), :class => "pro_new_users mt5 fl" %>-->
<br/>
<span class=" c_grey mt3 fl"><%=h time_tag(user.created_on) %></span>
</div>
</li>
<% end %>
</ul>
<div style="text-align:center;">
<div class="pages" style="width:auto; display:inline-block;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @watcher_pages, @watchers_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<div class="cl"></div>
</div>

View File

@ -14,14 +14,16 @@
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<label class=" fl"><span class="c_red f12">*</span>&nbsp;版本库名称&nbsp;&nbsp;:&nbsp;</label>
<%= f.text_field :identifier, :disabled =>@repository.nil? || @repository.identifier_frozen? ? true:false, :label=>"", :no_label => true, :class => "w650 fl", :style => "height: 28px;", :id => "project_setting_repository" %>
<%= f.text_field :identifier, :disabled => @repository.nil? || @repository.identifier_frozen? ? true:false, :label=>"", :no_label => true, :class => "w650 fl", :style => "height: 28px;", :id => "project_setting_repository" %>
<span style="display: none" class="c_orange ml100" id="valid_repository_name">版本库名是无效的</span>
</li>
<li class="clear">
<label class=" fl">&nbsp;&nbsp;</label>
<p class=" fl c_grey pro_new_grey">1.长度必须在1到254个字符之间<br/>
<p class=" fl c_grey pro_new_grey">
1.长度必须在1到254个字符之间<br/>
2.仅限使用小写字母a-z、数字、破折号-和下划线_<br>
3.一旦保存,标识无法修改</p>
3.一旦保存,标识无法修改
</p>
</li>
</ul>
<a href="javascript:void(0)" onclick="cancel_for_create();" class="fr sy_btn_grey"><%=l(:button_cancel)%></a>
@ -35,14 +37,22 @@
<tr>
<th class="w130 pl10 pr10 hidden fl">版本库名</th>
<th class="w90 pr10 hidden fl">管理系统</th>
<th class="w536 hidden fl">库路径</th>
<th class="w490 hidden fl">库路径</th>
<th class="w46 hidden fl">&nbsp;</th>
</tr>
</thead>
<tbody>
<tr>
<th class="w130 pl10 pr10 hidden fl"><%= @gitlab_repository.identifier %></th>
<th class="w90 pr10 hidden fl">Git</th>
<th class="w536 hidden fl"><%=h @repos_url %></th>
<th class="w490 hidden fl"><%=h @repos_url %></th>
<th class="w46 hidden fl">
<% if is_project_manager?(User.current.id, @project.id) %>
<%= link_to "删除", destroy_repository_project_path(@project), :class => "c_blue", :remote => true %>
<% else %>
<%= "删除" %>
<% end %>
</th>
</tr>
</tbody>
</table>

View File

@ -1,11 +1,11 @@
<!--新版项目头部结束-->
<div class="ke-block pro_new_info mb10 break_word" style="padding-bottom: 5px" >
<div class="ke-block pro_new_info mb10 " style="padding-bottom: 5px;word-break: normal;word-wrap: break-word" >
<div id="project_invite_code"><%= render :partial => 'projects/invite_code' %></div>
<div id="project_description_code" style="padding: 0 15px 10px 15px;">
<% if @project.description.blank? %>
<p class="break_word" style="padding-top:5px"><%= @project.name %></p>
<p style="padding-top:5px"><%= @project.name %></p>
<% else %>
<p class="break_word" style="padding-top:5px"><%=h @project.description.html_safe %></p>
<p style="padding-top:5px"><%=h @project.description.html_safe %></p>
<% end %>
</div>
</div>

View File

@ -1,28 +1,29 @@
<div class="container-big mb10">
<div class="project_r_h" style="width:970px;">
<h2 class="project_h2"><%= l(:label_user_watcher)%></h2>
<div class="pro_new_info mb10">
<h2 class="clear">成员<span class="fr pro_new_font mr15" > 本页面展示关注了 <%= link_to @project.owner.try(:show_name), user_path(@project.owner) %>/<%= link_to @project.name, project_path(@project) %> 的用户</span></h2>
<ul class="clear pro_new_users_box">
<% @watchers.each do |user| %>
<li class="clear">
<%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_path(user), :alt => "用户头像", :class => "pro_new_users fl mr5" %>
<div class="fl mt5 clear">
<%= link_to user.try(:show_name), user_path(user), :class => "pro_new_users mt5 fl" %>
<!-- <span class="ml5 mr5 mt5 fl"> / </span>
<%#= link_to project.name, project_path(project), :class => "pro_new_users mt5 fl" %>-->
<br/>
<span class=" c_grey mt3 fl"><%=h time_tag(user.created_on) %></span>
</div>
</li>
<% end %>
</ul>
<div style="text-align:center;">
<div class="pages" style="width:auto; display:inline-block;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @watcher_pages, @watchers_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
<div class="st_list2" style="width:970px;">
<div class="st_box">
<a href="#" class="fr fb mb5" >加入时间</a>
<div class="cl"></div><!--st_box_top end-->
<% for user in @project.watcher_users %>
<div class="st_boxlist">
<a href="javascript:" class="st_img">
<%= user.nil? ? '' : (image_tag(url_to_avatar(user), :width => 32, :height => 32)) %>
</a>
<span class="fl ml10 c_grey"><%= l(:label_username)%></span>
<%= link_to(user.name, user_path(user),:class => "ml10 c_blue02") %>
<span class="fr c_grey"><%= format_date(user.created_on) %></span>
</div>
<div class="cl"></div>
<% end%>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
</div>
<% html_title(l(:label_followers)) -%>
</div>

View File

@ -12,9 +12,9 @@
<% if @forked_project.nil? %>
<%= select_tag :branch, options_for_select(@source_rev), :id => "pull_request_branch", :name => "target_branch", :value => "target_branch",:class => "fl PullReques_minselect ml5" %>
<% else %>
<select onchange="choice_branch(this.value, document.getElementById('pull_request_branch'), <%= @source_rev %>, <%= @forked_rev %>);" id="target_project_id" name="target_project_id" value="target_project_id" class="fl PullReques_minselect">
<option id="source_project_name" name="<%= @project.id %>" value="<%= @project.id %>" ><%= @source_project_name %></option>
<option id="target_project_name" name="<%= @forked_project.id %>" value="<%= @forked_project.id %>" ><%= @forked_project_name %></option>
<select onchange="choice_branch(this.value, document.getElementById('pull_request_branch'), <%= @source_rev %>, <%= @forked_rev %>, <%= @project.id %>, <%= @project.forked_from_project_id %>);" id="target_project_id" name="target_project_id" value="target_project_id" class="fl PullReques_minselect">
<option id="source_project_name" name="source_project_name" value="<%= @project.id %>" ><%= @source_project_name %></option>
<option id="target_project_name" name="forked_project_name" value="<%= @forked_project.id %>" ><%= @forked_project_name %></option>
</select>
<select name="target_branch" id="pull_request_branch" class = "fl PullReques_minselect ml5" >
<% @source_rev.each do |rev| %>

View File

@ -31,15 +31,7 @@
改动已合并至 <%= @request.target_branch %> 分支
</div>
<% else %>
<% if is_project_manager?(User.current.id, @project.id) %>
<% if @request.state == "closed" %>
该请求已被关闭
<% else %>
<div class="alert alert-orange mb15 ">
在管理员接受后,将由系统自动合并。<%= link_to "接受", accept_pull_request_project_pull_request_path(@request.id, :project_id => @project.id), :class => "linkBlue2", :remote => true %></a>
</div>
<% end %>
<% end %>
<%= render "show_container" %>
<% end %>

View File

@ -0,0 +1,15 @@
<% if @request.state == "closed" %>
<div class="alert alert-orange mb15 ">
该请求已被关闭
</div>
<% elsif @commits_count == 0 %>
<div class="alert alert-orange mb15 ">
项目分支 <%= @request.source_branch %> 和 <%= @request.target_branch %> 似乎没有差异,请将新改动提交至源分支或者切换到其它目标分支
</div>
<% else %>
<% if is_project_manager?(User.current.id, @project.id) %>
<div class="alert alert-orange mb15 ">
在管理员接受后,将由系统自动合并。<%= link_to "接受", accept_pull_request_project_pull_request_path(@request.id, :project_id => @project.id), :class => "linkBlue2", :remote => true %></a>
</div>
<% end %>
<% end %>

View File

@ -3,9 +3,18 @@
<div class="new_roadmap_conbox mb10" >
<div class="new_roadmap_navbox clear">
<ul class="new_roadmap_nav fl" >
<li class="new_roadmap_nav_hover"><%= link_to "待处理<span class='new_roadmap_nav_taghover ml5'>#{@requests_opened_count}</span>".html_safe, project_pull_requests_path(:type => "1"), :remote => true, :class => "new_roadmap_type_nomal" %></li>
<li><%= link_to "已处理<span class='new_roadmap_nav_tagnomal ml5'>#{@requests_merged_count}</span>".html_safe, project_pull_requests_path(:type => "2"), :remote => true, :class => "new_roadmap_type_nomal" %></li>
<li><%= link_to "已关闭<span class='new_roadmap_nav_tagnomal ml5'>#{@requests_closed_count}</span>".html_safe, project_pull_requests_path(:type => "3"), :remote => true, :class => "new_roadmap_type_nomal" %></li>
<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'>#{@requests_opened_count}</span>".html_safe,
project_pull_requests_path(:type => "1"), :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_1" %>
</li>
<li id="new_roadmap_nav_2" onclick="HoverLi(2);">
<%= link_to "已处理<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_2'>#{@requests_merged_count}</span>".html_safe,
project_pull_requests_path(:type => "2"), :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_2" %>
</li>
<li id="new_roadmap_nav_3" onclick="HoverLi(3);">
<%= link_to "已关闭<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_3'>#{@requests_closed_count}</span>".html_safe,
project_pull_requests_path(:type => "3"), :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_3" %>
</li>
</ul>
<% if allow_pull_request(@project) && User.current.member_of?(@project) %>
<%= link_to "创建Pull Request", new_project_pull_request_path, :class => "btn btn-green fr mr15 mt10" %>
@ -34,11 +43,23 @@
<script>
// $("#mergeBanner").parent().css({"width":"730px","background-color":"#fff","padding":"10px","margin-left":"10px","margin-bottom":"10px"});
// $("#mergeBanner").parent().before("<div class='homepageRightBanner mb10'><span class='f16 fontGrey3'>Pull Request</span></div>");
function g(o){
return document.getElementById(o);
}
function HoverLi(n){
//如果有N个标签,就将i<=N;
for(var i=1;i<=3;i++){
g('new_roadmap_nav_'+i).className='new_roadmap_nav_nomal';
g('new_roadmap_type_'+i).className='new_roadmap_type_nomal';
g('new_roadmap_num_'+i).className='new_roadmap_nav_tagnomal';
g('pull_requests_list').className='undis';
}
g('new_roadmap_nav_'+n).className='new_roadmap_nav_hover';
g('new_roadmap_type_'+n).className='new_roadmap_type_hover';
g('new_roadmap_num_'+n).className='new_roadmap_nav_taghover';
g('pull_requests_list').className='dis';
}
$(".new_roadmap_nav li").click(function(){
$(".new_roadmap_nav li").removeClass("new_roadmap_nav_hover");
$(this).addClass("new_roadmap_nav_hover");
});
</script>
<% else %>
<%= render :partial => "projects/no_data" %>

View File

@ -14,28 +14,31 @@
<div class="pr">
<span class="fl ml25 fontGrey2">关联项目:</span>
<div class="fl projectName">
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? || User.current.allowed_to?(:as_teacher, @homework.course) %>
<% if student_work.project.status != 9 && (student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? || User.current.allowed_to?(:as_teacher, @homework.course)) %>
<%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fl hidden', :style => "max-width:550px;", :title => "项目名称", :target => "_blank" %>
<% else %>
<% elsif student_work.project.status != 9 %>
<span class="fontBlue fr hidden" style="max-width:550px;" title="该项目是私有的"><%= student_work.project.name %></span>
<% end %>
<% else %>
<span class="fontGrey2 fr hidden" style="max-width:550px;" title="该项目已删除"><%= student_work.project.name %>(已删除)</span><% end %>
<% project = student_work.project %>
<div class="score-tip none tl f12" style="width:300px; top:-48px; right:-372px;">
<em style="bottom:45px;"></em>
<font style="bottom:45px;"></font>
<p class="fb break_word mw280"><%= project.name %></p>
<p class="fb break_word mw280"><%= project.name %><%= project.status == 9 ? "(已删除)" : ""%></p>
<p class="mb10">
<span class="mr15">创建者:<%= project.creater %></span><span>成员数量:<%= project.members.count %></span></p>
<% project_score = project.project_score %>
<p>项目综合得分:<%= static_project_score(project_score).to_i %></p>
<p>项目综合得分:<%= project.status == 9 ? 0 : static_project_score(project_score).to_i %></p>
<% if project.status != 9 %>
<p>= 代码提交得分 + issue得分 + 资源得分 + 帖子得分</p>
<p>= <%= (project_score.changeset_num||0) * 4 %>
+ <%= project_score.issue_num * 4 + project_score.issue_journal_num %> + <%= project_score.attach_num * 5 %>
+ <%= project_score.board_num * 2 + project_score.board_message_num + project_score.news_num %></p>
<% end %>
</div>
</div>
</div>

View File

@ -1,13 +1,15 @@
<div class="syllabus_courses_box">
<% projects.each do |project|%>
<% allow_visit = project.is_public || User.current.member_of?(project) || User.current.admin? || User.current.allowed_to?(:as_teacher, @homework.course) %>
<% allow_visit = project.status != 9 && (project.is_public || User.current.member_of?(project) || User.current.admin? || User.current.allowed_to?(:as_teacher, @homework.course)) %>
<div class="syllabus_courses_list" style="cursor: default">
<div class="sy_courses_open">
<h3>
<% if allow_visit %>
<%= link_to "#{project.name}", project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "new_project_title fl",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>
<% else %>
<% elsif project.status != 9 %>
<a href="javascript:void(0)" class="new_project_title fl" title="私有项目不可访问"><%=project.name %></a>
<% else %>
<a href="javascript:void(0)" class="new_project_title fl" title="项目已删除"><%=project.name %></a>
<% end %>
</h3>
<span class="<%= project.is_public? ? 'syllabus_class_open' : 'syllabus_class_private' %> fl ml10 mt3 syllabus_class_property"><%= project.is_public? ? '公开' : '私有' %></span>

View File

@ -36,8 +36,8 @@
<% end %>
<span class="<%= course.is_public == 0 ? 'hw_icon_private' : 'hw_icon_open' %> fl mr20 mt3"></span>
<div class="cl"></div>
<p class="sy_cgrey">
<span class=" mr15">创建老师:<%=link_to course.teacher.show_name, user_path(course.teacher), :class => 'sy_cblue' %></span>
<div class="sy_cgrey">
<p class="mr15 hidden fl" style="max-width: 140px;">创建老师:<%=link_to course.teacher.show_name, user_path(course.teacher), :class => 'sy_cblue', :title => "#{course.teacher.show_name}" %></p>
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,course) %>
<% homework_num = course.homework_commons.count %>
<% else %>
@ -59,7 +59,7 @@
</span>
<span class=" mr15">学期:<%= current_time_and_term course %></span>
<span class=" mr15">更新时间:<%= format_date(course.updated_on) %></span>
</p>
</div>
</div>
<% if @list_type == 0 %>
<% if User.current.member_of_course?(course) %>

View File

@ -1,8 +1,8 @@
<div class="orig_cont clearfix">
<% unless comment.parent.nil? %>
<div>
<%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id} %>
<%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
</div>
<% end %>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => comment, :type => type, :user_activity_id => user_activity_id} %>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => comment, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
</div>

View File

@ -28,7 +28,7 @@
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id},
{:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id},
:remote => true,
:method => 'get',
:title => l(:button_reply)) %>
@ -39,7 +39,7 @@
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id},
{:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id},
:remote => true,
:method => 'get',
:title => l(:button_reply)) %>

View File

@ -1,7 +1,7 @@
<div class = "cl"> </div>
<div id="course-boardlist">
<div class="listbox mt10" >
<h2 class="list-h2">讨论区列表</h2>
<p class="list-h2">讨论区列表</p>
<div class="category">
<span class="grayTxt ">排序:</span>
<%= link_to "时间", {:controller => 'boards', :action => 'index', :board_id =>@board.id, :type => @type, :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
@ -20,9 +20,9 @@
<div class="list-file">
<div><span class="item_list fl"></span>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :class => "list-title fl" %>
<%= link_to activity.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :class => "list-title-normal fl" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :class => "list-title f1" %>
<%= link_to activity.parent.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :class => "list-title-normal f1" %>
<% end %>
<% if activity.sticky == 1 %>
<span class="fl ml10 red-cir-btn">顶</span>
@ -30,20 +30,20 @@
<% if activity.locked %>
<span class="fl ml10 green-cir-btn" title="已锁定">锁</span>
<% end %>
<% u = User.where("id=?",activity.author_id).first%>
<%# u = User.where("id=?",activity.author_id).first%>
<div class="cl"></div>
</div>
<div class="massages-content ml15">
<% if activity.parent_id.nil? %>
<% content = activity.content %>
<% else %>
<% content = activity.parent.content %>
<% end %>
<p><%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54, :maxwordsnum=>75, :maxwidth=>563} %></p>
</div>
<!--<div class="massages-content ml15">-->
<!--<%# if activity.parent_id.nil? %>-->
<!--<% content = activity.content %>-->
<!--<%# else %>-->
<!--<%# content = activity.parent.content %>-->
<!--<%# end %>-->
<!--<p><%#=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54, :maxwordsnum=>75, :maxwidth=>563} %></p>-->
<!--</div>-->
<div class="ml15 mt10">
<span class="grayTxt">
发帖人: <%=(u.try(:realname) != " " ? u.lastname + u.firstname : u.try(:login)) %>
<span class="grayTxt mr15">
发帖人:<%= link_to activity.author.show_name, user_path(activity.author), :class => "link-blue" %>
</span>
<span class="grayTxt">更新:<%= format_time(activity.children.any? ? activity.children.last[:created_on] : activity[:created_on] ) %></span>
<% all_comments = []%>

View File

@ -1,7 +1,7 @@
<div class = "cl"> </div>
<div id="course-newslist">
<div class="listbox mt10" >
<h2 class="list-h2">通知列表</h2>
<p class="list-h2">通知列表</p>
<div class="category">
<span class="grayTxt ">排序:</span>
<%= link_to "时间", {:controller => 'news', :action => 'index', :type => @type, :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
@ -19,18 +19,19 @@
<% topics.each do |activity| %>
<div class="list-file">
<div><span class="item_list fl"></span>
<%= link_to activity.title.to_s, User.current.logged? ? news_path(activity) : signin_url_without_domain, :class => "list-title fl" %>
<%= link_to activity.title.to_s, User.current.logged? ? news_path(activity) : signin_url_without_domain, :class => "list-title-normal fl" %>
<% if activity.sticky == 1 %>
<span class="fl ml10 red-cir-btn">顶</span>
<% end%>
<% u = User.where("id=?",activity.author_id).first%> <div class="cl"></div>
</div>
<div class="massages-content ml15">
<p><%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>activity.description, :maxheight=>54, :maxwordsnum=>100, :maxwidth=>563} %></p>
<% u = User.where("id=?",activity.author_id).first%>
<div class="cl"></div>
</div>
<!--<div class="massages-content ml15">-->
<!--<p><%#=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>activity.description, :maxheight=>54, :maxwordsnum=>100, :maxwidth=>563} %></p>-->
<!--</div>-->
<div class="ml15 mt10">
<span class="grayTxt">
发布者: <%= activity.author.show_name %>
<span class="grayTxt mr15">
发布者:<%= link_to activity.author.show_name, user_path(activity.author), :class => "link-blue" %>
</span>
<span class="grayTxt">更新:<%= format_time(activity.course_acts.first.try(:updated_at)) %></span>
<% count=0 %>

View File

@ -1,8 +1,8 @@
<div class="orig_cont clearfix">
<% if !comment.parent.nil? && !comment.parent.parent.nil? %>
<div>
<%=render :partial => 'users/journal_comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id} %>
<%=render :partial => 'users/journal_comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
</div>
<% end %>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => comment, :type => type, :user_activity_id => user_activity_id} %>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => comment, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
</div>

View File

@ -8,21 +8,21 @@
<% length = parents_rely.length %>
<div id="comment_reply_<%=comment.id %>">
<% if length <= 2 %>
<%=render :partial => 'users/journal_comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id} %>
<%=render :partial => 'users/journal_comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id, :parent_id => comment.id} %>
<% else %>
<div class="orig_cont clearfix">
<div class="orig_cont clearfix">
<!--<div>-->
<!--<%#=render :partial => 'users/journal_comment_reply', :locals => {:comment => parents_rely[length - 1]} %>-->
<!--</div>-->
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 1], :type => type, :user_activity_id => user_activity_id} %>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 1], :type => type, :user_activity_id => user_activity_id, :parent_id => comment.id} %>
</div>
<div class="orig_cont_hide clearfix">
<span class="orig_icon" >&darr; </span>
<span class="orig_icon" style="display:none;" > &uarr;</span><span class="">已经隐藏<%=(length - 2).to_s %>个楼层</span>
<%= link_to '[点击展开]', show_all_replies_users_path(:comment => comment, :type => comment.class),:remote=>true, :class => 'linkBlue2' %>
<%= link_to '[点击展开]', show_all_replies_users_path(:comment => comment, :type => comment.class, :user_activity_id => user_activity_id, :parent_id => comment.id),:remote=>true, :class => 'linkBlue2' %>
</div>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0], :type => type, :user_activity_id => user_activity_id} %>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0], :type => type, :user_activity_id => user_activity_id, :parent_id => comment.id} %>
</div>
<% end %>
</div>

View File

@ -8,21 +8,21 @@
<% length = parents_rely.length %>
<div id="comment_reply_<%=comment.id %>">
<% if length <= 2 %>
<%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id} %>
<%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id, :parent_id => comment.id} %>
<% else %>
<div class="orig_cont clearfix">
<div class="orig_cont clearfix">
<!--<div>-->
<!--<%#=render :partial => 'users/comment_reply', :locals => {:comment => parents_rely[length - 1]} %>-->
<!--</div>-->
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 1], :type => type, :user_activity_id => user_activity_id} %>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 1], :type => type, :user_activity_id => user_activity_id, :parent_id => comment.id} %>
</div>
<div class="orig_cont_hide clearfix">
<span class="orig_icon" >&darr; </span>
<span class="orig_icon" style="display:none;" > &uarr;</span><span class="">已经隐藏<%=(length - 2).to_s %>个楼层</span>
<%= link_to '[点击展开]', show_all_replies_users_path(:comment => comment, :type => comment.class), :remote=>true, :class => 'linkBlue2' %>
<%= link_to '[点击展开]', show_all_replies_users_path(:comment => comment, :type => comment.class, :user_activity_id => user_activity_id, :parent_id => comment.id), :remote=>true, :class => 'linkBlue2' %>
</div>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0], :type => type, :user_activity_id => user_activity_id} %>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0], :type => type, :user_activity_id => user_activity_id, :parent_id => comment.id} %>
</div>
<% end %>
</div>

View File

@ -1,7 +1,7 @@
<div class = "cl"> </div>
<div id="project-boardlist">
<div class="container-big mt10" >
<h2 class="list-h2">讨论区列表</h2>
<p class="list-h2">讨论区列表</p>
<div class="category">
<span class="grayTxt ">排序:</span>
<%= link_to "时间", {:controller => 'boards', :action => 'index', :type => @type, :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
@ -20,9 +20,9 @@
<div class="list-file">
<div><span class="item_list fl"></span>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :class=> "list-title fl", :style => "max-width:950px;" %>
<%= link_to activity.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :class=> "list-title-normal fl", :style => "max-width:950px;" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :class=> "list-title f1", :style => "max-width:950px;" %>
<%= link_to activity.parent.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :class=> "list-title-normal f1", :style => "max-width:950px;" %>
<% end %>
<% if activity.sticky == 1 %>
<span class="fl ml10 red-cir-btn">顶</span>
@ -30,20 +30,20 @@
<% if activity.locked %>
<span class="fl ml10 green-cir-btn" title="已锁定">锁</span>
<% end %>
<% u = User.where("id=?",activity.author_id).first%>
<%# u = User.where("id=?",activity.author_id).first%>
<div class="cl"></div>
</div>
<div class="ml15">
<% if activity.parent_id.nil? %>
<% content = activity.content %>
<% else %>
<% content = activity.parent.content %>
<% end %>
<p><%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54, :maxwordsnum=>225, :maxwidth=>950} %></p>
</div>
<!--<div class="ml15">-->
<!--<%# if activity.parent_id.nil? %>-->
<!--<%# content = activity.content %>-->
<!--<%# else %>-->
<!--<%# content = activity.parent.content %>-->
<!--<%# end %>-->
<!--<p><%#=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54, :maxwordsnum=>225, :maxwidth=>950} %></p>-->
<!--</div>-->
<div class="ml15 mt10 f12">
<span class="grayTxt">
发帖人:<%=(u.try(:realname) != " " ? u.try(:lastname) + u.try(:firstname) : u.try(:login)) unless u.nil? %>
<span class="grayTxt mr15">
发帖人<%= link_to activity.author.show_name, user_path(activity.author), :class => "link-blue" %>
</span>
<span class="grayTxt">更新:<%= format_time(activity.children.any? ? activity.children.last[:created_on] : activity[:created_on] ) %></span>
<% all_comments = []%>

View File

@ -2,7 +2,9 @@
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.author), :width => "30", :height => "30"),user_path(ma.author) %></a></li>
<li class="homepageNewsPubType fl">
<span class="newsBlue homepageNewsPublisher"><%= ma.author.login %></span><span class="homepageNewsType fl">提到了你:</span>
<span class="newsBlue homepageNewsPublisher">
<%= link_to ma.author.show_name, user_path(ma.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
</span><span class="homepageNewsType fl">提到了你:</span>
</li>
<li class="homepageNewsContent fl">
<% if ma.at_message_type == "Message" && !ma.at_message.course.nil? %>

View File

@ -1,5 +1,5 @@
<div class="listbox" id="course-list">
<h2 class="list-h2">课程列表</h2>
<p class="list-h2">课程列表</p>
<div class="category">
<span class="grayTxt ">排序:</span>
<%= link_to "时间", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
@ -19,7 +19,7 @@
<ul class="list-file">
<li>
<span class="item_list fl"></span>
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), :class => "list-title fl #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}",
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), :class => "list-title-normal fl #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}",
:style => 'color:#000',:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级:")+course.name+""+current_time_and_term(course)+""%>
<% teacher = User.where("id=?",course.tea_id).first%>
<span class="fr grayTxt">

View File

@ -1,55 +1,55 @@
<% unless list.nil?%>
<% for item in list %>
<div class="courses_list line" id="fans_item_<%=item.id%>">
<div class="courses_list_pic fl">
<a href="<%= user_path(item) %>">
<%= image_tag(url_to_avatar(item), :style=>"width:64px;height:64px;",:alt=>"头像") %>
</a>
</div>
<div class="courses_list_info fl ml10">
<a href="<%= user_path(item) %>" title="<%= item.show_name %>" class="courses_list_title f14 fb c_blue02 fl"><%= item.show_name %></a>
<div class="cl"></div>
<div class="courses_list_table ">
<% if item.user_extensions && !item.user_extensions.brief_introduction.nil? && !item.user_extensions.brief_introduction.empty? %>
<p class="fans_sign" title="<%= item.user_extensions.brief_introduction %>">个性签名:<%= item.user_extensions.brief_introduction %></p>
<% for item in list %>
<div class="courses_list line" id="fans_item_<%=item.id%>">
<div class="courses_list_pic fl">
<a href="<%= user_path(item) %>">
<%= image_tag(url_to_avatar(item), :style=>"width:64px;height:64px;",:alt=>"头像") %>
</a>
</div>
<div class="courses_list_info fl ml10">
<a href="<%= user_path(item) %>" title="<%= item.show_name %>" class="courses_list_title f14 fb c_blue02 fl"><%= item.show_name %></a>
<div class="cl"></div>
<div class="courses_list_table ">
<% if item.user_extensions && !item.user_extensions.brief_introduction.nil? && !item.user_extensions.brief_introduction.empty? %>
<p class="fans_sign" title="<%= item.user_extensions.brief_introduction %>">个性签名:<%= item.user_extensions.brief_introduction %></p>
<% end %>
<table><tbody><tr>
<td class="td_w60 ">加入时间:</td>
<td class="td_w110 "><%= format_date(item.created_on) %></td>
<% if (item.user_extensions.identity == 0 || item.user_extensions.identity == 1) && !item.user_extensions.school.nil? %>
<td class="td_w60 ">工作单位:</td>
<td class="td_w110 ">
<li style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="<%= item.user_extensions.school.name %>">
<a href="<%= url_for(:controller=>'welcome',:action => 'course', :school_id => item.user_extensions.school.id,:host=>Setting.host_course) %>"><%= item.user_extensions.school.name %></a>
</li>
</td>
<% elsif item.user_extensions.identity == 3 && !item.user_extensions.occupation.nil? && !item.user_extensions.occupation.empty? %>
<td class="td_w60 ">工作单位:</td>
<td class="td_w110 ">
<li style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="<%= item.user_extensions.occupation %>">
<%= item.user_extensions.occupation %>
</li>
</td>
<% elsif item.user_extensions.identity == 2 %>
<td class="td_w60 ">工作单位:</td>
<td class="td_w110 ">
<li style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="<%= item.show_name %>">
<%= item.show_name %>
</li>
</td>
<% end %>
</tr></tbody></table>
</div>
</div>
<!-- 如果只有自己的关注页面才能关注人 取消关注操作,那么还要加 一句&& User.current.id == target.id-->
<% if(User.current.logged? && User.current != item )%>
<%if(item.watched_by?(User.current))%>
<a href="<%= watch_path(:object_type=>'user',:object_id=>item.id,:target_id=>target.id,:action_name=>action_name,:page=>page) %>" class="grey_n_btn fr mt20" data-method="delete" data-remote="true" title="取消关注">取消关注</a>
<% else %>
<a href="<%= watch_path(:object_type=>'user',:object_id=>item.id,:target_id=>target.id,:action_name=>action_name,:page=>page) %>" class="blue_n_btn fr mt20" data-method="post" data-remote="true" title="添加关注">添加关注</a>
<% end %>
<% end %>
<table><tbody><tr>
<td class="td_w60 ">加入时间:</td>
<td class="td_w110 "><%= format_date(item.created_on) %></td>
<% if (item.user_extensions.identity == 0 || item.user_extensions.identity == 1) && !item.user_extensions.school.nil? %>
<td class="td_w60 ">工作单位:</td>
<td class="td_w110 ">
<li style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="<%= item.user_extensions.school.name %>">
<a href="<%= url_for(:controller=>'welcome',:action => 'course', :school_id => item.user_extensions.school.id,:host=>Setting.host_course) %>"><%= item.user_extensions.school.name %></a>
</li>
</td>
<% elsif item.user_extensions.identity == 3 && !item.user_extensions.occupation.nil? && !item.user_extensions.occupation.empty? %>
<td class="td_w60 ">工作单位:</td>
<td class="td_w110 ">
<li style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="<%= item.user_extensions.occupation %>">
<%= item.user_extensions.occupation %>
</li>
</td>
<% elsif item.user_extensions.identity == 2 %>
<td class="td_w60 ">工作单位:</td>
<td class="td_w110 ">
<li style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="<%= item.show_name %>">
<%= item.show_name %>
</li>
</td>
<% end %>
</tr></tbody></table>
<div class="cl"></div>
</div>
</div>
<!-- 如果只有自己的关注页面才能关注人 取消关注操作,那么还要加 一句&& User.current.id == target.id-->
<% if(User.current.logged? && User.current != item )%>
<%if(item.watched_by?(User.current))%>
<a href="<%= watch_path(:object_type=>'user',:object_id=>item.id,:target_id=>target.id,:action_name=>action_name,:page=>page) %>" class="grey_n_btn fr mt20" data-method="delete" data-remote="true" title="取消关注">取消关注</a>
<% else %>
<a href="<%= watch_path(:object_type=>'user',:object_id=>item.id,:target_id=>target.id,:action_name=>action_name,:page=>page) %>" class="blue_n_btn fr mt20" data-method="post" data-remote="true" title="添加关注">添加关注</a>
<% end %>
<% end %>
<div class="cl"></div>
</div>
<% end %>
<% end %>
<% end %>

View File

@ -2,6 +2,6 @@
<% if ma.status != 0 %>
<span class="newsBlue homepageNewsPublisher">系统提示</span>
<% else %>
<%=link_to User.where("id=?", ma.applied_user_id).first.show_name, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<%=link_to User.where("id=?", ma.applied_user_id).first.show_name, user_path(ma.applied_user_id), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<% end %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>"><%= applied_school_tip(ma) %></span>

View File

@ -1,8 +1,15 @@
<% if ma.class == CourseMessage %>
<% if ma.course_message_type == "News" && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"),user_path(ma.course_message.author), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了通知:</span></li>
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);">
<%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"),user_path(ma.course_message.author), :target => '_blank' %>
</a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了通知:</span>
</li>
<li class="homepageNewsContent fl">
<%= link_to ma.course_message.title, {:controller => 'news', :action => 'show', :id => ma.course_message.id },
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
@ -22,7 +29,7 @@
<% if ma.course_message_type == "Comment" && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">评论了通知:</span></li>
<li class="homepageNewsPubType fl"><%=link_to User.find(ma.course_message.author_id).show_name, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">评论了通知:</span></li>
<li class="homepageNewsContent fl">
<%= link_to ma.course_message.commented.title, {:controller => 'news', :action => 'show', :id => ma.course_message.commented.id },
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" , :target => '_blank'%>
@ -291,7 +298,7 @@
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl">
<%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">
<%=link_to ma.course_message.author.show_name, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">
<%= ma.course_message.parent_id.nil? ? "发布了班级帖子:" : "评论了班级帖子:" %></span></li>
<% if ma.course_message.parent_id.nil? %>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
@ -615,7 +622,7 @@
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id), :target => '_blank' %></a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<%=link_to User.find(ma.course_message_id).show_name, user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">将您加入了班级:</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
@ -683,7 +690,7 @@
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id), :target => '_blank' %></a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<%=link_to User.find(ma.course_message_id).show_name, user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">将您移出了班级:</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">

View File

@ -26,7 +26,7 @@
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(User.find(ma.forge_message_id)), :width => "30", :height => "30"), user_path(ma.forge_message_id), :target => '_blank' %></a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to User.find(ma.forge_message_id), user_path(User.find(ma.forge_message_id)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<%=link_to User.find(ma.forge_message_id).show_name, user_path(User.find(ma.forge_message_id)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">将您加入了项目:</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
@ -47,7 +47,7 @@
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(User.find(ma.forge_message_id)), :width => "30", :height => "30"), user_path(ma.forge_message_id), :target => '_blank' %></a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to User.find(ma.forge_message_id), user_path(User.find(ma.forge_message_id)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<%=link_to User.find(ma.forge_message_id).show_name, user_path(User.find(ma.forge_message_id)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">将您移出了项目:</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
@ -99,11 +99,15 @@
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author), :target => '_blank' %></a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>"><%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%></span>
<%=link_to User.find(ma.forge_message.author_id).show_name, user_path(ma.forge_message.author),
:class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">
<%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%>
</span>
</li>
<li class="homepageHomeworkContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.forge_message.subject, issue_path(:id => ma.forge_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
<%= link_to ma.forge_message.subject, issue_path(:id => ma.forge_message.id),
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
<!--:onmouseover => "message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a>
@ -117,8 +121,11 @@
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author), :target => '_blank' %></a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>"><%= ma.forge_message.tracker_id == 5 ? "发布了周报:":"指派了问题给你:"%></span>
<%=link_to User.find(ma.forge_message.author_id).show_name, user_path(ma.forge_message.author),
:class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">
<%= ma.forge_message.tracker_id == 5 ? "发布了周报:":"指派了问题给你:"%>
</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.forge_message.subject, issue_path(:id => ma.forge_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
@ -133,10 +140,12 @@
<% if ma.forge_message_type == "Journal" && ma.forge_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.forge_message.user), :width => "30", :height => "30"), user_path(ma.forge_message.user), :target => '_blank' %></a>
<a href="javascript:void(0);">
<%=link_to image_tag(url_to_avatar(ma.forge_message.user), :width => "30", :height => "30"), user_path(ma.forge_message.user), :target => '_blank' %>
</a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to ma.forge_message.user, user_path(ma.forge_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<%= link_to User.find(ma.forge_message.user_id).show_name, user_path(ma.forge_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">
更新了问题状态:</span>
</li>
@ -153,7 +162,7 @@
<% if ma.forge_message_type == "Message" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<li class="homepageNewsPubType fl"><%=link_to User.find(ma.forge_message.user_id).show_name, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %></span></li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.forge_message.subject, board_message_path(ma.forge_message.board_id, ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
@ -166,9 +175,16 @@
<% end %>
<% if ma.forge_message_type == "Comment" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">评论了新闻:</span></li>
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);">
<%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author), :target => '_blank' %>
</a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to User.find(ma.forge_message.user_id).show_name, user_path(ma.forge_message.author),
:class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">评论了新闻:</span>
</li>
<li class="homepageNewsContent fl">
<%= link_to "#{ma.forge_message.commented.title}",
{:controller => 'news', :action => 'show', :id => ma.forge_message.commented.id },:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>

View File

@ -5,7 +5,7 @@
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.memo.author), :width => "30", :height => "30"), user_path(ma.memo.author), :target => '_blank' %></a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to ma.memo.author, user_path(ma.memo.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<%=link_to User.find(ma.memo.author_id).show_name, user_path(ma.memo.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>" ><%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %></span>
</li>
<% if ma.memo.parent_id.nil? %>

View File

@ -2,11 +2,16 @@
<% if ma.journals_for_message_type == "JournalsForMessage" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.journals_for_message.user), :width => "30", :height => "30"), user_path(ma.journals_for_message.user), :target => '_blank' %></a>
<a href="javascript:void(0);">
<%=link_to image_tag(url_to_avatar(ma.journals_for_message.user), :width => "30", :height => "30"),
user_path(ma.journals_for_message.user), :target => '_blank' %>
</a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to ma.journals_for_message.user, user_path(ma.journals_for_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %></span>
<%=link_to User.find(ma.journals_for_message.user_id).show_name, user_path(ma.journals_for_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">
<%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %>
</span>
</li>
<li class="homepageNewsContent fl">
<%= link_to message_content(ma.journals_for_message.notes), feedback_path(ma.journals_for_message.jour_id, :anchor => "user_activity_#{ma.journals_for_message.id}"), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank'%>

View File

@ -82,7 +82,7 @@
<div class="listbox" id="project-list">
<h2 class="list-h2">项目列表</h2>
<p class="list-h2">项目列表</p>
<div class="category">
<span class="grayTxt ">排序:</span>
<%= link_to "时间", {:controller => 'users', :action => 'user_projectlist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
@ -102,7 +102,7 @@
<ul class="list-file">
<li>
<span class="item_list fl"></span>
<%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "list-title fl",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>
<%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "list-title-normal fl",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>
<% projectUser = User.where("id=?",project.user_id).first%>
<span class="fr grayTxt">
<%='创建者:'+(projectUser.try(:realname) != " " ? projectUser.lastname + projectUser.firstname : projectUser.try(:login)) %>

View File

@ -1,4 +1,4 @@
<% if params[:type] == 'Message' %>
<% if @type == 'Message' %>
<% if @user_activity_id.to_i != @root.id %>
<% if @is_project %>
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'projects/project_message_post_reply', :locals => {:activity => @root,:user_activity_id =>@user_activity_id}) %>");
@ -10,23 +10,23 @@
<% else %>
window.location.href = "<%=board_message_path(@root.board_id, @root) %>";
<% end %>
<% elsif params[:type] == 'HomeworkCommon' %>
<% elsif @type == 'HomeworkCommon' %>
$("#homework_post_reply_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/homework_post_reply', :locals => {:activity => @root, :user_activity_id => @user_activity_id, :is_teacher => @is_teacher}) %>");
<% elsif params[:type] == 'BlogComment' %>
<% elsif @type == 'BlogComment' %>
<% if @user_activity_id.to_i != @root.id %>
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/user_blog_post_reply', :locals => {:activity => @root,:user_activity_id =>@user_activity_id}) %>");
<% else %>
window.location.href = "<%=user_blog_blog_comment_path(:user_id => @root.author_id,:blog_id=>@root.blog_id,:id=>@root.id) %>";
<% end %>
<% elsif params[:type] == 'News' %>
<% elsif @type == 'News' || params[:type] == 'Comment' %>
<% if @user_activity_id.to_i != @root.id %>
$("#activity_post_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/course_news_post_reply', :locals => {:activity => @root,:user_activity_id =>@user_activity_id}) %>");
<% else %>
window.location.href = "<%=news_path(@root) %>";
<% end %>
<% elsif params[:type] == 'JournalsForMessage' %>
<% elsif @type == 'JournalsForMessage' %>
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/user_journal_post_reply', :locals => {:activity => @root,:user_activity_id =>@user_activity_id}) %>");
<% elsif params[:type] == 'Issue' %>
<% elsif @type == 'Issue' || params[:type] == 'Journal' %>
<% if @user_activity_id.to_i != @root.id %>
<% if @is_project %>
$("#div_user_issue_reply_<%=@user_activity_id%>").html("<%= escape_javascript(render :partial => 'projects/project_issue_reply', :locals => {:activity => @root, :user_activity_id => @user_activity_id}) %>");
@ -36,13 +36,13 @@ $("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(re
<% else %>
window.location.href = "<%=issue_path(@root) %>";
<% end %>
<% elsif params[:type] == 'OrgDocumentComment' %>
<% elsif @type == 'OrgDocumentComment' %>
<% if @user_activity_id.to_i != @root.id %>
$("#activity_post_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'organizations/org_document_post_reply', :locals => {:activity => @root, :user_activity_id => @user_activity_id}) %>");
<% else %>
window.location.href = "<%=org_document_comment_path(:id => @root.id, :organization_id => @root.organization.id) %>";
<% end %>
<% elsif params[:type] == 'Syllabus' %>
<% elsif @type == 'Syllabus' %>
$("#activity_post_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'syllabuses/syllabus_post_reply', :locals => {:activity => @root, :user_activity_id => @user_activity_id}) %>");
<% end %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");

View File

@ -1,10 +1,10 @@
if($("#reply_message_<%= @reply.id%>").length > 0) {
$("#reply_message_<%= @reply.id%>").replaceWith("<%= escape_javascript(render :partial => 'users/reply_to_comment', :locals => {:reply => @reply}) %>");
$("#reply_iconup_<%=@reply.id %>").show();
if($("#comment_reply_<%=@parent_id %> #reply_message_<%= @reply.id%>").length > 0) {
$("#comment_reply_<%=@parent_id %> #reply_message_<%= @reply.id%>").replaceWith("<%= escape_javascript(render :partial => 'users/reply_to_comment', :locals => {:reply => @reply}) %>");
$("#comment_reply_<%=@parent_id %> #reply_iconup_<%=@reply.id %>").show();
$(function(){
sd_create_editor_from_data(<%= @reply.id%>,null,"100%", "<%=@reply.class.to_s%>");
});
}else if($("#reply_to_message_<%= @reply.id%>").length >0) {
$("#reply_to_message_<%= @reply.id%>").replaceWith("<p id='reply_message_<%= @reply.id%>'></p>");
$("#reply_iconup_<%=@reply.id %>").hide();
}else if($("#comment_reply_<%=@parent_id %> #reply_to_message_<%= @reply.id%>").length >0) {
$("#comment_reply_<%=@parent_id %> #reply_to_message_<%= @reply.id%>").replaceWith("<p id='reply_message_<%= @reply.id%>'></p>");
$("#comment_reply_<%=@parent_id %> #reply_iconup_<%=@reply.id %>").hide();
}

View File

@ -1,9 +1,13 @@
<% unless @comment.parent.nil? %>
<% if params[:type] == 'JournalsForMessage' && (@comment.jour_type == 'Principal' || @comment.jour_type == 'Course') %>
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/journal_comment_reply', :locals => {:comment => @comment.parent, :type => params[:type]})%>");
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/journal_comment_reply', :locals => {:comment => @comment.parent, :type => params[:type], :user_activity_id => @user_activity_id, :parent_id => @parent_id})%>");
<% elsif params[:type] == 'is_project_message' %>
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'projects/journal_comment_reply', :locals => {:comment => @comment.parent, :user_activity_id => @user_activity_id, :parent_id => @parent_id})%>");
<% elsif params[:type] == 'is_project_issue' %>
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'projects/project_issue_comments_reply', :locals => {:comment => @comment.parent, :user_activity_id => @user_activity_id, :parent_id => @parent_id})%>");
<% elsif (@comment.class.to_s == 'Message' || @comment.class.to_s == 'BlogComment' || @comment.class.to_s == 'OrgDocumentComment') %>
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/journal_comment_reply', :locals => {:comment => @comment.parent, :type => params[:type]})%>");
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/journal_comment_reply', :locals => {:comment => @comment.parent, :type => params[:type], :user_activity_id => @user_activity_id, :parent_id => @parent_id})%>");
<% else %>
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/comment_reply', :locals => {:comment => @comment.parent, :type => params[:type]})%>");
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/comment_reply', :locals => {:comment => @comment.parent, :type => params[:type], :user_activity_id => @user_activity_id, :parent_id => @parent_id})%>");
<% end %>
<% end %>

View File

@ -7,39 +7,39 @@
}
</script>
<div class="courses_box" id="RSide" style="margin-left:0; margin-bottom:0; width:728px;">
<div class="courses_top mb10" id="<%= (@action == 'fans' || @action == 'visitor' ) ? 'nh_fans_list' : 'nh_wacth_list' %>">
<% if @action == 'fans' %>
<div class="courses_box" id="RSide" style="margin-left:0; margin-bottom:0; width:728px;">
<div class="courses_top mb10" id="<%= (@action == 'fans' || @action == 'visitor' ) ? 'nh_fans_list' : 'nh_wacth_list' %>">
<% if @action == 'fans' %>
<h2 class="courses_h2 fl">粉丝</h2>
<div class="courses_select fr">共有<span class="c_orange" nh_name="fans_count" id="fans_span"><%=@obj_count%></span>名粉丝</div>
<% elsif @action == 'visitor' %>
<% elsif @action == 'visitor' %>
<h2 class="courses_h2 fl">访客</h2>
<div class="courses_select fr">共有<span class="c_orange"><%=@obj_count%></span>访客</div>
<% else %>
<% else %>
<h2 class="courses_h2 fl">关注</h2>
<div class="courses_select fr">一共关注<span class="c_orange" nh_name="watcher_count" id="watch_span"><%=@obj_count%></span>人</div>
<% end %>
<% end %>
<div class="cl"></div>
</div>
<div id="users_list">
<%# for item in @list %>
<%= render :partial => 'users/user_fans_item', :locals => {:list => @list,:target=>@user,:action_name=>@action,:page=>params[:page]} %>
<%# end %>
</div>
<p id="nodata" class="nodata" style="display:<%= @list.count > 0 ? 'none' : 'block' %>;"><%= l(:label_no_data) %></p>
<div style="text-align:center;">
<div class="pages" style="width:auto; display:inline-block;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true%>
</ul>
<div class="cl"></div>
</div>
<div id="users_list">
<%# for item in @list %>
<%= render :partial => 'users/user_fans_item', :locals => {:list => @list,:target=>@user,:action_name=>@action,:page=>params[:page]} %>
<%# end %>
</div>
<p id="nodata" class="nodata" style="display:<%= @list.count > 0 ? 'none' : 'block' %>;"><%= l(:label_no_data) %></p>
<div style="text-align:center;">
<div class="pages" style="width:auto; display:inline-block;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true%>
</ul>
<div class="cl"></div>
</div>
</div>
<!--<ul class="wlist" style=" border:none;">-->
<!--<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>-->
<!--</ul>-->
<!--<div class="cl"></div>-->
</div>
<!--<ul class="wlist" style=" border:none;">-->
<!--<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>-->
<!--</ul>-->
<!--<div class="cl"></div>-->
</div>
<!--</div>-->

View File

@ -87,3 +87,4 @@

View File

@ -9,21 +9,21 @@
</tr>
</thead>
<tbody>
<tr>
<td>合计</td>
<td><%= Issue.where(:fixed_version_id => @version.id).count %> </td>
<td><%= Issue.where(:fixed_version_id => @version.id, :status_id => 3).count %></td>
<td><%= Issue.where(:fixed_version_id => @version.id, :status_id => 5).count %></td>
<td><%= Issue.where(fixed_version_id: @version.id, status_id: [1,2,4]).count %></td>
</tr>
<% @version_issue_assigned_name.each do | assigned | %>
<tr>
<td><%= User.find(assigned[0]).try(:show_name) %></td>
<td><%= User.find(assigned[0]).try(:show_name).nil? ? "未指派" : User.find(assigned[0]).try(:show_name) %></td>
<td><%= Issue.where(:fixed_version_id => @version.id, :assigned_to_id => assigned[0]).count %></td>
<td><%= Issue.where(:fixed_version_id => @version.id, :assigned_to_id => assigned[0], :status_id => 3).count %></td>
<td><%= Issue.where(:fixed_version_id => @version.id, :assigned_to_id => assigned[0], :status_id => 5).count %></td>
<td><%= Issue.where(fixed_version_id: @version.id, assigned_to_id: assigned[0], status_id: [1,2,4]).count %></td>
</tr>
<% end %>
<tr>
<td>Total</td>
<td><%= Issue.where(:fixed_version_id => @version.id).count %> </td>
<td><%= Issue.where(:fixed_version_id => @version.id, :status_id => 3).count %></td>
<td><%= Issue.where(:fixed_version_id => @version.id, :status_id => 5).count %></td>
<td><%= Issue.where(fixed_version_id: @version.id, status_id: [1,2,4]).count %></td>
</tr>
</tbody>
</table>

View File

@ -14,7 +14,7 @@
<li class="mb10 clear">
<label><span class="c_red f12">*</span>&nbsp;名称&nbsp;&nbsp;:&nbsp;</label>
<%= f.text_field :name, :maxlength => 60, :class=>"w650", :style=>"height: 28px;", :id => "popub_setting_version_name", :no_label => true %>
<p class="c_orange ml100" style="display: none" id="pupub_project_setting_version_title">标题不能为空</p>
<p class="c_orange ml100" style=" margin-left:50px;display: none" id="pupub_project_setting_version_title">标题不能为空</p>
</li>
<li class="mb10 clear">
<label class="ml5">&nbsp;描述&nbsp;&nbsp;:&nbsp;</label>

View File

@ -1,7 +1,9 @@
<% if( params[:object_type] == 'user') %>
//点击头像下面的添加关注按钮
<% if( params[:target_id] == params[:object_id] ) %>
$("#watch_user_btn_div").html("<%= escape_javascript render(:partial => "layouts/user_watch_btn", :locals => {:target => watched.first}) %>");
<% if @user %>
$("#watch_user_btn_div").html("<%= escape_javascript render(:partial => "layouts/user_watch_btn", :locals => {:target => watched.first}) %>");
<% end %>
$("#user_fans_number").html("<%= watched.first.watcher_users.count.to_s%>");
$(".add_cancel_watch_<%= watched.first.id %>").html("<%= escape_javascript (render :partial => 'users/watch_btn_for_picture', :locals => {:user => watched.first}) %>");
$(".fans_count_<%= watched.first.id %>").text("<%= watched.first.watcher_users.count.to_s %>");

View File

@ -226,7 +226,7 @@ zh:
button_download: 下载
button_more: "更多"
button_delete: 删除
button_unfollow: 取消关注
button_unfollow: 关注
button_follow: 关注
button_watch: 跟踪
button_unwatch: 取消跟踪

View File

@ -52,7 +52,7 @@ zh:
label_agree_join_project: 同意加入
label_apply_project: "加入"
label_button_following: "添加关注"
label_button_following: "关注"
label_project_collect: 收藏
label_project_collect_cancel: 取消收藏
label_exit_project: 退出项目

View File

@ -780,12 +780,14 @@ RedmineApp::Application.routes.draw do
get 'settings(/:tab)', :action => 'settings', :as => 'settings'
#by young
get 'member', :to => 'projects#member', :as => 'member'
match 'project_watcherlist', :to => 'projects#project_watcherlist', :as => 'project_watcherlist'
match 'store_mine', :to => 'projects#store_mine', :as => 'store_mine'
match 'enshrine', :to => 'projects#enshrine', :as => 'enshrine'
match 'member_forked', :to => 'projects#member_forked', :as => 'member_forked'
get 'file', :action => 'file', :as => 'file'
get 'statistics', :action => 'statistics', :as => 'statistics'
get 'repository_tree_changes', :action => 'repository_tree_changes', :as => 'repository_tree_changes'
get 'destroy_repository', :action => 'destroy_repository', :as => 'destroy_repository'
get 'feedback', :action => 'feedback', :as => 'project_feedback'
get 'watcherlist', :action=> 'watcherlist'

View File

@ -0,0 +1,12 @@
class DeleteTempErrorMessage < ActiveRecord::Migration
def up
Organization.where(:id => 68).update_all(:name => "blankname")
MessageAll.where(:message_id => 171).destroy_all
OrgMessage.where(:id => 171).destroy_all
MessageAll.where(:message_id => 16).destroy_all
OrgMessage.where(:id => 16).destroy_all
end
def down
end
end

View File

@ -0,0 +1,8 @@
class ModifyFixedVersionId < ActiveRecord::Migration
def up
Issue.where(:fixed_version_id => 0).update_all(:fixed_version_id => nil)
end
def down
end
end

View File

@ -0,0 +1,18 @@
class MigrateStudentWorks < ActiveRecord::Migration
def up
count = Course.all.count / 30 + 2
transaction do
for i in 1 ... count do i
Course.page(i).per(30).each do |course|
homework_ids = course.homework_commons.blank? ? "(-1)" : "(" + course.homework_commons.map{|hw| hw.id}.join(",") + ")"
student_ids = course.student.blank? ? "(-1)" : "(" + course.student.map{|st| st.student_id}.join(",") + ")"
student_works = StudentWork.where("homework_common_id in #{homework_ids} and user_id not in #{student_ids}")
student_works.update_all(:is_delete => 1)
end
end
end
end
def down
end
end

View File

@ -0,0 +1,5 @@
class AddNoAnonPenaltyToHomeworkManual < ActiveRecord::Migration
def change
add_column :homework_detail_manuals, :no_anon_penalty, :integer, :default => 1
end
end

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,8 @@ module Gitlab
ObjectifiedHash.new body
elsif body.is_a? Array
body.collect! { |e| ObjectifiedHash.new(e) }
elsif body == true
body
else
raise Error::Parsing.new "Couldn't parse a response body"
end

View File

@ -80,31 +80,28 @@ namespace :homework_evaluation do
homework_detail_manuals.each do |homework_detail_manual|
homework_common = homework_detail_manual.homework_common
if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 2 #开启匿评状态才可关闭匿评
#计算缺评扣分
#计算缺评扣分 参与匿评
work_ids = "(" + homework_common.student_works.has_committed.map(&:id).join(",") + ")"
if homework_common.homework_type != 3
homework_common.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_common.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
if student_work.absence_penalty != 0
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_common.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
end
homework_common.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_common.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_common.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
homework_detail_manual.update_column('comment_status', 3)
# 匿评关闭消息通知 给所有人发
course = homework_common.course

View File

@ -0,0 +1,59 @@
module Trustie
module Gitlab
module Diff
class File
attr_reader :diff
delegate :new_file, :deleted_file, :renamed_file,
:old_path, :new_path, to: :diff, prefix: false
def initialize(diff)
@diff = diff
end
# Array of Gitlab::DIff::Line objects
def diff_lines
@lines ||= parser.parse(raw_diff.lines)
end
def mode_changed?
!!(diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode)
end
def parser
Parser.new
end
def raw_diff
diff.diff.to_s
end
def next_line(index)
diff_lines[index + 1]
end
def prev_line(index)
if index > 0
diff_lines[index - 1]
end
end
def file_path
if diff.new_path.present?
diff.new_path
elsif diff.old_path.present?
diff.old_path
end
end
def added_lines
diff_lines.count(&:added?)
end
def removed_lines
diff_lines.count(&:removed?)
end
end
end
end
end

View File

@ -0,0 +1,22 @@
module Trustie
module Gitlab
module Diff
class Line
attr_reader :type, :text, :index, :old_pos, :new_pos
def initialize(text, type, index, old_pos, new_pos)
@text, @type, @index = text, type, index
@old_pos, @new_pos = old_pos, new_pos
end
def added?
type == 'new'
end
def removed?
type == 'old'
end
end
end
end
end

View File

@ -0,0 +1,12 @@
module Trustie
module Gitlab
module Diff
class LineCode
def self.generate(file_path, new_line_position, old_line_position)
"#{Digest::SHA1.hexdigest(file_path)}_#{old_line_position}_#{new_line_position}"
end
end
end
end
end

View File

@ -0,0 +1,81 @@
module Trustie
module Gitlab
module Diff
class Parser
include Enumerable
def parse(lines)
@lines = lines
lines_obj = []
line_obj_index = 0
line_old = 1
line_new = 1
type = nil
lines_arr = InlineDiff.processing lines
lines_arr.each do |line|
next if filename?(line)
full_line = html_escape(line.gsub(/\n/, ''))
full_line = InlineDiff.replace_markers full_line
if line.match(/^@@ -/)
type = "match"
line_old = line.match(/\-[0-9]*/)[0].to_i.abs rescue 0
line_new = line.match(/\+[0-9]*/)[0].to_i.abs rescue 0
next if line_old <= 1 && line_new <= 1 #top of file
lines_obj << Line.new(full_line, type, line_obj_index, line_old, line_new)
line_obj_index += 1
next
else
type = identification_type(line)
lines_obj << Line.new(full_line, type, line_obj_index, line_old, line_new)
line_obj_index += 1
end
if line[0] == "+"
line_new += 1
elsif line[0] == "-"
line_old += 1
else
line_new += 1
line_old += 1
end
end
lines_obj
end
def empty?
@lines.empty?
end
private
def filename?(line)
line.start_with?('--- /dev/null', '+++ /dev/null', '--- a', '+++ b',
'--- /tmp/diffy', '+++ /tmp/diffy')
end
def identification_type(line)
if line[0] == "+"
"new"
elsif line[0] == "-"
"old"
else
nil
end
end
def html_escape(str)
replacements = { '&' => '&amp;', '>' => '&gt;', '<' => '&lt;', '"' => '&quot;', "'" => '&#39;' }
str.gsub(/[&"'><]/, replacements)
end
end
end
end
end

View File

@ -0,0 +1,106 @@
module Trustie
module Gitlab
class InlineDiff
class << self
START = "#!idiff-start!#"
FINISH = "#!idiff-finish!#"
def processing(diff_arr)
indexes = _indexes_of_changed_lines diff_arr
indexes.each do |index|
first_line = diff_arr[index+1]
second_line = diff_arr[index+2]
# Skip inline diff if empty line was replaced with content
next if first_line == "-\n"
first_token = find_first_token(first_line, second_line)
apply_first_token(diff_arr, index, first_token)
last_token = find_last_token(first_line, second_line, first_token)
apply_last_token(diff_arr, index, last_token)
end
diff_arr
end
def apply_first_token(diff_arr, index, first_token)
start = first_token + START
if first_token.empty?
# In case if we remove string of spaces in commit
diff_arr[index+1].sub!("-", "-" => "-#{START}")
diff_arr[index+2].sub!("+", "+" => "+#{START}")
else
diff_arr[index+1].sub!(first_token, first_token => start)
diff_arr[index+2].sub!(first_token, first_token => start)
end
end
def apply_last_token(diff_arr, index, last_token)
# This is tricky: escape backslashes so that `sub` doesn't interpret them
# as backreferences. Regexp.escape does NOT do the right thing.
replace_token = FINISH + last_token.gsub(/\\/, '\&\&')
diff_arr[index+1].sub!(/#{Regexp.escape(last_token)}$/, replace_token)
diff_arr[index+2].sub!(/#{Regexp.escape(last_token)}$/, replace_token)
end
def find_first_token(first_line, second_line)
max_length = [first_line.size, second_line.size].max
first_the_same_symbols = 0
(0..max_length + 1).each do |i|
first_the_same_symbols = i - 1
if first_line[i] != second_line[i] && i > 0
break
end
end
first_line[0..first_the_same_symbols][1..-1]
end
def find_last_token(first_line, second_line, first_token)
max_length = [first_line.size, second_line.size].max
last_the_same_symbols = 0
(1..max_length + 1).each do |i|
last_the_same_symbols = -i
shortest_line = second_line.size > first_line.size ? first_line : second_line
if (first_line[-i] != second_line[-i]) || "#{first_token}#{START}".size == shortest_line[1..-i].size
break
end
end
last_the_same_symbols += 1
first_line[last_the_same_symbols..-1]
end
def _indexes_of_changed_lines(diff_arr)
chain_of_first_symbols = ""
diff_arr.each_with_index do |line, i|
chain_of_first_symbols += line[0]
end
chain_of_first_symbols.gsub!(/[^\-\+]/, "#")
offset = 0
indexes = []
while index = chain_of_first_symbols.index("#-+#", offset)
indexes << index
offset = index + 1
end
indexes
end
def replace_markers(line)
line.gsub!(START, "<span class='idiff'>")
line.gsub!(FINISH, "</span>")
line
end
end
end
end
end

View File

@ -42,7 +42,7 @@ module Trustie
gproject = g.create_project(repository.identifier,
path: repository.identifier,
description: project.description,
description: false,
wiki_enabled: false,
wall_enabled: false,
issues_enabled: false,
@ -88,7 +88,7 @@ module Trustie
# can use password
gproject = self.g.create_project(path,
path: path,
description: project.description,
description: false,
wiki_enabled: false,
wall_enabled: false,
issues_enabled: false,

Some files were not shown because too many files have changed in this diff Show More