Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
Conflicts: db/schema.rb
This commit is contained in:
commit
099fcde246
4
Gemfile
4
Gemfile
|
@ -4,9 +4,9 @@ unless RUBY_PLATFORM =~ /w32/
|
|||
# unix-like only
|
||||
gem 'iconv'
|
||||
if RUBY_PLATFORM =~ /darwin/
|
||||
gem "rmagick", "= 2.15.4" ## osx must be this version
|
||||
# gem "rmagick", "= 2.15.4" ## osx must be this version
|
||||
elsif RUBY_PLATFORM =~ /linux/
|
||||
gem "rmagick", "~> 2.13.1" ## centos yum install ImageMagick-devel
|
||||
# gem "rmagick", "~> 2.13.1" ## centos yum install ImageMagick-devel
|
||||
end
|
||||
gem 'certified'
|
||||
gem 'net-ssh', '2.9.1'
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the training_tasks controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -279,6 +279,14 @@ class AccountController < ApplicationController
|
|||
render :json => result
|
||||
end
|
||||
|
||||
def change_email
|
||||
user = User.find params[:user_id].to_i
|
||||
user.update_attributes(:mail => params[:value])
|
||||
result = {:email => user.mail}
|
||||
|
||||
render :json => result
|
||||
end
|
||||
|
||||
def email_activation
|
||||
|
||||
|
||||
|
|
|
@ -978,7 +978,11 @@ class AdminController < ApplicationController
|
|||
#作业
|
||||
def homework
|
||||
#@homework = HomeworkCommon.order('end_time desc')
|
||||
@homework = HomeworkCommon.order( 'created_at desc ')
|
||||
if params[:type] == "2"
|
||||
@homework = HomeworkCommon.where(:homework_type => 2).order( 'created_at desc ')
|
||||
else
|
||||
@homework = HomeworkCommon.order( 'created_at desc ')
|
||||
end
|
||||
@homework = paginateHelper @homework,30
|
||||
@page = (params['page'] || 1).to_i - 1
|
||||
respond_to do |format|
|
||||
|
|
|
@ -312,7 +312,11 @@ class ApplicationController < ActionController::Base
|
|||
def authorize_allowed(ctrl = params[:controller], action = params[:action], global = false)
|
||||
#modify by NWB
|
||||
if @project
|
||||
allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project || @projects, :global => global)
|
||||
if ctrl == "repositories" && action == "show" && @project.hidden_repo
|
||||
allowed = User.current.admin? || (User.current.member_of?(@project) && !(role_of_members_in_project(@project.id, User.current.id) == "Reporter"))
|
||||
else
|
||||
allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project || @projects, :global => global)
|
||||
end
|
||||
elsif @course
|
||||
allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @course || @courses, :global => global)
|
||||
else
|
||||
|
|
|
@ -29,6 +29,8 @@ class AtController < ApplicationController
|
|||
case type
|
||||
when "Issue"
|
||||
find_issue(id)
|
||||
whne 'TrainingTask'
|
||||
find_training_task(id)
|
||||
when 'Project'
|
||||
find_project(id)
|
||||
when 'Course'
|
||||
|
@ -69,6 +71,13 @@ class AtController < ApplicationController
|
|||
at_persons.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id }
|
||||
end
|
||||
|
||||
def find_training_task(id)
|
||||
training_task = TrainingTask.find(id)
|
||||
journals = training_task.journals
|
||||
at_persons = journals.map(&:user) + training_task.project.users
|
||||
at_persons.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id }
|
||||
end
|
||||
|
||||
def find_project(id)
|
||||
return [] if id.to_i<0
|
||||
at_persons = Project.find(id).users
|
||||
|
|
|
@ -143,7 +143,7 @@ class ForumsController < ApplicationController
|
|||
reorder(order).
|
||||
preload(:author, {:last_reply => :author}).
|
||||
all
|
||||
@forums = Forum.reorder("topic_count desc,updated_at desc")
|
||||
@forums = Forum.find_by_sql("SELECT *,topic_count + memo_count tm FROM `forums` order by tm desc;")
|
||||
@my_forums_count = Memo.where("author_id =? and parent_id is null", User.current.id).count
|
||||
@my_memos_count = Memo.where("author_id =? and parent_id is not null", User.current.id).count
|
||||
@errors = params[:errors]
|
||||
|
|
|
@ -1,166 +1,168 @@
|
|||
class PraiseTreadController < ApplicationController
|
||||
|
||||
accept_api_auth :tread_plus,:praise_plus
|
||||
# before_filter :require_login,:only => [:praise_plus,:tread_plus]
|
||||
before_filter :user_unlogged_check,:only => [:praise_plus,:tread_plus,:praise_minus]
|
||||
|
||||
def praise_plus
|
||||
@obj = nil
|
||||
@activity = false
|
||||
if request.get?
|
||||
@obj_id = params[:obj_id]
|
||||
@obj_type = params[:obj_type]
|
||||
if !params[:user_activity_id].nil? && !params[:type].nil?
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@type = params[:type]
|
||||
@activity = true
|
||||
end
|
||||
# @is_in_list = nil
|
||||
@obj = find_object_by_type_and_id(@obj_type,@obj_id)
|
||||
pts = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",@obj_id,@obj_type.to_s,User.current.id)
|
||||
unless pts.empty?
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
return
|
||||
end
|
||||
@horizontal = params[:horizontal].downcase == "false" ? false:true if params[:horizontal]
|
||||
# if @obj.respond_to?("author_id")
|
||||
# author_id = @obj.author_id
|
||||
# elsif @obj.respond_to?("user_id")
|
||||
# author_id = @obj.user_id
|
||||
# end
|
||||
# unless author_id == User.current.id
|
||||
praise_tread_plus(@obj_type,@obj_id,1)
|
||||
# end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def praise_minus
|
||||
@obj = nil
|
||||
@activity = false
|
||||
if request.get?
|
||||
#@obj = params[:obj] # 传的是对象,最后变成id了
|
||||
#首先更新praise_tread 表 删除关注记录
|
||||
#@pt = PraiseTread.find_by_user_id_and_praise_tread_object_id_and_praise_tread_object_type(User.current.id,@obj,"user")
|
||||
@obj_id = params[:obj_id]
|
||||
@obj_type = params[:obj_type]
|
||||
if !params[:user_activity_id].nil? && !params[:type].nil?
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@type = params[:type]
|
||||
@activity = true
|
||||
end
|
||||
@obj = find_object_by_type_and_id(@obj_type,@obj_id)
|
||||
@pt = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",@obj_id,@obj_type.to_s,User.current.id).first
|
||||
if @pt.nil?
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
return
|
||||
end
|
||||
@pt.delete if !@pt.nil?
|
||||
#再更新praise_tread_cache表 使相应的记录减1 当为0时删除
|
||||
@ptc = PraiseTreadCache.where("object_id=? and object_type=?",@obj_id,@obj_type.to_s).first
|
||||
@ptc.minus(1) if !@ptc.nil?
|
||||
if @ptc.praise_num == 0
|
||||
@ptc.delete
|
||||
end
|
||||
|
||||
end
|
||||
#@obj = User.find_by_id(@obj)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def tread_plus
|
||||
@obj = nil
|
||||
# @is_in_list = nil
|
||||
if request.get?
|
||||
@obj_id = params[:obj_id]
|
||||
@obj_type = params[:obj_type]
|
||||
#@horizontal = params[:horizontal].downcase == "false" ? false:true
|
||||
@obj = find_object_by_type_and_id(@obj_type,@obj_id)
|
||||
unless @obj.author_id == User.current.id
|
||||
praise_tread_plus(@obj_type,@obj_id,0)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def tread_minus
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_object_by_type_and_id(type,id)
|
||||
@obj = nil
|
||||
case type
|
||||
when 'Memo'
|
||||
@obj = Memo.find_by_id(id)
|
||||
when 'Message'
|
||||
@obj = Message.find_by_id(id)
|
||||
when 'HomeworkCommon'
|
||||
@obj = HomeworkCommon.find_by_id(id)
|
||||
when 'JournalsForMessage'
|
||||
@obj = JournalsForMessage.find_by_id(id)
|
||||
when 'News'
|
||||
@obj = News.find_by_id(id)
|
||||
when 'Comment'
|
||||
@obj = Comment.find_by_id(id)
|
||||
when 'Journal'
|
||||
@obj = Journal.find_by_id(id)
|
||||
when 'BlogComment'
|
||||
@obj = BlogComment.find_by_id(id)
|
||||
when 'OrgDocumentComment'
|
||||
@obj = OrgDocumentComment.find_by_id(id)
|
||||
when 'User'
|
||||
@obj = User.find_by_id(id)
|
||||
when 'Issue'
|
||||
@obj = Issue.find_by_id(id)
|
||||
when 'Project'
|
||||
@obj = Project.find_by_id(id)
|
||||
when 'Bid'
|
||||
@obj = Bid.find_by_id(id)
|
||||
when 'Contest'
|
||||
@obj = Contest.find_by_id(id)
|
||||
when 'Syllabus'
|
||||
@obj = Syllabus.find_by_id(id)
|
||||
when 'Work'
|
||||
@obj = Work.find_by_id(id)
|
||||
else
|
||||
@obj = nil
|
||||
end
|
||||
return @obj
|
||||
end
|
||||
|
||||
def praise_tread_plus(type,id,flag)
|
||||
unless id.nil? and type.nil?
|
||||
#首先创建或更新praise_tread 表
|
||||
@pt = PraiseTread.new
|
||||
@pt.user_id = User.current.id
|
||||
@pt.praise_tread_object_id = id.to_i
|
||||
@pt.praise_tread_object_type = type
|
||||
@pt.praise_or_tread = flag
|
||||
@pt.save
|
||||
# end
|
||||
|
||||
#再创建或更新praise_tread_cache表
|
||||
#@ptc = PraiseTreadCache.find_by_object_id_and_object_type(id,type)
|
||||
@ptc = PraiseTreadCache.where("object_id = ? and object_type = ?",id.to_i,type).first
|
||||
@ptc = @ptc.nil? ? PraiseTreadCache.new : @ptc
|
||||
@ptc.object_id = id.to_i
|
||||
@ptc.object_type = type
|
||||
@ptc.save
|
||||
@ptc.plus(flag,1)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
class PraiseTreadController < ApplicationController
|
||||
|
||||
accept_api_auth :tread_plus,:praise_plus
|
||||
# before_filter :require_login,:only => [:praise_plus,:tread_plus]
|
||||
before_filter :user_unlogged_check,:only => [:praise_plus,:tread_plus,:praise_minus]
|
||||
|
||||
def praise_plus
|
||||
@obj = nil
|
||||
@activity = false
|
||||
if request.get?
|
||||
@obj_id = params[:obj_id]
|
||||
@obj_type = params[:obj_type]
|
||||
if !params[:user_activity_id].nil? && !params[:type].nil?
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@type = params[:type]
|
||||
@activity = true
|
||||
end
|
||||
# @is_in_list = nil
|
||||
@obj = find_object_by_type_and_id(@obj_type,@obj_id)
|
||||
pts = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",@obj_id,@obj_type.to_s,User.current.id)
|
||||
unless pts.empty?
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
return
|
||||
end
|
||||
@horizontal = params[:horizontal].downcase == "false" ? false:true if params[:horizontal]
|
||||
# if @obj.respond_to?("author_id")
|
||||
# author_id = @obj.author_id
|
||||
# elsif @obj.respond_to?("user_id")
|
||||
# author_id = @obj.user_id
|
||||
# end
|
||||
# unless author_id == User.current.id
|
||||
praise_tread_plus(@obj_type,@obj_id,1)
|
||||
# end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def praise_minus
|
||||
@obj = nil
|
||||
@activity = false
|
||||
if request.get?
|
||||
#@obj = params[:obj] # 传的是对象,最后变成id了
|
||||
#首先更新praise_tread 表 删除关注记录
|
||||
#@pt = PraiseTread.find_by_user_id_and_praise_tread_object_id_and_praise_tread_object_type(User.current.id,@obj,"user")
|
||||
@obj_id = params[:obj_id]
|
||||
@obj_type = params[:obj_type]
|
||||
if !params[:user_activity_id].nil? && !params[:type].nil?
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@type = params[:type]
|
||||
@activity = true
|
||||
end
|
||||
@obj = find_object_by_type_and_id(@obj_type,@obj_id)
|
||||
@pt = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",@obj_id,@obj_type.to_s,User.current.id).first
|
||||
if @pt.nil?
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
return
|
||||
end
|
||||
@pt.delete if !@pt.nil?
|
||||
#再更新praise_tread_cache表 使相应的记录减1 当为0时删除
|
||||
@ptc = PraiseTreadCache.where("object_id=? and object_type=?",@obj_id,@obj_type.to_s).first
|
||||
@ptc.minus(1) if !@ptc.nil?
|
||||
if @ptc.praise_num == 0
|
||||
@ptc.delete
|
||||
end
|
||||
|
||||
end
|
||||
#@obj = User.find_by_id(@obj)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def tread_plus
|
||||
@obj = nil
|
||||
# @is_in_list = nil
|
||||
if request.get?
|
||||
@obj_id = params[:obj_id]
|
||||
@obj_type = params[:obj_type]
|
||||
#@horizontal = params[:horizontal].downcase == "false" ? false:true
|
||||
@obj = find_object_by_type_and_id(@obj_type,@obj_id)
|
||||
unless @obj.author_id == User.current.id
|
||||
praise_tread_plus(@obj_type,@obj_id,0)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def tread_minus
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_object_by_type_and_id(type,id)
|
||||
@obj = nil
|
||||
case type
|
||||
when 'Memo'
|
||||
@obj = Memo.find_by_id(id)
|
||||
when 'Message'
|
||||
@obj = Message.find_by_id(id)
|
||||
when 'HomeworkCommon'
|
||||
@obj = HomeworkCommon.find_by_id(id)
|
||||
when 'JournalsForMessage'
|
||||
@obj = JournalsForMessage.find_by_id(id)
|
||||
when 'News'
|
||||
@obj = News.find_by_id(id)
|
||||
when 'Comment'
|
||||
@obj = Comment.find_by_id(id)
|
||||
when 'Journal'
|
||||
@obj = Journal.find_by_id(id)
|
||||
when 'BlogComment'
|
||||
@obj = BlogComment.find_by_id(id)
|
||||
when 'OrgDocumentComment'
|
||||
@obj = OrgDocumentComment.find_by_id(id)
|
||||
when 'User'
|
||||
@obj = User.find_by_id(id)
|
||||
when 'Issue'
|
||||
@obj = Issue.find_by_id(id)
|
||||
when 'TrainingTask'
|
||||
@obj = TrainingTask.find_by_id(id)
|
||||
when 'Project'
|
||||
@obj = Project.find_by_id(id)
|
||||
when 'Bid'
|
||||
@obj = Bid.find_by_id(id)
|
||||
when 'Contest'
|
||||
@obj = Contest.find_by_id(id)
|
||||
when 'Syllabus'
|
||||
@obj = Syllabus.find_by_id(id)
|
||||
when 'Work'
|
||||
@obj = Work.find_by_id(id)
|
||||
else
|
||||
@obj = nil
|
||||
end
|
||||
return @obj
|
||||
end
|
||||
|
||||
def praise_tread_plus(type,id,flag)
|
||||
unless id.nil? and type.nil?
|
||||
#首先创建或更新praise_tread 表
|
||||
@pt = PraiseTread.new
|
||||
@pt.user_id = User.current.id
|
||||
@pt.praise_tread_object_id = id.to_i
|
||||
@pt.praise_tread_object_type = type
|
||||
@pt.praise_or_tread = flag
|
||||
@pt.save
|
||||
# end
|
||||
|
||||
#再创建或更新praise_tread_cache表
|
||||
#@ptc = PraiseTreadCache.find_by_object_id_and_object_type(id,type)
|
||||
@ptc = PraiseTreadCache.where("object_id = ? and object_type = ?",id.to_i,type).first
|
||||
@ptc = @ptc.nil? ? PraiseTreadCache.new : @ptc
|
||||
@ptc.object_id = id.to_i
|
||||
@ptc.object_type = type
|
||||
@ptc.save
|
||||
@ptc.plus(flag,1)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -29,7 +29,7 @@ class ProjectsController < ApplicationController
|
|||
menu_item :share, :only => :share
|
||||
|
||||
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,
|
||||
:view_homework_attaches,:join_project, :project_home]
|
||||
:view_homework_attaches,:join_project, :project_home, :training_execute, :training_task_status]
|
||||
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]
|
||||
|
@ -332,9 +332,11 @@ class ProjectsController < ApplicationController
|
|||
if User.current.member_of?(@project) || User.current.admin?
|
||||
case params[:type]
|
||||
when nil
|
||||
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'Project', 'Attachment','Commit')", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10)
|
||||
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'TrainingTask','Message','News', 'Project', 'Attachment','Commit')", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10)
|
||||
when 'issue'
|
||||
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Issue'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10)
|
||||
when 'training_task'
|
||||
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'TrainingTask'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10)
|
||||
when 'news'
|
||||
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'News'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10)
|
||||
when 'message'
|
||||
|
@ -379,7 +381,9 @@ class ProjectsController < ApplicationController
|
|||
def settings
|
||||
# 顶部导航
|
||||
@project_menu_type = 10
|
||||
|
||||
if @project.is_child_training_project?
|
||||
return render_404
|
||||
end
|
||||
# 修改查看消息状态
|
||||
applied_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type =? and viewed =?", User.current.id, @project, "AppliedProject", 0)
|
||||
applied_messages.update_all(:viewed => true)
|
||||
|
@ -765,6 +769,18 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def add_script
|
||||
if User.current.admin? || User.current.member_of?(@project)
|
||||
if @project.update_attribute(:script, params[:project_script])
|
||||
@notice = "脚本添加成功"
|
||||
else
|
||||
@notice = "脚本添加失败"
|
||||
end
|
||||
else
|
||||
return render_403
|
||||
end
|
||||
end
|
||||
|
||||
def modules
|
||||
@project.enabled_module_names = params[:enabled_module_names]
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
|
@ -805,6 +821,231 @@ class ProjectsController < ApplicationController
|
|||
redirect_to admin_projects_url(:status => params[:status])
|
||||
end
|
||||
|
||||
# 弹框提醒:
|
||||
# 自己不能参加自己的实训项目
|
||||
# 没有建立版本库的项目不能开启实训
|
||||
# 已经实训过直接跳入
|
||||
#
|
||||
def training_chiled_project_exec
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# training_status: 默认为0; 1代表实训项目; 2:代表实训子项目
|
||||
def training_project_execute
|
||||
if @project.training_tasks.count == 0
|
||||
@notice = "实训开启失败:请先发布实训任务"
|
||||
return
|
||||
elsif Repository.where(:project_id => @project.id, :type => "Repository::Gitlab").count == 0
|
||||
@notice = "实训开启失败:请先创建版本库"
|
||||
return
|
||||
end
|
||||
jobName = "#{@project.id}"
|
||||
pipeLine = "#{Base64.encode64(@project.script)}"
|
||||
uri = URI("http://123.59.135.74:9999/jenkins-exec/api/createJob")
|
||||
params = {jobName: jobName, pipeLine: pipeLine}
|
||||
res = uri_exec uri, params
|
||||
training_project_notice res
|
||||
@project.update_attribute(:training_status, 1)
|
||||
end
|
||||
|
||||
def training_project_update
|
||||
jobName = "#{@project.id}"
|
||||
pipeLine = "#{Base64.encode64(@project.script)}"
|
||||
uri = URI("http://123.59.135.74:9999/jenkins-exec/api/updateJob")
|
||||
params = {jobName: jobName, pipeLine: pipeLine}
|
||||
res = uri_exec uri, params
|
||||
training_project_notice res
|
||||
@project.update_attribute(:training_status, 1)
|
||||
end
|
||||
|
||||
def training_project_notice res
|
||||
if res['code'] == 0
|
||||
@notice = "实训开启成功"
|
||||
elsif res['code'] == -2
|
||||
@notice = "Job已存在"
|
||||
else
|
||||
@notice = res['msg'].nil? ? "实训开启失败" : res['msg']
|
||||
end
|
||||
end
|
||||
|
||||
# TrainintTask.status 0:评测中 1:评测成功 2:评测惊醒中
|
||||
# 非项目成员、非实训子项目不允许执行该方法
|
||||
def task_execute
|
||||
if !@project.is_child_training_project? || !User.current.member_of?(@project)
|
||||
return render_403
|
||||
end
|
||||
taskId = params[:training_task_id]
|
||||
jobName = @project.forked_from_project_id
|
||||
@training_task = TrainingTask.find(taskId)
|
||||
if @training_task.status == 0
|
||||
params = {:jobName => "#{jobName}", :taskId => "#{taskId}"}
|
||||
uri = URI.parse("http://123.59.135.74:9999/jenkins-exec/api/buildJob")
|
||||
begin
|
||||
res = uri_exec uri, params
|
||||
# 任务开启成功后创建一条留言提示,并发布
|
||||
@training_task.update_attribute(:status, 2)
|
||||
return
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def uri_exec uri, params
|
||||
res = Net::HTTP.post_form(uri, params).body
|
||||
res = JSON.parse(res)
|
||||
end
|
||||
|
||||
# 开启实训项目,学生会fork一个项目并自动发送任务
|
||||
def training_project_extend
|
||||
@project = Project.find(params[:id])
|
||||
@repository = Repository.where("project_id =? and type =?", @project.id, "Repository::Gitlab")
|
||||
# 如果当前用户已经fork过该项目,不会新fork项目,则跳至已fork的项
|
||||
unless has_forked?(@project, User.current)
|
||||
project = project_from_current_project(@project.id, User.current.id)
|
||||
redirect_to project_path(project)
|
||||
else
|
||||
ActiveRecord::Base.transaction do
|
||||
g = Gitlab.client
|
||||
if User.current.gid.nil?
|
||||
s = Trustie::Gitlab::Sync.new
|
||||
s.sync_user(User.current)
|
||||
end
|
||||
gproject = g.fork(@project.gpid, User.current.gid)
|
||||
if gproject
|
||||
new_training_project = copy_project_and_module(@project, gproject)
|
||||
forked_count = @project.forked_count.to_i + 1
|
||||
@project.update_attributes(:forked_count => forked_count)
|
||||
# 发布实训任务,只发布实训任务的第一个
|
||||
publish_training_tasks(@project.id, new_training_project.id, 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 需要传Task ID
|
||||
# 判断任务是否完成
|
||||
# 如果完成则发送下一个任务直到任务结束
|
||||
# TrainingTask.status 1 成功,其它失败
|
||||
def training_task_status
|
||||
status = params[:status].to_i
|
||||
task_id = params[:taskId]
|
||||
message = params[:msg].to_i
|
||||
begin
|
||||
@training_task = TrainingTask.find(task_id)
|
||||
# 如果已经执行成功过,则不重复执行
|
||||
return if @training_task.status == 1
|
||||
original_project_id = Project.find(@training_task.project_id).try(:forked_from_project_id)
|
||||
original_project = Project.find(original_project_id)
|
||||
rescue
|
||||
return
|
||||
end
|
||||
original_tasks_count = original_project.training_tasks.count
|
||||
position = @training_task.try(:position) + 1
|
||||
# 测试,默认成功
|
||||
if status == 0
|
||||
ActiveRecord::Base.transaction do
|
||||
if position <= original_tasks_count
|
||||
# 继续发布下一个任务
|
||||
publish_training_tasks original_project_id, @training_task.project_id, position
|
||||
@training_task.update_attribute(:status, 1)
|
||||
end
|
||||
# 创建一条回复提醒
|
||||
content = "恭喜您通过测评"
|
||||
add_training_task_journal(content, original_project.user_id)
|
||||
end
|
||||
else
|
||||
content = "很遗憾,您没有通过该步"
|
||||
add_training_task_journal(content, original_project.user_id)
|
||||
end
|
||||
end
|
||||
|
||||
# 创建一条回复
|
||||
def add_training_task_journal content, user_id
|
||||
jour = Journal.new
|
||||
jour.user_id = user_id
|
||||
jour.notes = content
|
||||
jour.journalized = @training_task
|
||||
jour.save
|
||||
update_user_activity(@training_task.class, @training_task.id)
|
||||
update_forge_activity(@training_task.class, @training_task.id)
|
||||
end
|
||||
|
||||
# 实训开启成功后,发布第一个任务
|
||||
# REDO:失败后提醒用户,及相关处理
|
||||
def publish_training_tasks original_project_id, new_training_project_id, position
|
||||
original_task = TrainingTask.where(:project_id => original_project_id, :position => position).first
|
||||
training_task = TrainingTask.new
|
||||
training_task.save_attachments(params[:attachments] || (params[:training_task] && params[:training_task][:uploads]))
|
||||
training_task.subject = original_task.subject
|
||||
training_task.description = original_task.description
|
||||
training_task.position = original_task.position
|
||||
training_task.project_id = new_training_project_id
|
||||
training_task.author_id = User.current.id
|
||||
if training_task.save
|
||||
respond_to do |format|
|
||||
format.html{redirect_to project_url(new_training_project_id)}
|
||||
end
|
||||
else
|
||||
raise "create task failed"
|
||||
end
|
||||
end
|
||||
|
||||
# 复制项目
|
||||
def copy_project_and_module tproject, gproject
|
||||
project = Project.new
|
||||
project.name = tproject.name
|
||||
project.is_public = tproject.is_public
|
||||
project.status = tproject.status
|
||||
project.description = tproject.description
|
||||
project.hidden_repo = tproject.hidden_repo
|
||||
project.user_id = User.current.id
|
||||
project.project_type = 0
|
||||
project.project_new_type = tproject.project_new_type
|
||||
project.gpid = gproject.id
|
||||
project.forked_from_project_id = tproject.id
|
||||
project.enabled_module_names = tproject.enabled_module_names
|
||||
if project.save
|
||||
project.update_attribute(:training_status,2)
|
||||
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
|
||||
m = Member.new(:user => User.current, :roles => [r])
|
||||
if ProjectScore.where("project_id=?", project.id).first.nil?
|
||||
ProjectScore.create(:project_id => project.id, :score => false)
|
||||
end
|
||||
project_info = ProjectInfo.new(:user_id => User.current.id, :project_id => project.id)
|
||||
user_grades = UserGrade.create(:user_id => User.current.id, :project_id => project.id)
|
||||
Rails.logger.debug "UserGrade created: #{user_grades.to_json}"
|
||||
project_status = ProjectStatus.create(:project_id => @project.id, :watchers_count => 0, :changesets_count => 0, :project_type => @project.project_type,:grade => 0)
|
||||
Rails.logger.debug "ProjectStatus created: #{project_status.to_json}"
|
||||
project.members << m
|
||||
project.project_infos << project_info
|
||||
copy_repository(project, gproject)
|
||||
return project
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'forked', :layout => 'base_projects'}
|
||||
format.api { render_validation_errors(@project) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 判断用户是否已经fork过该项目
|
||||
def has_forked?(project, user)
|
||||
projects = Project.where("user_id =?", user)
|
||||
projects.map(&:forked_from_project_id).detect{|s| s == @project.id}.nil? ? true : false
|
||||
end
|
||||
|
||||
def copy_repository(project, gproject)
|
||||
repository = Repository.factory('Git')
|
||||
repository.project_id = project.id
|
||||
repository.type = 'Repository::Gitlab'
|
||||
repository.url = gproject.name
|
||||
repository.identifier = gproject.name
|
||||
repository = repository.save
|
||||
end
|
||||
|
||||
# 资源库fork弹框
|
||||
def forked_pop
|
||||
respond_to do |format|
|
||||
|
|
|
@ -35,12 +35,13 @@ class RepositoriesController < ApplicationController
|
|||
before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo, :stats, :quality_analysis]
|
||||
before_filter :find_repository, :only => [:edit, :update, :destroy, :committers]
|
||||
|
||||
before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo, :to_gitlab, :forked, :export_rep_static]
|
||||
before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo, :to_gitlab, :forked, :export_rep_static, :training_project_extend]
|
||||
# 连接gitlab
|
||||
# before_filter :connect_gitlab, :only => [:quality_analysis, :commit_diff]
|
||||
|
||||
before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
|
||||
before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :project_archive, :quality_analysis, :commit_diff]
|
||||
# before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :project_archive, :quality_analysis, :commit_diff]
|
||||
before_filter :authorize_visible , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :project_archive, :quality_analysis, :commit_diff]
|
||||
# 版本库新增权限
|
||||
# before_filter :show_rep, :only => [:show, :stats, :revisions, :revision, :diff, :commit_diff ]
|
||||
accept_rss_auth :revisions
|
||||
|
@ -132,6 +133,94 @@ class RepositoriesController < ApplicationController
|
|||
# send_file "/path/to/file.zip"
|
||||
end
|
||||
|
||||
# 开启实训项目,学生会fork一个项目并自动发送任务
|
||||
def training_project_extend
|
||||
@project = Project.find(params[:id])
|
||||
@repository = Repository.where("project_id =? and type =?", @project.id, "Repository::Gitlab")
|
||||
# 如果当前用户已经fork过该项目,不会新fork项目,则跳至已fork的项
|
||||
unless has_forked?(@project, User.current)
|
||||
project = project_from_current_project(@project.id, User.current.id)
|
||||
redirect_to project_path(project)
|
||||
else
|
||||
ActiveRecord::Base.transaction do
|
||||
g = Gitlab.client
|
||||
if User.current.gid.nil?
|
||||
begin
|
||||
s = Trustie::Gitlab::Sync.new
|
||||
s.sync_user(User.current)
|
||||
ensure
|
||||
logger.error "Syn user failed ==>#{User.current.id}"
|
||||
end
|
||||
end
|
||||
gproject = g.fork(@project.gpid, User.current.gid)
|
||||
if gproject
|
||||
new_training_project = copu_project_and_module(@project, gproject)
|
||||
forked_count = @project.forked_count.to_i + 1
|
||||
@project.update_attributes(:forked_count => forked_count)
|
||||
# 发布实训任务,只发布实训任务的第一个
|
||||
publish_training_tasks(@project, new_training_project)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def copu_project_and_module tproject, gproject
|
||||
project = Project.new
|
||||
project.name = tproject.name
|
||||
project.is_public = tproject.is_public
|
||||
project.status = tproject.status
|
||||
project.description = tproject.description
|
||||
project.hidden_repo = tproject.hidden_repo
|
||||
project.user_id = User.current.id
|
||||
project.project_type = 0
|
||||
project.project_new_type = tproject.project_new_type
|
||||
project.gpid = gproject.id
|
||||
project.forked_from_project_id = tproject.id
|
||||
project.enabled_module_names = tproject.enabled_module_names
|
||||
if project.save
|
||||
project.update_attribute(:training_status,1)
|
||||
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
|
||||
m = Member.new(:user => User.current, :roles => [r])
|
||||
if ProjectScore.where("project_id=?", project.id).first.nil?
|
||||
ProjectScore.create(:project_id => project.id, :score => false)
|
||||
end
|
||||
project_info = ProjectInfo.new(:user_id => User.current.id, :project_id => project.id)
|
||||
user_grades = UserGrade.create(:user_id => User.current.id, :project_id => project.id)
|
||||
Rails.logger.debug "UserGrade created: #{user_grades.to_json}"
|
||||
project_status = ProjectStatus.create(:project_id => @project.id, :watchers_count => 0, :changesets_count => 0, :project_type => @project.project_type,:grade => 0)
|
||||
Rails.logger.debug "ProjectStatus created: #{project_status.to_json}"
|
||||
project.members << m
|
||||
project.project_infos << project_info
|
||||
copy_repository(project, gproject)
|
||||
return project
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'forked', :layout => 'base_projects'}
|
||||
format.api { render_validation_errors(@project) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# REDO: 如果实训项目还没有创建任务的时候应该跳出
|
||||
def publish_training_tasks original_project, new_training_project
|
||||
original_task = TrainingTask.where(:project_id => original_project.id, :position => 1).first
|
||||
training_task = TrainingTask.new
|
||||
training_task.save_attachments(params[:attachments] || (params[:training_task] && params[:training_task][:uploads]))
|
||||
training_task.subject = original_task.subject
|
||||
training_task.description = original_task.description
|
||||
training_task.position = original_task.position
|
||||
training_task.project_id = new_training_project.id
|
||||
training_task.author_id = User.current.id
|
||||
if training_task.save
|
||||
respond_to do |format|
|
||||
format.html{redirect_to project_training_tasks_url(:project_id => new_training_project.id)}
|
||||
end
|
||||
else
|
||||
raise "create task failed"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# 判断用户是否已经fork过该项目
|
||||
def has_forked?(project, user)
|
||||
projects = Project.where("user_id =?", user)
|
||||
|
@ -183,6 +272,7 @@ class RepositoriesController < ApplicationController
|
|||
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => project.id) }
|
||||
format.js
|
||||
end
|
||||
return project
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'forked', :layout => 'base_projects'}
|
||||
|
@ -396,11 +486,12 @@ update
|
|||
redirect_to :controller => 'repositories', :action => 'show', :id => @project.id, to: 'gitlab'
|
||||
end
|
||||
|
||||
# 权限:
|
||||
# 如果项目隐藏了版本库,则非项目成员及项目报告人员不能够访问版本库
|
||||
# 如果没有隐藏版本库,只要项目公开,其它成员都可以看到版本库
|
||||
# 项目关联了课程,课程的老师是可以看到版本库的
|
||||
# 超级管理员可以看到项目版本库
|
||||
def show
|
||||
if !User.current.admin? && (@project.hidden_repo && (role_of_members_in_project(@project.id, User.current.id) == "Reporter" || !is_project_member?(User.current.id, @project.id)))
|
||||
render_403
|
||||
return
|
||||
else
|
||||
# 顶部导航
|
||||
@project_menu_type = 5
|
||||
|
||||
|
@ -410,7 +501,6 @@ update
|
|||
if request.xhr?
|
||||
@entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
|
||||
else
|
||||
unless @entries.blank?
|
||||
@changesets_latest_coimmit = @g.rep_last_changes(@project.gpid, :rev => @rev, :path => @path)
|
||||
# @g.rep_last_changes(@project.gpid, :rev => @rev, :path => @path)
|
||||
# 总的提交数
|
||||
|
@ -426,7 +516,6 @@ update
|
|||
# token值解密
|
||||
# gitlab_token = aes_dicrypt("priEn3UwXfJs3Pmy", token)
|
||||
@zip_path = Gitlab.endpoint.to_s + "/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=" + token
|
||||
end
|
||||
|
||||
@creator = @project.owner.to_s
|
||||
gitlab_address = Redmine::Configuration['gitlab_address']
|
||||
|
@ -448,7 +537,6 @@ update
|
|||
render :layout => 'base_projects'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
alias_method :browse, :show
|
||||
|
||||
|
@ -698,6 +786,19 @@ update
|
|||
end
|
||||
end
|
||||
|
||||
def authorize_visible
|
||||
allowed = authorize_allowed(params[:controller], params[:action], global = false)
|
||||
if allowed || User.current.admin? || (@project.hidden_repo && User.current.member_of?(@project) && !role_of_members_in_project(@project.id, User.current.id) == "Reporter")
|
||||
true
|
||||
else
|
||||
if @project && @project.archived?
|
||||
render_403 :message => :notice_not_authorized_archived_project
|
||||
else
|
||||
deny_access
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# 更新项目统计数
|
||||
def update_commits_count project, count
|
||||
|
|
|
@ -0,0 +1,388 @@
|
|||
# encoding: utf-8
|
||||
class TrainingTasksController < ApplicationController
|
||||
|
||||
layout 'base_projects'
|
||||
before_filter :find_project, :only => [:index, :new, :create, :update_form, :issue_commits, :commit_for_issue, :issue_commit_delete, :destroy]
|
||||
before_filter :allow_manager, :only => [:index, :show]
|
||||
before_filter :allow_members, :only => [:new, :create]
|
||||
before_filter :build_new_task_from_params, :only => [:new, :create, :update_form]
|
||||
before_filter :find_training_task, :only => [:show, :edit, :update, :add_journal, :complete_training_task]
|
||||
|
||||
# before_filter :find_issues, :only => [:bulk_edit, :bulk_update, :destroy]
|
||||
|
||||
# before_filter :authorize, :except => [:index, :show]
|
||||
# before_filter :authorize, :except => [:new, :index,:add_journal, :add_journal_in_org,:delete_journal,:reply,:add_reply, :issue_commits, :commit_for_issue, :issue_commit_delete]
|
||||
|
||||
before_filter :check_for_default_issue_status, :only => [:new, :create]
|
||||
before_filter :build_new_task_from_params, :only => [:new, :create, :update_form]
|
||||
accept_rss_auth :index, :show
|
||||
accept_api_auth :index, :show, :create, :update, :destroy
|
||||
|
||||
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
|
||||
|
||||
helper :journals
|
||||
helper :projects
|
||||
include ProjectsHelper
|
||||
helper :custom_fields
|
||||
include CustomFieldsHelper
|
||||
helper :issue_relations
|
||||
include IssueRelationsHelper
|
||||
helper :watchers
|
||||
include WatchersHelper
|
||||
helper :attachments
|
||||
include AttachmentsHelper
|
||||
helper :queries
|
||||
include QueriesHelper
|
||||
helper :repositories
|
||||
include RepositoriesHelper
|
||||
helper :sort
|
||||
include SortHelper
|
||||
include IssuesHelper
|
||||
helper :timelog
|
||||
include Redmine::Export::PDF
|
||||
helper :project_score
|
||||
include ApplicationHelper
|
||||
|
||||
def issue_commit_delete
|
||||
commit_id = params[:commit_id].split(",")
|
||||
issue_commit_ids = params[:issue_commit_ids]
|
||||
# issue_id存在则为issue详情或者编辑的时候,否则为新建Issue
|
||||
# 编辑和详情的时候需要在数据库中删除记录,新建的时候在内存中删除
|
||||
if params[:issue_id]
|
||||
commit_issue = CommitIssues.where(:commit_id => commit_id, :issue_id => params[:issue_id], :project_id => @project.id).first
|
||||
commit_issue.delete if commit_issue
|
||||
end
|
||||
@issue_commit_ids = issue_commit_ids - commit_id
|
||||
end
|
||||
# over
|
||||
|
||||
def index
|
||||
# 顶部导航
|
||||
@project_menu_type = 11
|
||||
@training_tasks = TrainingTask.where(:project_id => @project.id).order('position desc')
|
||||
@training_tasks_count = @training_tasks.count
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@training_tasks_pages = Paginator.new @training_tasks_count, @limit, params['page'] || 1
|
||||
@offset ||= @training_tasks_pages.offset
|
||||
@training_tasks = paginateHelper @training_tasks, @limit
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
def show
|
||||
# 顶部导航
|
||||
@project_menu_type = 11
|
||||
# 打开编辑内容
|
||||
@is_edit = true unless params[:edit].nil?
|
||||
@jour_reply = Journal.new
|
||||
@journals = @training_task.journals.includes(:user, :details).reorder("#{Journal.table_name}.id desc").all
|
||||
@journals = get_no_children_comments_all @journals
|
||||
@journals.each_with_index {|j,i| j.indice = i+1}
|
||||
@journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @training_task.project)
|
||||
@journals.reverse! if User.current.wants_comments_in_reverse_order?
|
||||
@journal = Journal.new(:journalized => @training_task)
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# Add a new issue
|
||||
# The new issue will be created from an existing one if copy_from parameter is given
|
||||
def new
|
||||
# 顶部导航
|
||||
@project_menu_type = 11
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'new', :layout => 'base_projects' }
|
||||
end
|
||||
end
|
||||
|
||||
# 用户发布新任务
|
||||
def create
|
||||
@training_task.save_attachments(params[:attachments] || (params[:training_task] && params[:training_task][:uploads]))
|
||||
@training_task.subject = params[:training_task][:subject]
|
||||
@training_task.description = params[:training_task][:description]
|
||||
@training_task.tracker_id = params[:training_task][:tracker_id]
|
||||
@training_task.position = params[:training_task][:position].to_i
|
||||
if @training_task.save
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render_attachment_warning_if_needed(@training_task)
|
||||
redirect_to training_task_url(@training_task)
|
||||
}
|
||||
end
|
||||
return
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'new' }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def complete_training_task
|
||||
taskId = @training_task.position
|
||||
end
|
||||
|
||||
def edit
|
||||
@project_menu_type = 11
|
||||
# 修改实例变量的值
|
||||
return unless build_new_task_from_params
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'base_projects' }
|
||||
format.xml { }
|
||||
end
|
||||
end
|
||||
|
||||
# 用户编辑更改issue
|
||||
def update
|
||||
return unless build_new_task_from_params
|
||||
@training_task.save_attachments(params[:attachments] || (params[:training_task] && params[:training_task][:uploads]))
|
||||
if @training_task.update_attributes(params[:training_task])
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html{redirect_to training_task_url(@training_task)}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update_user_issue_detail(issue, params)
|
||||
case params[:type]
|
||||
when "status"
|
||||
issue.update_attribute(:status_id, params[:status_id])
|
||||
when "assigned"
|
||||
issue.update_attribute(:assigned_to_id, params[:assigned_to_id])
|
||||
when "ratio"
|
||||
issue.update_attribute(:done_ratio, params[:done_ratio])
|
||||
when "prior"
|
||||
issue.update_attribute(:priority_id, params[:priority_id])
|
||||
end
|
||||
end
|
||||
|
||||
# Updates the issue form when changing the project, status or tracker
|
||||
# on issue creation/update
|
||||
def update_form
|
||||
end
|
||||
|
||||
def destroy
|
||||
return unless build_new_task_from_params
|
||||
@training_task.destroy
|
||||
respond_to do |format|
|
||||
if params[:type] == "project_show"
|
||||
format.html {redirect_to project_path(@project)}
|
||||
else
|
||||
format.html {redirect_to project_training_tasks_path(@project)}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def add_journal
|
||||
if User.current.logged?
|
||||
jour = Journal.new
|
||||
jour.user_id = User.current.id
|
||||
jour.notes = params[:notes]
|
||||
jour.journalized = @training_task
|
||||
jour.save_attachments(params[:attachments])
|
||||
jour.save
|
||||
update_user_activity(@training_task.class, @training_task.id)
|
||||
update_forge_activity(@training_task.class, @training_task.id)
|
||||
# @allowed_statuses = @training_task.new_statuses_allowed_to(User.current)
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@priorities = IssuePriority.active
|
||||
|
||||
respond_to do |format|
|
||||
# Issue详情单独处理
|
||||
if params[:is_issue_show]
|
||||
format.js{ redirect_to training_task_path(@training_task) }
|
||||
else
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def add_journal_in_org
|
||||
if User.current.logged?
|
||||
jour = Journal.new
|
||||
jour.user_id = User.current.id
|
||||
jour.notes = params[:notes]
|
||||
jour.journalized = @issue
|
||||
jour.save
|
||||
org_activity = OrgActivity.where("org_act_type='Issue' and org_act_id =#{@issue.id}").first
|
||||
org_activity.updated_at = jour.created_on
|
||||
org_activity.save
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#对某个journ回复,显示回复框
|
||||
def reply
|
||||
@training_task = TrainingTask.find(params[:id])
|
||||
@jour = Journal.find(params[:journal_id])
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
#给issue添加journ。回复内容包含 对某个被回复的journ的内容
|
||||
def add_reply
|
||||
if User.current.logged?
|
||||
jour = Journal.find(params[:journal_id])
|
||||
@training_task = TrainingTask.find params[:id]
|
||||
@project = @training_task.project
|
||||
# @allowed_statuses = @training_task.new_statuses_allowed_to(User.current)
|
||||
@priorities = IssuePriority.active
|
||||
new_jour = Journal.new
|
||||
new_jour.user_id = User.current.id
|
||||
new_jour.reply_id = params[:journal_id]
|
||||
new_jour.parent_id = jour.id
|
||||
new_jour.notes = params[:content]
|
||||
new_jour.journalized = @training_task
|
||||
new_jour.save_attachments(params[:attachments])
|
||||
# new_jour = @issue.journals.build(:user_id => User.current.id, :reply_id => params[:journal_id], :notes => params[:content], :parent_id => jour.id)
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
if new_jour.save
|
||||
update_user_activity(@training_task.class, @training_task.id)
|
||||
update_forge_activity(@training_task.class, @training_task.id)
|
||||
respond_to do |format|
|
||||
if params[:is_issue_show]
|
||||
format.js{ redirect_to training_task_path(@training_task) }
|
||||
else
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
=begin
|
||||
@journals = @training_task.journals.includes(:user, :details).reorder("#{Journal.table_name}.id desc").all
|
||||
@journals = get_no_children_comments_all @journals
|
||||
@journals.each_with_index {|j,i| j.indice = i+1}
|
||||
@journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @training_task.project)
|
||||
@journals.reverse! if User.current.wants_comments_in_reverse_order?
|
||||
@journal = Journal.new(:journalized => @training_task)
|
||||
respond_to do |format|
|
||||
#if params[:is_issue_show]
|
||||
# format.js{ redirect_to training_task_path(@training_task) }
|
||||
#else
|
||||
format.js
|
||||
#end
|
||||
end
|
||||
=end
|
||||
end
|
||||
end
|
||||
|
||||
# 需要刷新详情页面,代码同步一致
|
||||
# 获取project和issue状态是为了刷新页面
|
||||
# 值所以用delete是因为issue和journal在act_as_attachment中是同一个类型
|
||||
# 非动态页面直接刷新,动态页面手动刷新
|
||||
def delete_journal
|
||||
@is_project = params[:is_project]
|
||||
@training_task = TrainingTask.find(params[:id])
|
||||
begin
|
||||
forge_acts = ForgeMessage.where(:forge_message_type => "Journal", :forge_message_id => params[:journal_id])
|
||||
forge_acts.destroy_all unless forge_acts.empty?
|
||||
at_message = AtMessage.where(:at_message_type => "Journal", :at_message_id => params[:journal_id])
|
||||
at_message.destroy_all unless at_message.empty?
|
||||
Journal.delete(params[:journal_id])
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
respond_to do |format|
|
||||
if @user_activity_id
|
||||
format.js
|
||||
else
|
||||
format.js{ redirect_to training_task_path(@training_task)}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_project
|
||||
project_id = params[:project_id] || (params[:issue] && params[:issue][:project_id])
|
||||
@project = Project.find(project_id)
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
def allow_members
|
||||
if !(User.current.member_of?(@project) || User.current.admin?)
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def allow_manager
|
||||
if !(User.current.admin? || is_project_member?(User.current.id, @project.id))
|
||||
return render_403
|
||||
end
|
||||
end
|
||||
|
||||
def retrieve_previous_and_next_issue_ids
|
||||
retrieve_query_from_session
|
||||
if @query
|
||||
sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
|
||||
sort_update(@query.sortable_columns, 'issues_index_sort')
|
||||
limit = 500
|
||||
issue_ids = @query.issue_ids(:order => sort_clause, :limit => (limit + 1), :include => [:assigned_to, :tracker, :priority, :category, :fixed_version])
|
||||
if (idx = issue_ids.index(@issue.id)) && idx < limit
|
||||
if issue_ids.size < 500
|
||||
@issue_position = idx + 1
|
||||
@issue_count = issue_ids.size
|
||||
end
|
||||
@prev_issue_id = issue_ids[idx - 1] if idx > 0
|
||||
@next_issue_id = issue_ids[idx + 1] if idx < (issue_ids.size - 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def build_new_task_from_params
|
||||
if params[:id].blank?
|
||||
@training_task = TrainingTask.new
|
||||
@training_task.project = @project
|
||||
else
|
||||
@training_task = @project.training_tasks.find(params[:id])
|
||||
end
|
||||
|
||||
@training_task.project = @project
|
||||
@training_task.author ||= User.current
|
||||
end
|
||||
|
||||
def check_for_default_issue_status
|
||||
if IssueStatus.default.nil?
|
||||
render_error l(:error_no_default_issue_status)
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
def parse_params_for_bulk_issue_attributes(params)
|
||||
attributes = (params[:issue] || {}).reject {|k,v| v.blank?}
|
||||
attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'}
|
||||
if custom = attributes[:custom_field_values]
|
||||
custom.reject! {|k,v| v.blank?}
|
||||
custom.keys.each do |k|
|
||||
if custom[k].is_a?(Array)
|
||||
custom[k] << '' if custom[k].delete('__none__')
|
||||
else
|
||||
custom[k] = '' if custom[k] == '__none__'
|
||||
end
|
||||
end
|
||||
end
|
||||
attributes
|
||||
end
|
||||
|
||||
# Find the issue whose id is the :id parameter
|
||||
# Raises a Unauthorized exception if the issue is not visible
|
||||
def find_training_task
|
||||
@training_task = TrainingTask.find(params[:id])
|
||||
@project = @training_task.project
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
end
|
|
@ -310,6 +310,11 @@ class UsersController < ApplicationController
|
|||
@user_activity_id = params[:user_activity_id]
|
||||
@activity_id = params[:activity_id]
|
||||
@type = 'Issue'
|
||||
when 'Training_task'
|
||||
@reply = Journal.find params[:reply_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@activity_id = params[:activity_id]
|
||||
@type = 'Training_task'
|
||||
when 'Syllabus'
|
||||
@reply = JournalsForMessage.find params[:reply_id]
|
||||
@type = 'Syllabus'
|
||||
|
@ -417,6 +422,11 @@ class UsersController < ApplicationController
|
|||
comment = @root.journals.build(:user_id => User.current.id, :reply_id => params[:reply_id], :notes => params[:reply_message], :parent_id => reply.id)
|
||||
comment.save
|
||||
@is_project = params[:is_project] if params[:is_project]
|
||||
when 'TrainingTask'
|
||||
@root = reply.training_task
|
||||
comment = @root.journals.build(:user_id => User.current.id, :reply_id => params[:reply_id], :notes => params[:reply_message], :parent_id => reply.id)
|
||||
comment.save
|
||||
@is_project = params[:is_project] if params[:is_project]
|
||||
when 'Syllabus'
|
||||
@root = Syllabus.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}
|
||||
|
@ -4402,6 +4412,11 @@ class UsersController < ApplicationController
|
|||
@journals = @activity.journals.reorder("created_on desc")
|
||||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||
@user_activity = ForgeActivity.where(params[:div_id].to_i).first if params[:div_id]
|
||||
when 'is_project_training_task'
|
||||
@activity = TrainingTask.where('id = ?', params[:id].to_i).first
|
||||
@journals = @activity.journals.reorder("created_on desc")
|
||||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||
@user_activity = ForgeActivity.where(params[:div_id].to_i).first if params[:div_id]
|
||||
when 'BlogComment'
|
||||
obj = BlogComment.where('id = ?', params[:id].to_i).first
|
||||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||
|
|
|
@ -3697,7 +3697,7 @@ def get_reply_by_type type, reply_id
|
|||
reply = OrgDocumentComment.find reply_id
|
||||
when 'News','Comment'
|
||||
reply = Comment.find reply_id
|
||||
when 'Issue'
|
||||
when 'Issue', 'TrainingTask'
|
||||
reply = Journal.find reply_id
|
||||
when 'Journal'
|
||||
reply = Journal.find reply_id
|
||||
|
|
|
@ -544,6 +544,8 @@ module ProjectsHelper
|
|||
result = "manage_versions"
|
||||
elsif user.allowed_to?(:manage_repository, @project)
|
||||
result = "manage_repository"
|
||||
elsif @project.is_training_project?
|
||||
result = "training_task"
|
||||
end
|
||||
result
|
||||
end
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
module TrainingTasksHelper
|
||||
include ApplicationHelper
|
||||
include TagsHelper
|
||||
require 'iconv'
|
||||
|
||||
# Returns the textual representation of a journal details
|
||||
# as an array of strings
|
||||
def details_to_strings(details, no_html=false, options={})
|
||||
options[:only_path] = (options[:only_path] == false ? false : true)
|
||||
options[:token] = options[:token] if options[:token]
|
||||
strings = []
|
||||
values_by_field = {}
|
||||
details.each do |detail|
|
||||
|
||||
if detail.property == 'cf'
|
||||
field_id = detail.prop_key
|
||||
field = CustomField.find_by_id(field_id)
|
||||
if field && field.multiple?
|
||||
values_by_field[field_id] ||= {:added => [], :deleted => []}
|
||||
if detail.old_value
|
||||
values_by_field[field_id][:deleted] << detail.old_value
|
||||
end
|
||||
if detail.value
|
||||
values_by_field[field_id][:added] << detail.value
|
||||
end
|
||||
next
|
||||
end
|
||||
end
|
||||
strings << show_detail(detail, no_html, options)
|
||||
|
||||
end
|
||||
values_by_field.each do |field_id, changes|
|
||||
detail = JournalDetail.new(:property => 'cf', :prop_key => field_id)
|
||||
if changes[:added].any?
|
||||
detail.value = changes[:added]
|
||||
strings << show_detail(detail, no_html, options)
|
||||
elsif changes[:deleted].any?
|
||||
detail.old_value = changes[:deleted]
|
||||
strings << show_detail(detail, no_html, options)
|
||||
end
|
||||
end
|
||||
strings
|
||||
end
|
||||
end
|
|
@ -23,7 +23,8 @@ class Journal < ActiveRecord::Base
|
|||
belongs_to :journalized, :polymorphic => true,:touch => true
|
||||
# added as a quick fix to allow eager loading of the polymorphic association
|
||||
# since always associated to an issue, for now
|
||||
belongs_to :issue, :foreign_key => :journalized_id,:touch => true
|
||||
belongs_to :issue, :foreign_key => :journalized_id, :touch => true
|
||||
belongs_to :training_task, :foreign_key => :journalized_id, :touch => true
|
||||
|
||||
belongs_to :user
|
||||
has_many :details, :class_name => "JournalDetail", :dependent => :delete_all
|
||||
|
@ -192,27 +193,44 @@ class Journal < ActiveRecord::Base
|
|||
def act_as_forge_message
|
||||
receivers = []
|
||||
# 直接回复
|
||||
if self.user_id != self.issue.author_id
|
||||
receivers << self.issue.author_id
|
||||
end
|
||||
if self.user_id != self.issue.assigned_to_id && self.issue.assigned_to_id != self.issue.author_id # 指派人不是自己的话,则给指派人发送
|
||||
receivers << self.issue.assigned_to_id
|
||||
end
|
||||
receivers.each do |r|
|
||||
self.forge_messages << ForgeMessage.new(:user_id => r, :project_id => self.issue.project_id, :viewed => false)
|
||||
if self.journalized_type == 'Issue'
|
||||
if self.user_id != self.issue.author_id
|
||||
receivers << self.issue.author_id
|
||||
end
|
||||
if self.user_id != self.issue.assigned_to_id && self.issue.assigned_to_id != self.issue.author_id # 指派人不是自己的话,则给指派人发送
|
||||
receivers << self.issue.assigned_to_id
|
||||
end
|
||||
receivers.each do |r|
|
||||
self.forge_messages << ForgeMessage.new(:user_id => r, :project_id => self.issue.project_id, :viewed => false)
|
||||
end
|
||||
elsif self.journalized_type == 'TrainingTask'
|
||||
if self.user_id != self.training_task.author_id
|
||||
receivers << self.training_task.author_id
|
||||
end
|
||||
receivers.each do |r|
|
||||
self.forge_messages << ForgeMessage.new(:user_id => r, :project_id => self.training_task.project, :viewed => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 更新用户分数 -by zjc
|
||||
def be_user_score
|
||||
if (self.journalized_type == 'Issue')
|
||||
#新建了缺陷留言且留言不为空,不为空白
|
||||
if !self.notes.nil? && self.notes.gsub(' ','') != ''
|
||||
#协同得分加分
|
||||
UserScore.joint(:post_issue_message, self.user,self.issue.author,self, { message_id: self.id })
|
||||
update_messges_for_issue(self.user,1)
|
||||
update_messges_for_issue(self.user,2,self.issue.project)
|
||||
if !self.notes.nil? && self.notes.gsub(' ','') != ''
|
||||
#协同得分加分
|
||||
UserScore.joint(:post_issue_message, self.user,self.issue.author,self, { message_id: self.id })
|
||||
update_messges_for_issue(self.user,1)
|
||||
update_messges_for_issue(self.user,2,self.issue.project)
|
||||
end
|
||||
elsif( self.journalized_type == 'TrainingTask')
|
||||
if !self.notes.nil? && self.notes.gsub(' ','') != ''
|
||||
#协同得分加分
|
||||
UserScore.joint(:post_issue_message, self.user, self.training_task.author, self, { message_id: self.id })
|
||||
update_messges_for_issue(self.user, 1)
|
||||
update_messges_for_issue(self.user, 2, self.training_task.project)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
# 减少用户分数 -by zjc
|
||||
def down_user_score
|
||||
|
@ -237,12 +255,18 @@ class Journal < ActiveRecord::Base
|
|||
|
||||
# issue留言总数更新
|
||||
def add_journals_count
|
||||
if !self.issue.project.nil? && self.journalized_type == "Issue" && !self.issue.project.project_score.nil?
|
||||
project = self.issue.project
|
||||
project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num + 1)
|
||||
if self.journalized_type == 'Issue'
|
||||
if !self.issue.project.nil? && self.journalized_type == "Issue" && !self.issue.project.project_score.nil?
|
||||
project = self.issue.project
|
||||
project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num + 1)
|
||||
end
|
||||
elsif self.journalized_type == 'TrainingTask'
|
||||
if !self.training_task.project.nil? && self.journalized_type == "TrainingTask" && !self.training_task.project.project_score.nil?
|
||||
project = self.training_task.project
|
||||
project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 回复issue的时候,更新issue的时候
|
||||
def update_issue_time
|
||||
if self.journalized_type == "Issue"
|
||||
|
|
|
@ -1,98 +1,100 @@
|
|||
class PraiseTread < ActiveRecord::Base
|
||||
attr_accessible :user_id,:praise_tread_object_id,:praise_tread_object_type,:praise_or_tread
|
||||
belongs_to :user
|
||||
belongs_to :praise_tread_object, polymorphic: true
|
||||
#after_create :be_user_score
|
||||
#after_destroy :down_user_score
|
||||
include UserScoreHelper
|
||||
def self.find_object_by_type_and_id(type,id)
|
||||
@obj = nil
|
||||
case type
|
||||
when 'User'
|
||||
@obj = User.find_by_id(id)
|
||||
when 'Issue'
|
||||
@obj = Issue.find_by_id(id)
|
||||
when 'Project'
|
||||
@obj = Project.find_by_id(id)
|
||||
when 'Bid'
|
||||
@obj = Bid.find_by_id(id)
|
||||
when 'Contest'
|
||||
@obj = Contest.find_by_id(id)
|
||||
when 'Memo'
|
||||
@obj = Memo.find_by_id(id)
|
||||
when 'Message'
|
||||
@obj = Message.find_by_id(id)
|
||||
end
|
||||
return @obj
|
||||
end
|
||||
|
||||
# 获取裁定对象为Message时Message所属的项目或课程
|
||||
def project
|
||||
project = nil
|
||||
if self.praise_tread_object_type == 'Message' || self.praise_tread_object_type == 'Issues'
|
||||
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
|
||||
project = obj.project
|
||||
end
|
||||
project
|
||||
end
|
||||
|
||||
#更新用户分数 - by zjc
|
||||
def be_user_score
|
||||
#踩贴吧或讨论区帖子
|
||||
if self.praise_or_tread == 0 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message')
|
||||
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
|
||||
target_user = obj.author
|
||||
UserScore.skill(:treaded_by_user, User.current,target_user,self, { praise_tread_id: self.id })
|
||||
update_tread(self.user,1)
|
||||
update_tread(target_user,1)
|
||||
unless self.project.nil?
|
||||
update_tread(self.user,2,self.project)
|
||||
update_tread(target_user,2,self.project)
|
||||
end
|
||||
#顶贴吧或讨论区帖子
|
||||
elsif self.praise_or_tread == 1 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message')
|
||||
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
|
||||
target_user = obj.author
|
||||
UserScore.skill(:praised_by_user, User.current,target_user,self,{ praise_tread_id: self.id })
|
||||
update_praise(target_user,1)
|
||||
unless self.project.nil?
|
||||
update_praise(target_user,2,self.project)
|
||||
end
|
||||
#更新用户等级
|
||||
UserLevels.update_user_level(target_user)
|
||||
end
|
||||
end
|
||||
|
||||
def down_user_score
|
||||
#踩贴吧或讨论区帖子
|
||||
if self.praise_or_tread == 0 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message')
|
||||
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
|
||||
target_user = obj.author
|
||||
#UserScore.skill(:treaded_by_user, User.current,target_user,self, { praise_tread_id: self.id })
|
||||
update_tread(self.user,1)
|
||||
update_tread(target_user,1)
|
||||
unless self.project.nil?
|
||||
update_tread(self.user,2,self.project)
|
||||
update_tread(target_user,2,self.project)
|
||||
end
|
||||
#顶贴吧或讨论区帖子
|
||||
elsif self.praise_or_tread == 1 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message')
|
||||
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
|
||||
target_user = obj.author
|
||||
#UserScore.skill(:praised_by_user, User.current,target_user,self,{ praise_tread_id: self.id })
|
||||
update_praise(target_user,1)
|
||||
unless self.project.nil?
|
||||
update_praise(target_user,2,self.project)
|
||||
end
|
||||
#更新用户等级
|
||||
UserLevels.update_user_level(target_user)
|
||||
end
|
||||
end
|
||||
|
||||
def self.praised(activity)
|
||||
self.where(praise_tread_object_id: activity.id,
|
||||
praise_tread_object_type: activity.class.to_s,
|
||||
user_id: User.current.id).empty?
|
||||
end
|
||||
|
||||
end
|
||||
class PraiseTread < ActiveRecord::Base
|
||||
attr_accessible :user_id,:praise_tread_object_id,:praise_tread_object_type,:praise_or_tread
|
||||
belongs_to :user
|
||||
belongs_to :praise_tread_object, polymorphic: true
|
||||
#after_create :be_user_score
|
||||
#after_destroy :down_user_score
|
||||
include UserScoreHelper
|
||||
def self.find_object_by_type_and_id(type,id)
|
||||
@obj = nil
|
||||
case type
|
||||
when 'User'
|
||||
@obj = User.find_by_id(id)
|
||||
when 'Issue'
|
||||
@obj = Issue.find_by_id(id)
|
||||
when 'TrainingTask'
|
||||
@obj = TrainingTask.find_by_id(id)
|
||||
when 'Project'
|
||||
@obj = Project.find_by_id(id)
|
||||
when 'Bid'
|
||||
@obj = Bid.find_by_id(id)
|
||||
when 'Contest'
|
||||
@obj = Contest.find_by_id(id)
|
||||
when 'Memo'
|
||||
@obj = Memo.find_by_id(id)
|
||||
when 'Message'
|
||||
@obj = Message.find_by_id(id)
|
||||
end
|
||||
return @obj
|
||||
end
|
||||
|
||||
# 获取裁定对象为Message时Message所属的项目或课程
|
||||
def project
|
||||
project = nil
|
||||
if self.praise_tread_object_type == 'Message' || self.praise_tread_object_type == 'Issues'
|
||||
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
|
||||
project = obj.project
|
||||
end
|
||||
project
|
||||
end
|
||||
|
||||
#更新用户分数 - by zjc
|
||||
def be_user_score
|
||||
#踩贴吧或讨论区帖子
|
||||
if self.praise_or_tread == 0 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message')
|
||||
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
|
||||
target_user = obj.author
|
||||
UserScore.skill(:treaded_by_user, User.current,target_user,self, { praise_tread_id: self.id })
|
||||
update_tread(self.user,1)
|
||||
update_tread(target_user,1)
|
||||
unless self.project.nil?
|
||||
update_tread(self.user,2,self.project)
|
||||
update_tread(target_user,2,self.project)
|
||||
end
|
||||
#顶贴吧或讨论区帖子
|
||||
elsif self.praise_or_tread == 1 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message')
|
||||
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
|
||||
target_user = obj.author
|
||||
UserScore.skill(:praised_by_user, User.current,target_user,self,{ praise_tread_id: self.id })
|
||||
update_praise(target_user,1)
|
||||
unless self.project.nil?
|
||||
update_praise(target_user,2,self.project)
|
||||
end
|
||||
#更新用户等级
|
||||
UserLevels.update_user_level(target_user)
|
||||
end
|
||||
end
|
||||
|
||||
def down_user_score
|
||||
#踩贴吧或讨论区帖子
|
||||
if self.praise_or_tread == 0 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message')
|
||||
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
|
||||
target_user = obj.author
|
||||
#UserScore.skill(:treaded_by_user, User.current,target_user,self, { praise_tread_id: self.id })
|
||||
update_tread(self.user,1)
|
||||
update_tread(target_user,1)
|
||||
unless self.project.nil?
|
||||
update_tread(self.user,2,self.project)
|
||||
update_tread(target_user,2,self.project)
|
||||
end
|
||||
#顶贴吧或讨论区帖子
|
||||
elsif self.praise_or_tread == 1 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message')
|
||||
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
|
||||
target_user = obj.author
|
||||
#UserScore.skill(:praised_by_user, User.current,target_user,self,{ praise_tread_id: self.id })
|
||||
update_praise(target_user,1)
|
||||
unless self.project.nil?
|
||||
update_praise(target_user,2,self.project)
|
||||
end
|
||||
#更新用户等级
|
||||
UserLevels.update_user_level(target_user)
|
||||
end
|
||||
end
|
||||
|
||||
def self.praised(activity)
|
||||
self.where(praise_tread_object_id: activity.id,
|
||||
praise_tread_object_type: activity.class.to_s,
|
||||
user_id: User.current.id).empty?
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -57,6 +57,7 @@ class Project < ActiveRecord::Base
|
|||
has_many :enabled_modules, :dependent => :delete_all
|
||||
has_and_belongs_to_many :trackers, :order => "#{Tracker.table_name}.position"
|
||||
has_many :issues, :dependent => :destroy, :include => [:status, :tracker],:order => "issues.id ASC"
|
||||
has_many :training_tasks, :dependent => :destroy, :order => "training_tasks.id ASC"
|
||||
has_many :issue_changes, :through => :issues, :source => :journals
|
||||
has_many :versions, :dependent => :destroy, :order => "#{Version.table_name}.effective_date DESC, #{Version.table_name}.name DESC"
|
||||
has_many :time_entries, :dependent => :delete_all
|
||||
|
@ -159,6 +160,7 @@ class Project < ActiveRecord::Base
|
|||
after_create :create_board_sync,:acts_as_forge_activities, :create_project_ealasticsearch_index
|
||||
before_destroy :delete_all_members,:delete_project_ealasticsearch_index
|
||||
after_update :update_project_ealasticsearch_index
|
||||
|
||||
def remove_references_before_destroy
|
||||
return if self.id.nil?
|
||||
Watcher.delete_all ['watchable_id = ?', id]
|
||||
|
@ -193,6 +195,7 @@ class Project < ActiveRecord::Base
|
|||
scope :project_entities, -> { where(project_type: ProjectType_project) }
|
||||
scope :course_entities, -> { where(project_type: ProjectType_course) }
|
||||
scope :indexable,lambda { where('is_public = 1')} #用于elastic建索引的scope
|
||||
|
||||
def self.search(query)
|
||||
__elasticsearch__.search(
|
||||
{
|
||||
|
@ -219,6 +222,17 @@ class Project < ActiveRecord::Base
|
|||
}
|
||||
)
|
||||
end
|
||||
|
||||
# 判断项目是否为实训项目
|
||||
def is_training_project?
|
||||
(!self.enabled_modules.where("name = 'training_tasks'").empty? && self.training_status == 1) ? true : false
|
||||
end
|
||||
|
||||
# 判断项目是否为开启实训的项目(eg:学生开启实训)
|
||||
def is_child_training_project?
|
||||
self.training_status == 2 ? true :false
|
||||
end
|
||||
|
||||
def new_course
|
||||
self.where('project_type = ?', 1)
|
||||
end
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
class TrainingTask < ActiveRecord::Base
|
||||
attr_accessible :description, :project_id, :subject, :tracker_id
|
||||
belongs_to :project,:touch=> true
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
belongs_to :tracker
|
||||
has_many :journals, :as => :journalized, :dependent => :destroy
|
||||
has_many :visible_journals,
|
||||
:class_name => 'Journal',
|
||||
:as => :journalized,
|
||||
:conditions => Proc.new {
|
||||
["(#{Journal.table_name}.private_notes = ? OR (#{Project.allowed_to_condition(User.current, :view_private_notes)}))", false]
|
||||
},
|
||||
:readonly => true
|
||||
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
||||
has_one :praise_tread_cache, as: :object, dependent: :destroy
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity', :as => :forge_act, :dependent => :destroy
|
||||
|
||||
acts_as_attachable
|
||||
|
||||
validates_presence_of :subject, :author
|
||||
validates_length_of :subject, :maximum => 255
|
||||
after_create :act_as_forge_activity
|
||||
|
||||
def act_as_forge_activity
|
||||
self.forge_acts << ForgeActivity.new(:user_id => self.author_id, :project_id => self.project_id)
|
||||
end
|
||||
|
||||
end
|
|
@ -1239,6 +1239,16 @@ class User < Principal
|
|||
Thread.current[:current_user] ||= User.anonymous
|
||||
end
|
||||
|
||||
def user_real_extension
|
||||
ue = self.user_extensions
|
||||
if ue.nil?
|
||||
ue = UserExtensions.new
|
||||
ue.user_id = self.id
|
||||
ue.save
|
||||
end
|
||||
ue
|
||||
end
|
||||
|
||||
# Returns the anonymous user. If the anonymous user does not exist, it is created. There can be only
|
||||
# one anonymous user per database.
|
||||
def self.anonymous
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
<div id="muban_popup_box" style="width:400px;">
|
||||
<div class="muban_popup_top">
|
||||
<h3 class="fl">更换邮箱</h3>
|
||||
<a href="javascript:void(0);" class="muban_icons_close fr" 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;text-align: center;">
|
||||
<li style="margin-left: 40px">
|
||||
<span class="c_red f12"></span> 原邮箱 :
|
||||
<span style="width: 200px"><%= user.mail %></span>
|
||||
</li>
|
||||
<div class="c1"></div>
|
||||
<li style="margin-left: 40px">
|
||||
<span class="c_red f12"></span> 新邮箱 :
|
||||
<input type="text" style="width:200px" id="user_mail" name="user[mail]" placeholder="请输入邮箱地址">
|
||||
<p class="new_login_error fl" id="mail_req" style="display: none;margin-left: 68px;">请输入正确的邮箱</p>
|
||||
</li>
|
||||
</li>
|
||||
<div class="clear"></div>
|
||||
<li class="mt10">
|
||||
<label class="mr27"> </label>
|
||||
<a href="javascript:void(0);" class="sy_btn_grey fl" onclick="hideModal()">取 消</a>
|
||||
<a href="javascript:void(0);" class="sy_btn_blue fl ml20" onclick="submit_user_emails()">确 定</a>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var $mail_correct = false;
|
||||
var $mail = $('#user_mail');
|
||||
$mail.blur(function (event) {
|
||||
if (/^[a-zA-Z0-9]+([._\\]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(this.value) == false){
|
||||
$('#mail_req').html( '<span style="color: #c00202">邮件格式不对</span>').show();
|
||||
$mail_correct = false;
|
||||
return ;
|
||||
}
|
||||
if ($(this).is('#user_mail')) {
|
||||
$.get('<%= account_valid_ajax_path %>',
|
||||
{ valid: "mail",
|
||||
value: this.value },
|
||||
function (data) {
|
||||
if (data.valid) {
|
||||
$('#mail_req').html( '<span style="color: green">'+data.message+'</span>' );
|
||||
$mail_correct = true;
|
||||
} else {
|
||||
$('#mail_req').html( '<span style="color: #c00202">'+data.message+'</span>' );
|
||||
$mail_correct = false;
|
||||
}
|
||||
$('#mail_req').css('display','block');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function submit_user_emails(){
|
||||
if($mail_correct == false){
|
||||
return
|
||||
}else{
|
||||
$.get('<%= account_change_email_path(:user_id => @user.id) %>',
|
||||
{ valid: "mail",
|
||||
value: document.getElementById("user_mail").value },
|
||||
function (data){
|
||||
$("#user_email_show").html(data.email);
|
||||
hideModal();
|
||||
return;
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -1,22 +1,31 @@
|
|||
<div class="new_content">
|
||||
<div class="email_verify">
|
||||
<p class="email_verify_prompt"><span class="icons_email_prompt"></span>您的账号尚未激活,请先进入您的注册邮箱,激活您的账号。</p>
|
||||
<p class="email_verify_prompt"><span class="icons_email_prompt"></span>您的账号尚未激活,请先进入您的注册邮箱(<span class="c_red" id="user_email_show"><%= @user.mail %></span>),激活您的账号。</p>
|
||||
<button class="email_verify_btn mt30 ml30" onclick = "resendMail('<%= resendmail_path(@user) %>','<%= @user.id %>');">重新发送激活邮件</button>
|
||||
<%#= link_to l(:label_mail_resend), { :controller => 'account', :action => 'resendmail',:user => @user}, :class=>"email_verify_btn mt30 ml30", :remote => true, :method => 'get' %>
|
||||
<ul class="email_prompt_txt ml30 mt30">
|
||||
<ul class="email_prompt_txt ml30 mt30" style="width:580px;margin-bottom: 20px">
|
||||
<p class="email_prompt_p">如果您尚未收到激活邮件,请按照以下步骤操作:</p>
|
||||
<li>检查邮箱的“订阅邮件”、“垃圾邮件”,可能会发现激活邮件。 </li>
|
||||
<li>如果激活邮件已无效,请点击重新发送激活邮件按钮。</li>
|
||||
<li>如果您无法收到激活邮件,请您直接给我们管理员留言:</li>
|
||||
<div class=" mt10">
|
||||
<textarea style="resize: none;" class="email_prompt_mes" placeholder="请管理员尽快帮我解决邮箱激活问题"></textarea>
|
||||
<button class="email_sub_btn fr" onclick="leave_email_activation_message('<%= leave_email_activation_message_path(1)%>','<%= @user.id %>');">确定</button>
|
||||
<div class="cl"></div>
|
||||
<li>如果重发注册验证邮箱邮件仍然没有收到,请<a href="javascript:void(0);" class="link-blue" onclick="change_user_email()">更换邮箱地址</a>,重新发送激活邮件</li>
|
||||
<li>如果您始终无法收到激活邮件,请直接给我们留言:</li>
|
||||
<div class="mt10">
|
||||
<% get_memo %>
|
||||
<%= form_for(@new_memo, :url => mail_feedback_forum_path(@public_forum, :user_id => @user.id), :remote => true) do |f| %>
|
||||
<%= f.text_area :subject, :id => "subject", :class => "email_prompt_mes", :style => "width: 568px;", :placeholder => l(:label_email_feedback_tips) %>
|
||||
<%= f.hidden_field :content, :id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
|
||||
<span class="c_red fl" id="mail_valid_feedback_tip" style="display: none;">内容不能为空</span>
|
||||
<a href="javascript:void(0);" class="btn btn-blue fr" onclick="f_submit();">确定</a>
|
||||
<% end %>
|
||||
</div>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function change_user_email(){
|
||||
var htmlvalue = "<%= j (render :partial => 'account/change_user_email', :locals => {:user => @user}) %>";
|
||||
pop_box_new(htmlvalue,520,316);
|
||||
}
|
||||
function resendMail(url,id)
|
||||
{
|
||||
$.get(
|
||||
|
@ -55,4 +64,26 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
function regex_mv_name()
|
||||
{
|
||||
var name = $.trim($("#subject").val());
|
||||
if(name.length == 0)
|
||||
{
|
||||
$("#mail_valid_feedback_tip").show();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#mail_valid_feedback_tip").hide();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function f_submit()
|
||||
{
|
||||
if(regex_mv_name()){
|
||||
$("#new_memo").submit();
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<div class="email_verify" style="width: 580px;">
|
||||
<p class="fb f18" style="color:green;"><i class="icon-ok mr5 f18"></i>注册成功!
|
||||
<span style=" color:#3b94d6; font-size:12px; font-weight:normal;">请在24小时内点击邮件中的链接来激活您的账号。</span></p>
|
||||
<p class="f14 mt30 mb5">请登录邮箱(<span class="c_red"><%= @user.mail %></span>)收取账号激活邮件。<br/>点击邮件中的激活链接,方可使用该账号
|
||||
<p class="f14 mt30 mb5">请登录邮箱(<span class="c_red" id="user_email_show"><%= @user.mail %></span>)收取账号激活邮件。<br/>点击邮件中的激活链接,方可使用该账号
|
||||
</p>
|
||||
<p>
|
||||
<a href="http://mail.<%= email %>" class="btn btn-blue" target="_blank"><%= l(:label_check_email)%></a>
|
||||
|
@ -14,14 +14,15 @@
|
|||
|
||||
<ul class="email_prompt_txt mt30" style="width: 580px;">
|
||||
<p class="email_prompt_p">如果您一直收不到激活邮件,请按照以下步骤操作:</p>
|
||||
<li>1.请确认是否填写了正确的邮箱地址 </li>
|
||||
<li>2.请注意查看邮箱中的“订阅邮件”、“垃圾邮件”,可能Trustie的邮件被误杀了</li>
|
||||
<li>3.请点击重新发送激活邮件按钮</li>
|
||||
<li>4.如果您无法收到激活邮件,请直接给我们留言:</li>
|
||||
<li>请确认是否填写了正确的邮箱地址 </li>
|
||||
<li>请注意查看邮箱中的“订阅邮件”、“垃圾邮件”,可能Trustie的邮件被误杀了</li>
|
||||
<li>请点击重新发送激活邮件按钮</li>
|
||||
<li>如果重发注册验证邮箱邮件仍然没有收到,请<a href="javascript:void(0);" class="link-blue" onclick="change_user_email()">更换邮箱地址</a>,重新发送激活邮件</li>
|
||||
<li>如果您始终无法收到激活邮件,请直接给我们留言:</li>
|
||||
<div class="mt10 clearfix">
|
||||
<% get_memo %>
|
||||
<%= form_for(@new_memo, :url => mail_feedback_forum_path(@public_forum, :user_id => @user.id), :remote => true) do |f| %>
|
||||
<%= f.text_area :subject, :id => "subject", :class => "email_prompt_mes", :style => "width: 568px;", :placeholder => l(:label_feedback_tips) %>
|
||||
<%= f.text_area :subject, :id => "subject", :class => "email_prompt_mes", :style => "width: 568px;", :placeholder => l(:label_email_feedback_tips) %>
|
||||
<%= f.hidden_field :content, :id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
|
||||
<span class="c_red fl" id="mail_valid_feedback_tip" style="display: none;">内容不能为空</span>
|
||||
<a href="javascript:void(0);" class="btn btn-blue fr" onclick="f_submit();">确定</a>
|
||||
|
@ -33,6 +34,11 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
function change_user_email(){
|
||||
var htmlvalue = "<%= j (render :partial => 'account/change_user_email', :locals => {:user => @user}) %>";
|
||||
pop_box_new(htmlvalue,520,316);
|
||||
}
|
||||
function regex_mv_name()
|
||||
{
|
||||
var name = $.trim($("#subject").val());
|
||||
|
@ -51,7 +57,6 @@
|
|||
function f_submit()
|
||||
{
|
||||
if(regex_mv_name()){
|
||||
alert("222");
|
||||
$("#new_memo").submit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<h3>
|
||||
<%=l(:label_user_homework)%>
|
||||
</h3>
|
||||
|
||||
<p><%= link_to "编程作业", admin_homework_path(:type => "2") %></p>
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<%= link_to '管理员身份', switch_role_contest_path(@contest, :user_id => User.current.id, :curr_role => 14, :tar_role => 13), :class => "fr sy_btn_blue mt28 ml10", :title => "由评委身份切换至管理员身份" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% elsif User.current.logged? %>
|
||||
<%= link_to "加入竞赛",join_contest_contests_path(),:remote => true, :method => "get", :class => "fr sy_btn_blue mt28 ml10" %>
|
||||
<% end %>
|
||||
<span class="fr mt30 f16"> 邀请码:
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<div class="cl"></div>
|
||||
|
||||
<div id="messageContent">
|
||||
<div class="resources"><%= link_to image_tag(url_to_avatar(User.current),:class=>"fl mr10", :width => "50", :height => "50"), :alt => "用户头像" %>
|
||||
<div class="resources " ><%= link_to image_tag(url_to_avatar(User.current),:class=>"fl mr10", :width => "50", :height => "50"), :alt => "用户头像" %>
|
||||
<div class="fl" style="width:658px;">
|
||||
<%= form_for('new_form',:url => leave_contest_message_path(@contest.id), :html =>{:id => "contest_feedback_new"}, :method => "post") do |f|%>
|
||||
<%= render :partial => "users/jour_form", :locals => {:f => f, :object => @contest} %>
|
||||
|
|
|
@ -40,6 +40,9 @@
|
|||
<li>
|
||||
<a href="http://www.xtu.edu.cn/" target="_blank"><img src="images/footer_logo/p-xtu.png" width="210" height="40" alt="湘潭大学"></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:void(0)" target="_blank"><img src="images/footer_logo/p-zgkyrj.png" width="210" height="40" alt="中国开源软件推进联盟"></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
<%= link_to user.show_name, user_path(user), :class => 'fl sy_class_users_st_name' ,:title => "#{user.show_name}", :target => '_blank' %>
|
||||
</td>
|
||||
<td>
|
||||
<span class="sy_class_users_st_num" title="<%= user.user_extensions.student_id %>"><%= user.user_extensions.student_id %></span>
|
||||
<span class="sy_class_users_st_num" title="<%= user.user_real_extension.student_id %>"><%= user.user_real_extension.student_id %></span>
|
||||
</td>
|
||||
<td>
|
||||
<% if !is_teacher && User.current.id != member.user_id && course_has_score_open_common_homework(@course) %>
|
||||
|
|
|
@ -1,99 +1,108 @@
|
|||
<% project_file_num = Attachment.where(:container_type => "Project", :container_id => @project.id).count %>
|
||||
<% project_issue_count = @project.issues.count %>
|
||||
<% project_acts = ForgeActivity.where("project_id = ?", @project.id).count %>
|
||||
<% raodmaps = Version.where("project_id = ?", @project.id).count %>
|
||||
<% project_score = @project.project_score %>
|
||||
<%# 更新访问数,刷新的时候更新访问次数 %>
|
||||
<% update_visiti_count @project %>
|
||||
|
||||
<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>
|
||||
|
||||
<!--加入、退出、关注项目-->
|
||||
<div class="fr clear mr15">
|
||||
<ul><span id="join_in_project_applied"><%= render :partial => "projects/applied_status" %></span></ul>
|
||||
</div>
|
||||
<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", :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 %>
|
||||
|
||||
<div class="pro_new_topnav mt8">
|
||||
<ul>
|
||||
<li id="project_menu_01">
|
||||
<%= link_to "#{l(:label_activity)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k(project_acts)}</span>".html_safe, {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "pro_new_proname", :title => "#{project_acts}" %>
|
||||
</li>
|
||||
<!--问题跟踪-->
|
||||
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
|
||||
<li id="project_menu_02">
|
||||
<%= link_to project_issue_count > 0 ? "#{l(:label_issue_tracking)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k project_issue_count}</span>".html_safe : "#{l(:label_issue_tracking)}", project_issues_path(@project, :remote => true), :class => "pro_new_proname", :title => "#{project_issue_count}" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<!--讨论区-->
|
||||
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
|
||||
<li id="project_menu_03">
|
||||
<%= link_to project_score.board_num > 0 ? "#{l(:project_module_boards)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k project_score.board_num}</span>".html_safe : "#{l(:project_module_boards)}", project_boards_path(@project), :class => "pro_new_proname", :title => "#{project_score.board_num}" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<!--资源库-->
|
||||
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
|
||||
<li id="project_menu_04">
|
||||
<%= link_to project_file_num > 0 ? "#{l(:project_module_files)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k project_file_num}</span>".html_safe : l(:project_module_files), project_files_path(@project), :class => "pro_new_proname", :title => "#{project_file_num}" %>
|
||||
<% end %>
|
||||
<!--版本库-->
|
||||
<% if visible_repository?(@project) %>
|
||||
<% if User.current.admin? || (is_project_member?(User.current.id, @project.id) && role_of_members_in_project(@project.id, User.current.id) != "Reporter" ) %>
|
||||
<li id="project_menu_05"><%= link_to @project.project_score.changeset_num.to_i > 0 ? "#{l(:project_module_repository)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k project_score.changeset_num}</span>".html_safe : "#{l(:project_module_repository)}",({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).try(:identifier)}), :class => "pro_new_proname", :title => "#{project_score.changeset_num}" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!--Pull Request-->
|
||||
<% unless @project.gpid.nil? %>
|
||||
<li id="project_menu_06">
|
||||
<%= link_to project_score.pull_request_num >0 ? "Pull Requests <span class='issues_nav_tag ml5'>#{switch_integer_into_k project_score.pull_request_num}</span>".html_safe : "Pull Requests", project_pull_requests_path(@project), :class => "pro_new_proname", :title => "#{project_score.pull_request_num}" %>
|
||||
<% if project_score.pull_request_num >0 %>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
<!--里程碑-->
|
||||
<li id="project_menu_07">
|
||||
<%= link_to @project.versions.count >0 ? "#{l(:label_roadmap)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k @project.versions.count}</span>".html_safe : l(:label_roadmap) ,project_roadmap_path(@project), :class => "pro_new_proname", :title => "#{@project.versions.count}" %>
|
||||
</li>
|
||||
<!--日历-->
|
||||
<% unless @project.enabled_modules.where("name = 'calendar'").empty? %>
|
||||
<li id="project_menu_08">
|
||||
<%= link_to l(:project_module_calendar),project_calendar_path(@project) %>
|
||||
</li>
|
||||
<% end %>
|
||||
<!--甘特图-->
|
||||
<% unless @project.enabled_modules.where("name = 'gantt'").empty? %>
|
||||
<li id="project_menu_09">
|
||||
<%= link_to l(:project_module_gantt) ,project_gantt_path(@project) %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<% if User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project) %>
|
||||
<li id="project_menu_010">
|
||||
<%= link_to "#{l(:button_configure)}", settings_project_path(@project), :class => "pro_new_proname" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--新版项目头部结束-->
|
||||
<script>
|
||||
$(function(){
|
||||
|
||||
$("#project_menu_0<%= @project_menu_type %>").addClass('pro_new_topnav_active');
|
||||
|
||||
})
|
||||
<% project_file_num = Attachment.where(:container_type => "Project", :container_id => @project.id).count %>
|
||||
<% project_issue_count = @project.issues.count %>
|
||||
<% training_tasks_count = @project.training_tasks.count %>
|
||||
<% project_acts = ForgeActivity.where("project_id = ?", @project.id).count %>
|
||||
<% raodmaps = Version.where("project_id = ?", @project.id).count %>
|
||||
<% project_score = @project.project_score %>
|
||||
<%# 更新访问数,刷新的时候更新访问次数 %>
|
||||
<% update_visiti_count @project %>
|
||||
|
||||
<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>
|
||||
|
||||
<!--加入、退出、关注项目-->
|
||||
<% if !@project.is_child_training_project? %>
|
||||
<div class="fr clear mr15">
|
||||
<ul><span id="join_in_project_applied"><%= render :partial => "projects/applied_status" %></span></ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<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", :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 %>
|
||||
|
||||
<div class="pro_new_topnav mt8">
|
||||
<ul>
|
||||
<li id="project_menu_01">
|
||||
<%= link_to "#{l(:label_activity)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k(project_acts)}</span>".html_safe, {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "pro_new_proname", :title => "#{project_acts}" %>
|
||||
</li>
|
||||
<!--问题跟踪-->
|
||||
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
|
||||
<li id="project_menu_02">
|
||||
<%= link_to project_issue_count > 0 ? "#{l(:label_issue_tracking)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k project_issue_count}</span>".html_safe : "#{l(:label_issue_tracking)}", project_issues_path(@project, :remote => true), :class => "pro_new_proname", :title => "#{project_issue_count}" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<!--实训任务-->
|
||||
<% if !@project.enabled_modules.where("name = 'training_tasks'").empty? %>
|
||||
<% if User.current.admin? || is_project_member?(User.current.id, @project.id) %>
|
||||
<li id="project_menu_011">
|
||||
<%= link_to training_tasks_count > 0 ? "#{l(:project_module_training_tasks)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k training_tasks_count}</span>".html_safe : "#{l(:project_module_training_tasks)}", project_training_tasks_url(@project), :class => "pro_new_proname", :title => "#{training_tasks_count}" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!--讨论区-->
|
||||
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
|
||||
<li id="project_menu_03">
|
||||
<%= link_to project_score.board_num > 0 ? "#{l(:project_module_boards)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k project_score.board_num}</span>".html_safe : "#{l(:project_module_boards)}", project_boards_path(@project), :class => "pro_new_proname", :title => "#{project_score.board_num}" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<!--资源库-->
|
||||
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
|
||||
<li id="project_menu_04">
|
||||
<%= link_to project_file_num > 0 ? "#{l(:project_module_files)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k project_file_num}</span>".html_safe : l(:project_module_files), project_files_path(@project), :class => "pro_new_proname", :title => "#{project_file_num}" %>
|
||||
<% end %>
|
||||
<!--版本库-->
|
||||
<% if !@project.enabled_modules.where("name = 'repository'").empty? && !Repository.where(:project_id => @project.id, :type => "Repository::Gitlab").first.nil? %>
|
||||
<li id="project_menu_05"><%= link_to @project.project_score.changeset_num.to_i > 0 ? "#{l(:project_module_repository)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k project_score.changeset_num}</span>".html_safe : "#{l(:project_module_repository)}",({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).try(:identifier)}), :class => "pro_new_proname", :title => "#{project_score.changeset_num}" %></li>
|
||||
<% end %>
|
||||
<!--Pull Request-->
|
||||
<% unless @project.gpid.nil? %>
|
||||
<li id="project_menu_06">
|
||||
<%= link_to project_score.pull_request_num >0 ? "Pull Requests <span class='issues_nav_tag ml5'>#{switch_integer_into_k project_score.pull_request_num}</span>".html_safe : "Pull Requests", project_pull_requests_path(@project), :class => "pro_new_proname", :title => "#{project_score.pull_request_num}" %>
|
||||
<% if project_score.pull_request_num >0 %>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
<!--里程碑-->
|
||||
<li id="project_menu_07">
|
||||
<%= link_to @project.versions.count >0 ? "#{l(:label_roadmap)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k @project.versions.count}</span>".html_safe : l(:label_roadmap) ,project_roadmap_path(@project), :class => "pro_new_proname", :title => "#{@project.versions.count}" %>
|
||||
</li>
|
||||
<!--日历-->
|
||||
<% unless @project.enabled_modules.where("name = 'calendar'").empty? %>
|
||||
<li id="project_menu_08">
|
||||
<%= link_to l(:project_module_calendar),project_calendar_path(@project) %>
|
||||
</li>
|
||||
<% end %>
|
||||
<!--甘特图-->
|
||||
<% unless @project.enabled_modules.where("name = 'gantt'").empty? %>
|
||||
<li id="project_menu_09">
|
||||
<%= link_to l(:project_module_gantt) ,project_gantt_path(@project) %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<% if (User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project)) && !@project.is_child_training_project? %>
|
||||
<li id="project_menu_010">
|
||||
<%= link_to "#{l(:button_configure)}", settings_project_path(@project), :class => "pro_new_proname" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--新版项目头部结束-->
|
||||
<script>
|
||||
$(function(){
|
||||
|
||||
$("#project_menu_0<%= @project_menu_type %>").addClass('pro_new_topnav_active');
|
||||
|
||||
})
|
||||
</script>
|
|
@ -38,9 +38,8 @@
|
|||
<li class="fl"><a href="http://www.webxmf.com/" target="_blank"><img src="/images/footer_logo/bee_logo.png" width="167" height="40" style="display: inline-block;" alt="web小蜜蜂" /></a></li>
|
||||
</ul>
|
||||
<div class="cl"></div>-->
|
||||
<ul class="copyright">
|
||||
<li class="fl mr10"><%= l(:label_rights_reserved)%></li>
|
||||
<li class="fl"><a href="http://www.miibeian.gov.cn/" class="fl f_grey" target="_blank"><%= l(:label_license)%></a></li>
|
||||
</ul>
|
||||
<div class="copyright">
|
||||
<p ><%= l(:label_rights_reserved)%><span class="mr10"></span><a href="http://www.miibeian.gov.cn/" class=" f_grey" target="_blank"><%= l(:label_license)%></a></p>
|
||||
</div>
|
||||
</ul>
|
||||
</div><!--Footer end-->
|
|
@ -38,8 +38,7 @@
|
|||
<li class="fl"><a href="http://www.webxmf.com/" target="_blank"><img src="/images/footer_logo/bee_logo.png" width="167" height="40" style="display: inline-block;" alt="web小蜜蜂" /></a></li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<ul class="copyright">
|
||||
<li class="fl mr30"><%= l(:label_rights_reserved)%></li>
|
||||
<li class="fl"><a href="http://www.miibeian.gov.cn/" class="fl f_grey" target="_blank"><%= l(:label_license)%></a></li>
|
||||
</ul>
|
||||
<div class="copyright">
|
||||
<p ><%= l(:label_rights_reserved)%><span class="mr10"></span><a href="http://www.miibeian.gov.cn/" class=" f_grey" target="_blank"><%= l(:label_license)%></a></p>
|
||||
</div>
|
||||
</div><!--Footer end-->
|
|
@ -116,6 +116,7 @@
|
|||
$("#navHomepageSearchType").hide();
|
||||
});
|
||||
|
||||
<% unless @force %>
|
||||
$("#user_messages").mouseenter(function(){
|
||||
onNotice = true;
|
||||
$("#user_messages_list").show();
|
||||
|
@ -134,6 +135,7 @@
|
|||
obj.html("<%=escape_javascript(render :partial => 'layouts/message_loading') %>");
|
||||
} }, 500);
|
||||
});
|
||||
<% end %>
|
||||
$("#message_list_detail").mouseenter(function(event){
|
||||
event.stopPropagation();
|
||||
onUserMessages = true;
|
||||
|
|
|
@ -132,7 +132,7 @@
|
|||
role_str = "参赛者"
|
||||
end
|
||||
end %>
|
||||
<li><a href="<%=contest_path(ma.contest_id) %>" target="_blank" title='<%= user.show_name%> <%= user.user_extensions.school_id.blank? ? "" : "来自"+user.user_extensions.school.name+"," %>申请以"<%= role_str%>"的身份加入竞赛:<%=Contest.find(ma.contest_id).name %> <%= User.find(ma.contest_message_id).show_name %><%= ma.status == 1 ? "已同意" : "已拒绝"%>'><span class="shadowbox_news_user"><%= user.show_name%> </span><%= user.user_extensions.school_id.blank? ? "" : "来自"+user.user_extensions.school.name+"," %>申请以"<%= role_str%>"的身份加入竞赛:<%=Contest.find(ma.contest_id).name %> <%= User.find(ma.contest_message_id).show_name %><%= ma.status == 1 ? "已同意" : "已拒绝"%></a></li>
|
||||
<li><a href="<%=contest_path(ma.contest_id) %>" target="_blank" title='<%= user.show_name%> <%= user.user_extensions.school_id.blank? || user.user_extensions.school.nil? ? "" : "来自"+user.user_extensions.school.name+"," %>申请以"<%= role_str%>"的身份加入竞赛:<%=Contest.find(ma.contest_id).name %> <%= User.find(ma.contest_message_id).show_name %><%= ma.status == 1 ? "已同意" : "已拒绝"%>'><span class="shadowbox_news_user"><%= user.show_name%> </span><%= user.user_extensions.school_id.blank? || user.user_extensions.school.nil? ? "" : "来自"+user.user_extensions.school.name+"," %>申请以"<%= role_str%>"的身份加入竞赛:<%=Contest.find(ma.contest_id).name %> <%= User.find(ma.contest_message_id).show_name %><%= ma.status == 1 ? "已同意" : "已拒绝"%></a></li>
|
||||
<% elsif ma.contest_message_type == "JoinContest" and ma.status == 0 %>
|
||||
<li><a href="<%=contest_path(ma.contest) %>" target="_blank" title="<%=User.find(ma.contest_message_id).show_name %> 将您加入了竞赛:<%= ma.contest.name%>"><span class="shadowbox_news_user"><%=User.find(ma.contest_message_id).show_name %> </span>将您加入了竞赛:<%= ma.contest.name%></a></li>
|
||||
<% elsif ma.contest_message_type == "JoinContest" and ma.status == 1 %>
|
||||
|
@ -177,8 +177,8 @@
|
|||
<% applied_contest = ma.applied %>
|
||||
<% contest = Contest.find applied_contest.contest_id %>
|
||||
<% message_user = User.find(applied_contest.user_id) %>
|
||||
<% content = '<span class="shadowbox_news_user">'+message_user.show_name+' </span>'+(message_user.user_extensions.school_id.blank? ? "" : "来自")+message_user.user_extensions.school.name+","+'申请以"'+ get_role_str(ma.role) + '"的身份加入竞赛:' + contest.name%>
|
||||
<%= link_to content.html_safe, contest_path(contest.id), :title => "#{message_user.show_name} #{message_user.user_extensions.school_id.blank? ? '' : '来自'+message_user.user_extensions.school.name},申请以'#{get_role_str(ma.role)}'的身份加入竞赛:#{contest.name}", :target => '_blank' %>
|
||||
<% content = '<span class="shadowbox_news_user">'+message_user.show_name+' </span>'+(message_user.user_extensions.school_id.blank? || message_user.user_extensions.school.nil? ? "" : "来自"+message_user.user_extensions.school.name+",")+'申请以"'+ get_role_str(ma.role) + '"的身份加入竞赛:' + contest.name%>
|
||||
<%= link_to content.html_safe, contest_path(contest.id), :title => "#{message_user.show_name} #{message_user.user_extensions.school_id.blank? || message_user.user_extensions.school.nil? ? '' : '来自'+message_user.user_extensions.school.name+","}申请以'#{get_role_str(ma.role)}'的身份加入竞赛:#{contest.name}", :target => '_blank' %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% elsif ma.class == ForgeMessage %>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus','css/moduel', 'css/user', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify','contest'%>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','sy_public','syllabus', 'css/moduel','css/contest'%>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','css/sy_public','css/syllabus', 'css/moduel','css/contest'%>
|
||||
<%= javascript_include_tag "course","avatars","header","attachments",'prettify','contest' %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus','css/moduel', 'css/user', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','sy_public','syllabus', 'css/moduel','css/contest'%>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','css/syllabus', 'css/moduel','css/contest'%>
|
||||
<%= javascript_include_tag "course","avatars","header","attachments",'prettify' %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
|
|
|
@ -162,8 +162,7 @@
|
|||
<div class="cl"></div>
|
||||
|
||||
<ul class="copyright mt10">
|
||||
<li class="fl mr30">Copyright © 2007-2016, All Rights Reserved</li>
|
||||
<li>ICP备09019772</li>
|
||||
<p ><%= l(:label_rights_reserved)%><span class="mr10"></span><a href="http://www.miibeian.gov.cn/" class=" f_grey" target="_blank"><%= l(:label_license)%></a></p>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus','css/moduel', 'css/user', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','csws/syllabus','css/moduel', 'css/user', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public','css/structure','css/courses','css/popup','prettify','syllabus','sy_public','css/moduel',:media => 'all'%>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public','css/structure','css/courses','css/popup','prettify','css/syllabus','css/sy_public','css/moduel',:media => 'all'%>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "bootstrap","avatars","course",'attachments','prettify','syllabus','cookie'%>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= stylesheet_link_tag 'css/common','css/structure', 'css/public', 'css/courses','prettify', 'css/org', 'syllabus'%>
|
||||
<%= stylesheet_link_tag 'css/common','css/structure', 'css/public', 'css/courses','prettify', 'css/org', 'css/syllabus'%>
|
||||
<%= javascript_include_tag "course","header",'prettify','contest' %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus','css/moduel', 'css/user', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus',:media => 'all' %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus',:media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
<%= stylesheet_link_tag 'css/common','css/structure','css/public','css/popup','syllabus','sy_public', :media => 'all'%>
|
||||
<%= stylesheet_link_tag 'css/common','css/structure','css/public','css/popup','css/syllabus','css/sy_public', :media => 'all'%>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript"
|
||||
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
|
|
|
@ -1,11 +1,23 @@
|
|||
<% if PraiseTread.praised(activity) %>
|
||||
<a href='<%= praise_tread_praise_plus_path({:obj_id=>activity.id,:obj_type=>activity.class,:user_activity_id=>user_activity_id,:type=>type }) %>' data-remote="true" class="<%=type == 'reply'? 'fr' : 'ml15' %> likeButton" title="点赞" >
|
||||
<a href='<%= praise_tread_praise_plus_path({:obj_id => activity.id,
|
||||
:obj_type => activity.class,
|
||||
:user_activity_id => user_activity_id,
|
||||
:type => type }) %>'
|
||||
data-remote="true"
|
||||
class="<%= type == 'reply'? 'fr' : 'ml15' %> likeButton"
|
||||
title="点赞" >
|
||||
<span class="likeText">赞</span>
|
||||
<% num = activity.praise_tread_cache ? activity.praise_tread_cache.praise_num : 0 %>
|
||||
<span class="likeNum"><%= (num.nil? ? 0 : num) > 0 ? "(#{(num.nil? ? 0 : num)})" : "" %></span>
|
||||
</a>
|
||||
<% else %>
|
||||
<a href='<%= praise_tread_praise_minus_path({:obj_id=>activity.id,:obj_type=>activity.class,:user_activity_id=>user_activity_id,:type=>type }) %>' data-remote="true" class="<%=type == 'reply'? 'fr' : 'ml15' %> likeButton" title="取消点赞" >
|
||||
<a href='<%= praise_tread_praise_minus_path({:obj_id => activity.id,
|
||||
:obj_type => activity.class,
|
||||
:user_activity_id => user_activity_id,
|
||||
:type => type }) %>'
|
||||
data-remote="true"
|
||||
class="<%= type == 'reply'? 'fr' : 'ml15' %> likeButton"
|
||||
title="取消点赞" >
|
||||
<span class="likeText">已赞</span>
|
||||
<% num = activity.praise_tread_cache ? activity.praise_tread_cache.praise_num : 0 %>
|
||||
<span class="likeNum"><%= (num.nil? ? 0 : num) > 0 ? "(#{(num.nil? ? 0 : num)})" : "" %></span>
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
<% unless activity.author.nil? %>
|
||||
<div class="container-big mt10" id="user_activity_<%= user_activity_id%>">
|
||||
<div class="pr">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
|
||||
<%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
|
||||
</div>
|
||||
<div class="content-big">
|
||||
<div class="homepagePostTo break_word">
|
||||
<%= link_to activity.try(:author).show_name, user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
TO
|
||||
<%= link_to activity.project.name.to_s+" | 实训任务", project_training_tasks_path(activity.project), :class => "newsBlue ml15"%>
|
||||
</div>
|
||||
<% if User.current.logged? && is_project_manager?(User.current.id, project_id) || activity.author_id == User.current.id %>
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%= link_to l(:button_edit), edit_training_task_path(activity.id), :class => 'postOptionLink', :accesskey => accesskey(:edit) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:button_delete), training_task_path(activity.id, :project_id => @project.id, :type => "project_show"), :data => {:confirm => l(:text_trainig_task_destroy_confirmation)}, :method => :delete, :class => 'postOptionLink' %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<div id="training_task_details">
|
||||
<%= render :partial => "training_tasks/training_task_details", :locals => {:activity => activity} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostSubmitContainer">
|
||||
<div class="homepagePostDeadline fl">
|
||||
发布时间:
|
||||
<%=format_time(activity.created_at) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id => user_activity_id, :content => activity.description} %>
|
||||
<div class="cl"></div>
|
||||
<div class="mb10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
|
||||
</div>
|
||||
<% if @project.is_child_training_project? %>
|
||||
<div id="training_project_task_status_<%= activity.id %>">
|
||||
<%= render :partial => "training_tasks/action_status", :locals => {:activity => activity} %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div id="div_user_issue_reply_<%=user_activity_id%>">
|
||||
<%= render :partial => 'projects/project_issue_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id} %>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
user_card_show_hide();
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
|
|
@ -1,43 +1,49 @@
|
|||
<% if !User.current.member_of?(@project) %>
|
||||
<% if User.current.login? && !User.current.admin %>
|
||||
<!--关注项目-->
|
||||
<li class="mr5 fl">
|
||||
<%= 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">
|
||||
<% if AppliedProject.where(:user_id => User.current, :project_id => @project_id).first.nil? %>
|
||||
<%= join_in_project_link(@project, User.current) %>
|
||||
<% 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 => "项目成员列表" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<!--项目创建者不能退出项目-->
|
||||
<% if User.current.login? %>
|
||||
<li class="mr5 fl">
|
||||
<%= 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 %>
|
||||
<% end %>
|
||||
|
||||
<!--项目fork-->
|
||||
<li class="mr5 fl">
|
||||
<%= 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" title="fork成员列表"><%= project_fork_count %></a>
|
||||
</li>
|
||||
|
||||
|
||||
<% if !User.current.member_of?(@project) %>
|
||||
<% if User.current.login? && !User.current.admin %>
|
||||
<!--关注项目-->
|
||||
<li class="mr5 fl">
|
||||
<%= 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">
|
||||
<% if AppliedProject.where(:user_id => User.current, :project_id => @project_id).first.nil? %>
|
||||
<%= join_in_project_link(@project, User.current) %>
|
||||
<% 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 => "项目成员列表" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<!--项目创建者不能退出项目-->
|
||||
<% if User.current.login? %>
|
||||
<li class="mr5 fl">
|
||||
<%= 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 %>
|
||||
<% end %>
|
||||
|
||||
<!--项目fork-->
|
||||
<li class="mr5 fl">
|
||||
<!--实训项目条件:1、modules中选中了实训任务 2、不是fork的项目-->
|
||||
<% if @project.is_training_project? && User.current.id != @project.user_id %>
|
||||
<%= link_to "开始实训", training_chiled_project_exec_project_path(@project), :class => "sy_btn_green fr", :remote => true %>
|
||||
<% else %>
|
||||
<%= 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" title="fork成员列表"><%= project_fork_count %></a>
|
||||
<% end %>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<h2 style="background: #fff; font-size: 14px; color: #333; height: 40px; line-height: 40px; padding-left: 15px; border-bottom:1px solid #e5e5e5;">项目简介
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<% if User.current.member_of?(@project) && !@project.is_child_training_project? %>
|
||||
<span class="fr mr15" id="project_invite_code">邀请码:<span style="color: #333;"><%= @project.invite_code %></span></span>
|
||||
<% end %>
|
||||
</h2>
|
|
@ -40,7 +40,11 @@
|
|||
<!--缺陷动态-->
|
||||
<% when "Issue" %>
|
||||
<%= render :partial => 'projects/act_issues', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %>
|
||||
<!--message -->
|
||||
<% when "TrainingTask" %>
|
||||
<% if User.current.admin? || is_project_member?(User.current.id, @project.id) %>
|
||||
<%= render :partial => 'projects/act_training_tasks', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %>
|
||||
<% end %>
|
||||
<!--message-->
|
||||
<% when "Message" %>
|
||||
<%= render :partial => 'projects/act_messages', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :is_course => 1, :is_board => 0} %>
|
||||
<!--Attachment -->
|
||||
|
|
|
@ -32,27 +32,64 @@
|
|||
<span class="reply_praise_count_<%= comment.id %>">
|
||||
<%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %>
|
||||
</span>
|
||||
|
||||
<span style="position: relative" class="fr mr20">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:controller => 'users', :action => 'reply_to', :reply_id => comment.id, :type => 'Issue', :user_activity_id => user_activity_id, :activity_id => activity.id, :is_project => true},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_reply)) %>
|
||||
<% if activity.class.to_s == 'TrainingTask' %>
|
||||
<%= link_to(l(:button_reply),
|
||||
{:controller => 'users',
|
||||
:action => 'reply_to',
|
||||
:reply_id => comment.id,
|
||||
:type => 'Training_task',
|
||||
:user_activity_id => user_activity_id,
|
||||
:activity_id => activity.id,
|
||||
:is_project => true},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_reply)) %>
|
||||
<% else %>
|
||||
<%= link_to(l(:button_reply),
|
||||
{:controller => 'users',
|
||||
:action => 'reply_to',
|
||||
:reply_id => comment.id,
|
||||
:type => 'Issue',
|
||||
:user_activity_id => user_activity_id,
|
||||
:activity_id => activity.id, :is_project => true},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_reply)) %>
|
||||
|
||||
<% end %>
|
||||
<span id="reply_iconup_<%= comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
|
||||
</span>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'issues',:action => 'delete_journal', :id => activity.id,:journal_id=>comment.id, :user_activity_id => user_activity_id, :is_project => true},
|
||||
:method => 'get',
|
||||
:confirm => l(:text_are_you_sure),
|
||||
:remote=>true,
|
||||
:id => "delete_reply_#{activity.id}_#{comment.id}",
|
||||
:class => 'fr mr20 undis',
|
||||
:title => l(:button_delete)
|
||||
) if comment.user_id == User.current.id %>
|
||||
|
||||
<% if activity.class.to_s == 'TrainingTask' %>
|
||||
<%= link_to(l(:button_delete),
|
||||
{:controller => 'training_tasks',
|
||||
:action => 'delete_journal',
|
||||
:id => activity.id,
|
||||
:journal_id=>comment.id,
|
||||
:user_activity_id => user_activity_id,
|
||||
:is_project => true},
|
||||
:method => 'get',
|
||||
:confirm => l(:text_are_you_sure),
|
||||
:remote=>true,
|
||||
:id => "delete_reply_#{activity.id}_#{comment.id}",
|
||||
:class => 'fr mr20 undis',
|
||||
:title => l(:button_delete)) if comment.user_id == User.current.id %>
|
||||
<% else %>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'issues',
|
||||
:action => 'delete_journal',
|
||||
:id => activity.id,
|
||||
:journal_id=>comment.id,
|
||||
:user_activity_id => user_activity_id,
|
||||
:is_project => true},
|
||||
:method => 'get',
|
||||
:confirm => l(:text_are_you_sure),
|
||||
:remote=>true,
|
||||
:id => "delete_reply_#{activity.id}_#{comment.id}",
|
||||
:class => 'fr mr20 undis',
|
||||
:title => l(:button_delete)) if comment.user_id == User.current.id %>
|
||||
<% end %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
@ -70,13 +107,13 @@
|
|||
<div class="reply-content mb10">
|
||||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= user_activity_id %>' style="display:none;">
|
||||
<%= form_for('new_form',:url => add_journal_issue_path(activity.id, :user_activity_id => user_activity_id, :is_project => true),:method => "post", :remote => true) do |f| %>
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="notes"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<%= form_for('new_form', :url => (activity.class.to_s == 'TrainingTask' ? add_journal_training_task_path(activity.id, :user_activity_id => user_activity_id, :is_project => true) : add_journal_issue_path(activity.id, :user_activity_id => user_activity_id, :is_project => true) ), :method => "post", :remote => true) do |f| %>
|
||||
<input type="hidden" name="user_activity_id" value="<%= user_activity_id %>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id %>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id %>' name="notes"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id %>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<p nhname='contentmsg_<%= user_activity_id %>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<% else %>
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
<div class="container-big-grey">
|
||||
<%= render :partial => 'projects/project_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :expand_more =>no_children_comments[:three_more]} %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<%= render :partial => "projects/project_issue_expand_show", :locals => {:comments => no_children_comments[:no_children_comments], :activity => activity, :user_activity_id => user_activity_id} %>
|
||||
<%= render :partial => "projects/project_issue_expand_show", :locals => { :comments => no_children_comments[:no_children_comments], :activity => activity, :user_activity_id => user_activity_id} %>
|
||||
</div>
|
||||
</div>
|
|
@ -3,7 +3,7 @@
|
|||
<span>回复</span>
|
||||
<span class="reply_iconup" > ︿</span>
|
||||
<span class="mr15"><%= count>0 ? "(#{count})" : "" %></span><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=user_activity_id %>">
|
||||
<span id="praise_count_<%= user_activity_id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -11,15 +11,19 @@
|
|||
<% if expand_more %>
|
||||
<div class="homepagePostReplyBannerMore">
|
||||
<% if activity.class.to_s == 'Issue' %>
|
||||
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply_homework('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'is_project_issue',<%=user_activity_id %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
<a id="reply_btn_<%= user_activity_id %>" onclick="expand_reply_homework('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'is_project_issue',<%= user_activity_id %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
展开更多
|
||||
</a>
|
||||
<% elsif activity.class.to_s == 'Message' %>
|
||||
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply_homework('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'is_project_message',<%=user_activity_id %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
<a id="reply_btn_<%= user_activity_id %>" onclick="expand_reply_homework('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'is_project_message',<%= user_activity_id %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
展开更多
|
||||
</a>
|
||||
<% elsif activity.class.to_s == 'TrainingTask' %>
|
||||
<a id="reply_btn_<%= user_activity_id %>" onclick="expand_reply_homework('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'is_project_training_task',<%= user_activity_id %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
展开更多
|
||||
</a>
|
||||
<% else %>
|
||||
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply_homework('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'<%=activity.class %>',<%=user_activity_id %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
<a id="reply_btn_<%= user_activity_id %>" onclick="expand_reply_homework('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'<%=activity.class %>',<%= user_activity_id %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
展开更多
|
||||
</a>
|
||||
<% end %>
|
||||
|
|
|
@ -26,6 +26,16 @@
|
|||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>' class="fl"></p>
|
||||
<% end %>
|
||||
<% elsif @type == 'Training_task' %>
|
||||
<%= form_for('new_form', :url => add_reply_training_task_path(reply.training_task.id, :is_project => true),:method => "post", :remote => true) do |f|%>
|
||||
<%= hidden_field_tag 'journal_id',params[:journal_id],:value =>reply.id %>
|
||||
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>@user_activity_id %>
|
||||
<div nhname='toolbar_container_<%= reply.id %>' ></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="content"></textarea>
|
||||
<a id="new_message_submit_btn_<%= reply.id %>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>' class="fl"></p>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<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" >
|
||||
<%# 实训项目和非实训项目,@type为true的时候为实训 %>
|
||||
<% if User.current.id == @project.user_id %>
|
||||
<li class="center mb30" style="line-height:20px">
|
||||
很抱歉,您不能在自己的实训项目中启动训练
|
||||
</li>
|
||||
<% else %>
|
||||
<% if @project.gpid.blank? %>
|
||||
<li class="center mb30" style="line-height:20px">
|
||||
该项目还没有创建版本库,暂时不支持实训
|
||||
</li>
|
||||
<% else %>
|
||||
<li class="center mb5" style="line-height:20px">
|
||||
<% if has_forked_cur_project(@project) %>
|
||||
您已经实训过该项目,点击“确定”将会跳转到您的实训项目主页,请问您是否继续?
|
||||
<% elsif @project.training_tasks.count == 0 %>
|
||||
该项目还没有创建实训任务,暂时不支持开启实训
|
||||
<% else %>
|
||||
实训将在后台为您创建一个新的同名项目,并为您推送第一个任务,请问您是否继续?
|
||||
<% end %>
|
||||
</li>
|
||||
<li class="mt10">
|
||||
<label class="mr27"> </label>
|
||||
<a href="javascript:void(0);" class="sy_btn_grey fl " onclick="hideModal()">取 消</a>
|
||||
<%= link_to "确 定", {:controller => 'projects', :action => 'training_project_extend'}, :class => "sy_btn_blue fl ml20", :onclick => "hideModal();", :target => "_blank" %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,2 @@
|
|||
$("#training_project_exec_tip").html('<%= escape_javascript(render :partial => 'projects/settings/training_project_exec_tip') %>');
|
||||
$("#training_project_filter_tip").html('<%= escape_javascript(render :partial => 'projects/settings/training_projects_filter_tip') %>');
|
|
@ -19,6 +19,9 @@
|
|||
<% if User.current.allowed_to?(:manage_repository, @project) %>
|
||||
<li><a href="javascript:void(0)" id="pro_st_tb_6" class="<%= show_memu == 'manage_repository' ? 'active' : ''%>" onclick="project_setting(6);">版本库</a></li>
|
||||
<% end %>
|
||||
<% if !@project.enabled_modules.where("name = 'training_tasks'").empty? %>
|
||||
<li><a href="javascript:void(0)" id="pro_st_tb_7" class="<%= show_memu == 'trainig_task' ? 'active' : ''%>" onclick="project_setting(7);">实训任务</a></li>
|
||||
<% end %>
|
||||
<!--<li id="pro_st_tb_7" class="pro_st_normaltab" onclick="project_setting(7);">活动(时间跟踪)</li>-->
|
||||
<!--<li id="pro_st_tb_8" class="pro_st_normaltab" onclick="project_setting(8);">代码评审</li>-->
|
||||
</ul>
|
||||
|
@ -27,7 +30,6 @@
|
|||
<div class="<%= show_memu == 'edit_project' ? 'pro_st_dis' : 'pro_st_undis'%>" id="pro_st_tbc_01">
|
||||
<%= render :partial=>"projects/settings/new_edit" if User.current.allowed_to?(:edit_project, @project)%>
|
||||
</div><!--tbc_01 end-->
|
||||
|
||||
<div class="<%= show_memu == 'select_project_modules' ? 'pro_st_dis' : 'pro_st_undis'%>" id="pro_st_tbc_02">
|
||||
<%= render :partial=>"projects/settings/new_modules" if User.current.allowed_to?(:select_project_modules, @project)%>
|
||||
</div><!--tbc_02 end-->
|
||||
|
@ -51,6 +53,10 @@
|
|||
<div class="<%= show_memu == 'manage_repository' ? 'pro_st_dis' : 'pro_st_undis'%>" id="pro_st_tbc_06">
|
||||
<%= render :partial=>"projects/settings/new_repositories" if User.current.allowed_to?(:manage_repository, @project)%>
|
||||
</div><!--tbc_06 end-->
|
||||
|
||||
<div class="<%= show_memu == 'training_task' ? 'pro_st_dis' : 'pro_st_undis'%>" id="pro_st_tbc_07">
|
||||
<%= render :partial=>"projects/settings/new_trainig_task" if is_project_manager?(User.current.id, @project.id) %>
|
||||
</div><!--tbc_06 end-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,42 +1,42 @@
|
|||
<ul class="pro_newsetting_con ml30 mb15">
|
||||
<h2 class="pro_newsetting_title">请选择此项目可以使用的模块:</h2>
|
||||
<%= form_for @project,:url => { :action => 'modules', :id => @project },:html => {:id => 'modules-form',:method => :post} do |f| %>
|
||||
<% Redmine::AccessControl.available_project_modules.each do |m| %>
|
||||
<li class="clear ">
|
||||
<%= check_box_tag('enabled_module_names[]', m, @project.module_enabled?(m), :class=>"fl mt8").html_safe -%>
|
||||
<p class="fl ml5"><%= l_or_humanize(m, :prefix => "project_module_").html_safe %></p>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="clear ">
|
||||
<p class="fl ml5"><%= check_all_links('modules-form').html_safe %></p>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="clear">
|
||||
<a href="javascript:void(0);" class="sy_btn_blue mr15 fr" onclick="$('#modules-form').submit()"> <%= l(:button_save) %></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<!--h2 class="c_blue mb10">请选择此项目可以使用的模块:</h2>
|
||||
<%#= form_for @project,:url => { :action => 'modules', :id => @project },:html => {:id => 'modules-form',:method => :post} do |f| %>
|
||||
<div class="box pl15">
|
||||
<ul>
|
||||
<%# Redmine::AccessControl.available_project_modules.each do |m| %>
|
||||
<li>
|
||||
<label>
|
||||
<%#= check_box_tag('enabled_module_names[]', m, @project.module_enabled?(m)).html_safe -%>
|
||||
<%#= l_or_humanize(m, :prefix => "project_module_").html_safe %>
|
||||
</label>
|
||||
</li>
|
||||
<%# end %>
|
||||
</ul>
|
||||
</div><!--box end-->
|
||||
<!--p class="mb10 c_grey">
|
||||
<#%= check_all_links('modules-form').html_safe %>
|
||||
</p>
|
||||
<p>
|
||||
<a href="javascript:void(0)" class="blue_btn" onclick="$('#modules-form').submit();">
|
||||
<%#= l(:button_save) %>
|
||||
</a>
|
||||
</p>
|
||||
<%# end %>-->
|
||||
<div class="pro_new_prompt ml15 mr15 mb10"><p>问题跟踪模块与实训模块不能同时选择</p><p>一旦选定并保存后,将不能修改</p></div>
|
||||
<ul class="pro_newsetting_con ml30 mb15">
|
||||
<h2 class="pro_newsetting_title">请选择此项目可以使用的模块:</h2>
|
||||
<%= form_for @project,:url => { :action => 'modules', :id => @project },:html => {:id => 'modules-form',:method => :post} do |f| %>
|
||||
<% Redmine::AccessControl.available_project_modules.each do |m| %>
|
||||
<li class="clear">
|
||||
<%= check_box_tag('enabled_module_names[]', m, @project.module_enabled?(m), :class=>"fl mt8", :id => 'project_module_'+m.to_s ).html_safe -%>
|
||||
<p class="fl ml5"><%= l_or_humanize(m, :prefix => "project_module_").html_safe %></p>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="clear ">
|
||||
<p class="fl ml5"><%= check_all_links('modules-form').html_safe %></p>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="clear">
|
||||
<a href="javascript:void(0);" class="sy_btn_blue mr15 fr" onclick="$('#modules-form').submit()"> <%= l(:button_save) %></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
if($("#project_module_issue_tracking").is(":checked")){
|
||||
$("#project_module_training_tasks").attr('disabled', 'disabled')
|
||||
}else if($("#project_module_training_tasks").is(":checked")){
|
||||
$("#project_module_issue_tracking").attr('disabled', 'disabled');
|
||||
}
|
||||
$("#project_module_issue_tracking").on('click', function(){
|
||||
if($("#project_module_issue_tracking").is(":checked")) {
|
||||
$("#project_module_training_tasks").attr('disabled', 'disabled');
|
||||
}else{
|
||||
$("#project_module_training_tasks").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
$("#project_module_training_tasks").on('click', function(){
|
||||
if($("#project_module_training_tasks").is(":checked")){
|
||||
$("#project_module_issue_tracking").attr('disabled', 'disabled');
|
||||
}else {
|
||||
$("#project_module_issue_tracking").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,44 @@
|
|||
<div id="training_project_exec_tip">
|
||||
<%= render :partial => "projects/settings/training_project_exec_tip" %>
|
||||
</div>
|
||||
|
||||
<div class=" sy_new_tchbox clear ">
|
||||
<div id="training_project_filter_tip">
|
||||
<%= render :partial => "projects/settings/training_projects_filter_tip" %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="clear">
|
||||
<%= form_tag(url_for(:controller => 'projects', :action => 'add_script', :project_id => @project.id), :id => 'project_script_form', :method => "post", :remote => true) do %>
|
||||
<textarea id="project_script" name="project_script" style="width:746px; height:300px;border: 1px solid #c8c8c8; padding:5px;margin-bottom: 5px;" placeholder="请输入脚本"><%= @project.script %></textarea>
|
||||
<span id ="project_script_tip" class="c_red" style="display: none">内容不能为空</span>
|
||||
<a href="javascript:void(0)" class="fr btn btn-grey">取消</a>
|
||||
<a href="javascript:void(0)" class="fr btn btn-blue mr5" onclick="project_script_commit()">确定</a>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function regex_pr_comment()
|
||||
{
|
||||
var comment = $.trim($("#project_script").val());
|
||||
if(comment.length == 0)
|
||||
{
|
||||
$("#project_script_tip").show();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#project_script_tip").hide();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//提交pull request_comment
|
||||
function project_script_commit()
|
||||
{
|
||||
if(regex_pr_comment())
|
||||
{
|
||||
$("#project_script_form").submit();
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,3 @@
|
|||
<% if @notice %>
|
||||
<div class="alert alert-orange ml15 mr15 mb10"><p><%= @notice %></p></div>
|
||||
<% end %>
|
|
@ -0,0 +1,7 @@
|
|||
<% unless @project.script.blank? %>
|
||||
<% if @project.training_status == 1 %>
|
||||
<%= link_to "重启实训", training_project_update_project_path, :class => "fr sy_btn_green mb10", :remote => true %>
|
||||
<% else %>
|
||||
<%= link_to "开启实训", training_project_execute_project_path, :class => "fr sy_btn_green mb10", :remote => true %>
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -1,6 +1,6 @@
|
|||
<!--新版项目头部结束-->
|
||||
<div class="ke-block pro_description_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_invite_code"><%= render :partial => 'projects/invite_code' %></div>
|
||||
<div id="project_description_code" style="padding: 0 15px 10px 15px;font-size: 14px;">
|
||||
<% if @project.description.blank? %>
|
||||
<p style="padding-top:5px"><%= @project.name %></p>
|
||||
|
@ -24,15 +24,15 @@
|
|||
<!--<li><%#= link_to "作业动态", {:controller => "courses", :action => "show", :type => "homework"}, :class => "homepagePostTypeAssignment postTypeGrey" %></li>-->
|
||||
<li><%= link_to "资源库动态", {:controller => "projects", :action => "show", :type => "attachment"}, :class => "homepagePostTypeResource resourcesGrey" %></li>
|
||||
<li><%= link_to "讨论区动态", {:controller => "projects", :action => "show", :type => "message"}, :class => "homepagePostTypeForum postTypeGrey" %></li>
|
||||
<!--<li><%#= link_to "问卷动态", {:controller => "courses", :action => "show", :type => "poll"}, :class => "homepagePostTypeQuiz postTypeGrey" %></li>-->
|
||||
<% if @project.is_training_project? && is_project_member?(User.current.id, @project.id) %>
|
||||
<li><%= link_to "实训任务动态", {:controller => "projects", :action => "show", :type => "training_task"}, :class => "homepagePostTypeForum postTypeGrey" %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<!--CONTENT LIST-->
|
||||
|
||||
</div>
|
||||
|
||||
<%= render :partial => "project_activities", :locals => {:forge_acts => @events_pages, :page => 0, :type => @type} %>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
$("#training_project_task_status_<%= @training_task.id %>").html('<%= escape_javascript( render :partial => 'training_tasks/action_status', :locals => {:activity => @training_task}) %>');
|
||||
$("#training_task_details").html('<%= escape_javascript( render :partial => 'training_tasks/training_task_details', :locals => {:activity => @training_task, :project_id => @project.id}) %>');
|
|
@ -0,0 +1,3 @@
|
|||
var htmlvalue = "<%= escape_javascript(render :partial => 'projects/training_child_project_exec') %>";
|
||||
pop_box_new(htmlvalue,460,316);
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
$("#training_project_exec_tip").html('<%= escape_javascript(render :partial => 'projects/settings/training_project_exec_tip') %>');
|
||||
$("#training_project_filter_tip").html('<%= escape_javascript(render :partial => 'projects/settings/training_projects_filter_tip') %>');
|
|
@ -0,0 +1,2 @@
|
|||
$("#training_project_exec_tip").html('<%= escape_javascript(render :partial => 'projects/settings/training_project_exec_tip') %>');
|
||||
$("#training_project_filter_tip").html('<%= escape_javascript(render :partial => 'projects/settings/training_projects_filter_tip') %>');
|
|
@ -0,0 +1 @@
|
|||
$("#task_action_status_<%= @training_task.id %>").html('<%= escape_javascript( render :partial => 'training_tasks/action_status', :locals => {:activity => @training_task}) %>');
|
|
@ -8,7 +8,7 @@
|
|||
<table class="sy_new_table " cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<td style="width:15%;">名称</td>
|
||||
<td style="width:15%;padding-left: 5px">名称</td>
|
||||
<td style="width:10%;">分支</td>
|
||||
<td style="width:10%;">语言</td>
|
||||
<td style="width:25%;">路径</td>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<% if @quality_analyses && @quality_analyses.count > 0 %>
|
||||
<% @quality_analyses.each do |qa| %>
|
||||
<tr>
|
||||
<td style="width:15%;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" title="<%= qa.sonar_name %>"><%=link_to qa.sonar_name, project_quality_analysis_path(:resource_id => qa.sonar_name, :branch => (qa.branch.nil? ? "master" : qa.branch)), :class => "analysis-result-name fl fontBlue2 hidden" %></td>
|
||||
<td style="width:15%;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;padding-left: 5px;" title="<%= qa.sonar_name %>"><%=link_to qa.sonar_name, project_quality_analysis_path(:resource_id => qa.sonar_name, :branch => (qa.branch.nil? ? "master" : qa.branch)), :class => "analysis-result-name fl fontBlue2 hidden" %></td>
|
||||
<td style="width:10%;"><%= qa.branch %></td>
|
||||
<td style="width:10%;"><%= qa.language %></td>
|
||||
<td style="width:25%;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" title="<%= qa.path %>"><%= qa.path %></td>
|
||||
|
|
|
@ -6,16 +6,17 @@
|
|||
</div>
|
||||
<div class="sy_popup_con" style="width:380px;">
|
||||
<ul class="sy_popup_add" >
|
||||
<%# 实训项目和非实训项目,@type为true的时候为实训 %>
|
||||
<% if User.current.id == @project.user_id %>
|
||||
<li class="center mb30" style="line-height:20px">
|
||||
自己不能Fork自己创建的项目
|
||||
</li>
|
||||
<% else %>
|
||||
<% if @project.gpid.blank? %>
|
||||
<% if @project.gpid.blank? %>
|
||||
<li class="center mb30" style="line-height:20px">
|
||||
该项目还没有创建版本库,暂时不能Fork
|
||||
</li>
|
||||
<% else %>
|
||||
<% else %>
|
||||
<li class="center mb5" style="line-height:20px">
|
||||
<% if has_forked_cur_project(@project) %>
|
||||
您已经Fork过该项目,点击“确定”将会跳入您Fork的项目主页,请问是否继续?
|
||||
|
@ -29,8 +30,8 @@
|
|||
<%= link_to "确 定", {:controller => 'repositories', :action => 'forked'}, :class => "sy_btn_blue fl ml20", :onclick => "hideModal();", :target => "_blank" %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
|
@ -1,11 +1,11 @@
|
|||
<div class="recordBanner mt3">
|
||||
<% if @changesets_latest_coimmit %>
|
||||
<% if @changesets_latest_coimmit && @changesets_latest_coimmit.try(:time) %>
|
||||
<div class="recordBanner mt3">
|
||||
<%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.try(:author_email))), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %>
|
||||
<%= link_to_user_mail(@changesets_latest_coimmit.try(:author_email), "fb fontGrey3 mr5 fl hidden maxwidth150 ml5") %>
|
||||
<div class="fl">提交于 <%= time_tag(@changesets_latest_coimmit.try(:time)) %> 前:</div>
|
||||
<div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.message %>"><%= @changesets_latest_coimmit.message %></div>
|
||||
<% end %>
|
||||
<% if @entry && @entry.kind == 'file' %>
|
||||
<%= render :partial => 'link_to_functions' %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if @entry && @entry.kind == 'file' %>
|
||||
<%= render :partial => 'link_to_functions' %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
|
@ -1,10 +1 @@
|
|||
<div class="project_r_h">
|
||||
<div class="fl"><h2 class="project_h2_repository"><%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %></h2></div>
|
||||
</div>
|
||||
<%= form_for('forked',:url => {:controller => 'repositories', :action => 'forked'},:method => "post") do |f| %>
|
||||
<input type="text" name="repo_name"/>
|
||||
<button type="submit">确定</button>
|
||||
<% end %>
|
||||
<%= @project.id %>
|
||||
<%= @repository.id %>
|
||||
<%= User.current %>
|
||||
|
||||
|
|
|
@ -1,86 +1,70 @@
|
|||
<%#= call_hook(:view_repositories_show_contextual, {:repository => @repository, :project => @project}) %>
|
||||
<div class="wrap-big">
|
||||
<div class="repository_con" style="line-height:1.9;">
|
||||
<% if @entries.nil? %>
|
||||
<%# 未提交代码提示 %>
|
||||
<div class=" repository-url light-well">
|
||||
<% if @entries.nil? && authorize_for('repositories', 'browse') %>
|
||||
<div class="page-title">
|
||||
该版本库还没有上传代码!
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @repository.type.to_s == "Repository::Gitlab" %>
|
||||
版本库地址:<%= @repos_url %>
|
||||
<% else %>
|
||||
版本库地址:<%= h @repository.url %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<ul class="clearfix pro-top-info mb10">
|
||||
<li><i class="icon-time mr5 c_grey02 f16 fb"></i>
|
||||
<%=link_to "#{choise_commit_count(@changesets_all_count, @g_project.commit_count.to_i)}",
|
||||
{:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param,
|
||||
:rev => @rev, :page => 1 ,:commit_count =>"#{@changesets_all_count}"}, :class => "linkBlue fb" %> 提交
|
||||
</li>
|
||||
<li><i class="icon-sitemap mr5 c_grey02 f16 fb"></i>
|
||||
<a class="linkBlue fb "><%= @repository.branches.count %></a>分支
|
||||
</li>
|
||||
<li><i class="icon-bar-chart mr5 c_grey02 f16 fb"></i>
|
||||
<%=link_to "贡献统计", stats_repository_project_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev,
|
||||
:creator => @creator, :default_branch => @g_default_branch ) %>
|
||||
</li>
|
||||
</ul>
|
||||
<div class=" clearfix mb5">
|
||||
<div class=" fl clearfix">
|
||||
<%= render :partial => 'navigation' %>
|
||||
</div>
|
||||
<a href="<%= @zip_path %>" class="btn_zipdown fl ml10" onclick="">ZIP下载</a>
|
||||
<% if User.current.member_of?(@project) && @project.is_public? %>
|
||||
<% if quality_analysis(User.current.try(:login), @repository.id).nil? %>
|
||||
<%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "1"), :remote => true, :class => "btn_zipdown fl ml10" %>
|
||||
<% else %>
|
||||
<%= link_to "重新分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "2"), :remote => true, :class => "btn_zipdown fl ml10" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %>
|
||||
<%= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "btn_zipdown fl ml10" %>
|
||||
<% end %>
|
||||
|
||||
<div class="fr ">
|
||||
<label class="pro-fenzhi-label fl">克隆网址</label>
|
||||
<input type="text" id="copy_rep_content" class="pro-fenzhi-input fl" value="<%= @repos_url.to_s.lstrip %>"/>
|
||||
<a href="javascript:void(0);" alt="点击复制版本库地址" onclick="jsCopy()" title="点击复制版本库地址" class="fl pro-fenzhi-a"><i class="icon-copy"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
<%= render :partial => 'latest_commit' %>
|
||||
<div class="cl"></div>
|
||||
<div class="repository_con" style="line-height:1.9;">
|
||||
<ul class="clearfix pro-top-info mb10">
|
||||
<li><i class="icon-time mr5 c_grey02 f16 fb"></i>
|
||||
<%=link_to "#{choise_commit_count(@changesets_all_count, @g_project.commit_count.to_i)}",
|
||||
{:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param,
|
||||
:rev => @rev, :page => 1 ,:commit_count =>"#{@changesets_all_count}"}, :class => "linkBlue fb" %> 提交
|
||||
</li>
|
||||
<li><i class="icon-sitemap mr5 c_grey02 f16 fb"></i>
|
||||
<a class="linkBlue fb "><%= @repository.branches.count %></a>分支
|
||||
</li>
|
||||
<li><i class="icon-bar-chart mr5 c_grey02 f16 fb"></i>
|
||||
<%=link_to "贡献统计", stats_repository_project_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev,
|
||||
:creator => @creator, :default_branch => @g_default_branch ) %>
|
||||
</li>
|
||||
</ul>
|
||||
<div class=" clearfix mb5">
|
||||
<div class=" fl clearfix">
|
||||
<%= render :partial => 'navigation' %>
|
||||
</div>
|
||||
<a href="<%= @zip_path %>" class="btn_zipdown fl ml10" onclick="">ZIP下载</a>
|
||||
<% if !@entries.blank? && User.current.member_of?(@project) && @project.is_public? %>
|
||||
<% if quality_analysis(User.current.try(:login), @repository.id).nil? %>
|
||||
<%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "1"), :remote => true, :class => "btn_zipdown fl ml10" %>
|
||||
<% else %>
|
||||
<%= link_to "重新分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "2"), :remote => true, :class => "btn_zipdown fl ml10" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %>
|
||||
<%= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "btn_zipdown fl ml10" %>
|
||||
<% end %>
|
||||
|
||||
<% if !@entries.nil? && authorize_for('repositories', 'browse') %>
|
||||
<div class="fr ">
|
||||
<label class="pro-fenzhi-label fl">克隆网址</label>
|
||||
<input type="text" id="copy_rep_content" class="pro-fenzhi-input fl" value="<%= @repos_url.to_s.lstrip %>"/>
|
||||
<a href="javascript:void(0);" alt="点击复制版本库地址" onclick="jsCopy()" title="点击复制版本库地址" class="fl pro-fenzhi-a"><i class="icon-copy"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
<%= render :partial => 'latest_commit' %>
|
||||
<div class="cl"></div>
|
||||
|
||||
<% if !@entries.blank? && authorize_for('repositories', 'browse') %>
|
||||
<%= render :partial => 'dir_list' %>
|
||||
<% else %>
|
||||
<%= render :partial => "projects/no_data" %>
|
||||
<% end %>
|
||||
|
||||
<% memo = Memo.where(:id => 1232).first %>
|
||||
<% unless memo.nil? %>
|
||||
<a href="<%= Setting.protocol + "://" %><%=Setting.host_name %>/forums/1/memos/1232" class="linkBlue2" target="_blank">如何提交代码</a>
|
||||
<a href="<%= Setting.protocol + "://" %><%=Setting.host_name %>/forums/1/memos/1232" class="linkBlue2" target="_blank">如何提交代码</a>
|
||||
<% end %>
|
||||
<% unless @entries.blank? %>
|
||||
<div class="fr">
|
||||
<a style="color: #7f7f7f;">导出统计结果:</a>
|
||||
<%= link_to "最近一周", {:controller => 'repositories', :action => 'export_rep_static', :format => 'xls', :rev => @rev, :cycle => "week" }, :class => "linkBlue2" %> <a style="color: #7f7f7f;">|</a>
|
||||
<%= link_to "最近一月", {:controller => 'repositories', :action => 'export_rep_static', :format => 'xls', :rev => @rev, :cycle => "month" }, :class => "linkBlue2" %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="fr">
|
||||
<a style="color: #7f7f7f;">导出统计结果:</a>
|
||||
<%= link_to "最近一周", {:controller => 'repositories', :action => 'export_rep_static', :format => 'xls', :rev => @rev, :cycle => "week" }, :class => "linkBlue2" %> <a style="color: #7f7f7f;">|</a>
|
||||
<%= link_to "最近一月", {:controller => 'repositories', :action => 'export_rep_static', :format => 'xls', :rev => @rev, :cycle => "month" }, :class => "linkBlue2" %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<%#= link_to "导出excel", {:controller => 'repositories', :action => 'export_rep_static', :rev => @rev}, :format => 'xls' %>
|
||||
<!--<a href="<%#=project_issues_path(:project_id => @project, :format => 'xls')%>" class="hw_btn_blue fr" alt="导出EXCEL">导出EXCEL</a>-->
|
||||
</div>
|
||||
<%#= link_to "导出excel", {:controller => 'repositories', :action => 'export_rep_static', :rev => @rev}, :format => 'xls' %>
|
||||
<!--<a href="<%#=project_issues_path(:project_id => @project, :format => 'xls')%>" class="hw_btn_blue fr" alt="导出EXCEL">导出EXCEL</a>-->
|
||||
</div>
|
||||
</div>
|
||||
<%# content_for :header_tags do %>
|
||||
<%#= stylesheet_link_tag "scm" %>
|
||||
<%#= stylesheet_link_tag "scm" %>
|
||||
<%# end %>
|
||||
|
||||
<% html_title(l(:label_repository)) -%>
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<%# activity = activity.nil? ? local_assigns[:activity] : activity %>
|
||||
<div class="mb10">
|
||||
<% if activity.status == 1 %>
|
||||
<span class="task-display-span b_dgrey mt10">本任务已通过测评,处于关闭状态。</span>
|
||||
<% elsif activity.status == 2 %>
|
||||
<span class="task-display-span alert-blue mt10">当前任务正在后台测评中,稍后将显示您的任务完成情况......</span>
|
||||
<% else %>
|
||||
<% if User.current.member_of?(@project) && @project.is_child_training_project? %>
|
||||
<%= link_to "提交评测", task_execute_project_path(@project, :training_task_id => activity.id), :class => "task-display-span bBlue mt10", :remote => true %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<% tasks.each do |task| -%>
|
||||
<%= render :partial => 'content_list', :locals => {:activity => task, :user_activity_id => task.id} %>
|
||||
<% end %>
|
|
@ -0,0 +1,66 @@
|
|||
<% unless activity.author.nil? %>
|
||||
<tr id="user_activity_<%= user_activity_id %>">
|
||||
<td>
|
||||
<% if activity.status == 1 %>
|
||||
<div class="issues_ciricons fl ml15"><span class="issues_ciricons_02 "></span></div>
|
||||
<% else %>
|
||||
<div class="issues_ciricons fl ml15 mt5"><i class="icon-flag fb " style="color:#49a547; font-size:15px;"></i></div>
|
||||
<% end %>
|
||||
<div class=" fl ml5">
|
||||
<div class="issues_list_titlebox clear">
|
||||
<a href="<%= training_task_path(activity)%>" class="issues_list_title fl task-list-title" target="_blank" title="<%= activity.subject.to_s %>" >
|
||||
<span class="task-step mr5">step<%= activity.position %></span>
|
||||
<%= activity.subject.to_s %>
|
||||
</a>
|
||||
<% if activity.status == 1 %>
|
||||
<span class="task-linebtn-green fl ml5 mt3">已解决</span>
|
||||
<% else %>
|
||||
<span class="task-linebtn-green fl ml5 mt3">正在解决中</span>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="issues_list_small">
|
||||
<p class="fl issues_list_name" ><span class="mr5"><%= format_time(activity.created_at) %></span>发布</p>
|
||||
<p class="fl ml10"> <span class="mr5"><%= format_time(activity.updated_at) %></span>更新</p>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td >
|
||||
<% if activity.journals.count != 0 %>
|
||||
<a href="javascript:void(0);" class="issues_icons_mes fl mr5 ml5 "></a>
|
||||
<a href="javascript:void(0);" class="fl mt2"><%= activity.journals.count %></a>
|
||||
<% end %>
|
||||
</td>
|
||||
<% if @project.is_child_training_project? %>
|
||||
<td>
|
||||
<div id="task_action_status_<%= activity.id %>">
|
||||
<%= render :partial => 'action_status', :locals => {:activity => activity} %>
|
||||
</div>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<script>
|
||||
$(".issues_list_box").mouseover(function(){
|
||||
var iconOrder;
|
||||
var iconSize = $(this).children().eq(2).children().eq(7).children().size();
|
||||
if(iconSize > 1){
|
||||
iconOrder = 2;
|
||||
} else{
|
||||
iconOrder = 0;
|
||||
}
|
||||
$(this).children().eq(2).children().eq(7).children().eq(iconOrder).show();
|
||||
});
|
||||
$(".issues_list_box").mouseout(function(){
|
||||
var iconOrder;
|
||||
var iconSize = $(this).children().eq(2).children().eq(7).children().size();
|
||||
if(iconSize > 1){
|
||||
iconOrder = 2;
|
||||
} else{
|
||||
iconOrder = 0;
|
||||
}
|
||||
$(this).children().eq(2).children().eq(7).children().eq(iconOrder).hide();
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<div id="issue_detail" style="display: block">
|
||||
<div class="ping_dispic">
|
||||
<%= link_to image_tag(url_to_avatar(@training_task.author), :width => 46, :height => 46), user_path(@training_task.author), :class => "ping_dispic" %>
|
||||
</div>
|
||||
<div class="talk_txt fl">
|
||||
<div id="training_task_details">
|
||||
<%= render :partial => "training_tasks/training_task_details", :locals => {:activity => @training_task, :project_id => @project.id} %>
|
||||
</div>
|
||||
<br>
|
||||
<div class="cl"></div>
|
||||
由<%=link_to @training_task.author.show_name, user_path(@training_task.author), :class => "link-blue" %>添加于 <%= format_time(@training_task.created_at).html_safe %>
|
||||
</div>
|
||||
|
||||
<!--talk_txt end-->
|
||||
<a href="javascript:void(0)" class="talk_edit fr"> </a>
|
||||
<% if User.current.logged? && is_project_manager?(User.current.id, @project.id) || @training_task.author_id == User.current.id %>
|
||||
<%= link_to l(:button_delete), training_task_path(@training_task.id, :project_id => @project.id), :data => {:confirm => l(:text_trainig_task_destroy_confirmation)}, :method => :delete, :class => 'talk_edit fr' %>
|
||||
<%= link_to l(:button_edit), edit_training_task_path(@training_task), :class => 'talk_edit fr', :accesskey => accesskey(:edit) %>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
<% if @training_task.description? || @training_task.attachments.any? -%>
|
||||
<div class="talk_info mb10 issue_desc ke-block" id="issue_desc_<%= @training_task.id %>" style="word-break:break-all;">
|
||||
<% if @training_task.description? %>
|
||||
<%= textAreailizable @training_task, :description, :attachments => @training_task.attachments %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end -%>
|
||||
|
||||
<%# 附件局部刷新 %>
|
||||
<div id = "div_issue_attachment_<%= @training_task.id %>">
|
||||
<%= render :partial => 'task_attachments', :locals => {:training_task => @training_task} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div id="training_project_task_status_<%= @training_task.id %>">
|
||||
<%= render :partial => "training_tasks/action_status", :locals => {:activity => @training_task} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('issue_desc_<%= @training_task.id %>');
|
||||
autoUrl('issue_desc_<%= @training_task.id %>');
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,49 @@
|
|||
<ul>
|
||||
<li class="clear">
|
||||
<label class="label"><span class="c_red f12">*</span> 序号 : </label>
|
||||
<%= f.text_field :position, :no_label => true, :placeholder => "请输入序号(整数)", :onkeyup => "this.value=this.value.replace(/\D/g,'')", :onafterpaste => "this.value=this.value.replace(/\D/g,'')" %>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<label class="label"><span class="c_red f12">*</span> 标题 : </label>
|
||||
<%= f.text_field :subject, :class => "input-big", :no_label => true, :id => "training_task_id", :placeholder => "请输入标题" %>
|
||||
<span style="display: none">标题不能为空</span>
|
||||
<%= javascript_tag do %>
|
||||
observeAutocompleteField('issue_subject',
|
||||
'<%= escape_javascript auto_complete_issues_path(:project_id => @project, :scope => (Setting.cross_project_issue_relations? ? 'all' : nil)) %>',
|
||||
{ select: function(event, ui) {
|
||||
$('input#issue_subject').val(ui.item.value);
|
||||
}
|
||||
});
|
||||
<% end %>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<label class="label fl"> 描述 : </label>
|
||||
<%= f.label_for_field :description, :no_label => true, :class => "fl" %>
|
||||
<%= f.kindeditor :description,
|
||||
:editor_id => "training_task_desc_editor",
|
||||
:width=>'885px',
|
||||
:height =>192,
|
||||
:resizeType => 0,
|
||||
:no_label => true,
|
||||
:at_id => @project.id,
|
||||
:at_type => @project.class.to_s %>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<label class="label"><%= l(:label_attachment_plural) %>:</label>
|
||||
<%= render :partial => 'attachments/form', :locals => {:container => @training_task} %>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<% if params[:action] == "new" %>
|
||||
<a href="<%= project_training_tasks_url(@project, :remote => true) %>" class="sy_btn_grey mr5 fr"> 取消</a>
|
||||
<% else %>
|
||||
<%= link_to "取消", training_task_path(@training_task), :class => "sy_btn_grey mr5 fr" %>
|
||||
<% end %>
|
||||
<input onclick="issue_create();" class="sy_btn_blue mr5 fr" onfocus="this.blur()" id="issue_confirm" style="width: 28px;color: #FFF" value="保存">
|
||||
</li>
|
||||
</ul>
|
||||
<script>
|
||||
function issue_create(){
|
||||
training_task_desc_editor.sync();
|
||||
$('#project_training_form').submit();
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,94 @@
|
|||
<ul>
|
||||
<% @journals.each do |comment| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= comment.id %>');
|
||||
autoUrl('reply_content_<%= comment.id %>');
|
||||
});
|
||||
</script>
|
||||
<li class="reply-container ml15" nhname="reply_rec">
|
||||
<div class="homepagePostReplyPortrait" >
|
||||
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33"), user_path(comment.user_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="reply-content ml15" onmouseover="$('#delete_reply_<%= comment.id %>').show();" onmouseout="$('#delete_reply_<%= comment.id %>').hide();">
|
||||
<%= render :partial => 'users/news_contents', :locals => {:comment => comment, :type => 'TrainingTask', :user_activity_id => issue.id}%>
|
||||
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||
<% if comment.details.any? %>
|
||||
<% details_to_strings(comment.details).each do |string| %>
|
||||
<p><%= string %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<P><%= comment.notes.html_safe %></P>
|
||||
</div>
|
||||
<div class="orig_reply mb10 mt-10">
|
||||
<div class="reply">
|
||||
<span class="reply-right">
|
||||
<span class="reply_praise_count_<%= comment.id %>">
|
||||
<%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %>
|
||||
</span>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
<%= link_to(l(:button_reply),
|
||||
{:controller => 'training_tasks',
|
||||
:action => 'reply',
|
||||
:user_id => comment.user_id,
|
||||
:id => @training_task.id,
|
||||
:journal_id => comment.id},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_reply)) %>
|
||||
<span id="reply_iconup_<%= comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
|
||||
</span>
|
||||
<%= link_to(l(:button_delete),
|
||||
{:controller => 'training_tasks',
|
||||
:action => 'delete_journal',
|
||||
:id => @training_task.id,
|
||||
:journal_id => comment.id},
|
||||
:method => :get,
|
||||
:remote => true,
|
||||
:id => "delete_reply_#{comment.id}",
|
||||
:class => 'fr mr20 undis',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if comment.user_id == User.current.id %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= comment.id %>"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="reply-container borderBottomNone minHeight48 ml15">
|
||||
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @training_task.id %>">
|
||||
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@training_task.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
|
||||
<div class="homepagePostReplyInputContainer mb10 reply-content">
|
||||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= @training_task.id %>' style="display:none;">
|
||||
<%= form_for('new_form', :url => add_journal_project_training_task_path(@training_task.id, :is_issue_show => true), :method => "post", :remote => true) do |f| %>
|
||||
<input type="hidden" name="issue_id" value="<%=@training_task.id%>"/>
|
||||
<div nhname='toolbar_container_<%= @training_task.id %>' ></div>
|
||||
<div class="cl"></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @training_task.id %>' name="notes"></textarea>
|
||||
<div class="cl"></div>
|
||||
<div class="mt5 fl">
|
||||
<%= render :partial => 'attachments/issue_reply', :locals => {:container => @training_task} %>
|
||||
</div>
|
||||
<span nhname='contentmsg_<%= @training_task.id %>' class="fl mt5"></span>
|
||||
<a id="new_message_submit_btn_<%= @training_task.id %>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr mt5" style="display:none;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => "users/show_unlogged" %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
|
@ -0,0 +1,6 @@
|
|||
<% count = @training_task.journals.count %>
|
||||
回复<span class="mr15"><%= count > 0 ? "(#{count})" : "" %></span>
|
||||
<span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%= @training_task.id %>">
|
||||
<%=render :partial => "praise_tread/praise", :locals => {:activity => @training_task, :user_activity_id => @training_task.id, :type => "activity"}%>
|
||||
</span>
|
|
@ -0,0 +1,10 @@
|
|||
<% if training_task.attachments.any? %>
|
||||
<div class="pro_pic_box mb10">
|
||||
<a href="javascript:void(0)" class="link_img fl">
|
||||
<!--显示附件、图片-->
|
||||
<%= link_to_attachment_project training_task, :thumbnails => true %>
|
||||
</a><br/>
|
||||
<%#= call_hook(:view_issues_show_description_bottom, :training_task => training_task) %>
|
||||
</div><!--pro_pic_box end-->
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
|
@ -0,0 +1,16 @@
|
|||
<div class="homepagePostTitle break_word task-title ">
|
||||
<% if activity.status == 1 %>
|
||||
<div class="issues_ciricons fl"><span class="issues_ciricons_02 "></span></div>
|
||||
<% else %>
|
||||
<div class="issues_ciricons fl mt2 "><i class="icon-flag fb " style="color:#49a547; font-size:15px;"></i></div>
|
||||
<% end %>
|
||||
<span class="task-step mr5 ml5">step<%= activity.position %></span>
|
||||
|
||||
<%= link_to activity.subject.to_s, training_task_url(activity), :class => "postGrey ml5 ", :target => "_blank", :style => "" %>
|
||||
<div class="cl"></div>
|
||||
<!--<%# if activity.status == 1 %>-->
|
||||
<!--<span class="task-linebtn-green fl ml5 mt3">已解决</span>-->
|
||||
<!--<%# else %>-->
|
||||
<!--<span class="task-linebtn-green fl ml5 mt3">正在解决中</span>-->
|
||||
<!--<%# end %>-->
|
||||
</div>
|
|
@ -0,0 +1,27 @@
|
|||
<div class="ReplyToMessageContainer borderBottomNone " id="reply_to_message_<%= @jour.id %>" style="width:895px;">
|
||||
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @jour.id%>">
|
||||
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@training_task.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
|
||||
<div class="ReplyToMessageInputContainer" style="width:840px">
|
||||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= @jour.id %>' style="display:none;">
|
||||
<%= form_for('new_form', :url => add_reply_training_task_path(@training_task, :is_issue_show => true), :method => "post", :remote => true) do |f|%>
|
||||
<input type="hidden" name="journal_id" value="<%= @jour.id %>"/>
|
||||
<div nhname='toolbar_container_<%= @jour.id %>' ></div>
|
||||
<div class="cl"></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @jour.id %>' name="content"></textarea>
|
||||
<div class="cl"></div>
|
||||
<span nhname='contentmsg_<%= @jour.id %>' class="fl"></span>
|
||||
<a id="new_message_submit_btn_<%= @jour.id %>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => "users/show_unlogged" %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,6 @@
|
|||
<% if params[:is_project] %>
|
||||
$("#div_user_issue_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'projects/project_issue_reply', :locals => {:activity => @training_task, :user_activity_id => @user_activity_id}) %>");
|
||||
<% else %>
|
||||
$("#div_user_issue_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @training_task, :user_activity_id => @user_activity_id}) %>");
|
||||
<% end %>
|
||||
sd_create_editor_from_data(<%= @user_activity_id %>, null, "100%", "UserActivity");
|
|
@ -0,0 +1,13 @@
|
|||
<% if @user_activity_id %>
|
||||
<%# 动态中 %>
|
||||
<% if params[:is_project] %>
|
||||
$("#div_user_issue_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'projects/project_issue_reply', :locals => {:activity => @training_task, :user_activity_id => @user_activity_id}) %>");
|
||||
<% else %>
|
||||
$("#div_user_issue_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @training_task, :user_activity_id => @user_activity_id}) %>");
|
||||
<% end %>
|
||||
|
||||
sd_create_editor_from_data(<%= @user_activity_id %>, null, "100%","<%= @training_task.class.name %>");
|
||||
<% else %>
|
||||
<%# issue详情 %>
|
||||
<%= render "jounal_refresh" %>
|
||||
<% end %>
|
|
@ -0,0 +1,14 @@
|
|||
<% if @user_activity_id %>
|
||||
<% if @is_project %>
|
||||
$("#div_user_issue_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'projects/project_issue_reply',
|
||||
:locals => {:activity => @training_task,
|
||||
:user_activity_id => @user_activity_id}) %>");
|
||||
<% else %>
|
||||
$("#div_user_issue_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply',
|
||||
:locals => {:activity => @training_task,
|
||||
:user_activity_id => @user_activity_id}) %>");
|
||||
<% end %>
|
||||
sd_create_editor_from_data(<%= @user_activity_id %>, null, "100%","<%= @training_task.class.name %>");
|
||||
<% else %>
|
||||
<%= render "jounal_refresh" %>
|
||||
<% end %>
|
|
@ -0,0 +1,15 @@
|
|||
<div id="training_task_edit">
|
||||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
|
||||
<% end %>
|
||||
|
||||
<div class="pro_new_con mb10">
|
||||
<div class="pro-task-new-con clear">
|
||||
<%= labelled_form_for @training_task, :html => {:id => 'project_training_form', :multipart => true} do |f| %>
|
||||
<div id="all_attributes" >
|
||||
<%= render :partial => 'training_tasks/form', :locals => {:f => f} %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,251 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true,init_activity: true) %>
|
||||
<% end %>
|
||||
|
||||
<script xmlns="http://www.w3.org/1999/html">
|
||||
function add_style(){
|
||||
if($("select[id='tracker_id']").val() != 0){
|
||||
$("#tracker_id").addClass('issues_filter_active');
|
||||
}
|
||||
if($("select[id='author_id']").val() != 0){
|
||||
$("#author_id").addClass('issues_filter_active');
|
||||
}
|
||||
if($("select[id='assigned_to_id']").val() !=0){
|
||||
$("#assigned_to_id").addClass('issues_filter_active');
|
||||
}
|
||||
if($("select[id='priority_id']").val() !=0){
|
||||
$("#priority_id").addClass('issues_filter_active');
|
||||
}
|
||||
if($("select[id='fixed_version_id']").val() !=0){
|
||||
$("#fixed_version_id").addClass('issues_filter_active');
|
||||
}
|
||||
if($("select[id='status_id']").val() != 0 ){
|
||||
$("#status_id").addClass('issues_filter_active');
|
||||
}
|
||||
if($("select[id='done_ratio']").val() != -1){
|
||||
$("#done_ratio").addClass('issues_filter_active');
|
||||
}
|
||||
if($("select[id='test']").val() != 0 ){
|
||||
$("#test").addClass('issues_filter_active');
|
||||
}
|
||||
if($("select[id='tracker_id']").val() == 0){
|
||||
$("#tracker_id").removeClass('issues_filter_active');
|
||||
}
|
||||
if($("select[id='author_id']").val() == 0){
|
||||
$("#author_id").removeClass('issues_filter_active');
|
||||
}
|
||||
if($("select[id='assigned_to_id']").val() ==0){
|
||||
$("#assigned_to_id").removeClass('issues_filter_active');
|
||||
}
|
||||
if($("select[id='priority_id']").val() ==0){
|
||||
$("#priority_id").removeClass('issues_filter_active');
|
||||
}
|
||||
if($("select[id='fixed_version_id']").val() ==0){
|
||||
$("#fixed_version_id").removeClass('issues_filter_active');
|
||||
}
|
||||
if($("select[id='status_id']").val() == 0 ){
|
||||
$("#status_id").removeClass('issues_filter_active');
|
||||
}
|
||||
if($("select[id='done_ratio']").val() == -1){
|
||||
$("#done_ratio").removeClass('issues_filter_active');
|
||||
}
|
||||
if($("select[id='test']").val() == 0 ){
|
||||
$("#test").removeClass('issues_filter_active');
|
||||
}
|
||||
};
|
||||
//issues列表
|
||||
function g(o){
|
||||
return document.getElementById(o);
|
||||
}
|
||||
function HoverLi(n){
|
||||
//如果有N个标签,就将i<=N;
|
||||
for(var i=1;i<=3;i++){
|
||||
g('issues_list_nav_'+i).className='issues_nav_nomal';
|
||||
g('issues_list_content_'+i).className='undis';
|
||||
}
|
||||
g('issues_list_content_'+n).className='dis';
|
||||
g('issues_list_nav_'+n).className='issues_nav_hover';
|
||||
}
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
$("input[nhname='date_show']").change(function(){
|
||||
if($(this).val()=='创建日期起始' || $(this).val()=='创建日期结束')return;
|
||||
$("input[nhname='date_val']",$(this).parent('div')).val($(this).val());
|
||||
remote_function();
|
||||
});
|
||||
|
||||
});
|
||||
function remote_function() {
|
||||
if($.trim($("#issue_create_date_end_show").val()) !="" && Date.parse($.trim($("#issue_create_date_end_show").val())) < Date.parse($.trim($("#issue_create_date_start_show").val()))){
|
||||
alert("开始日期不能大于结束日期!");
|
||||
}
|
||||
$("#issue_query_form").submit();
|
||||
// $.ajax({
|
||||
// url:'<%#= project_issues_path(@project)%>',
|
||||
// data:{
|
||||
// subject:$("#v_subject").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
|
||||
// status_id: $("#status_id").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
|
||||
// assigned_to_id: $("#assigned_to_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
|
||||
// priority_id: $("#priority_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
|
||||
// author_id: $("#author_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, "")
|
||||
// },
|
||||
// success: function(data){
|
||||
// },
|
||||
// error: function(data){
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
function remote_function_export(project_id) {
|
||||
// $("#export_issue_hidden").attr("value","1");
|
||||
// $("#issue_query_form").attr("set_filter","1");
|
||||
// $("#issue_query_form").attr("action","/projects/"+project_id+"/issues.xls");
|
||||
// $("#issue_query_form").submit();
|
||||
// $("#issue_query_form").attr("action","/projects/"+project_id+"/issues");
|
||||
// $("#issue_query_form").removeAttr("format");
|
||||
// $("#issue_query_form").attr("set_filter","0");
|
||||
// $("#export_issue_hidden").attr("value","0");
|
||||
|
||||
var tracker_id = $("#tracker_id").attr("value");
|
||||
var subject = $("#v_subject").attr("value");
|
||||
var assigned_to_id = $("#assigned_to_id").attr("value");
|
||||
var fixed_version_id = $("#fixed_version_id").attr("value");
|
||||
var status_id = $("#status_id").attr("value");
|
||||
var done_ratio = $("#done_ratio").attr("value");
|
||||
var test = $("#test").attr("value");
|
||||
var author_id = $("#author_id").attr("value");
|
||||
var priority_id = $("#priority_id").attr("value");
|
||||
var issue_create_date_start = $("#issue_date_start_issue_export").attr("value");
|
||||
var issue_create_date_end = $("#issue_date_end_issue_export").attr("value");
|
||||
$("#sendexcel").attr("href","/projects/"+project_id+"/issues.xls?export=true&set_filter=1&tracker_id="+tracker_id+"&assigned_to_id="+assigned_to_id+"&fixed_version_id="+fixed_version_id+"&status_id="+status_id+"&done_ratio="+done_ratio+"&test="+test+"&author_id="+author_id+"&subject="+subject+"&issue_create_date_start="+issue_create_date_start+"&issue_create_date_end="+issue_create_date_end+"&priority_id="+priority_id);
|
||||
///projects/1811/issues.xls?export=true&set_filter=1
|
||||
}
|
||||
|
||||
// function nh_reset_form() {
|
||||
// $("#issue_query_form")[0].reset();
|
||||
// $("input[nhname='date_val']").val('');//涛哥的火狐reset 清不掉这个值 我擦
|
||||
// remote_function();
|
||||
// }
|
||||
|
||||
function EnterPress(e){
|
||||
var e = e || window.event;
|
||||
if(e.keyCode == 13){
|
||||
remote_function();
|
||||
}
|
||||
}
|
||||
|
||||
// 点击的时候让过滤条件选中assign_to
|
||||
function switch_assign_to(assign) {
|
||||
var assign = "option[value =" + assign + "]";
|
||||
$("#issues_type_2").click(function(){
|
||||
|
||||
});
|
||||
$("select[id='assigned_to_id']").find(assign).attr("selected", "selected");
|
||||
$("select[id='author_id']").val('');
|
||||
$("select[id='priority_id']").val('');
|
||||
$("select[id='tracker_id']").val('');
|
||||
$("select[id='fixed_version_id']").val('');
|
||||
$("select[id='status_id']").val('');
|
||||
$("select[id='done_ratio']").val('');
|
||||
$("select[id='test']").val('');
|
||||
$("#tracker_id").removeClass('issues_filter_active');
|
||||
$("#author_id").removeClass('issues_filter_active');
|
||||
$("#assigned_to_id").addClass('issues_filter_active');
|
||||
$("#priority_id").removeClass('issues_filter_active');
|
||||
$("#fixed_version_id").removeClass('issues_filter_active');
|
||||
$("#status_id").removeClass('issues_filter_active');
|
||||
$("#done_ratio").removeClass('issues_filter_active');
|
||||
$("#test").removeClass('issues_filter_active');
|
||||
remote_function();
|
||||
}
|
||||
|
||||
// 点击的时候让过滤条件选中user_id
|
||||
function createByMe(user_id) {
|
||||
var user = "option[value =" + user_id + "]";
|
||||
$("#createByMe").click(function(){
|
||||
|
||||
});
|
||||
$("select[id='author_id']").find(user).attr("selected", "selected");
|
||||
$("select[id='assigned_to_id']").val('');
|
||||
$("select[id='priority_id']").val('');
|
||||
$("select[id='tracker_id']").val('');
|
||||
$("select[id='fixed_version_id']").val('');
|
||||
$("select[id='status_id']").val('');
|
||||
$("select[id='done_ratio']").val('');
|
||||
$("select[id='test']").val('');
|
||||
$("#tracker_id").removeClass('issues_filter_active');
|
||||
$("#author_id").addClass('issues_filter_active');
|
||||
$("#assigned_to_id").removeClass('issues_filter_active');
|
||||
$("#priority_id").removeClass('issues_filter_active');
|
||||
$("#fixed_version_id").removeClass('issues_filter_active');
|
||||
$("#status_id").removeClass('issues_filter_active');
|
||||
$("#done_ratio").removeClass('issues_filter_active');
|
||||
$("#test").removeClass('issues_filter_active');
|
||||
remote_function();
|
||||
}
|
||||
// 清楚表单所有选项
|
||||
function all_reset_form() {
|
||||
$("#issue_query_form")[0].reset();
|
||||
$("select[id='author_id']").val('');
|
||||
$("select[id='assigned_to_id']").val('');
|
||||
$("input[nhname='date_val']").val('');
|
||||
$("#tracker_id").removeClass('issues_filter_active');
|
||||
$("#author_id").removeClass('issues_filter_active');
|
||||
$("#assigned_to_id").removeClass('issues_filter_active');
|
||||
$("#priority_id").removeClass('issues_filter_active');
|
||||
$("#fixed_version_id").removeClass('issues_filter_active');
|
||||
$("#status_id").removeClass('issues_filter_active');
|
||||
$("#done_ratio").removeClass('issues_filter_active');
|
||||
$("#test").removeClass('issues_filter_active');
|
||||
remote_function();
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--实训任务列表开始-->
|
||||
<div class="myissues_con mb10">
|
||||
<% if !@project.is_child_training_project? || User.current.admin? %>
|
||||
<a href="<%= new_project_training_task_path(@project) %>" class="btn btn-green fr mb10">新建</a>
|
||||
<div class="cl"></div>
|
||||
<% else %>
|
||||
<div class="pro_new_prompt mb10">
|
||||
<p>完成任务后,请点击“提交评测”按钮,若通过系统测试,将为你发送下一个任务,祝你早日通关,加油!</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @training_tasks.empty? %>
|
||||
<%= render :partial => "projects/no_data" %>
|
||||
<% else %>
|
||||
<div class="issues_con_list" >
|
||||
<div >
|
||||
<table class="issues-table" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><p class="text-left">所有<span class="issues_nav_tag ml5" style=" font-weight: normal;"><%= @training_tasks_count %></span></p></th>
|
||||
<th class="w50"> </th>
|
||||
<% if @project.is_child_training_project? %>
|
||||
<th class="w100"> </th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="issue_list">
|
||||
<%= render :partial => 'all_list', :locals => {:tasks => @training_tasks} %>
|
||||
</tbody>
|
||||
</table>
|
||||
<div style="text-align:left;">
|
||||
<div style="width:auto; display:inline-block;">
|
||||
<ul>
|
||||
<a href="javascript:void(0);" id="sendexcel" class="fl ml15 mt15" style="<%= @training_tasks_count > 10 ? 'height:24px;line-height:0;' : 'height:0;line-height:0;' %>"></a>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="pages fr" style="width:auto; display:inline-block;">
|
||||
<ul id="issue_list_pagination" class="fr">
|
||||
<%= pagination_links_full @training_tasks_pages, @training_tasks_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<!--实训任务结束-->
|
|
@ -0,0 +1,3 @@
|
|||
$("#issue_list").html("<%= escape_javascript(render :partial => 'training_tasks/all_list',:locals => {:tasks => @training_tasks, :project=> @project})%>");
|
||||
$("#issue_list_pagination").html('<%= pagination_links_full @training_tasks_pages, @training_tasks_count, :training_tasks => @training_tasks, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>');
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
|
||||
<% end %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--新建缺陷开始-->
|
||||
<div class="pro_new_con mb10">
|
||||
<div class="pro-task-new-con clear">
|
||||
<%#= call_hook(:view_issues_new_top, {:training_task => @training_task}) %>
|
||||
<%= labelled_form_for @training_task, :url => project_training_tasks_url(@project),
|
||||
:html => {:id => 'project_training_form', :multipart => true} do |f| %>
|
||||
<%= error_messages_for 'training_task' %>
|
||||
<%= hidden_field_tag 'copy_from', params[:copy_from] if params[:copy_from] %>
|
||||
<div>
|
||||
<%= render :partial => 'training_tasks/form', :locals => {:f => f} %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<!--新建缺陷结束-->
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<% if params[:is_project]%>
|
||||
$("#reply_message_<%= @jour.id %>").
|
||||
<% else %>
|
||||
if($("#reply_message_<%= @jour.id %>").length > 0) {
|
||||
$("#reply_message_<%= @jour.id %>").replaceWith("<%= escape_javascript(render :partial => 'training_tasks/training_tasks_reply_ke_form') %>");
|
||||
$(function(){
|
||||
sd_create_editor_from_data(<%= @jour.id %>, null, "100%", "<%= @jour.class.name %>");
|
||||
});
|
||||
}else if($("#reply_to_message_<%= @jour.id %>").length >0) {
|
||||
$("#reply_to_message_<%= @jour.id %>").replaceWith("<p id='reply_message_<%= @jour.id %>'></p>");
|
||||
}
|
||||
<% end %>
|
|
@ -0,0 +1,42 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true) %>
|
||||
<%= javascript_include_tag 'create_kindeditor'%>
|
||||
<% end %>
|
||||
<script>
|
||||
sd_create_editor_from_data(<%= @training_task.id %>, null, "100%", "<%= @training_task.class.name %>");
|
||||
</script>
|
||||
|
||||
<div class="mt10 mb10" id =issue_show_total"">
|
||||
<div class="banner-big f16 fontGrey3">
|
||||
任务详情
|
||||
<a href="<%= new_project_training_task_path(@project) %>" class="sy_btn_green fr" >新建</a>
|
||||
</div>
|
||||
|
||||
<div class="container-big mt10" style="float:left;">
|
||||
<div class="pro_page_box">
|
||||
<div class="problem_main borderBottomNone">
|
||||
<div id="issue_detail_show">
|
||||
<%= render :partial => 'detail'%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--problem_main end-->
|
||||
<div style="clear: both;"></div>
|
||||
<div class="container-big-grey">
|
||||
<div class="topBorder" style="display: <%= @training_task.journals.count > 0 ? 'none': '' %>"></div>
|
||||
<div class="reply-banner" >
|
||||
<div class="homepagePostReplyBannerCount" id="training_task_reply_banner">
|
||||
<%= render :partial => 'reply_banner' %>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
</div>
|
||||
<div class="" id="reply_div_<%= @training_task.id %>" >
|
||||
<%= render :partial => 'issue_replies',:locals => {:issue => @training_task, :replies_all_i => 0 } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
// $("#div_user_issue_reply_<%#= @user_activity_id %>").html("<%#= escape_javascript(render :partial => 'projects/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>");
|
||||
|
||||
$("#reply_div_<%= @training_task.id %>").html("<%= escape_javascript(render :partial => 'training_tasks/issue_replies', :locals => {:issue => @training_task}) %>");
|
||||
$("#div_issue_attachment_<%=@training_task.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => @training_task}) %>");
|
||||
issue_desc_editor = KindEditor.create('#issue_description',
|
||||
{"width":"85%",
|
||||
"resizeType":0,
|
||||
"no_label":true,
|
||||
"at_id":<%= @training_task.project_id %>,
|
||||
"at_type":"Project",
|
||||
"autoHeightMode":true,
|
||||
"afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);};if(typeof enableAt ==='function'){enableAt(self, \"<%= @training_task.project_id %>\", 'Project');}; this.loadPlugin('autoheight')})",
|
||||
"emotionsBasePath":'<%= Setting.host_name%>',
|
||||
"height":300,
|
||||
"allowFileManager":true,
|
||||
"uploadJson":"/kindeditor/upload",
|
||||
"fileManagerJson":"/kindeditor/filemanager"});
|
||||
$(".homepagePostReplyBannerCount").html('<%= escape_javascript(render :partial => 'reply_banner') %>');
|
||||
sd_create_editor_from_data(<%= @training_task.id %>, null, "100%", "<%= @training_task.class.name %>");
|
|
@ -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, :parent_id => parent_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, :parent_id => parent_id} %>
|
||||
<%= render :partial => 'users/comment_reply_detail', :locals => {:comment => comment, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
|
||||
</div>
|
|
@ -1,7 +1,7 @@
|
|||
<div class="orig_user fl">
|
||||
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => "33", :height => "33"), user_path(comment.creator_user), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="orig_right fl" onmouseout="$(this).find('.reply-right').hide();" onmouseover="$(this).find('.reply-right').show();">
|
||||
<div class="<%= comment.journalized_type == 'TrainingTask' ? 'new_orig_right fl' : 'orig_right fl' %>" onmouseout="$(this).find('.reply-right').hide();" onmouseover="$(this).find('.reply-right').show();">
|
||||
<%= link_to comment.creator_user.show_name, user_path(comment.creator_user), :class => "content-username" %>
|
||||
<span class="orig_area"><%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %></span>
|
||||
<div class="orig_content">
|
||||
|
@ -26,23 +26,31 @@
|
|||
<% topic = comment.root %>
|
||||
<% if !topic.locked? && authorize_for('messages', 'reply') %>
|
||||
<span 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, :parent_id => parent_id},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_reply)) %>
|
||||
<%= link_to(l(:button_reply),
|
||||
{: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)) %>
|
||||
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup03" style="display: none"> ︿</span>
|
||||
</span>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<span 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, :parent_id => parent_id},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_reply)) %>
|
||||
<%= link_to(l(:button_reply),
|
||||
{: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)) %>
|
||||
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup03" style="display: none"> ︿</span>
|
||||
</span>
|
||||
<% end %>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
:class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
|
||||
</span>
|
||||
<span class="homepageNewsType fl">
|
||||
<%= message_user.user_extensions.school_id.blank? ? "" : "来自"+message_user.user_extensions.school.name+"," %>
|
||||
<%= message_user.user_extensions.school_id.blank? || message_user.user_extensions.school.nil? ? "" : "来自"+message_user.user_extensions.school.name+"," %>
|
||||
申请以"<%= get_role_str ma.role %>"的身份加入竞赛:
|
||||
</span>
|
||||
</li>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<% parents_rely = [] %>
|
||||
<% parents_rely = get_reply_parents parents_rely, comment %>
|
||||
<% length = parents_rely.length %>
|
||||
<div id="comment_reply_<%=comment.id %>">
|
||||
<div id="comment_reply_<%= comment.id %>">
|
||||
<% if length <= 5 %>
|
||||
<%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id, :parent_id => comment.id} %>
|
||||
<% else %>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="resources" id="user_activity_<%= user_activity_id%>" style="<%= activity.private == 1? 'background-color:#cecece;':'' %>">
|
||||
<div class="resources mb10" id="user_activity_<%= user_activity_id%>" style="<%= activity.private == 1? 'background-color:#cecece;':'' %>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user), :alt => "用户头像" %>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<%=link_to user.show_name, user_path(user),
|
||||
:class => "newsBlue homepageNewsPublisher", :target => '_blank' %></span>
|
||||
<span class="homepageNewsType fl">
|
||||
<%= user.user_extensions.school_id.blank? ? "" : "来自"+user.user_extensions.school.name+"," %>
|
||||
<%= user.user_extensions.school_id.blank? || user.user_extensions.school.nil? ? "" : "来自"+user.user_extensions.school.name+"," %>
|
||||
申请以"<%= role_str%>"的身份加入竞赛:
|
||||
</span>
|
||||
</li>
|
||||
|
|
|
@ -1,17 +1,55 @@
|
|||
<% if params[:type] == 'HomeworkCommon' || params[:type] == 'Work' %>
|
||||
$('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @journals, :type => @type, :is_teacher => @is_teacher, :user_activity_id => @user_activity_id, :activity_id => params[:id].to_i}) %>');
|
||||
$('#reply_div_<%= @user_activity_id %>').html('<%= escape_javascript(render :partial => 'users/news_replies',
|
||||
:locals => {:comments => @journals,
|
||||
:type => @type,
|
||||
:is_teacher => @is_teacher,
|
||||
:user_activity_id => @user_activity_id,
|
||||
:activity_id => params[:id].to_i}) %>');
|
||||
<% elsif params[:type] == 'JournalsForMessage' %>
|
||||
$('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id =>params[:id].to_i}) %>');
|
||||
$('#reply_div_<%= @user_activity_id %>').html('<%= escape_javascript(render :partial => 'users/message_replies',
|
||||
:locals => {:comments => @journals,
|
||||
:user_activity_id => @user_activity_id,
|
||||
:type => @type,
|
||||
:activity_id =>params[:id].to_i}) %>');
|
||||
<% elsif params[:type] == 'Message' %>
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>');
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%= escape_javascript(render :partial => 'users/message_replies',
|
||||
:locals => {:comments => @journals,
|
||||
:user_activity_id => @user_activity_id,
|
||||
:type => @type,
|
||||
:activity_id => params[:id].to_i}) %>');
|
||||
<% elsif params[:type] == 'BlogComment' %>
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>');
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies',
|
||||
:locals => {:comments => @journals,
|
||||
:user_activity_id => @user_activity_id,
|
||||
:type => @type,
|
||||
:activity_id => params[:id].to_i}) %>');
|
||||
<% elsif params[:type] == 'OrgDocumentComment' %>
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>');
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%= escape_javascript(render :partial => 'users/message_replies',
|
||||
:locals => {:comments => @journals,
|
||||
:user_activity_id => @user_activity_id,
|
||||
:type => @type,
|
||||
:activity_id => params[:id].to_i}) %>');
|
||||
<% elsif params[:type] == 'News' || params[:type] == 'Issue' || params[:type] == 'Syllabus' %>
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>');
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%= escape_javascript(render :partial => 'users/news_replies',
|
||||
:locals => {:comments => @journals,
|
||||
:user_activity_id => @user_activity_id,
|
||||
:type => @type,
|
||||
:activity_id => params[:id].to_i}) %>');
|
||||
<% elsif params[:type] == 'is_project_issue' %>
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'projects/project_issue_expand_show', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :activity => @activity}) %>');
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%= escape_javascript(render :partial => 'projects/project_issue_expand_show',
|
||||
:locals => {:comments => @journals,
|
||||
:user_activity_id => @user_activity_id,
|
||||
:activity => @activity}) %>');
|
||||
<% elsif params[:type] == 'is_project_training_task' %>
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%= escape_javascript(render :partial => 'projects/project_issue_expand_show',
|
||||
:locals => {:comments => @journals,
|
||||
:user_activity_id => @user_activity_id,
|
||||
:activity => @activity}) %>');
|
||||
sd_create_editor_from_data(<%= @user_activity_id %>, null, "100%", "UserActivity");
|
||||
<% elsif params[:type] == 'is_project_message' %>
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'projects/project_message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>');
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%= escape_javascript(render :partial => 'projects/project_message_replies',
|
||||
:locals => {:comments => @journals,
|
||||
:user_activity_id => @user_activity_id,
|
||||
:type => @type,
|
||||
:activity_id => params[:id].to_i}) %>');
|
||||
<% end %>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue