From 889af32abf4dc6ed9b93a3da96291f9e7ce419a9 Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Wed, 9 Jan 2013 19:56:32 +0000 Subject: [PATCH] [pluginize-solr] Display search query only if there is a search engine --- app/views/layouts/application-ng.rhtml | 12 +++++++----- test/functional/home_controller_test.rb | 10 ++++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/views/layouts/application-ng.rhtml b/app/views/layouts/application-ng.rhtml index 480e3f9..cc96b58 100644 --- a/app/views/layouts/application-ng.rhtml +++ b/app/views/layouts/application-ng.rhtml @@ -69,11 +69,13 @@ <% end %> -
- -
<%=_('Press Enter to send the search query.')%>
- <%= javascript_tag 'jQuery("#user form input").hint();' %> -
+ <% if @plugins.first(:search_engine?) %> +
+ +
<%=_('Press Enter to send the search query.')%>
+ <%= javascript_tag 'jQuery("#user form input").hint();' %> +
+ <% end %>

diff --git a/test/functional/home_controller_test.rb b/test/functional/home_controller_test.rb index 99233ef..09609d8 100644 --- a/test/functional/home_controller_test.rb +++ b/test/functional/home_controller_test.rb @@ -136,4 +136,14 @@ class HomeControllerTest < ActionController::TestCase assert_no_tag :tag => 'a', :attributes => {:href => '/account/signup'} end + should "not display search field if there is no search engine on" do + Noosfero::Plugin::Manager.any_instance.stubs(:first).with(:search_engine?).returns(false) + get :index + assert_no_tag :tag => 'input', :attributes => {:name => 'query'} + + Noosfero::Plugin::Manager.any_instance.stubs(:first).with(:search_engine?).returns(true) + get :index + assert_tag :tag => 'input', :attributes => {:name => 'query'} + end + end -- libgit2 0.21.2