on detail view show stored annotation if available

This commit is contained in:
Pfingstfrosch 2020-06-04 21:54:17 +02:00
parent d59030ffc0
commit 88783ffede

View File

@ -22,6 +22,10 @@ class Crawlers::PeopleCrawlerController < Crawlers::TissCrawlerController
params[:api] = '/api/person/v22/id/' params[:api] = '/api/person/v22/id/'
params[:tiss_id] = params[:tiss_id] params[:tiss_id] = params[:tiss_id]
if FavoritePerson.exists?(params[:tiss_id])
@stored_person = FavoritePerson.find(params[:tiss_id])
end
puts params puts params
# TissCrawler fetches the person's detail information # TissCrawler fetches the person's detail information
@person = TissCrawler.get_details(params) @person = TissCrawler.get_details(params)
@ -50,4 +54,14 @@ class Crawlers::PeopleCrawlerController < Crawlers::TissCrawlerController
redirect_back(fallback_location: crawlers_tiss_crawler_search_path) redirect_back(fallback_location: crawlers_tiss_crawler_search_path)
end end
def add_annotation
if FavoritePerson.exists?(params[:id])
FavoritePerson.update(params[:id], :personal_annotation => params[:body])
flash[:alert] = 'Annotation stored!'
else
flash[:alert] = 'Person has to be favorited first!'
end
redirect_back(fallback_location: crawlers_tiss_crawler_search_path)
end
end end