Browse Source

修改jump跳转

pull/4/head
欧醚 4 years ago
parent
commit
bc3df81610
4 changed files with 17 additions and 9 deletions
  1. +5
    -0
      app/controllers/about_controller.rb
  2. +0
    -8
      app/controllers/jump_controller.rb
  3. +11
    -0
      app/views/about/jump.html.haml
  4. +1
    -1
      config/routes.rb

+ 5
- 0
app/controllers/about_controller.rb View File

@ -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?

+ 0
- 8
app/controllers/jump_controller.rb View File

@ -1,8 +0,0 @@
class JumpController < ApplicationController
before_action :authenticate_user!
def index
redirect_to("//#{params[:destin]}/#{params[:path]}")
end
end

+ 11
- 0
app/views/about/jump.html.haml View File

@ -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'

+ 1
- 1
config/routes.rb View File

@ -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

Loading…
Cancel
Save