mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-06-19 02:05:37 +08:00
The configuration used to be saved as a pipe-separated value in site settings, with only the enabled ones. This meant there would be no order kept if something is disabled as they were simply omitted from the site setting. This commit moves us to a DB table to save the settings so order can be kept. Also, the change is committed immediately now instead of on closure of the modal. It is also smart about not refreshing when toggling "off" or rearranging.
23 lines
662 B
Ruby
Vendored
23 lines
662 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
class AdminDashboardSection < ActiveRecord::Base
|
|
validates :section_id, presence: true, uniqueness: true
|
|
validates :position, presence: true
|
|
validates :visible, inclusion: { in: [true, false] }
|
|
end
|
|
|
|
# == Schema Information
|
|
#
|
|
# Table name: admin_dashboard_sections
|
|
#
|
|
# id :bigint not null, primary key
|
|
# position :integer not null
|
|
# visible :boolean default(TRUE), not null
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
# section_id :string not null
|
|
#
|
|
# Indexes
|
|
#
|
|
# index_admin_dashboard_sections_on_section_id (section_id) UNIQUE
|
|
#
|