forked from juno/redmine_markdown_extra_formatter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added meta redirect to external link
- Loading branch information
Junya Ogura
committed
Jun 19, 2009
1 parent
0f885d0
commit 130cbf2
Showing
6 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# -*- coding: utf-8 -*- | ||
class RedirectController < ApplicationController | ||
unloadable | ||
|
||
def index | ||
@target = params[:url].join('/') | ||
@target = @target + '/' if /(\/$)/ =~ request.path | ||
|
||
if @target =~ /^https?:\/\/.+/i | ||
@meta = true | ||
end | ||
|
||
render :file=>"#{RAILS_ROOT}/public/404.html", :status => '404 Not Found' and return if @target.length == 0 | ||
render :layout => false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module RedirectHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<html> | ||
<head> | ||
<title>redirecting...</title> | ||
<% if @meta -%> | ||
<meta http-equiv="refresh" content="0;url=<%=h @target %>"/> | ||
<% end -%> | ||
</head> | ||
<body> | ||
<p>Redirecting to <a href="<%= @target %>"><%= @target %></a></p> | ||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
map.connect 'redirect/*url', :controller => 'redirect', :action => 'index' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require File.dirname(__FILE__) + '/../test_helper' | ||
|
||
class RedirectControllerTest < ActionController::TestCase | ||
# Replace this with your real tests. | ||
def test_truth | ||
assert true | ||
end | ||
end |