Commit 889af32abf4dc6ed9b93a3da96291f9e7ce419a9
1 parent
b4d274ac
Exists in
master
and in
29 other branches
[pluginize-solr] Display search query only if there is a search engine
PS: Must make index work.
Showing
2 changed files
with
17 additions
and
5 deletions
Show diff stats
app/views/layouts/application-ng.rhtml
@@ -69,11 +69,13 @@ | @@ -69,11 +69,13 @@ | ||
69 | <% end %> | 69 | <% end %> |
70 | 70 | ||
71 | </span> | 71 | </span> |
72 | - <form action="/search" class="search_form" method="get" class="clean"> | ||
73 | - <input name="query" size="15" title="<%=_('Search...')%>" onfocus="this.form.className='focused';" onblur="this.form.className=''" /> | ||
74 | - <div><%=_('Press <strong>Enter</strong> to send the search query.')%></div> | ||
75 | - <%= javascript_tag 'jQuery("#user form input").hint();' %> | ||
76 | - </form> | 72 | + <% if @plugins.first(:search_engine?) %> |
73 | + <form action="/search" class="search_form" method="get" class="clean"> | ||
74 | + <input name="query" size="15" title="<%=_('Search...')%>" onfocus="this.form.className='focused';" onblur="this.form.className=''" /> | ||
75 | + <div><%=_('Press <strong>Enter</strong> to send the search query.')%></div> | ||
76 | + <%= javascript_tag 'jQuery("#user form input").hint();' %> | ||
77 | + </form> | ||
78 | + <% end %> | ||
77 | </div><!-- end id="user" --> | 79 | </div><!-- end id="user" --> |
78 | 80 | ||
79 | <h1 id="site-title"> | 81 | <h1 id="site-title"> |
test/functional/home_controller_test.rb
@@ -136,4 +136,14 @@ class HomeControllerTest < ActionController::TestCase | @@ -136,4 +136,14 @@ class HomeControllerTest < ActionController::TestCase | ||
136 | assert_no_tag :tag => 'a', :attributes => {:href => '/account/signup'} | 136 | assert_no_tag :tag => 'a', :attributes => {:href => '/account/signup'} |
137 | end | 137 | end |
138 | 138 | ||
139 | + should "not display search field if there is no search engine on" do | ||
140 | + Noosfero::Plugin::Manager.any_instance.stubs(:first).with(:search_engine?).returns(false) | ||
141 | + get :index | ||
142 | + assert_no_tag :tag => 'input', :attributes => {:name => 'query'} | ||
143 | + | ||
144 | + Noosfero::Plugin::Manager.any_instance.stubs(:first).with(:search_engine?).returns(true) | ||
145 | + get :index | ||
146 | + assert_tag :tag => 'input', :attributes => {:name => 'query'} | ||
147 | + end | ||
148 | + | ||
139 | end | 149 | end |