删除issue,返回页面不变

This commit is contained in:
alan 2016-03-17 14:13:29 +08:00
parent 4d82f0c959
commit a4e2fd741e
7 changed files with 30 additions and 9 deletions

View File

@ -36,6 +36,7 @@ gem 'chinese_pinyin'
# gem 'progress_bar' # gem 'progress_bar'
gem 'ansi' gem 'ansi'
gem 'debugger'
gem 'kaminari' gem 'kaminari'
gem 'elasticsearch-model' gem 'elasticsearch-model'
gem 'elasticsearch-rails' gem 'elasticsearch-rails'

View File

@ -390,6 +390,9 @@ class IssuesController < ApplicationController
end end
def destroy 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 @hours = TimeEntry.sum(:hours, :conditions => ['issue_id IN (?)', @issues]).to_f
if @hours > 0 if @hours > 0
case params[:todo] case params[:todo]
@ -418,7 +421,11 @@ class IssuesController < ApplicationController
end end
end end
respond_to do |format| 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 } format.api { render_api_ok }
end end
end end

View File

@ -22,10 +22,18 @@ module RoutesHelper
# Returns the path to project issues or to the cross-project # Returns the path to project issues or to the cross-project
# issue list if project is nil # issue list if project is nil
def _project_issues_path(project, *args) def _project_issues_path(project, *args)
if project if args[0].to_s.include? '_page'
project_issues_path(project, *args) if args[0].to_s == "user_page"
user_activities_path(args[1].to_i)
else
project_path(project)
end
else else
issues_path(*args) if project
project_issues_path(project, *args)
else
issues_path(*args)
end
end end
end end

View File

@ -66,7 +66,7 @@
<%= render :partial => 'projects/project_create', :locals => {:activity => activity, :user_activity_id => activity.id} %> <%= render :partial => 'projects/project_create', :locals => {:activity => activity, :user_activity_id => activity.id} %>
<!--缺陷动态--> <!--缺陷动态-->
<% when "Issue" %> <% 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 --> <!--message -->
<% when "Message" %> <% when "Message" %>

View File

@ -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) %> <%= 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>
<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>
<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) %> <%= link_to l(:button_copy), project_copy_issue_path(activity.project, activity), :class => 'postOptionLink' if User.current.allowed_to?(:add_issues, activity.project) %>

View File

@ -89,7 +89,7 @@
<% if act %> <% if act %>
<% case user_activity.act_type.to_s %> <% case user_activity.act_type.to_s %>
<% when 'Issue' %> <% 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' %> <% when 'Message' %>
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %> <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %>
<% when 'ProjectCreateInfo'%> <% when 'ProjectCreateInfo'%>

View File

@ -45,5 +45,4 @@
<% homepage = BlogComment.find(@user.blog.homepage_id) %> <% homepage = BlogComment.find(@user.blog.homepage_id) %>
<%= render :partial => 'blogs/homepage', :locals => {:activity => homepage, :user_activity_id => homepage.id} %> <%= render :partial => 'blogs/homepage', :locals => {:activity => homepage, :user_activity_id => homepage.id} %>
<% end %> <% end %>
<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities,:page => 0,:type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id)} %>
<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities,:page => 0,:type => @type} %>