删除issue,返回页面不变
This commit is contained in:
parent
4d82f0c959
commit
a4e2fd741e
1
Gemfile
1
Gemfile
|
@ -36,6 +36,7 @@ gem 'chinese_pinyin'
|
|||
# gem 'progress_bar'
|
||||
gem 'ansi'
|
||||
|
||||
gem 'debugger'
|
||||
gem 'kaminari'
|
||||
gem 'elasticsearch-model'
|
||||
gem 'elasticsearch-rails'
|
||||
|
|
|
@ -390,6 +390,9 @@ class IssuesController < ApplicationController
|
|||
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]
|
||||
|
@ -418,7 +421,11 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { redirect_back_or_default _project_issues_path(@project) }
|
||||
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
|
||||
|
|
|
@ -22,10 +22,18 @@ module RoutesHelper
|
|||
# Returns the path to project issues or to the cross-project
|
||||
# issue list if project is nil
|
||||
def _project_issues_path(project, *args)
|
||||
if project
|
||||
project_issues_path(project, *args)
|
||||
if args[0].to_s.include? '_page'
|
||||
if args[0].to_s == "user_page"
|
||||
user_activities_path(args[1].to_i)
|
||||
else
|
||||
project_path(project)
|
||||
end
|
||||
else
|
||||
issues_path(*args)
|
||||
if project
|
||||
project_issues_path(project, *args)
|
||||
else
|
||||
issues_path(*args)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<%= render :partial => 'projects/project_create', :locals => {:activity => activity, :user_activity_id => activity.id} %>
|
||||
<!--缺陷动态-->
|
||||
<% when "Issue" %>
|
||||
<%= render :partial => 'users/project_issue', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id} %>
|
||||
<%= render :partial => 'users/project_issue', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %>
|
||||
|
||||
<!--message -->
|
||||
<% when "Message" %>
|
||||
|
|
|
@ -21,7 +21,13 @@
|
|||
<%= link_to l(:button_edit), issue_path(activity.id, :edit => 'true'), :class => 'postOptionLink', :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:button_delete), issue_path(activity.id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'postOptionLink' if User.current.allowed_to?(:delete_issues, activity.project) %>
|
||||
<% if !defined?(project_id) && !defined?(user_id) %>
|
||||
<%= link_to l(:button_delete), issue_path(activity.id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'postOptionLink' if User.current.allowed_to?(:delete_issues, activity.project) %>
|
||||
<% elsif defined?(project_id) %>
|
||||
<%= link_to l(:button_delete), issue_path(activity.id, :page_classify => "project_page", :page_id => project_id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'postOptionLink' if User.current.allowed_to?(:delete_issues, activity.project) %>
|
||||
<% elsif defined?(user_id) %>
|
||||
<%= link_to l(:button_delete), issue_path(activity.id, :page_classify => "user_page", :page_id => user_id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'postOptionLink' if User.current.allowed_to?(:delete_issues, activity.project) %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:button_copy), project_copy_issue_path(activity.project, activity), :class => 'postOptionLink' if User.current.allowed_to?(:add_issues, activity.project) %>
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
<% if act %>
|
||||
<% case user_activity.act_type.to_s %>
|
||||
<% when 'Issue' %>
|
||||
<%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||
<%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id, :user_id => user_id} %>
|
||||
<% when 'Message' %>
|
||||
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %>
|
||||
<% when 'ProjectCreateInfo'%>
|
||||
|
|
|
@ -45,5 +45,4 @@
|
|||
<% homepage = BlogComment.find(@user.blog.homepage_id) %>
|
||||
<%= render :partial => 'blogs/homepage', :locals => {:activity => homepage, :user_activity_id => homepage.id} %>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities,:page => 0,:type => @type} %>
|
||||
<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities,:page => 0,:type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id)} %>
|
||||
|
|
Loading…
Reference in New Issue