make me work
This commit is contained in:
parent
4a3773a29b
commit
717abd8796
3
app/assets/stylesheets/people_crawler.scss
Normal file
3
app/assets/stylesheets/people_crawler.scss
Normal 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/
|
||||
@ -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])
|
||||
32
app/controllers/crawlers/tiss_crawler_controller.rb
Normal file
32
app/controllers/crawlers/tiss_crawler_controller.rb
Normal 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
|
||||
2
app/helpers/people_crawler_helper.rb
Normal file
2
app/helpers/people_crawler_helper.rb
Normal file
@ -0,0 +1,2 @@
|
||||
module PeopleCrawlerHelper
|
||||
end
|
||||
7
test/controllers/people_crawler_controller_test.rb
Normal file
7
test/controllers/people_crawler_controller_test.rb
Normal file
@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class PeopleCrawlerControllerTest < ActionDispatch::IntegrationTest
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user