Change layout of favorites

This commit is contained in:
2020-05-07 11:57:39 +02:00
parent c8902d12ac
commit d111a371ae
5 changed files with 39 additions and 10 deletions
@@ -1,5 +1,6 @@
class Favorites::FavoritePersonController < ApplicationController
def index
@favoritePeople = FavoritePerson.all
@host = 'https://tiss.tuwien.ac.at'
end
end
+3 -1
View File
@@ -1,3 +1,5 @@
class FavoritePerson < ApplicationRecord
self.primary_key = "tiss_id"
self.primary_key = 'tiss_id'
validates :tiss_id, uniqueness: true
end
@@ -1,6 +1,23 @@
<h1>Your favorite people listed here ...</h1>
<p>For now only the tiss_ids are stored and shown</p>
<h1>Favorite People</h1>
<% @favoritePeople.each do |favPerson| %>
<p>Tiss_id: <%= favPerson.tiss_id %></p>
<% end %>
<ul class="people-list">
<% @favoritePeople.each do |person| %>
<li class="person">
<%= link_to 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>