Skip to content

Commit

Permalink
Added tags search to type-specific searches sidebar links (#8532)
Browse files Browse the repository at this point in the history
* Added Home tooltip to Public Lab link in navbar

* replaced .length and .count with .size

* Added tags search to type-specific searches sidebar links

* style typo fixed

* Inserted a partial template to display topic cards on tags search results page
  • Loading branch information
dldisha authored Oct 11, 2020
1 parent 5cd9728 commit 3311916
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
3 changes: 2 additions & 1 deletion app/helpers/search_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def create_nav_links_for_by_type(active_page, query)
{ section: "search-all", text: "All content types", path: "/search/content/#{query}" },
{ section: "search-questions", text: "Questions", path: "/search/questions/#{query}" },
{ section: "search-notes", text: "Notes", path: "/search/notes/#{query}" },
{ section: "search-wikis", text: "Wikis", path: "/search/wikis/#{query}" }
{ section: "search-wikis", text: "Wikis", path: "/search/wikis/#{query}" },
{ section: "search-tags", text: "Tags", path: "/search/tags/#{query}" }
]

result = ""
Expand Down
50 changes: 25 additions & 25 deletions app/views/search/tags.html.erb
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<%= render :partial => "search/nav" , :locals => { :section => "search-tags" }%>
<div class="col-md-2">
<%= render partial: "search/nav" , locals: { section: "search-tags" } %>
</div>

<div class="container">
<% if @tags.present? %>
<div class="container">
<h2> Results for <%= @search_criteria.query %></h2>
<p> <strong> Searched notes that contain the tag</strong></p>
<hr>
<div class="col-md-10">
<div class="container">
<% if @tags.present? %>
<div class="container">
<h2> Results for <%= @search_criteria.query %></h2>
<p> <strong> Searched notes that contain the tag</strong></p>
<hr>

<div class="row">
<% @tags.each do |tag| %>
<p><a href=<%= "#{tag}" %>><%= tag %></a></p>
<div class="row">
<%= render partial: "tag/topicCard" %>
</div>
</div>
<div class="text-center">
<% if @pagy %>
<%= raw pagy_bootstrap_nav @pagy %>
<% else %>
<%= will_paginate @tags, renderer: WillPaginate::ActionView::BootstrapLinkRenderer unless @unpaginated %></div>
<% end %>
</div>
</div>
<% else %>
<h4>
No results found for <%= params[:query] %> :-(
<p> Searched notes that contain the tag</p>
</br>
Try searching <a href="/search">for another topic</a> or looking for our items tagged with <a href="/tag/<%= params[:query] %>"><%= params[:query] %></a>
</h4>
<% end %>
<% else %>
<p>No results found for "<b><%= params[:query] %></b>" :-(</p>
<p>Try searching for another topic or looking for our items tagged with <a href="/tag/<%= params[:query] %>"><%= params[:query] %></a>
<% end %>
</div>
</div>
<div class="text-center">
<% if @pagy %>
<%= raw pagy_bootstrap_nav @pagy %>
<% else %>
<%= will_paginate @tags, renderer: WillPaginate::ActionView::BootstrapLinkRenderer unless @unpaginated %></div>
<% end %>

0 comments on commit 3311916

Please sign in to comment.