DEV: Move admin config pages out of /customize/ sub-route (#30511)

The customize routes add CSS classes that make these admin
config pages look different from the ones under /admin/config.
We want all config routes to be under /admin/config as well.

This commit moves the emoji, user fields, and permalinks pages
out of customize and into config, updating all references and
adding more rails routes as needed.

Also renames admin emojis route to emoji, emoji is singular and plural.
This commit is contained in:
Martin Brennan
2025-01-02 09:13:11 +10:00
committed by GitHub
parent 2ff3f44b95
commit 5711bf6f27
22 changed files with 112 additions and 101 deletions

View File

@ -220,7 +220,7 @@ Discourse::Application.routes.draw do
get "customize/theme-components" => "themes#index", :constraints => AdminConstraint.new
get "customize/colors" => "color_schemes#index", :constraints => AdminConstraint.new
get "customize/colors/:id" => "color_schemes#index", :constraints => AdminConstraint.new
get "customize/permalinks" => "permalinks#index", :constraints => AdminConstraint.new
get "config/permalinks" => "permalinks#index", :constraints => AdminConstraint.new
get "customize/embedding" => "embedding#show", :constraints => AdminConstraint.new
put "customize/embedding" => "embedding#update", :constraints => AdminConstraint.new
@ -243,15 +243,6 @@ Discourse::Application.routes.draw do
end
scope "/customize", constraints: AdminConstraint.new do
resources :user_fields,
only: %i[index create update destroy],
constraints: AdminConstraint.new
get "user_fields/new" => "user_fields#index"
get "user_fields/:id" => "user_fields#show"
get "user_fields/:id/edit" => "user_fields#edit"
resources :emojis, only: %i[index create destroy], constraints: AdminConstraint.new
get "emojis/new" => "emojis#index"
get "emojis/settings" => "emojis#index"
resources :form_templates, constraints: AdminConstraint.new, path: "/form-templates" do
collection { get "preview" => "form_templates#preview" }
end
@ -304,8 +295,6 @@ Discourse::Application.routes.draw do
resource :email_style, only: %i[show update]
get "email_style/:field" => "email_styles#show", :constraints => { field: /html|css/ }
resources :permalinks, only: %i[index new create show destroy]
end
resources :embeddable_hosts, only: %i[create update destroy], constraints: AdminConstraint.new
@ -421,6 +410,26 @@ Discourse::Application.routes.draw do
end
end
scope "/config" do
resources :user_fields,
path: "user_fields",
only: %i[index create update destroy],
constraints: AdminConstraint.new
get "user-fields/new" => "user_fields#index"
get "user-fields/:id" => "user_fields#show"
get "user-fields/:id/edit" => "user_fields#edit"
get "user-fields" => "user_fields#index"
get "user_fields/new" => "user_fields#index"
get "user_fields/:id" => "user_fields#show"
get "user_fields/:id/edit" => "user_fields#edit"
resources :emoji, only: %i[index create destroy], constraints: AdminConstraint.new
get "emoji/new" => "emoji#index"
get "emoji/settings" => "emoji#index"
resources :permalinks, only: %i[index new create show destroy]
end
get "section/:section_id" => "section#show", :constraints => AdminConstraint.new
resources :admin_notices, only: %i[destroy], constraints: AdminConstraint.new
end # admin namespace