Implement the basic search result page for projects

This commit is contained in:
Tobias Eidelpes 2020-05-27 17:47:41 +02:00
parent 9c76ce0553
commit f2ad597c94
2 changed files with 66 additions and 0 deletions

View File

@ -1,3 +1,49 @@
// Place all the styles related to the ProjectsCrawler controller here. // Place all the styles related to the ProjectsCrawler controller here.
// They will automatically be included in application.css. // They will automatically be included in application.css.
// You can use Sass (SCSS) here: https://sass-lang.com/ // You can use Sass (SCSS) here: https://sass-lang.com/
.projects-list {
list-style: none;
padding: 0;
margin: 0;
a {
text-decoration: none;
color: black;
}
.project {
line-height: 72px;
width: 100%;
padding: 8px 0 8px 0;
.list-link {
float: left;
width: 89%;
height: 72px;
}
.project-title {
width: 100%;
display: inline-block;
text-align: left;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.add-to-fav {
display: inline-block;
vertical-align: middle;
float: right;
width: 36px;
height: 36px;
svg {
width: 100%;
height: auto;
vertical-align: middle;
}
}
}
}

View File

@ -0,0 +1,20 @@
<h1>Results for "<%= params[:search_term] %>"</h1>
<ul class="projects-list">
<% @projects.each_with_index do |project| %>
<li class="project">
<%= link_to crawlers_projects_crawler_show_detail_url(:id => project['id'], :title => project['title']) do %>
<span class="list-link">
<span class="project-title">
<%= project['title'] %>
</span>
</span>
<% end %>
<span class="add-to-fav">
<%= link_to crawlers_projects_crawler_add_to_fav_url(:id => project['id'], :title => project['title']) do %>
<%= show_svg('favorite-24px.svg') %>
<% end %>
</span>
</li>
<% end %>
</ul>