From b0b39d9f8a93c80425598746c691aac2e24a86ae Mon Sep 17 00:00:00 2001 From: Amaia Castro Date: Thu, 6 Apr 2017 16:05:09 +0200 Subject: [PATCH] Remove sandbox Revert "Implement Sandbox" This reverts commit e806a39820c2920d18b80dc560d05db36ecb6ede. --- app/controllers/sandbox_controller.rb | 45 --------------------------- app/views/sandbox/index.html.erb | 13 -------- config/routes.rb | 5 --- 3 files changed, 63 deletions(-) delete mode 100644 app/controllers/sandbox_controller.rb delete mode 100644 app/views/sandbox/index.html.erb diff --git a/app/controllers/sandbox_controller.rb b/app/controllers/sandbox_controller.rb deleted file mode 100644 index 12b5dd91e..000000000 --- a/app/controllers/sandbox_controller.rb +++ /dev/null @@ -1,45 +0,0 @@ -class SandboxController < ApplicationController - skip_authorization_check - - layout :set_layout - - helper_method(:namespace) - - def index - @templates = Dir.glob(Rails.root.join('app/views/sandbox/*.html.erb').to_s).map do |filename| - filename = File.basename(filename, File.extname(filename)) - filename unless filename.starts_with?('_') || filename == 'index.html' - end.compact - end - - def show - if params[:template].index('.') # CVE-2014-0130 - render :action => "index" - elsif lookup_context.exists?("sandbox/#{params[:template]}") - if params[:template] == "index" - render :action => "index" - else - render "sandbox/#{params[:template]}" - end - - elsif lookup_context.exists?("sandbox/#{params[:template]}/index") - render "sandbox/#{params[:template]}/index" - else - render :action => "index" - end - end - - private - - def set_layout - if params[:template] && params[:template].split("_").first == "admin" - "admin" - else - "application" - end - end - - def namespace - "admin" - end -end diff --git a/app/views/sandbox/index.html.erb b/app/views/sandbox/index.html.erb deleted file mode 100644 index 9d6303698..000000000 --- a/app/views/sandbox/index.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -
-
-
-

Welcome to sandbox

- -
    - <% @templates.each do |template| %> -
  • <%= link_to template, "/sandbox/" + template %>
  • - <% end %> -
-
-
-
diff --git a/config/routes.rb b/config/routes.rb index 2088c48da..63b04458b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,10 +1,5 @@ Rails.application.routes.draw do - if Rails.env.development? || Rails.env.staging? - get '/sandbox' => 'sandbox#index' - get '/sandbox/*template' => 'sandbox#show' - end - devise_for :users, controllers: { registrations: 'users/registrations', sessions: 'users/sessions',