Preventing site default design being deleted.

This commit is contained in:
Fu Matthew 2012-12-27 10:20:37 +08:00
parent 71fc85c24e
commit cfb65dd056
1 changed files with 6 additions and 1 deletions

View File

@ -94,7 +94,12 @@ class Admin::DesignsController < OrbitBackendController
def destroy def destroy
@design = Design.find(params[:id]) @design = Design.find(params[:id])
if @site.design == @design
flash[:error] = "Failed! You can not delete a design that used by default "
else
@design.destroy @design.destroy
flash[:notice] = "Successfully deleted design."
end
redirect_to admin_designs_url redirect_to admin_designs_url
end end