fixes #846
This commit is contained in:
@@ -27,4 +27,9 @@ div#c-wiki-pages {
|
|||||||
margin-left: 15em;
|
margin-left: 15em;
|
||||||
padding-left: 1em;
|
padding-left: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.redirected-from {
|
||||||
|
font-size: 0.8em;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,8 +67,12 @@ class WikiPagesController < ApplicationController
|
|||||||
|
|
||||||
def show_or_new
|
def show_or_new
|
||||||
@wiki_page = WikiPage.find_by_title(params[:title])
|
@wiki_page = WikiPage.find_by_title(params[:title])
|
||||||
if @wiki_page
|
tag_alias = TagAlias.where("status = 'active' and antecedent_name = ?", params[:title]).first
|
||||||
redirect_to wiki_page_path(@wiki_page)
|
|
||||||
|
if tag_alias && params[:no_redirect].blank?
|
||||||
|
redirect_to show_or_new_wiki_pages_path(:title => tag_alias.consequent_name, :redirected_from => params[:title])
|
||||||
|
elsif @wiki_page
|
||||||
|
redirect_to wiki_page_path(@wiki_page, :redirected_from => params[:redirected_from])
|
||||||
else
|
else
|
||||||
@wiki_page = WikiPage.new(:title => params[:title])
|
@wiki_page = WikiPage.new(:title => params[:title])
|
||||||
respond_with(@wiki_page)
|
respond_with(@wiki_page)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ module WikiPagesHelper
|
|||||||
|
|
||||||
if consequent_aliases.any?
|
if consequent_aliases.any?
|
||||||
html << "<p class='hint'>The following tags are aliased to this tag: "
|
html << "<p class='hint'>The following tags are aliased to this tag: "
|
||||||
html << raw(consequent_aliases.map {|x| link_to(x.antecedent_name, show_or_new_wiki_pages_path(:title => x.antecedent_name))}.join(", "))
|
html << raw(consequent_aliases.map {|x| link_to(x.antecedent_name, show_or_new_wiki_pages_path(:title => x.antecedent_name, :no_redirect => true))}.join(", "))
|
||||||
html << ".</p>"
|
html << ".</p>"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,10 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
|
<% if params[:redirected_from].present? %>
|
||||||
|
<div class="hint redirected-from">Redirected from <%= link_to params[:redirected_from], show_or_new_wiki_pages_path(:title => params[:redirected_from], :no_redirect => true) %>.</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<div id="wiki-page-body" class="prose">
|
<div id="wiki-page-body" class="prose">
|
||||||
<%= format_text(@wiki_page.body) %>
|
<%= format_text(@wiki_page.body) %>
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
|
|
||||||
<section id="content">
|
<section id="content">
|
||||||
<h1 id="wiki-page-title"><%= params[:title] %></h1>
|
<h1 id="wiki-page-title"><%= params[:title] %></h1>
|
||||||
|
|
||||||
|
<% if params[:redirected_from].present? %>
|
||||||
|
<div class="hint redirected-from">Redirected from <%= link_to params[:redirected_from], show_or_new_wiki_pages_path(:title => params[:redirected_from], :no_redirect => true) %>.</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<div id="wiki-page-body" class="prose">
|
<div id="wiki-page-body" class="prose">
|
||||||
<p>This wiki page does not exist. <%= link_to "Create new wiki page", new_wiki_page_path(:wiki_page => {:title => params[:title]}) %>.</p>
|
<p>This wiki page does not exist. <%= link_to "Create new wiki page", new_wiki_page_path(:wiki_page => {:title => params[:title]}) %>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user