Created
February 18, 2015 22:51
-
-
Save SputterPuttRedux/a336a0badb144ba5a896 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="search-results"> | |
<% if (@searched_stories + @searched_snippets).empty? %> | |
<br> | |
<h3> We couldn't find any content Containing "<%= params[:search] %>"</h3> | |
<% elsif !@searched_stories.empty? %> | |
<h3> Stories with "<%= params[:search] %> in the title: " </h3> | |
<% @searched_stories.each do |story| %> | |
<% display_string = story.title %> | |
<% x = params[:search].upcase %> | |
<% if display_string.include?(params[:search]) %> | |
<% display_string.sub!(params[:search], x ) %> | |
<br> | |
<li><%= link_to display_string, story_path(story) %></li> | |
<% end %> | |
<% end %> | |
<% end %> | |
<% if @searched_snippets.empty? %> | |
<br> | |
<h3>We couldn't find any Snippets containing "<%= params[:search] %>".</h3> | |
<% else %> | |
<h3> Snippets that contain"<%= params[:search] %>":</h3> | |
<% @searched_snippets.each do |snip| %> | |
<li><%= link_to snip.content, snippet_path(snip) %></li> | |
<% end %> | |
<% end %> | |
</div> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment