mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:11:08 +08:00
FEATURE: Export customizations as JSON files
This commit is contained in:
@ -2,6 +2,8 @@ class Admin::SiteCustomizationsController < Admin::AdminController
|
||||
|
||||
before_filter :enable_customization
|
||||
|
||||
skip_before_filter :check_xhr, only: [:show]
|
||||
|
||||
def index
|
||||
@site_customizations = SiteCustomization.order(:name)
|
||||
|
||||
@ -48,6 +50,26 @@ class Admin::SiteCustomizationsController < Admin::AdminController
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@site_customization = SiteCustomization.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.json do
|
||||
check_xhr
|
||||
render json: SiteCustomizationSerializer.new(@site_customization)
|
||||
end
|
||||
|
||||
format.any(:html, :text) do
|
||||
raise RenderEmpty.new if request.xhr?
|
||||
|
||||
response.headers['Content-Disposition'] = "attachment; filename=#{@site_customization.name.parameterize}.dcstyle.json"
|
||||
response.sending_file = true
|
||||
render json: SiteCustomizationSerializer.new(@site_customization)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def site_customization_params
|
||||
|
Reference in New Issue
Block a user