diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 08a7bd2..bcffa1a 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -1,3 +1,3 @@ -class CoursesController < TissCrawlerController +class CoursesController < ApplicationController end diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 6a10db6..e521299 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -1,3 +1,3 @@ -class PeopleController < TissCrawlerController +class PeopleController < ApplicationController end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 4ede9c8..02fdf3a 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,3 +1,3 @@ -class ProjectsController < TissCrawlerController +class ProjectsController < ApplicationController end diff --git a/app/controllers/theses_controller.rb b/app/controllers/theses_controller.rb index de0002d..22b0f4d 100644 --- a/app/controllers/theses_controller.rb +++ b/app/controllers/theses_controller.rb @@ -1,3 +1,3 @@ -class ThesesController < TissCrawlerController +class ThesesController < ApplicationController end diff --git a/app/controllers/tiss_crawler_controller.rb b/app/controllers/tiss_crawler_controller.rb index 5c05876..5289d42 100644 --- a/app/controllers/tiss_crawler_controller.rb +++ b/app/controllers/tiss_crawler_controller.rb @@ -25,4 +25,13 @@ class TissCrawlerController < ApplicationController end + require 'tiss/tiss_crawler' + + def show_basic + result = TissCrawler.search(params) + @people = result.map { |person| Tiss::Person.new(person) } + # render(people_show_path, detail: false) + render template: people_show_basic_path + end + end diff --git a/app/views/courses/show_basic.html.erb b/app/views/courses/show_basic.html.erb deleted file mode 100644 index 824ffbd..0000000 --- a/app/views/courses/show_basic.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

Courses#show basic

-

Find me in app/views/courses/show.html.erb

diff --git a/app/views/courses/show_detailed.html.erb b/app/views/courses/show_detailed.html.erb deleted file mode 100644 index 8615080..0000000 --- a/app/views/courses/show_detailed.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

Courses#show detailed

-

Find me in app/views/courses/show.html.erb

diff --git a/app/views/people/index.html.erb b/app/views/people/index.html.erb index 91b0b69..575bbf8 100644 --- a/app/views/people/index.html.erb +++ b/app/views/people/index.html.erb @@ -1,11 +1,3 @@

People#index

Find me in app/views/people/index.html.erb

-<%= form_tag('/tisscrawler/search', :method => "get") do %> - <%= hidden_field_tag(:context, 'People') %> - <%= hidden_field_tag(:api, '/api/person/v22/psuche') %> - <%= hidden_field_tag(:search_parameter, 'q') %> - <%= label_tag(:search_term, "Search for:") %> - <%= text_field_tag(:search_term) %> - <%= submit_tag("Search") %> -<% end %> \ No newline at end of file diff --git a/app/views/people/show_detailed.html.erb b/app/views/people/show_detailed.html.erb deleted file mode 100644 index f810ca6..0000000 --- a/app/views/people/show_detailed.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -

People#show detailed

-

Find me in app/views/people/show.html.erb

- -<%= @people %> \ No newline at end of file diff --git a/app/views/projects/show_basic.html.erb b/app/views/projects/show_basic.html.erb deleted file mode 100644 index 960cc1c..0000000 --- a/app/views/projects/show_basic.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

Projects#show basic

-

Find me in app/views/projects/show.html.erb

diff --git a/app/views/projects/show_detailed.html.erb b/app/views/projects/show_detailed.html.erb deleted file mode 100644 index c3f4286..0000000 --- a/app/views/projects/show_detailed.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

Projects#show detailed

-

Find me in app/views/projects/show.html.erb

diff --git a/app/views/theses/show.basic.erb b/app/views/theses/show.basic.erb deleted file mode 100644 index 4e9ae09..0000000 --- a/app/views/theses/show.basic.erb +++ /dev/null @@ -1,2 +0,0 @@ -

Theses#show basic

-

Find me in app/views/theses/show.html.erb

diff --git a/app/views/theses/show_detailed.html.erb b/app/views/theses/show_detailed.html.erb deleted file mode 100644 index 595099b..0000000 --- a/app/views/theses/show_detailed.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

Theses#show detailed

-

Find me in app/views/theses/show.html.erb

diff --git a/app/views/tiss_crawler/search.html.erb b/app/views/tiss_crawler/_search_form.html.erb similarity index 100% rename from app/views/tiss_crawler/search.html.erb rename to app/views/tiss_crawler/_search_form.html.erb diff --git a/app/views/tiss_crawler/search_people.html.erb b/app/views/tiss_crawler/search_people.html.erb new file mode 100644 index 0000000..be84d5c --- /dev/null +++ b/app/views/tiss_crawler/search_people.html.erb @@ -0,0 +1,8 @@ +<%= form_tag('/tiss_crawler/search', :method => "get") do %> + <%= hidden_field_tag(:context, 'People') %> + <%= hidden_field_tag(:api, '/api/person/v22/psuche') %> + <%= hidden_field_tag(:search_parameter, 'q') %> + <%= label_tag(:search_term, "Search for:") %> + <%= text_field_tag(:search_term) %> + <%= submit_tag("Search") %> +<% end %> \ No newline at end of file diff --git a/app/views/people/show_basic.html.erb b/app/views/tiss_crawler/show_people.html.erb similarity index 64% rename from app/views/people/show_basic.html.erb rename to app/views/tiss_crawler/show_people.html.erb index cdc498b..42cc75c 100644 --- a/app/views/people/show_basic.html.erb +++ b/app/views/tiss_crawler/show_people.html.erb @@ -1,10 +1,8 @@ -

People#show basic

- This is the result for your basic people search: + <% @people.each do |person| %>

<%= person.first_name %> <%= person.last_name %> - <%= button_to people_show_detailed_path %> [add to favs]

<% end %> diff --git a/config/routes.rb b/config/routes.rb index feb2cde..92709e4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,20 +1,20 @@ Rails.application.routes.draw do devise_for :users, path_names: {sign_in: 'log_in', sign_out: 'log out'} + get 'people/index' + get 'people/show_basic' + post 'people/show_detailed' get 'theses/index' get 'theses/show_basic' get 'theses/show_detailed' get 'projects/index' get 'projects/show_basic' get 'projects/show_detailed' - get 'people/index' - get 'people/show_basic' - get 'people/show_detailed' get 'courses/index' get 'courses/show_basic' get 'courses/show_detailed' get 'login/index' - get 'tisscrawler/search', :to => 'tiss_crawler#search' + get 'tiss_crawler/search' # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html root 'login#index'