refactored favorites:

instead of using a fav page for each content, use a general favorites pane where the user can select which favs shall be shown
This commit is contained in:
Pfingstfrosch 2020-05-12 19:19:04 +02:00
parent a8f4d4a9db
commit 92eff82f1a
13 changed files with 88 additions and 9 deletions

View File

@ -0,0 +1,25 @@
// Place all the styles related to the favorites controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: https://sass-lang.com/
.favNav {
display: flex;
a:link, a:visited {
font-family: Helvetica, sans-serif;
transition: .3s all ease-in-out;
font-size: 18px;
background-color: #3F51B5;
color: white;
padding: 5px 10px;
text-align: center;
text-decoration: none;
display: inline-block;
flex-grow: 1;
}
a:hover, a:active {
background-color: #009688;
}
}

View File

@ -2,6 +2,24 @@
// They will automatically be included in application.css. // They will automatically be included in application.css.
// You can use Sass (SCSS) here: https://sass-lang.com/ // You can use Sass (SCSS) here: https://sass-lang.com/
h5 {
font-weight: normal;
opacity: 0.8;
}
.profile-picture {
float: right;
width: 25%;
img {
width: 100%;
max-width: 260px;
height: auto;
object-fit: contain;
}
}
.people-list { .people-list {
list-style: none; list-style: none;
padding: 0; padding: 0;

View File

@ -1,6 +0,0 @@
class Favorites::FavoritePersonController < ApplicationController
def index
@favoritePeople = FavoritePerson.all
@host = 'https://tiss.tuwien.ac.at'
end
end

View File

@ -0,0 +1,23 @@
class FavoritesController < ApplicationController
def index
end
def people
@favoritePeople = FavoritePerson.all
@host = 'https://tiss.tuwien.ac.at'
end
def courses
end
def theses
end
def projects
end
end

View File

@ -30,7 +30,7 @@ class PeopleCrawlerController < TissCrawlerController
if FavoritePerson.create(tiss_id: @person['tiss_id'], first_name: @person['first_name'], last_name: @person['last_name'], picture_uri: @person['picture_uri']).valid? if FavoritePerson.create(tiss_id: @person['tiss_id'], first_name: @person['first_name'], last_name: @person['last_name'], picture_uri: @person['picture_uri']).valid?
FavoritePerson.create(tiss_id: @person['tiss_id'], first_name: @person['first_name'], last_name: @person['last_name'], picture_uri: @person['picture_uri']) FavoritePerson.create(tiss_id: @person['tiss_id'], first_name: @person['first_name'], last_name: @person['last_name'], picture_uri: @person['picture_uri'])
respond_to do |format| respond_to do |format|
format.html { redirect_to favorites_favorite_person_index_url, notice: 'Favorite person stored' } format.html { redirect_to favorite_person_index_url, notice: 'Favorite person stored' }
end end
else else
flash[:alert] = "Person is already favorited!" flash[:alert] = "Person is already favorited!"

View File

@ -1,2 +0,0 @@
module Favorites::FavoritePersonHelper
end

View File

@ -0,0 +1,2 @@
module Favorites::FavoritesHelper
end

View File

@ -0,0 +1,6 @@
<div class='favNav'>
<%= link_to 'People', favorites_people_url%>
<%= link_to 'Courses', favorites_courses_url %>
<%= link_to 'Theses', favorites_theses_url %>
<%= link_to 'Projects', favorites_projects_url %>
</div>

View File

@ -0,0 +1,3 @@
<%= render(:partial => "nav")%>
<p>Fav Courses</p>

View File

@ -0,0 +1,2 @@
<%= render(:partial => "nav")%>

View File

@ -1,3 +1,5 @@
<%= render(:partial => "nav")%>
<h1>Favorite People</h1> <h1>Favorite People</h1>
<ul class="people-list"> <ul class="people-list">

View File

@ -0,0 +1,3 @@
<%= render(:partial => "nav")%>
<p>Fav Projects</p>

View File

@ -0,0 +1,3 @@
<%= render(:partial => "nav")%>
<p>Fav Theses</p>