refactoring

This commit is contained in:
Marco Zeisler 2020-04-21 13:52:27 +02:00
parent c5cc225ca6
commit e0a21f180f
17 changed files with 26 additions and 35 deletions

View File

@ -1,3 +1,3 @@
class CoursesController < TissCrawlerController
class CoursesController < ApplicationController
end

View File

@ -1,3 +1,3 @@
class PeopleController < TissCrawlerController
class PeopleController < ApplicationController
end

View File

@ -1,3 +1,3 @@
class ProjectsController < TissCrawlerController
class ProjectsController < ApplicationController
end

View File

@ -1,3 +1,3 @@
class ThesesController < TissCrawlerController
class ThesesController < ApplicationController
end

View File

@ -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

View File

@ -1,2 +0,0 @@
<h1>Courses#show basic</h1>
<p>Find me in app/views/courses/show.html.erb</p>

View File

@ -1,2 +0,0 @@
<h1>Courses#show detailed</h1>
<p>Find me in app/views/courses/show.html.erb</p>

View File

@ -1,11 +1,3 @@
<h1>People#index</h1>
<p>Find me in app/views/people/index.html.erb</p>
<%= 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 %>

View File

@ -1,4 +0,0 @@
<h1>People#show detailed</h1>
<p>Find me in app/views/people/show.html.erb</p>
<%= @people %>

View File

@ -1,2 +0,0 @@
<h1>Projects#show basic</h1>
<p>Find me in app/views/projects/show.html.erb</p>

View File

@ -1,2 +0,0 @@
<h1>Projects#show detailed</h1>
<p>Find me in app/views/projects/show.html.erb</p>

View File

@ -1,2 +0,0 @@
<h1>Theses#show basic</h1>
<p>Find me in app/views/theses/show.html.erb</p>

View File

@ -1,2 +0,0 @@
<h1>Theses#show detailed</h1>
<p>Find me in app/views/theses/show.html.erb</p>

View File

@ -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 %>

View File

@ -1,10 +1,8 @@
<h1>People#show basic</h1>
This is the result for your basic people search:
<% @people.each do |person| %>
<p>
<%= person.first_name %>
<%= person.last_name %>
<%= button_to people_show_detailed_path %> [add to favs]
</p>
<% end %>

View File

@ -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'