make me work

This commit is contained in:
Marco Zeisler 2020-04-24 16:56:22 +02:00
parent 4a3773a29b
commit 717abd8796
5 changed files with 48 additions and 24 deletions

View File

@ -0,0 +1,3 @@
// Place all the styles related to the PeopleCrawler controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: https://sass-lang.com/

View File

@ -1,26 +1,6 @@
class TissCrawlerController < ApplicationController
class PeopleCrawlerController < TissCrawlerController
# self designed lib to call the Tiss API
require 'tiss/tiss_crawler'
def search
# search context like 'People', 'Courses', etc is mandatory
$search_context = params[:search_context]
# evaluate the proper action regarding to the $search_context
case $search_context
when 'People'
# redirect to people_show_basic, propagate the search_term
redirect_to :action => 'people_show_basic', :search_term => params[:search_term]
when 'Courses'
when 'Theses'
when 'Projects'
else
puts 'Undefined search context'
end
end
def people_show_basic
def show_basic
params[:api] = '/api/person/v22/psuche'
params[:search_parameter] = 'q'
puts params[:search_context]
@ -29,7 +9,7 @@ class TissCrawlerController < ApplicationController
@people = TissCrawler.search(params)
end
def person_show_detail
def show_detail
params[:api] = '/api/person/v22/id/'
# TissCrawler fetches the person's detail information
@ -38,7 +18,7 @@ class TissCrawlerController < ApplicationController
@host = TissCrawler.get_host
end
def person_add_to_fav
def add_to_fav
puts params[:tiss_id]
# create stores the object to the db after creation
FavoritePerson.create(tiss_id: params[:tiss_id])

View File

@ -0,0 +1,32 @@
class TissCrawlerController < ApplicationController
# self designed lib to call the Tiss API
require 'tiss/tiss_crawler'
def search
# search context like 'People', 'Courses', etc is mandatory
$search_context = params[:search_context]
# evaluate the proper action regarding to the $search_context
case $search_context
when 'People'
# redirect to people_show_basic, propagate the search_term
redirect_to :action => 'people_show_basic', :search_term => params[:search_term]
when 'Courses'
when 'Theses'
when 'Projects'
else
puts 'Undefined search context'
end
end
def show_basic
end
def show_detail
end
def add_to_fav
end
end

View File

@ -0,0 +1,2 @@
module PeopleCrawlerHelper
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class PeopleCrawlerControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end