项目删除跳转修改;项目删除提示修改

This commit is contained in:
huang 2015-10-09 16:12:02 +08:00
parent 2187595b6c
commit 2518305959
2 changed files with 13 additions and 9 deletions

View File

@ -659,14 +659,10 @@ class ProjectsController < ApplicationController
# Delete @project
def destroy
@project_to_destroy = @project
if api_request? || params[:confirm]
@project_to_destroy.destroy
respond_to do |format|
format.html { redirect_to admin_projects_url }
format.api { render_api_ok }
end
else
render :layout => "base_projects"
@project_to_destroy.destroy
respond_to do |format|
format.html { redirect_to admin_projects_url }
format.api { render_api_ok }
end
# hide project in layout
@project = nil

View File

@ -65,7 +65,7 @@
<%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %>
<%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %>
<%= link_to(l(:button_copy), { :controller => 'projects', :action => 'copy', :id => project }, :class => 'icon icon-copy') %>
<%= link_to(l(:button_delete), project_path(project), :method => :delete, :class => 'icon icon-del') %>
<%= link_to(l(:button_delete), project_path(project), :method => :delete, :class => 'icon icon-del', :onClick=>"delcfm()" ) %>
</td>
</tr>
<% end %>
@ -74,3 +74,11 @@
</div>
<% html_title(l(:label_project_plural)) -%>
<script>
function delcfm() {
if (!confirm("删除项目会一并删除项目的关联信息,确认要删除吗?")) {
window.event.returnValue = false;
}
}
</script>