diff --git a/app/controllers/about_controller.rb b/app/controllers/about_controller.rb index 10fb4ffb6..fb9eb9f56 100644 --- a/app/controllers/about_controller.rb +++ b/app/controllers/about_controller.rb @@ -7,6 +7,7 @@ class AboutController < ApplicationController before_action :set_body_classes, only: :show before_action :set_instance_presenter before_action :set_expires_in, only: [:show, :more, :terms] + before_action :authenticate_user!, only: :jump skip_before_action :require_functional!, only: [:more, :terms] @@ -24,6 +25,10 @@ class AboutController < ApplicationController def terms; end + def jump + @jump_url = "https://#{params[:destin]}/#{params[:path]}" + end + helper_method :display_blocks? helper_method :display_blocks_rationale? helper_method :public_fetch_mode? diff --git a/app/controllers/jump_controller.rb b/app/controllers/jump_controller.rb deleted file mode 100644 index 37061c98e..000000000 --- a/app/controllers/jump_controller.rb +++ /dev/null @@ -1,8 +0,0 @@ - -class JumpController < ApplicationController - before_action :authenticate_user! - - def index - redirect_to("//#{params[:destin]}/#{params[:path]}") - end -end diff --git a/app/views/about/jump.html.haml b/app/views/about/jump.html.haml new file mode 100644 index 000000000..f26e410ba --- /dev/null +++ b/app/views/about/jump.html.haml @@ -0,0 +1,11 @@ +- content_for :page_title do + = @jump_url + +.grid + .column-0 + .box-widget + .rich-formatting + %h2= '将前往:' + %h4= link_to @jump_url, @jump_url + .column-1 + = render 'application/sidebar' diff --git a/config/routes.rb b/config/routes.rb index 4264947dc..e71ffa1a0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -451,7 +451,7 @@ Rails.application.routes.draw do get '/about/more', to: 'about#more' get '/terms', to: 'about#terms' - get '/jump/:destin/(*path)', to: 'jump#index', :constraints => { :destin => /[0-z\.]+/ } + get '/jump/:destin/(*path)', to: 'about#jump', :constraints => { :destin => /[0-z\.]+/ } match '/', via: [:post, :put, :patch, :delete], to: 'application#raise_not_found', format: false match '*unmatched_route', via: :all, to: 'application#raise_not_found', format: false