Change layout of favorites
This commit is contained in:
parent
c8902d12ac
commit
d111a371ae
@ -1,5 +1,6 @@
|
||||
class Favorites::FavoritePersonController < ApplicationController
|
||||
def index
|
||||
@favoritePeople = FavoritePerson.all
|
||||
@host = 'https://tiss.tuwien.ac.at'
|
||||
end
|
||||
end
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -1,9 +1,14 @@
|
||||
class CreateFavoritePeople < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :favorite_people do |t|
|
||||
t.string :tiss_id
|
||||
create_table :favorite_people, id: false do |t|
|
||||
t.string :tiss_id, null: false
|
||||
t.string :first_name
|
||||
t.string :last_name
|
||||
|
||||
t.string :picture_uri
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
add_index :favorite_people, :tiss_id, unique: true
|
||||
end
|
||||
end
|
||||
|
||||
@ -12,10 +12,14 @@
|
||||
|
||||
ActiveRecord::Schema.define(version: 2020_04_21_152314) do
|
||||
|
||||
create_table "favorite_people", force: :cascade do |t|
|
||||
t.string "tiss_id"
|
||||
create_table "favorite_people", id: false, force: :cascade do |t|
|
||||
t.string "tiss_id", null: false
|
||||
t.string "first_name"
|
||||
t.string "last_name"
|
||||
t.string "picture_uri"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["tiss_id"], name: "index_favorite_people_on_tiss_id", unique: true
|
||||
end
|
||||
|
||||
create_table "users", force: :cascade do |t|
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user