Merge branch 'dev_raining' of https://git.trustie.net/jacknudt/trustieforge into develop
# Conflicts: # db/schema.rb
This commit is contained in:
commit
77f58d76a5
|
@ -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/
|
|
@ -125,6 +125,8 @@ class PraiseTreadController < ApplicationController
|
||||||
@obj = User.find_by_id(id)
|
@obj = User.find_by_id(id)
|
||||||
when 'Issue'
|
when 'Issue'
|
||||||
@obj = Issue.find_by_id(id)
|
@obj = Issue.find_by_id(id)
|
||||||
|
when 'TrainingTask'
|
||||||
|
@obj = TrainingTask.find_by_id(id)
|
||||||
when 'Project'
|
when 'Project'
|
||||||
@obj = Project.find_by_id(id)
|
@obj = Project.find_by_id(id)
|
||||||
when 'Bid'
|
when 'Bid'
|
||||||
|
|
|
@ -807,6 +807,7 @@ class ProjectsController < ApplicationController
|
||||||
|
|
||||||
# 资源库fork弹框
|
# 资源库fork弹框
|
||||||
def forked_pop
|
def forked_pop
|
||||||
|
@type = params[:type]
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
|
|
|
@ -132,6 +132,52 @@ class RepositoriesController < ApplicationController
|
||||||
# send_file "/path/to/file.zip"
|
# send_file "/path/to/file.zip"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 开启实训项目
|
||||||
|
def training_task_execute
|
||||||
|
@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 "Synv user failed ==>#{User.current.id}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
gproject = g.fork(@project.gpid, User.current.gid)
|
||||||
|
if gproject
|
||||||
|
new_training_project = copy_project(@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 publish_training_tasks project, new_training_project
|
||||||
|
original_task = TrainingTask.where(:project_id => project.id, :position => 1)
|
||||||
|
training_task = TrainingTask.new
|
||||||
|
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]
|
||||||
|
if training_task.save
|
||||||
|
respond_to do |format|
|
||||||
|
format.html{redirect_to project_training_tasks_url(:project_id => new_training_project)}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
# 判断用户是否已经fork过该项目
|
# 判断用户是否已经fork过该项目
|
||||||
def has_forked?(project, user)
|
def has_forked?(project, user)
|
||||||
projects = Project.where("user_id =?", user)
|
projects = Project.where("user_id =?", user)
|
||||||
|
|
|
@ -0,0 +1,800 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
class TrainingTasksController < ApplicationController
|
||||||
|
|
||||||
|
layout 'base_projects'
|
||||||
|
before_filter :allow_manager, :only => []
|
||||||
|
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 :find_project, :only => [:index, :new, :create, :update_form, :issue_commits, :commit_for_issue, :issue_commit_delete]
|
||||||
|
# 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('updated_at 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
|
||||||
|
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]
|
||||||
|
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
|
||||||
|
# 修改实例变量的值
|
||||||
|
return unless update_issue_from_params
|
||||||
|
# issue 关联的commit
|
||||||
|
commit_issues = CommitIssues.where(:issue_id => @issue.id, :project_id => @issue.project_id)
|
||||||
|
@issue_commit_ids = commit_issues.map{|commit_issue| commit_issue.commit_id}
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html {render :layout => 'base_projects' }#added by young
|
||||||
|
format.xml { }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# 用户编辑更改issue
|
||||||
|
def update
|
||||||
|
# params[:assigned_to_id] = nil if params[:assigned_to_id].to_i == 0
|
||||||
|
# params[:fixed_version_id] = nil if params[:fixed_version_id].to_i == 0
|
||||||
|
if params[:issue_detail]
|
||||||
|
issue = Issue.find(params[:id])
|
||||||
|
issue = update_user_issue_detail(issue, params)
|
||||||
|
@saved = update_user_issue_detail(issue, params)
|
||||||
|
return
|
||||||
|
else
|
||||||
|
# 修改实例变量的值
|
||||||
|
return unless update_issue_from_params
|
||||||
|
@issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
|
||||||
|
@issue.assigned_to_id = nil if @issue.assigned_to_id == 0
|
||||||
|
@issue.fixed_version_id = nil if @issue.fixed_version_id == 0
|
||||||
|
saved = false
|
||||||
|
begin
|
||||||
|
@saved = @issue.save_issue_with_child_records(params, @time_entry)
|
||||||
|
rescue ActiveRecord::StaleObjectError
|
||||||
|
@conflict = true
|
||||||
|
if params[:last_journal_id]
|
||||||
|
@conflict_journals = @issue.journals_after(params[:last_journal_id]).all
|
||||||
|
@conflict_journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if @saved
|
||||||
|
# 更新commit关联情况
|
||||||
|
update_issue_commit params[:commit_ids]
|
||||||
|
#修改界面增加跟踪者
|
||||||
|
watcherlist = @issue.watcher_users
|
||||||
|
select_users = []
|
||||||
|
if params[:issue]
|
||||||
|
if params[:issue][:watcher_user_ids]
|
||||||
|
params[:issue][:watcher_user_ids].each do |user_id|
|
||||||
|
select_users << User.find(user_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
select_users.each do |user|
|
||||||
|
if watcherlist.include? user
|
||||||
|
else
|
||||||
|
@issue.add_watcher user
|
||||||
|
end
|
||||||
|
end
|
||||||
|
watcherlist.each do |user|
|
||||||
|
if select_users.include? user
|
||||||
|
else
|
||||||
|
@issue.remove_watcher user
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
render_attachment_warning_if_needed(@issue)
|
||||||
|
reply_id = params[:reference_user_id].to_i
|
||||||
|
if reply_id > 0
|
||||||
|
JournalReply.add_reply(@issue.current_journal.id, reply_id, User.current.id)
|
||||||
|
end
|
||||||
|
#flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record? 去掉这个notice,因为现在更新都是ajax操作
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
format.html { redirect_to issue_url(@issue.id) }
|
||||||
|
format.api { render_api_ok }
|
||||||
|
end
|
||||||
|
else
|
||||||
|
respond_to do |format|
|
||||||
|
|
||||||
|
format.js
|
||||||
|
format.html { render :action => 'edit' }
|
||||||
|
format.api { render_validation_errors(@issue) }
|
||||||
|
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
|
||||||
|
|
||||||
|
# Bulk edit/copy a set of issues
|
||||||
|
def bulk_edit
|
||||||
|
@issues.sort!
|
||||||
|
@copy = params[:copy].present?
|
||||||
|
@notes = params[:notes]
|
||||||
|
|
||||||
|
if User.current.allowed_to?(:move_issues, @projects)
|
||||||
|
@allowed_projects = Issue.allowed_target_projects_on_move
|
||||||
|
if params[:issue]
|
||||||
|
@target_project = @allowed_projects.detect {|p| p.id.to_s == params[:issue][:project_id].to_s}
|
||||||
|
if @target_project
|
||||||
|
target_projects = [@target_project]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
target_projects ||= @projects
|
||||||
|
|
||||||
|
if @copy
|
||||||
|
@available_statuses = [IssueStatus.default]
|
||||||
|
else
|
||||||
|
@available_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&)
|
||||||
|
end
|
||||||
|
@custom_fields = target_projects.map{|p|p.all_issue_custom_fields}.reduce(:&)
|
||||||
|
@assignables = target_projects.map(&:assignable_users).reduce(:&)
|
||||||
|
@trackers = target_projects.map(&:trackers).reduce(:&)
|
||||||
|
@versions = target_projects.map {|p| p.shared_versions.open}.reduce(:&)
|
||||||
|
@categories = target_projects.map {|p| p.issue_categories}.reduce(:&)
|
||||||
|
if @copy
|
||||||
|
@attachments_present = @issues.detect {|i| i.attachments.any?}.present?
|
||||||
|
@subtasks_present = @issues.detect {|i| !i.leaf?}.present?
|
||||||
|
end
|
||||||
|
|
||||||
|
@safe_attributes = @issues.map(&:safe_attribute_names).reduce(:&)
|
||||||
|
render :layout => false if request.xhr?
|
||||||
|
end
|
||||||
|
|
||||||
|
def bulk_update
|
||||||
|
@issues.sort!
|
||||||
|
@copy = params[:copy].present?
|
||||||
|
attributes = parse_params_for_bulk_issue_attributes(params)
|
||||||
|
|
||||||
|
unsaved_issue_ids = []
|
||||||
|
moved_issues = []
|
||||||
|
|
||||||
|
if @copy && params[:copy_subtasks].present?
|
||||||
|
# Descendant issues will be copied with the parent task
|
||||||
|
# Don't copy them twice
|
||||||
|
@issues.reject! {|issue| @issues.detect {|other| issue.is_descendant_of?(other)}}
|
||||||
|
end
|
||||||
|
|
||||||
|
@issues.each do |issue|
|
||||||
|
issue.reload
|
||||||
|
if @copy
|
||||||
|
issue = issue.copy({},
|
||||||
|
:attachments => params[:copy_attachments].present?,
|
||||||
|
:subtasks => params[:copy_subtasks].present?
|
||||||
|
)
|
||||||
|
end
|
||||||
|
journal = issue.init_journal(User.current, params[:notes])
|
||||||
|
issue.safe_attributes = attributes
|
||||||
|
call_hook(:controller_issues_bulk_edit_before_save, { :params => params, :issue => issue })
|
||||||
|
if issue.save
|
||||||
|
moved_issues << issue
|
||||||
|
else
|
||||||
|
# Keep unsaved issue ids to display them in flash error
|
||||||
|
unsaved_issue_ids << issue.id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
set_flash_from_bulk_issue_save(@issues, unsaved_issue_ids)
|
||||||
|
|
||||||
|
if params[:follow]
|
||||||
|
if @issues.size == 1 && moved_issues.size == 1
|
||||||
|
redirect_to issue_url(moved_issues.first)
|
||||||
|
elsif moved_issues.map(&:project).uniq.size == 1
|
||||||
|
redirect_to project_issues_url(moved_issues.map(&:project).first)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
redirect_back_or_default _project_issues_path(@project)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
# 增加删除页面类型,如果是个人主页,则返回该主页,项目动态则返回项目动态页眉
|
||||||
|
page_classify = params[:page_classify] unless params[:page_classify].nil?
|
||||||
|
page_id = params[:page_id] unless params[:page_id].nil?
|
||||||
|
@hours = TimeEntry.sum(:hours, :conditions => ['issue_id IN (?)', @issues]).to_f
|
||||||
|
if @hours > 0
|
||||||
|
case params[:todo]
|
||||||
|
when 'destroy'
|
||||||
|
# nothing to do
|
||||||
|
when 'nullify'
|
||||||
|
TimeEntry.update_all('issue_id = NULL', ['issue_id IN (?)', @issues])
|
||||||
|
when 'reassign'
|
||||||
|
reassign_to = @project.issues.find_by_id(params[:reassign_to_id])
|
||||||
|
if reassign_to.nil?
|
||||||
|
flash.now[:error] = l(:error_issue_not_found_in_project)
|
||||||
|
return
|
||||||
|
else
|
||||||
|
TimeEntry.update_all("issue_id = #{reassign_to.id}", ['issue_id IN (?)', @issues])
|
||||||
|
end
|
||||||
|
else
|
||||||
|
# display the destroy form if it's a user request
|
||||||
|
return unless api_request?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@issues.each do |issue|
|
||||||
|
begin
|
||||||
|
issue.reload.destroy
|
||||||
|
rescue ::ActiveRecord::RecordNotFound # raised by #reload if issue no longer exists
|
||||||
|
# nothing to do, issue was already deleted (eg. by a parent)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
respond_to do |format|
|
||||||
|
if page_classify
|
||||||
|
format.html { redirect_back_or_default _project_issues_path(@project, page_classify, page_id) }
|
||||||
|
else
|
||||||
|
format.html { redirect_back_or_default _project_issues_path(@project) }
|
||||||
|
end
|
||||||
|
format.api { render_api_ok }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_journal
|
||||||
|
if User.current.logged?
|
||||||
|
jour = Journal.new
|
||||||
|
jour.user_id = User.current.id
|
||||||
|
jour.notes = params[:notes]
|
||||||
|
jour.journalized = @issue
|
||||||
|
jour.save_attachments(params[:attachments])
|
||||||
|
jour.save
|
||||||
|
update_user_activity(@issue.class,@issue.id)
|
||||||
|
update_forge_activity(@issue.class,@issue.id)
|
||||||
|
@allowed_statuses = @issue.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 issue_path(@issue)}
|
||||||
|
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
|
||||||
|
@issue = Issue.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])
|
||||||
|
@issue = Issue.find params[:id]
|
||||||
|
@project = @issue.project
|
||||||
|
@allowed_statuses = @issue.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 = @issue
|
||||||
|
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(@issue.class,@issue.id)
|
||||||
|
update_forge_activity(@issue.class,@issue.id)
|
||||||
|
respond_to do |format|
|
||||||
|
if params[:is_issue_show]
|
||||||
|
format.js{redirect_to issue_path(@issue)}
|
||||||
|
else
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# 需要刷新详情页面,代码同步一致
|
||||||
|
# 获取project和issue状态是为了刷新页面
|
||||||
|
# 值所以用delete是因为issue和journal在act_as_attachment中是同一个类型
|
||||||
|
# 非动态页面直接刷新,动态页面手动刷新
|
||||||
|
def delete_journal
|
||||||
|
@is_project = params[:is_project]
|
||||||
|
@issue = Issue.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 issue_url(@issue)}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def statistics
|
||||||
|
@project = Project.find(params[:id])
|
||||||
|
params[:author_id].to_i != 0 ? (@author = User.find(params[:author_id].to_i).show_name) : @author = 0
|
||||||
|
case params[:tracker_id].to_i
|
||||||
|
when 1
|
||||||
|
@tracker = "缺陷"
|
||||||
|
when 2
|
||||||
|
@tracker = "功能"
|
||||||
|
when 3
|
||||||
|
@tracker = "支持"
|
||||||
|
when 4
|
||||||
|
@tracker = "任务"
|
||||||
|
when 5
|
||||||
|
@tracker = "周报"
|
||||||
|
when 0
|
||||||
|
@tracker = 0
|
||||||
|
end
|
||||||
|
params[:subject].blank? ? @search = 0 : @search = params[:subject]
|
||||||
|
params[:assigned_to_id].to_i != 0 ? (@assigned = User.find(params[:assigned_to_id].to_i).show_name) : @assigned = 0
|
||||||
|
params[:fixed_version_id].to_i != 0 ? (@version = Version.find(params[:fixed_version_id].to_i).name) : @version = 0
|
||||||
|
params[:done_ratio].to_i != -1 ? (@done = params[:done_ratio].to_i) : @done = -1
|
||||||
|
case params[:priority_id].to_i
|
||||||
|
when 1
|
||||||
|
@prior = "低"
|
||||||
|
when 2
|
||||||
|
@prior = "正常"
|
||||||
|
when 3
|
||||||
|
@prior = "高"
|
||||||
|
when 4
|
||||||
|
@prior = "紧急"
|
||||||
|
when 5
|
||||||
|
@prior = "立刻"
|
||||||
|
when 0
|
||||||
|
@prior = 0
|
||||||
|
end
|
||||||
|
case params[:status_id].to_i
|
||||||
|
when 1
|
||||||
|
@status = "新增"
|
||||||
|
when 2
|
||||||
|
@status = "正在解决"
|
||||||
|
when 3
|
||||||
|
@status = "已解决"
|
||||||
|
when 4
|
||||||
|
@status = "反馈"
|
||||||
|
when 5
|
||||||
|
@status = "关闭"
|
||||||
|
when 6
|
||||||
|
@status = "拒绝"
|
||||||
|
when 0
|
||||||
|
@status = 0
|
||||||
|
end
|
||||||
|
params[:issue_create_date_start].blank? ? @start_time = 0 : @start_time = params[:issue_create_date_start]
|
||||||
|
params[:issue_create_date_end].blank? ? @end_time = 0 : @end_time = params[:issue_create_date_end]
|
||||||
|
@filter_condition = true
|
||||||
|
@filter_condition = false if (@author == 0 && @tracker == 0 && @search == 0 && @assigned == 0 && @version == 0 && @done == -1 && @prior ==0 && @status == 0 && @start_time ==0 && @end_time)
|
||||||
|
if @project.nil?
|
||||||
|
render_404
|
||||||
|
end
|
||||||
|
retrieve_query
|
||||||
|
sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
|
||||||
|
sort_update(@query.sortable_columns)
|
||||||
|
@query.sort_criteria = sort_criteria.to_a
|
||||||
|
@project_base_tag = 'base_projects'
|
||||||
|
if @query.valid?
|
||||||
|
@tracker_id = params[:tracker_id]
|
||||||
|
@assign_to_id = params[:assigned_to_id]
|
||||||
|
@author_id = params[:author_id]
|
||||||
|
@priority_id = params[:priority_id]
|
||||||
|
@status_id = params[:status_id]
|
||||||
|
@subject = params[:subject]
|
||||||
|
@done_ratio = params[:done_ratio]
|
||||||
|
@fixed_version_id = params[:fixed_version_id]
|
||||||
|
@issue_count = @query.issue_count
|
||||||
|
@test = params[:test]
|
||||||
|
@project_sort = 'issues.updated_on desc'
|
||||||
|
if params[:test] != "0"
|
||||||
|
case @test
|
||||||
|
when "1"
|
||||||
|
@project_sort = 'issues.created_on desc'
|
||||||
|
when "2"
|
||||||
|
@project_sort = 'issues.created_on asc'
|
||||||
|
when "3"
|
||||||
|
@project_sort = 'issues.updated_on desc'
|
||||||
|
when "4"
|
||||||
|
@project_sort = 'issues.updated_on asc'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# 搜索结果
|
||||||
|
# SELECT assigned_to_id, count(*) as ac FROM `issues` where project_id = @project.id group by assigned_to_id order by ac desc;
|
||||||
|
@issues_filter = @query.issues.sort_by{ |i| Issue.where(:project_id => @project.id , :assigned_to_id => i.assigned_to_id).count }.reverse
|
||||||
|
# @issues_filter = @query.issues(:order => @project_sort)
|
||||||
|
|
||||||
|
# if params[:type] == 1 || params[:type].nil?
|
||||||
|
# @results = @issues_filter
|
||||||
|
# elsif params[:type] == "2"
|
||||||
|
# @results = @issues_filter.collect{|result| result.status_id !=5 }
|
||||||
|
# elsif params[:type] == "3"
|
||||||
|
# @results = @issues_filter.collect{|result| result.status_id !=5 }
|
||||||
|
# end
|
||||||
|
|
||||||
|
#统计
|
||||||
|
@results = {}
|
||||||
|
|
||||||
|
#统计total
|
||||||
|
@alltotal = {}
|
||||||
|
for i in 0..5 do
|
||||||
|
@alltotal[i] = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
@opentotal = {}
|
||||||
|
for i in 0..5 do
|
||||||
|
@opentotal[i] = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
@closetotal = {}
|
||||||
|
for i in 0..5 do
|
||||||
|
@closetotal[i] = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
#开启关闭
|
||||||
|
@issue_open_count = 0
|
||||||
|
@issue_close_count = 0
|
||||||
|
|
||||||
|
@issues_filter.each do |issue|
|
||||||
|
@alltotal[0] = @alltotal[0] + 1
|
||||||
|
@alltotal[issue.tracker_id.to_i] = @alltotal[issue.tracker_id.to_i] + 1
|
||||||
|
user_id = issue.assigned_to_id
|
||||||
|
if issue.assigned_to_id.nil?
|
||||||
|
user_id = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
if !@results[user_id].nil?
|
||||||
|
@results[user_id][0] = @results[user_id][0] + 1
|
||||||
|
@results[user_id][issue.tracker_id.to_i] = @results[user_id][issue.tracker_id.to_i] + 1
|
||||||
|
|
||||||
|
if issue.status_id.to_i == 5
|
||||||
|
@issue_close_count = @issue_close_count + 1
|
||||||
|
@results[user_id][12] = @results[user_id][12]+1
|
||||||
|
@results[user_id][12+issue.tracker_id.to_i] = @results[user_id][12+issue.tracker_id.to_i]+1
|
||||||
|
|
||||||
|
@closetotal[0] = @closetotal[0] + 1
|
||||||
|
@closetotal[issue.tracker_id.to_i] = @closetotal[issue.tracker_id.to_i] + 1
|
||||||
|
else
|
||||||
|
@issue_open_count = @issue_open_count + 1
|
||||||
|
@results[user_id][6] = @results[user_id][6]+1
|
||||||
|
@results[user_id][6+issue.tracker_id.to_i] = @results[user_id][6+issue.tracker_id.to_i]+1
|
||||||
|
|
||||||
|
@opentotal[0] = @opentotal[0] + 1
|
||||||
|
@opentotal[issue.tracker_id.to_i] = @opentotal[issue.tracker_id.to_i] + 1
|
||||||
|
end
|
||||||
|
else
|
||||||
|
|
||||||
|
@results[user_id] = {}
|
||||||
|
|
||||||
|
tmpuser = User.find(user_id)
|
||||||
|
|
||||||
|
@results[user_id][:name] = tmpuser.nil? ? "" : tmpuser.show_name
|
||||||
|
#所有的
|
||||||
|
@results[user_id][0] = 1
|
||||||
|
for i in 1..17 do
|
||||||
|
@results[user_id][i] = 0
|
||||||
|
end
|
||||||
|
# @results[user_id][1] = 0
|
||||||
|
# @results[user_id][2] = 0
|
||||||
|
# @results[user_id][3] = 0
|
||||||
|
# @results[user_id][4] = 0
|
||||||
|
# @results[user_id][5] = 0
|
||||||
|
@results[user_id][issue.tracker_id.to_i] = 1
|
||||||
|
|
||||||
|
#开启的 status_id = 12346
|
||||||
|
# @results[user_id][6] = 0
|
||||||
|
# @results[user_id][7] = 0
|
||||||
|
# @results[user_id][8] = 0
|
||||||
|
# @results[user_id][9] = 0
|
||||||
|
# @results[user_id][10] = 0
|
||||||
|
# @results[user_id][11] = 0
|
||||||
|
|
||||||
|
#关闭的 status_id = 5
|
||||||
|
# @results[user_id][12] = 0
|
||||||
|
# @results[user_id][13] = 0
|
||||||
|
# @results[user_id][14] = 0
|
||||||
|
# @results[user_id][15] = 0
|
||||||
|
# @results[user_id][16] = 0
|
||||||
|
# @results[user_id][17] = 0
|
||||||
|
|
||||||
|
if issue.status_id.to_i == 5
|
||||||
|
@results[user_id][12] = 1
|
||||||
|
@results[user_id][12+issue.tracker_id.to_i] = 1
|
||||||
|
@issue_close_count = @issue_close_count+1
|
||||||
|
|
||||||
|
@closetotal[0] = @closetotal[0] + 1
|
||||||
|
@closetotal[issue.tracker_id.to_i] = @closetotal[issue.tracker_id.to_i] + 1
|
||||||
|
else
|
||||||
|
@issue_open_count = @issue_open_count+1
|
||||||
|
@results[user_id][6] = 1
|
||||||
|
@results[user_id][6+issue.tracker_id.to_i] = 1
|
||||||
|
|
||||||
|
@opentotal[0] = @opentotal[0] + 1
|
||||||
|
@opentotal[issue.tracker_id.to_i] = @opentotal[issue.tracker_id.to_i] + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
render_404
|
||||||
|
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 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
|
||||||
|
|
||||||
|
# Used by #edit and #update to set some common instance variables
|
||||||
|
# from the params
|
||||||
|
# TODO: Refactor, not everything in here is needed by #edit
|
||||||
|
def update_issue_from_params
|
||||||
|
@edit_allowed = User.current.allowed_to?(:edit_issues, @project)
|
||||||
|
@time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
|
||||||
|
@time_entry.attributes = params[:time_entry]
|
||||||
|
|
||||||
|
# 更新issue状态时,journal表产生记录,返回@current_journal
|
||||||
|
@issue.init_journal(User.current)
|
||||||
|
issue_attributes = params[:issue]
|
||||||
|
if issue_attributes && params[:conflict_resolution]
|
||||||
|
case params[:conflict_resolution]
|
||||||
|
when 'overwrite'
|
||||||
|
issue_attributes = issue_attributes.dup
|
||||||
|
issue_attributes.delete(:lock_version)
|
||||||
|
when 'add_notes'
|
||||||
|
issue_attributes = issue_attributes.slice(:notes)
|
||||||
|
when 'cancel'
|
||||||
|
redirect_to issue_url(@issue)
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if params[:action] == "update"
|
||||||
|
senduser = User.find(params[:issue][:assigned_to_id])
|
||||||
|
if senduser.id != User.current.id && @issue.assigned_to_id != params[:issue][:assigned_to_id].to_i
|
||||||
|
issue_id = @issue.id
|
||||||
|
issue_title = params[:issue][:subject]
|
||||||
|
priority_id = params[:issue][:priority_id]
|
||||||
|
ps = ProjectsService.new
|
||||||
|
ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@issue.safe_attributes = issue_attributes
|
||||||
|
@priorities = IssuePriority.active
|
||||||
|
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
|
# TODO: Refactor, lots of extra code in here
|
||||||
|
# TODO: Changing tracker on an existing issue should not trigger this
|
||||||
|
def build_new_task_from_params
|
||||||
|
if params[:id].blank?
|
||||||
|
@training_task = TrainingTask.new
|
||||||
|
@training_task.project = @project
|
||||||
|
else
|
||||||
|
@training_task = @project.training_tasks.visible.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
@training_task.project = @project
|
||||||
|
@training_task.author ||= User.current
|
||||||
|
# Tracker must be set before custom field values
|
||||||
|
@training_task.tracker ||= @project.trackers.find((params[:training_task] && params[:training_task][:tracker_id]) || params[:tracker_id] || :first)
|
||||||
|
if @training_task.tracker.nil?
|
||||||
|
render_error l(:error_no_tracker_in_project)
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
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
|
|
@ -0,0 +1,2 @@
|
||||||
|
module TrainingTasksHelper
|
||||||
|
end
|
|
@ -12,6 +12,8 @@ class PraiseTread < ActiveRecord::Base
|
||||||
@obj = User.find_by_id(id)
|
@obj = User.find_by_id(id)
|
||||||
when 'Issue'
|
when 'Issue'
|
||||||
@obj = Issue.find_by_id(id)
|
@obj = Issue.find_by_id(id)
|
||||||
|
when 'TrainingTask'
|
||||||
|
@obj = TrainingTask.find_by_id(id)
|
||||||
when 'Project'
|
when 'Project'
|
||||||
@obj = Project.find_by_id(id)
|
@obj = Project.find_by_id(id)
|
||||||
when 'Bid'
|
when 'Bid'
|
||||||
|
|
|
@ -57,6 +57,7 @@ class Project < ActiveRecord::Base
|
||||||
has_many :enabled_modules, :dependent => :delete_all
|
has_many :enabled_modules, :dependent => :delete_all
|
||||||
has_and_belongs_to_many :trackers, :order => "#{Tracker.table_name}.position"
|
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 :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 :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 :versions, :dependent => :destroy, :order => "#{Version.table_name}.effective_date DESC, #{Version.table_name}.name DESC"
|
||||||
has_many :time_entries, :dependent => :delete_all
|
has_many :time_entries, :dependent => :delete_all
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
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
|
||||||
|
acts_as_attachable
|
||||||
|
|
||||||
|
validates_presence_of :subject, :author
|
||||||
|
validates_length_of :subject, :maximum => 255
|
||||||
|
end
|
|
@ -1,5 +1,6 @@
|
||||||
<% project_file_num = Attachment.where(:container_type => "Project", :container_id => @project.id).count %>
|
<% project_file_num = Attachment.where(:container_type => "Project", :container_id => @project.id).count %>
|
||||||
<% project_issue_count = @project.issues.count %>
|
<% project_issue_count = @project.issues.count %>
|
||||||
|
<% training_tasks_count = @project.training_tasks.count %>
|
||||||
<% project_acts = ForgeActivity.where("project_id = ?", @project.id).count %>
|
<% project_acts = ForgeActivity.where("project_id = ?", @project.id).count %>
|
||||||
<% raodmaps = Version.where("project_id = ?", @project.id).count %>
|
<% raodmaps = Version.where("project_id = ?", @project.id).count %>
|
||||||
<% project_score = @project.project_score %>
|
<% project_score = @project.project_score %>
|
||||||
|
@ -37,6 +38,12 @@
|
||||||
<%= 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}" %>
|
<%= 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>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<!--实训任务-->
|
||||||
|
<% unless @project.enabled_modules.where("name = 'training_tasks'").empty? %>
|
||||||
|
<li id="project_menu_11">
|
||||||
|
<%= 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, :remote => true), :class => "pro_new_proname", :title => "#{training_tasks_count}" %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
<!--讨论区-->
|
<!--讨论区-->
|
||||||
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
|
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
|
||||||
<li id="project_menu_03">
|
<li id="project_menu_03">
|
||||||
|
|
|
@ -35,9 +35,15 @@
|
||||||
|
|
||||||
<!--项目fork-->
|
<!--项目fork-->
|
||||||
<li class="mr5 fl">
|
<li class="mr5 fl">
|
||||||
<%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", forked_pop_project_path(@project),
|
<!--实训项目条件:1、modules中选中了实训任务 2、不是fork的项目-->
|
||||||
:class=>"pro_new_topbtn_left fl", :remote => true %>
|
<% if !@project.enabled_modules.where("name = 'training_tasks'").empty? && @project.forked_from_project_id.nil? %>
|
||||||
<a href="<%= member_forked_project_path(@project) %>" class=" pro_new_topbtn fl" title="fork成员列表"><%= project_fork_count %></a>
|
<%= link_to "开始实训", forked_pop_project_path(@project, :task => true), :class => "sy_btn_green fr" %>
|
||||||
|
<% 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>
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,31 +6,61 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="sy_popup_con" style="width:380px;">
|
<div class="sy_popup_con" style="width:380px;">
|
||||||
<ul class="sy_popup_add" >
|
<ul class="sy_popup_add" >
|
||||||
<% if User.current.id == @project.user_id %>
|
<%# 实训项目和非实训项目,@type为true的时候为实训 %>
|
||||||
<li class="center mb30" style="line-height:20px">
|
<% if @type %>
|
||||||
自己不能Fork自己创建的项目
|
<% if User.current.id == @project.user_id %>
|
||||||
</li>
|
|
||||||
<% else %>
|
|
||||||
<% if @project.gpid.blank? %>
|
|
||||||
<li class="center mb30" style="line-height:20px">
|
<li class="center mb30" style="line-height:20px">
|
||||||
该项目还没有创建版本库,暂时不能Fork
|
很抱歉,您不能在自己的实训项目中启动训练
|
||||||
</li>
|
</li>
|
||||||
<% else %>
|
<% else %>
|
||||||
<li class="center mb5" style="line-height:20px">
|
<% if @project.gpid.blank? %>
|
||||||
<% if has_forked_cur_project(@project) %>
|
<li class="center mb30" style="line-height:20px">
|
||||||
您已经Fork过该项目,点击“确定”将会跳入您Fork的项目主页,请问是否继续?
|
该项目还没有创建版本库,暂时不支持实训
|
||||||
<% else %>
|
</li>
|
||||||
Fork将在后台执行<br>平台将为您创建一个新的同名项目和版本库,请问是否继续?
|
<% else %>
|
||||||
<% end %>
|
<li class="center mb5" style="line-height:20px">
|
||||||
|
<% if has_training_cur_project(@project) %>
|
||||||
|
您已经实训过该项目,点击“确定”将会跳转到您的实训项目主页,请问您是否继续?
|
||||||
|
<% 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_task_execute'}, :class => "sy_btn_blue fl ml20", :onclick => "hideModal();", :target => "_blank" %>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<% if User.current.id == @project.user_id %>
|
||||||
|
<li class="center mb30" style="line-height:20px">
|
||||||
|
自己不能Fork自己创建的项目
|
||||||
</li>
|
</li>
|
||||||
<li class="mt10">
|
<% else %>
|
||||||
<label class="mr27"> </label>
|
<% if @project.gpid.blank? %>
|
||||||
<a href="javascript:void(0);" class="sy_btn_grey fl " onclick="hideModal()">取 消</a>
|
<li class="center mb30" style="line-height:20px">
|
||||||
<%= link_to "确 定", {:controller => 'repositories', :action => 'forked'}, :class => "sy_btn_blue fl ml20", :onclick => "hideModal();", :target => "_blank" %>
|
该项目还没有创建版本库,暂时不能Fork
|
||||||
<div class="cl"></div>
|
</li>
|
||||||
</li>
|
<% else %>
|
||||||
<% end %>
|
<li class="center mb5" style="line-height:20px">
|
||||||
|
<% if has_forked_cur_project(@project) %>
|
||||||
|
您已经Fork过该项目,点击“确定”将会跳入您Fork的项目主页,请问是否继续?
|
||||||
|
<% else %>
|
||||||
|
Fork将在后台执行<br>平台将为您创建一个新的同名项目和版本库,请问是否继续?
|
||||||
|
<% 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 => 'repositories', :action => 'forked'}, :class => "sy_btn_blue fl ml20", :onclick => "hideModal();", :target => "_blank" %>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -0,0 +1,12 @@
|
||||||
|
<% tasks.each do |task| -%>
|
||||||
|
<%= render :partial => 'content_list', :locals => {:activity => task, :user_activity_id => task.id} %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div style="text-align:left;">
|
||||||
|
<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>
|
|
@ -0,0 +1,71 @@
|
||||||
|
<% unless activity.author.nil? %>
|
||||||
|
<div class="issues_list_box clear" id="user_activity_<%= user_activity_id%>">
|
||||||
|
<div class="issues_ciricons fl ">
|
||||||
|
<span class="issues_ciricons_01"></span>
|
||||||
|
</div>
|
||||||
|
<div class=" fl ml5">
|
||||||
|
<div class="issues_list_titlebox clear">
|
||||||
|
<a href="<%= issue_path(activity) %>" class="issues_list_title fl" target="_blank" title="<%= activity.subject.to_s %>"><%= activity.subject.to_s %></a>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
<div class="issues_list_small">
|
||||||
|
<%# if activity.try(:author).try(:realname) == ' ' %>
|
||||||
|
<%#= link_to activity.try(:author), user_path(activity.author_id), :class => "fl issues_list_name" %>
|
||||||
|
<%# else %>
|
||||||
|
<%#= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "fl issues_list_name" %>
|
||||||
|
<%# end %>
|
||||||
|
<!--p class="fl ml10"> <span class="mr5"><%#=format_time(activity.created_on) %></span>发布</p-->
|
||||||
|
<p class="fl" ><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>
|
||||||
|
<ul class="issues_list_txt fr">
|
||||||
|
<li class="c_grey">
|
||||||
|
<% if activity.try(:author).try(:realname) == ' ' %>
|
||||||
|
<%= link_to activity.try(:author), user_path(activity.author_id)%>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id)%>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="issues_list_min c_grey mr5">
|
||||||
|
<% case activity.tracker_id %>
|
||||||
|
<% when 1%>
|
||||||
|
缺陷
|
||||||
|
<% when 2%>
|
||||||
|
功能
|
||||||
|
<% when 3%>
|
||||||
|
支持
|
||||||
|
<% when 4%>
|
||||||
|
任务
|
||||||
|
<% when 5%>
|
||||||
|
周报
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% 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,54 @@
|
||||||
|
<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">
|
||||||
|
<p class="pro_page_tit" style="word-break:break-all;">
|
||||||
|
<% case @training_task.tracker_id %>
|
||||||
|
<% when 1%>
|
||||||
|
<span class="fl" title="缺陷">【缺陷】</span>
|
||||||
|
<% when 2%>
|
||||||
|
<span class="fl" title="功能">【功能】</span>
|
||||||
|
<% when 3%>
|
||||||
|
<span class="fl" title="支持">【支持】</span>
|
||||||
|
<% when 4%>
|
||||||
|
<span class="fl" title="任务">【任务】</span>
|
||||||
|
<% when 5%>
|
||||||
|
<span class="fl" title="周报">【周报】</span>
|
||||||
|
<% end %>
|
||||||
|
</span> <span style="padding-left: 5px;"><%= @training_task.subject %></span></p>
|
||||||
|
<!--<span class='<%#= "#{get_issue_priority(@training_task.priority_id)[0]} " %>'><%#= get_issue_priority(@training_task.priority_id)[1] %></span></p>-->
|
||||||
|
<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>
|
||||||
|
<%= link_to "完成", complete_training_task_training_task_path(@training_task), :class => "sy_btn_green fr" %>
|
||||||
|
|
||||||
|
<!--talk_txt end-->
|
||||||
|
<a href="javascript:void(0)" class="talk_edit fr"> </a>
|
||||||
|
<%#= render :partial => 'action_menu' %>
|
||||||
|
<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? %>
|
||||||
|
<%#= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %>
|
||||||
|
<%= 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>
|
||||||
|
<!--属性-->
|
||||||
|
<%#= render :partial => 'issues/attributes_show' %>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
showNormalImage('issue_desc_<%= @training_task.id %>');
|
||||||
|
autoUrl('issue_desc_<%= @training_task.id %>');
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -0,0 +1,55 @@
|
||||||
|
<%= labelled_fields_for :training_task, @training_task do |f| %>
|
||||||
|
<ul class="fl pro_new_conbox_left">
|
||||||
|
<li class="clear">
|
||||||
|
<span class="fl mt6 mr12">类 型</span>
|
||||||
|
<%= f.select :tracker_id, Tracker.all.collect{ |t| [t.name, t.id] },{:required => true, :no_label => true},
|
||||||
|
:class => "fl", :style => "width:160px;padding-left:0px;" %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label class="label"><span class="c_red f12">*</span> 主题 : </label>
|
||||||
|
<%= f.text_field :subject, :style => "font-size:small;width:606px;", :no_label => true, :id => "training_task_id" %>
|
||||||
|
<span style="display: none">标题不能为空</span>
|
||||||
|
<!--Added by young-->
|
||||||
|
<%= 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"> 描述 : </label>
|
||||||
|
<%= f.label_for_field :description, :no_label => true, :class => "label" %>
|
||||||
|
<%#= link_to_function image_tag('edit.png'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %>
|
||||||
|
<%#= content_tag 'span', :id => "issue_description_and_toolbar" do %>
|
||||||
|
<%= f.kindeditor :description,:editor_id => "training_task_desc_editor", :width=>'85%', :height =>159, :resizeType => 0, :no_label => true, at_id: @project.id, at_type: @project.class.to_s %>
|
||||||
|
<%# end %>
|
||||||
|
<%#= wikitoolbar_for 'issue_description' %>
|
||||||
|
|
||||||
|
</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 %>
|
||||||
|
<!--<a href="javascript:void(0);" class="sy_btn_blue mr5 fr"> 保存并继续</a>-->
|
||||||
|
<!--<a href="javascript:void(0);" onclick="issue_desc_editor.sync();$('#issue-form').submit();" class="sy_btn_blue mr5 fr" id="issue_confirm"> 保存</a>-->
|
||||||
|
<input onclick="issue_create();" class="sy_btn_blue fr mr5" onfocus="this.blur()" id="issue_confirm" style="width: 28px;color: #FFF" value="保存">
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
<script>
|
||||||
|
function issue_create(){
|
||||||
|
training_task_desc_editor.sync();
|
||||||
|
$('#project_training_form').submit();
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -0,0 +1,89 @@
|
||||||
|
<ul>
|
||||||
|
<% @journals.each do |comment| %>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
showNormalImage('reply_content_<%= comment.id %>');
|
||||||
|
autoUrl('reply_content_<%= comment.id %>');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<li class="homepagePostReplyContainer" 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="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=comment.id %>').show();" onmouseout="$('#delete_reply_<%=comment.id %>').hide();">
|
||||||
|
<%= render :partial => 'users/news_contents', :locals => {:comment => comment, :type => 'Issue', :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 => 'issues', :action => 'reply', :user_id => comment.user_id, :id => issue.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 => 'issues',:action => 'delete_journal', :id => issue.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="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||||
|
|
||||||
|
<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">
|
||||||
|
<% if User.current.logged? %>
|
||||||
|
<div nhname='new_message_<%= @training_task.id %>' style="display:none;">
|
||||||
|
<%= form_for('new_form', :url => add_journal_issue_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,5 @@
|
||||||
|
<% count = @training_task.journals.count %>
|
||||||
|
回复<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><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,232 @@
|
||||||
|
<%= 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 id="myissues_con" class="myissues_con mb10">
|
||||||
|
<div class="clear mb5">
|
||||||
|
<div class="issues_statistics fl clear">
|
||||||
|
<ul>
|
||||||
|
<li>所有<a href="javascript:void(0);" class="issues_greycirbg_btn "><%= @training_tasks.count %></a></li>
|
||||||
|
</ul>
|
||||||
|
</div><!--issues_statistics end-->
|
||||||
|
<a href="<%= new_project_training_task_path(@project)%>" class="sy_btn_green fr">新建</a>
|
||||||
|
</div>
|
||||||
|
<% if @training_tasks.empty? %>
|
||||||
|
<%= render :partial => "projects/no_data" %>
|
||||||
|
<% else %>
|
||||||
|
<div id="issue_list">
|
||||||
|
<%= render :partial => 'all_list', :locals => {:tasks => @training_tasks, :query => @query, :training_tasks_pages=> @training_tasks_pages, :training_tasks_count=> @training_tasks_count, :project=> @project, :subject => @subject} %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<%#= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %>
|
||||||
|
</div><!--issues_con_list end-->
|
||||||
|
<div class="cl"></div>
|
||||||
|
<!--issues_filter end-->
|
||||||
|
<div id="issues_list_content_1">
|
||||||
|
</div><!--issues_list_content_1 end-->
|
||||||
|
<div id="issues_list_content_2" class="undis">
|
||||||
|
</div><!--issues_list_content_2 end-->
|
||||||
|
<div id="issues_list_content_3" class="undis">
|
||||||
|
</div><!--issues_list_content_3 end-->
|
||||||
|
<!--issues_con_list end-->
|
|
@ -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 ">
|
||||||
|
<div class="pro_newissue_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,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="resources 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="homepagePostReply">
|
||||||
|
<div class="topBorder" style="display: <%= @training_task.journals.count>0 ? 'none': '' %>"></div>
|
||||||
|
<div class="homepagePostReplyBanner" >
|
||||||
|
<div class="homepagePostReplyBannerCount">
|
||||||
|
<%=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>
|
||||||
|
|
|
@ -268,6 +268,7 @@ zh:
|
||||||
label_tags_numbers: "Tag统计"
|
label_tags_numbers: "Tag统计"
|
||||||
|
|
||||||
label_issue_plural: 问题跟踪
|
label_issue_plural: 问题跟踪
|
||||||
|
label_training_task: 实训任务
|
||||||
# label_project_plural: 项目列表
|
# label_project_plural: 项目列表
|
||||||
label_user_plural: 用户列表
|
label_user_plural: 用户列表
|
||||||
label_tags_call: 需求
|
label_tags_call: 需求
|
||||||
|
|
|
@ -390,6 +390,8 @@ zh:
|
||||||
project_module_time_tracking: 时间跟踪
|
project_module_time_tracking: 时间跟踪
|
||||||
#project_module_course: 课程
|
#project_module_course: 课程
|
||||||
|
|
||||||
|
project_module_training_tasks: 实训任务
|
||||||
|
|
||||||
# 成员配置
|
# 成员配置
|
||||||
label_approve: 批准
|
label_approve: 批准
|
||||||
label_refusal: 拒绝
|
label_refusal: 拒绝
|
||||||
|
|
|
@ -965,6 +965,18 @@ RedmineApp::Application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
resources :training_tasks do
|
||||||
|
collection do
|
||||||
|
|
||||||
|
end
|
||||||
|
member do
|
||||||
|
post 'add_journal'
|
||||||
|
get 'delete_journal'
|
||||||
|
get 'reply'
|
||||||
|
post 'add_reply'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
resources :pull_requests do
|
resources :pull_requests do
|
||||||
collection do
|
collection do
|
||||||
end
|
end
|
||||||
|
@ -1081,7 +1093,16 @@ RedmineApp::Application.routes.draw do
|
||||||
|
|
||||||
resources :queries, :except => [:show]
|
resources :queries, :except => [:show]
|
||||||
|
|
||||||
|
resources :training_tasks do
|
||||||
|
member do
|
||||||
|
post 'complete_training_task'
|
||||||
|
end
|
||||||
|
collection do
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
resources :news, :only => [:index, :show, :edit, :update, :destroy]
|
resources :news, :only => [:index, :show, :edit, :update, :destroy]
|
||||||
|
|
||||||
match '/news/:id/comments', :to => 'comments#create', :via => :post
|
match '/news/:id/comments', :to => 'comments#create', :via => :post
|
||||||
#match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete
|
#match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete
|
||||||
delete '/news/:id/comments/:comment_id', :to => 'comments#destroy', as: :delete_news_comments
|
delete '/news/:id/comments/:comment_id', :to => 'comments#destroy', as: :delete_news_comments
|
||||||
|
|
|
@ -201,6 +201,7 @@ default_projects_modules:
|
||||||
- calendar
|
- calendar
|
||||||
- gantt
|
- gantt
|
||||||
- course
|
- course
|
||||||
|
- training_tasks
|
||||||
# - dts
|
# - dts
|
||||||
default_projects_tracker_ids:
|
default_projects_tracker_ids:
|
||||||
serialized: true
|
serialized: true
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
class CreateTrainingTasks < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :training_tasks do |t|
|
||||||
|
t.integer :project_id
|
||||||
|
t.integer :tracker_id
|
||||||
|
t.string :subject
|
||||||
|
t.text :description
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,6 @@
|
||||||
|
class AddAuthorIdToTrainingTasks < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :training_tasks, :author_id, :integer
|
||||||
|
add_column :training_tasks, :status, :integer, :limit => 1, :default => 1
|
||||||
|
end
|
||||||
|
end
|
|
@ -193,6 +193,11 @@ Redmine::AccessControl.map do |map|
|
||||||
map.permission :delete_issue_watchers, {:watchers => :destroy}
|
map.permission :delete_issue_watchers, {:watchers => :destroy}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
map.project_module :training_tasks do |map|
|
||||||
|
map.permission :manage_training_tasks, {:training_tasks => [:new, :create]}, :require => :loggedin
|
||||||
|
map.permission :view_training_tasks, {:training_tasks => :index, :versions => :download}, :read => true
|
||||||
|
end
|
||||||
|
|
||||||
# map.project_module :time_tracking do |map|
|
# map.project_module :time_tracking do |map|
|
||||||
# map.permission :log_time, {:timelog => [:new, :create]}, :require => :loggedin
|
# map.permission :log_time, {:timelog => [:new, :create]}, :require => :loggedin
|
||||||
# map.permission :view_time_entries, {:timelog => [:index, :report, :show]}, :read => true
|
# map.permission :view_time_entries, {:timelog => [:index, :report, :show]}, :read => true
|
||||||
|
@ -413,6 +418,7 @@ Redmine::MenuManager.map :project_menu do |menu|
|
||||||
#menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id
|
#menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id
|
||||||
# :if => Proc.new { |p| p.shared_versions.any? }
|
# :if => Proc.new { |p| p.shared_versions.any? }
|
||||||
menu.push :issues, { :controller => 'issues', :action => 'index' },:if => Proc.new {|p| p.enabled_module_names.include?('issue_tracking') } ,:param => :project_id, :caption => :label_issue_plural
|
menu.push :issues, { :controller => 'issues', :action => 'index' },:if => Proc.new {|p| p.enabled_module_names.include?('issue_tracking') } ,:param => :project_id, :caption => :label_issue_plural
|
||||||
|
menu.push :training_tasks, { :controller => 'training_tasks', :action => 'index' },:if => Proc.new {|p| p.enabled_module_names.include?('training_tasks') } ,:param => :project_id, :caption => :label_training_task
|
||||||
# menu.push :new_issue, { :controller => 'issues', :action => 'new', :copy_from => nil }, :param => :project_id, :caption => :label_issue_new,
|
# menu.push :new_issue, { :controller => 'issues', :action => 'new', :copy_from => nil }, :param => :project_id, :caption => :label_issue_new,
|
||||||
# :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) }
|
# :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) }
|
||||||
# menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt
|
# menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe TrainingTasksController, :type => :controller do
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,9 @@
|
||||||
|
FactoryGirl.define do
|
||||||
|
factory :training_task do
|
||||||
|
project_id 1
|
||||||
|
tracker_id 1
|
||||||
|
subject "MyString"
|
||||||
|
description "MyText"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe TrainingTask, :type => :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
Loading…
Reference in New Issue