Commit 279a1e7da01518f664dce371997d86ecda371481
1 parent
c9061f80
Exists in
master
and in
29 other branches
ActionItem313: repeating query string in the search results page and
displaying link to make the same search in a broader scope git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1692 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
3 changed files
with
32 additions
and
1 deletions
Show diff stats
app/views/search/_display_results.rhtml
1 | +<div id='new-search'> | |
2 | +<% form_tag(:action => 'index') do %> | |
3 | + <%= text_field_tag 'query', @query %> | |
4 | + <%= submit_button :search, _('Search') %> | |
5 | +<% end %> | |
6 | + | |
7 | +<%= link_to _('Search for "%s" in the whole site') % @query, :controller => 'search', :action => 'index', :category_path => [], :query => @query if @category %> | |
8 | +</div> | |
9 | + | |
10 | + | |
1 | 11 | <div id="search-results" class="<%= 'only-one-result-box' if @results.size == 1 %>"> |
2 | 12 | <% pos = :odd %> |
3 | 13 | <% @results.each do |name,results| %> | ... | ... |
app/views/search/category_index.rhtml
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | <%= @category.ancestors.reverse.map { |a| link_to_category(a, false) }.join(' → ') %> |
5 | 5 | </div><!-- end id="category-ancestors" --> |
6 | 6 | |
7 | - <h1 id="categiry-name"><%= _('Category: %s') % @category.name %></h1> | |
7 | + <h1 id="category-name"><%= _('Category: %s') % @category.name %></h1> | |
8 | 8 | |
9 | 9 | <div class="category_itens"> |
10 | 10 | <%= render :partial => @category.class.name.underscore %> | ... | ... |
test/functional/search_controller_test.rb
... | ... | @@ -472,5 +472,26 @@ class SearchControllerTest < Test::Unit::TestCase |
472 | 472 | get :index |
473 | 473 | assert_no_tag :tag => 'div', :attributes => { :id => 'boxes', :class => 'boxes' } |
474 | 474 | end |
475 | + | |
476 | + should 'offer text box to enter a new search in general context' do | |
477 | + get :index, :query => 'a sample search' | |
478 | + assert_tag :tag => 'form', :attributes => { :action => '/search' }, :descendant => { | |
479 | + :tag => 'input', | |
480 | + :attributes => { :name => 'query', :value => 'a sample search' } | |
481 | + } | |
482 | + end | |
483 | + | |
484 | + should 'offer text box to enter a new seach in specific context' do | |
485 | + get :index, :category_path => [ 'my-category'], :query => 'a sample search' | |
486 | + assert_tag :tag => 'form', :attributes => { :action => '/search/index/my-category' }, :descendant => { | |
487 | + :tag => 'input', | |
488 | + :attributes => { :name => 'query', :value => 'a sample search' } | |
489 | + } | |
490 | + end | |
491 | + | |
492 | + should 'offer link to do the same search as before in general context' do | |
493 | + get :index, :category_path => [ 'my-category' ], :query => 'a sample search' | |
494 | + assert_tag :tag => 'a', :attributes => { :href => "/search?query=a+sample+search" }, :content => 'Search for "a sample search" in the whole site' | |
495 | + end | |
475 | 496 | |
476 | 497 | end | ... | ... |