From 8cf26c924983a2c5613e81d095850a2a00ac2e2f Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Wed, 12 Aug 2009 12:19:23 -0500 Subject: [PATCH] Add a "Create New Page" Link to the Search Page Based on an idea by nowa: http://github.com/nowa/instiki/commit/bcac6c9f943fdf6864ad954faf14654370c06128 --- app/views/wiki/search.rhtml | 3 +++ test/functional/wiki_controller_test.rb | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/views/wiki/search.rhtml b/app/views/wiki/search.rhtml index ecac3431..f962f2d9 100644 --- a/app/views/wiki/search.rhtml +++ b/app/views/wiki/search.rhtml @@ -35,4 +35,7 @@ expression. That's actually what Instiki uses, so go right ahead and flex your "[a-z]*Leet?RegExpSkill(s|z)"

+

+ Create a new page, named: "<%= link_to h(params[:query]), :web => @web.address, :action => 'new', :id => params[:query] %>" +

<%- end -%> diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index dc0a64a1..b546c43b 100755 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -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(%{Create a new page, named: \"}+ + %{non-existant < text})) + assert_match create_pattern, r.body end def test_search_null_in_query