added sorting arrow for favorites view

This commit is contained in:
Pfingstfrosch 2020-05-31 16:45:22 +02:00
parent cfcbf5acdb
commit ad85619ccc
7 changed files with 27 additions and 33 deletions

View File

@ -44,6 +44,7 @@
width: 100%;
}
tr:nth-child(odd) {
th, td {
//padding: 8px;

View File

@ -3,4 +3,15 @@ module FavoritesHelper
direction = column == sort_column && sort_direction == 'asc' ? 'desc' : 'asc'
link_to title, :sort => column, :direction => direction
end
def sorting_arrow(column)
if sort_column == column
direction = column == sort_column && sort_direction == 'asc' ? 'desc' : 'asc'
if direction == 'asc'
image_tag 'up.png'
else
image_tag 'down.png'
end
end
end
end

View File

@ -0,0 +1,4 @@
<th>
<%= sortable display, column %>
<%= sorting_arrow column %>
</th>

View File

@ -6,8 +6,8 @@
<div class="table_wrapper">
<table>
<tr>
<th><%= sortable "Title", "title" %></th>
<th><%= sortable "Registration Date", "created_at" %></th>
<%= render :partial => "favorites/th", :locals => {:display => "Title", :column => "title"} %>
<%= render :partial => "favorites/th", :locals => {:display => "Registration Date", :column => "created_at"} %>
</tr>
<% for course in @favorite_courses %>
<tr>

View File

@ -2,36 +2,14 @@
<h2>Favorite People</h2>
<!--<ul class="people-list">-->
<%# @favorite_people.each do |person| %>
<!-- <li class="person">-->
<%#= link_to crawlers_people_crawler_show_detail_url(:tiss_id => person['tiss_id']) do %>
<!-- <span class="list-link">-->
<!-- <span class="person-icon">-->
<%# if person['picture_uri'] != nil %>
<%#= image_tag @host + person['picture_uri'] %>
<%# else %>
<%#= show_svg('account_circle-black-48dp.svg') %>
<%# end %>
<!-- </span>-->
<!-- <span class="person-name">-->
<%#= person['first_name'] %>
<%#= person['last_name'] %>
<!-- </span>-->
<!-- </span>-->
<%# end %>
<!-- </li>-->
<%# end %>
<!--</ul>-->
<% if !@favorite_people[0].blank? %>
<div class="table_wrapper">
<table>
<tr>
<th></th>
<th><%= sortable "First Name", "first_name" %></th>
<th><%= sortable "Last Name", "last_name" %></th>
<th><%= sortable "Registration Date", "created_at" %></th>
<%= render :partial => "favorites/th", :locals => {:display => "First Name", :column => "first_name"} %>
<%= render :partial => "favorites/th", :locals => {:display => "Last Name", :column => "last_name"} %>
<%= render :partial => "favorites/th", :locals => {:display => "Registration Date", :column => "created_at"} %>
</tr>
<% for person in @favorite_people %>
<tr>
@ -39,9 +17,9 @@
<%= link_to crawlers_people_crawler_show_detail_url(:tiss_id => person['tiss_id']) do %>
<span>
<% if person['picture_uri'] != nil %>
<%= image_tag @host + person['picture_uri'], class: 'thumb'%>
<%= image_tag @host + person['picture_uri'], class: 'thumb' %>
<% else %>
<%= show_svg('account_circle-black-48dp.svg')%>
<%= show_svg('account_circle-black-48dp.svg') %>
<% end %>
</span>
<% end %>

View File

@ -6,8 +6,8 @@
<div class="table_wrapper">
<table>
<tr>
<th><%= sortable "Title", "title" %></th>
<th><%= sortable "Registration Date", "created_at" %></th>
<%= render :partial => "favorites/th", :locals => {:display => "Title", :column => "title"} %>
<%= render :partial => "favorites/th", :locals => {:display => "Registration Date", :column => "created_at"} %>
</tr>
<% for project in @favorite_projects %>
<tr>

View File

@ -6,8 +6,8 @@
<div class="table_wrapper">
<table>
<tr>
<th><%= sortable "Title", "title" %></th>
<th><%= sortable "Registration Date", "created_at" %></th>
<%= render :partial => "favorites/th", :locals => {:display => "Title", :column => "title"} %>
<%= render :partial => "favorites/th", :locals => {:display => "Registration Date", :column => "created_at"} %>
</tr>
<% for thesis in @favorite_theses %>
<tr>