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:
parent
a8f4d4a9db
commit
92eff82f1a
25
app/assets/stylesheets/favorites.scss
Normal file
25
app/assets/stylesheets/favorites.scss
Normal 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;
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,24 @@
|
||||
// They will automatically be included in application.css.
|
||||
// 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 {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
class Favorites::FavoritePersonController < ApplicationController
|
||||
def index
|
||||
@favoritePeople = FavoritePerson.all
|
||||
@host = 'https://tiss.tuwien.ac.at'
|
||||
end
|
||||
end
|
||||
23
app/controllers/favorites_controller.rb
Normal file
23
app/controllers/favorites_controller.rb
Normal 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
|
||||
@ -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?
|
||||
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|
|
||||
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
|
||||
else
|
||||
flash[:alert] = "Person is already favorited!"
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
module Favorites::FavoritePersonHelper
|
||||
end
|
||||
2
app/helpers/favorites/favorites_helper.rb
Normal file
2
app/helpers/favorites/favorites_helper.rb
Normal file
@ -0,0 +1,2 @@
|
||||
module Favorites::FavoritesHelper
|
||||
end
|
||||
6
app/views/favorites/_nav.html.erb
Normal file
6
app/views/favorites/_nav.html.erb
Normal 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>
|
||||
3
app/views/favorites/courses.html.erb
Normal file
3
app/views/favorites/courses.html.erb
Normal file
@ -0,0 +1,3 @@
|
||||
<%= render(:partial => "nav")%>
|
||||
|
||||
<p>Fav Courses</p>
|
||||
2
app/views/favorites/index.html.erb
Normal file
2
app/views/favorites/index.html.erb
Normal file
@ -0,0 +1,2 @@
|
||||
<%= render(:partial => "nav")%>
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
<%= render(:partial => "nav")%>
|
||||
|
||||
<h1>Favorite People</h1>
|
||||
|
||||
<ul class="people-list">
|
||||
3
app/views/favorites/projects.html.erb
Normal file
3
app/views/favorites/projects.html.erb
Normal file
@ -0,0 +1,3 @@
|
||||
<%= render(:partial => "nav")%>
|
||||
|
||||
<p>Fav Projects</p>
|
||||
3
app/views/favorites/theses.html.erb
Normal file
3
app/views/favorites/theses.html.erb
Normal file
@ -0,0 +1,3 @@
|
||||
<%= render(:partial => "nav")%>
|
||||
|
||||
<p>Fav Theses</p>
|
||||
Loading…
x
Reference in New Issue
Block a user