From 1a94f5919dc6dc168e71017ecda7c3048b39385a Mon Sep 17 00:00:00 2001 From: Pfingstfrosch Date: Sun, 31 May 2020 17:02:34 +0200 Subject: [PATCH] final styling of table sorting --- app/assets/stylesheets/favorites.scss | 14 ++++++++++++++ app/helpers/favorites_helper.rb | 4 +++- app/views/favorites/_th.html.erb | 1 - app/views/favorites/people.html.erb | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/favorites.scss b/app/assets/stylesheets/favorites.scss index 75ab2c7..6e8c764 100644 --- a/app/assets/stylesheets/favorites.scss +++ b/app/assets/stylesheets/favorites.scss @@ -39,6 +39,15 @@ .table_wrapper { overflow-x: auto; + th a { + display: flex; + align-items: center; + + img { + height: 100%; + } + } + table { border-collapse: collapse; width: 100%; @@ -53,4 +62,9 @@ } } + + th a { + color: black; + text-decoration: none; + } } \ No newline at end of file diff --git a/app/helpers/favorites_helper.rb b/app/helpers/favorites_helper.rb index ec16b80..ce79220 100644 --- a/app/helpers/favorites_helper.rb +++ b/app/helpers/favorites_helper.rb @@ -1,7 +1,9 @@ module FavoritesHelper def sortable(title, column) 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 def sorting_arrow(column) diff --git a/app/views/favorites/_th.html.erb b/app/views/favorites/_th.html.erb index 88a154c..036f5ed 100644 --- a/app/views/favorites/_th.html.erb +++ b/app/views/favorites/_th.html.erb @@ -1,4 +1,3 @@ <%= sortable display, column %> - <%= sorting_arrow column %> \ No newline at end of file diff --git a/app/views/favorites/people.html.erb b/app/views/favorites/people.html.erb index 8cc6b07..28cfd0a 100644 --- a/app/views/favorites/people.html.erb +++ b/app/views/favorites/people.html.erb @@ -6,7 +6,7 @@
- + <%= 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"} %>
Thumb