final styling of table sorting

This commit is contained in:
Pfingstfrosch 2020-05-31 17:02:34 +02:00
parent ad85619ccc
commit 1a94f5919d
4 changed files with 18 additions and 3 deletions

View File

@ -39,6 +39,15 @@
.table_wrapper { .table_wrapper {
overflow-x: auto; overflow-x: auto;
th a {
display: flex;
align-items: center;
img {
height: 100%;
}
}
table { table {
border-collapse: collapse; border-collapse: collapse;
width: 100%; width: 100%;
@ -53,4 +62,9 @@
} }
} }
th a {
color: black;
text-decoration: none;
}
} }

View File

@ -1,7 +1,9 @@
module FavoritesHelper module FavoritesHelper
def sortable(title, column) def sortable(title, column)
direction = column == sort_column && sort_direction == 'asc' ? 'desc' : 'asc' direction = column == sort_column && sort_direction == 'asc' ? 'desc' : 'asc'
link_to title, :sort => column, :direction => direction link_to :sort => column, :direction => direction do
content_tag(:div, title) + sorting_arrow(column)
end
end end
def sorting_arrow(column) def sorting_arrow(column)

View File

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

View File

@ -6,7 +6,7 @@
<div class="table_wrapper"> <div class="table_wrapper">
<table> <table>
<tr> <tr>
<th></th> <th>Thumb</th>
<%= render :partial => "favorites/th", :locals => {:display => "First Name", :column => "first_name"} %> <%= 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 => "Last Name", :column => "last_name"} %>
<%= render :partial => "favorites/th", :locals => {:display => "Registration Date", :column => "created_at"} %> <%= render :partial => "favorites/th", :locals => {:display => "Registration Date", :column => "created_at"} %>