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
commit 23ac219a94
12 changed files with 17 additions and 26 deletions

View File

@ -30,6 +30,11 @@ class Admins::PageThemesController < Admins::BaseController
end end
def destroy 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 if @page_theme.destroy
redirect_to admins_page_themes_path redirect_to admins_page_themes_path
flash[:success] = "删除主题成功" flash[:success] = "删除主题成功"

View File

@ -26,8 +26,6 @@
# cloud_url :string(255) default("") # cloud_url :string(255) default("")
# course_second_category_id :integer default("0") # course_second_category_id :integer default("0")
# delay_publish :boolean default("0") # delay_publish :boolean default("0")
# memo_image :boolean default("0")
# extra_type :integer default("0")
# #
# Indexes # Indexes
# #

View File

@ -17,7 +17,7 @@
# #
# Indexes # Indexes
# #
# index_identity_verifications_on_user_id (user_id) # index_identity_verifications_on_number (number)
# #
class IdentityVerification < ApplicationRecord class IdentityVerification < ApplicationRecord

View File

@ -7,7 +7,6 @@
# content :text(65535) # content :text(65535)
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
# is_secret :boolean default("0")
# #
class License < ApplicationRecord class License < ApplicationRecord

View File

@ -11,7 +11,6 @@
# course_group_id :integer default("0") # course_group_id :integer default("0")
# is_collect :integer default("1") # is_collect :integer default("1")
# graduation_group_id :integer default("0") # graduation_group_id :integer default("0")
# is_apply_signature :boolean default("0")
# team_user_id :integer # team_user_id :integer
# #
# Indexes # Indexes

View File

@ -5,7 +5,6 @@
# id :integer not null, primary key # id :integer not null, primary key
# user_id :integer # user_id :integer
# organization_id :integer # organization_id :integer
# is_creator :boolean default("0")
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
# #

View File

@ -62,7 +62,6 @@
# #
# Indexes # Indexes
# #
# index_projects_on_forked_count (forked_count)
# index_projects_on_forked_from_project_id (forked_from_project_id) # index_projects_on_forked_from_project_id (forked_from_project_id)
# index_projects_on_identifier (identifier) # index_projects_on_identifier (identifier)
# index_projects_on_invite_code (invite_code) # index_projects_on_invite_code (invite_code)
@ -72,7 +71,6 @@
# index_projects_on_license_id (license_id) # index_projects_on_license_id (license_id)
# index_projects_on_name (name) # index_projects_on_name (name)
# index_projects_on_platform (platform) # index_projects_on_platform (platform)
# index_projects_on_praises_count (praises_count)
# index_projects_on_project_category_id (project_category_id) # index_projects_on_project_category_id (project_category_id)
# index_projects_on_project_language_id (project_language_id) # index_projects_on_project_language_id (project_language_id)
# index_projects_on_project_type (project_type) # index_projects_on_project_type (project_type)
@ -80,7 +78,6 @@
# index_projects_on_rgt (rgt) # index_projects_on_rgt (rgt)
# index_projects_on_status (status) # index_projects_on_status (status)
# index_projects_on_updated_on (updated_on) # index_projects_on_updated_on (updated_on)
# index_projects_on_user_id (user_id)
# #
class Project < ApplicationRecord class Project < ApplicationRecord

View File

@ -15,7 +15,6 @@
# Indexes # Indexes
# #
# index_project_categories_on_ancestry (ancestry) # index_project_categories_on_ancestry (ancestry)
# index_project_categories_on_id (id)
# #
class ProjectCategory < ApplicationRecord class ProjectCategory < ApplicationRecord

View File

@ -9,10 +9,6 @@
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
# #
# Indexes
#
# index_project_languages_on_id (id)
#
class ProjectLanguage < ApplicationRecord class ProjectLanguage < ApplicationRecord
include Projectable include Projectable

View File

@ -27,7 +27,6 @@
# #
# Indexes # Indexes
# #
# index_name (project_id)
# index_repositories_on_identifier (identifier) # index_repositories_on_identifier (identifier)
# index_repositories_on_project_id (project_id) # index_repositories_on_project_id (project_id)
# index_repositories_on_user_id (user_id) # index_repositories_on_user_id (user_id)

View File

@ -22,9 +22,9 @@
# school_id :integer # school_id :integer
# description :string(255) # description :string(255)
# department_id :integer # department_id :integer
# province :text(65535) # province :string(255)
# custom_department :string(255)
# city :string(255) # city :string(255)
# custom_department :string(255)
# show_email :boolean default("0") # show_email :boolean default("0")
# show_location :boolean default("0") # show_location :boolean default("0")
# show_department :boolean default("0") # show_department :boolean default("0")

View File

@ -9,15 +9,15 @@
</div> </div>
<%= form_for @page_theme, url: {controller: "page_themes", action: "#{type}"}, html: { enctype: 'multipart/form-data' } do |p| %> <%= form_for @page_theme, url: {controller: "page_themes", action: "#{type}"}, html: { enctype: 'multipart/form-data' } do |p| %>
<div class="modal-body"> <div class="modal-body">
<div class="form-group"> <% if type == "create"%>
<label> <div class="form-group">
建站工具 <label>
</label> 建站工具
<% state_options = [['hugo', "hugo"], ['jeklly', "jeklly"],['hexo',"hexo"]] %> </label>
<%= select_tag('page_theme[language_frame]', options_for_select(state_options), class: 'form-control') %> <% state_options = [['hugo', "hugo"], ['jeklly', "jeklly"],['hexo',"hexo"]] %>
<%= select_tag('page_theme[language_frame]', options_for_select(state_options), class: 'form-control') %>
</div> </div>
<% end%>
<div class="form-group"> <div class="form-group">
<label> <label>
主题名 <span class="ml10 color-orange mr20">*</span> 主题名 <span class="ml10 color-orange mr20">*</span>