Set admin layout for admin sandbox templates
This commit is contained in:
@@ -1,6 +1,10 @@
|
|||||||
class SandboxController < ApplicationController
|
class SandboxController < ApplicationController
|
||||||
skip_authorization_check
|
skip_authorization_check
|
||||||
|
|
||||||
|
layout :set_layout
|
||||||
|
|
||||||
|
helper_method(:namespace)
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@templates = Dir.glob(Rails.root.join('app/views/sandbox/*.html.erb').to_s).map do |filename|
|
@templates = Dir.glob(Rails.root.join('app/views/sandbox/*.html.erb').to_s).map do |filename|
|
||||||
filename = File.basename(filename, File.extname(filename))
|
filename = File.basename(filename, File.extname(filename))
|
||||||
@@ -24,4 +28,18 @@ class SandboxController < ApplicationController
|
|||||||
render :action => "index"
|
render :action => "index"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_layout
|
||||||
|
if params[:template] && params[:template].split("_").first == "admin"
|
||||||
|
"admin"
|
||||||
|
else
|
||||||
|
"application"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def namespace
|
||||||
|
"admin"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user