Merge pull request '为建站主题配置增加删除限制' (#126) from KingChan/forgeplus:chenjing into standalone_develop

This commit is contained in:
KingChan
2023-08-25 11:48:33 +08:00
12 changed files with 17 additions and 26 deletions

View File

@@ -30,6 +30,11 @@ class Admins::PageThemesController < Admins::BaseController
end
def destroy
if PageTheme.where(language_frame: @page_theme.language_frame).count <= 1
flash[:danger] = "删除主题失败,必须存在一个主题"
return redirect_to admins_page_themes_path
end
if @page_theme.destroy
redirect_to admins_page_themes_path
flash[:success] = "删除主题成功"