Change layout of favorites
This commit is contained in:
parent
c8902d12ac
commit
d111a371ae
@ -1,5 +1,6 @@
|
|||||||
class Favorites::FavoritePersonController < ApplicationController
|
class Favorites::FavoritePersonController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@favoritePeople = FavoritePerson.all
|
@favoritePeople = FavoritePerson.all
|
||||||
|
@host = 'https://tiss.tuwien.ac.at'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
class FavoritePerson < ApplicationRecord
|
class FavoritePerson < ApplicationRecord
|
||||||
self.primary_key = "tiss_id"
|
self.primary_key = 'tiss_id'
|
||||||
|
|
||||||
|
validates :tiss_id, uniqueness: true
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,6 +1,23 @@
|
|||||||
<h1>Your favorite people listed here ...</h1>
|
<h1>Favorite People</h1>
|
||||||
<p>For now only the tiss_ids are stored and shown</p>
|
|
||||||
|
|
||||||
<% @favoritePeople.each do |favPerson| %>
|
<ul class="people-list">
|
||||||
<p>Tiss_id: <%= favPerson.tiss_id %></p>
|
<% @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 %>
|
<% 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]
|
class CreateFavoritePeople < ActiveRecord::Migration[6.0]
|
||||||
def change
|
def change
|
||||||
create_table :favorite_people do |t|
|
create_table :favorite_people, id: false do |t|
|
||||||
t.string :tiss_id
|
t.string :tiss_id, null: false
|
||||||
|
t.string :first_name
|
||||||
|
t.string :last_name
|
||||||
|
|
||||||
|
t.string :picture_uri
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
add_index :favorite_people, :tiss_id, unique: true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -12,10 +12,14 @@
|
|||||||
|
|
||||||
ActiveRecord::Schema.define(version: 2020_04_21_152314) do
|
ActiveRecord::Schema.define(version: 2020_04_21_152314) do
|
||||||
|
|
||||||
create_table "favorite_people", force: :cascade do |t|
|
create_table "favorite_people", id: false, force: :cascade do |t|
|
||||||
t.string "tiss_id"
|
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 "created_at", precision: 6, null: false
|
||||||
t.datetime "updated_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
|
end
|
||||||
|
|
||||||
create_table "users", force: :cascade do |t|
|
create_table "users", force: :cascade do |t|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user