Add a "Create New Page" Link to the Search Page

Based on an idea by nowa:

   bcac6c9f94
master
Jacques Distler 2009-08-12 12:19:23 -05:00
parent 664552ac02
commit 8cf26c9249
2 changed files with 8 additions and 1 deletions

View File

@ -35,4 +35,7 @@
expression. That's actually what Instiki uses, so go right ahead and flex your
"[a-z]*Leet?RegExpSkill(s|z)"
</p>
<p>
<b>Create a new page, named:</b> "<span class='newWikiWord'><%= link_to h(params[:query]), :web => @web.address, :action => 'new', :id => params[:query] %></span>"
</p>
<%- end -%>

View File

@ -782,11 +782,15 @@ class WikiControllerTest < ActionController::TestCase
end
def test_search_zero_results
r = process 'search', 'web' => 'wiki1', 'query' => 'non-existant text'
r = process 'search', 'web' => 'wiki1', 'query' => 'non-existant < text'
assert_response(:success)
assert_equal [], r.template_objects['results']
assert_equal [], r.template_objects['title_results']
create_pattern = Regexp.new(Regexp.escape(%{<b>Create a new page, named:</b> \"}+
%{<span class='newWikiWord'><a href=\"/wiki1/new/non-existant+%3C+t}+
%{ext\">non-existant &lt; text</a></span>}))
assert_match create_pattern, r.body
end
def test_search_null_in_query