Merge branch 'personal_annotations' into 'master'
Personal annotations See merge request kranklyboy/tiss2go!1
This commit is contained in:
commit
8cd87ce642
5
Gemfile
5
Gemfile
@ -3,8 +3,6 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|||||||
|
|
||||||
ruby '2.7.0'
|
ruby '2.7.0'
|
||||||
|
|
||||||
# gem 'nokogiri', require: false
|
|
||||||
|
|
||||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
||||||
gem 'rails', '6.0.2.1'
|
gem 'rails', '6.0.2.1'
|
||||||
# Use sqlite3 as the database for Active Record
|
# Use sqlite3 as the database for Active Record
|
||||||
@ -39,6 +37,9 @@ gem 'devise-encryptable', '0.2.0'
|
|||||||
# Reduces boot times through caching; required in config/boot.rb
|
# Reduces boot times through caching; required in config/boot.rb
|
||||||
gem 'bootsnap', '>= 1.4.2', require: false
|
gem 'bootsnap', '>= 1.4.2', require: false
|
||||||
|
|
||||||
|
# for composite primary keys
|
||||||
|
gem 'composite_primary_keys'
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
||||||
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
||||||
|
|||||||
21
Gemfile.lock
21
Gemfile.lock
@ -73,6 +73,8 @@ GEM
|
|||||||
regexp_parser (~> 1.5)
|
regexp_parser (~> 1.5)
|
||||||
xpath (~> 3.2)
|
xpath (~> 3.2)
|
||||||
childprocess (3.0.0)
|
childprocess (3.0.0)
|
||||||
|
composite_primary_keys (12.0.2)
|
||||||
|
activerecord (~> 6.0.0)
|
||||||
concurrent-ruby (1.1.6)
|
concurrent-ruby (1.1.6)
|
||||||
crass (1.0.6)
|
crass (1.0.6)
|
||||||
devise (4.7.1)
|
devise (4.7.1)
|
||||||
@ -84,7 +86,7 @@ GEM
|
|||||||
devise-encryptable (0.2.0)
|
devise-encryptable (0.2.0)
|
||||||
devise (>= 2.1.0)
|
devise (>= 2.1.0)
|
||||||
erubi (1.9.0)
|
erubi (1.9.0)
|
||||||
ffi (1.12.2)
|
ffi (1.12.2-x64-mingw32)
|
||||||
globalid (0.4.2)
|
globalid (0.4.2)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
httparty (0.18.0)
|
httparty (0.18.0)
|
||||||
@ -105,11 +107,11 @@ GEM
|
|||||||
mime-types (3.3.1)
|
mime-types (3.3.1)
|
||||||
mime-types-data (~> 3.2015)
|
mime-types-data (~> 3.2015)
|
||||||
mime-types-data (3.2019.1009)
|
mime-types-data (3.2019.1009)
|
||||||
mimemagic (0.3.4)
|
mimemagic (0.3.5)
|
||||||
mini_mime (1.0.2)
|
mini_mime (1.0.2)
|
||||||
mini_portile2 (2.4.0)
|
mini_portile2 (2.4.0)
|
||||||
minitest (5.14.0)
|
minitest (5.14.0)
|
||||||
msgpack (1.3.3)
|
msgpack (1.3.3-x64-mingw32)
|
||||||
multi_xml (0.6.0)
|
multi_xml (0.6.0)
|
||||||
nio4r (2.5.2)
|
nio4r (2.5.2)
|
||||||
nokogiri (1.10.9)
|
nokogiri (1.10.9)
|
||||||
@ -157,7 +159,7 @@ GEM
|
|||||||
rubyzip (2.3.0)
|
rubyzip (2.3.0)
|
||||||
sass-rails (6.0.0)
|
sass-rails (6.0.0)
|
||||||
sassc-rails (~> 2.1, >= 2.1.1)
|
sassc-rails (~> 2.1, >= 2.1.1)
|
||||||
sassc (2.2.1)
|
sassc (2.2.1-x64-mingw32)
|
||||||
ffi (~> 1.9)
|
ffi (~> 1.9)
|
||||||
sassc-rails (2.1.2)
|
sassc-rails (2.1.2)
|
||||||
railties (>= 4.0.0)
|
railties (>= 4.0.0)
|
||||||
@ -184,6 +186,8 @@ GEM
|
|||||||
turbolinks-source (5.2.0)
|
turbolinks-source (5.2.0)
|
||||||
tzinfo (1.2.7)
|
tzinfo (1.2.7)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
|
tzinfo-data (1.2019.3)
|
||||||
|
tzinfo (>= 1.0.0)
|
||||||
warden (1.2.8)
|
warden (1.2.8)
|
||||||
rack (>= 2.0.6)
|
rack (>= 2.0.6)
|
||||||
web-console (4.0.1)
|
web-console (4.0.1)
|
||||||
@ -199,20 +203,21 @@ GEM
|
|||||||
activesupport (>= 4.2)
|
activesupport (>= 4.2)
|
||||||
rack-proxy (>= 0.6.1)
|
rack-proxy (>= 0.6.1)
|
||||||
railties (>= 4.2)
|
railties (>= 4.2)
|
||||||
websocket-driver (0.7.1)
|
websocket-driver (0.7.2)
|
||||||
websocket-extensions (>= 0.1.0)
|
websocket-extensions (>= 0.1.0)
|
||||||
websocket-extensions (0.1.4)
|
websocket-extensions (0.1.5)
|
||||||
xpath (3.2.0)
|
xpath (3.2.0)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
zeitwerk (2.3.0)
|
zeitwerk (2.3.0)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
x64-mingw32
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
bootsnap (>= 1.4.2)
|
bootsnap (>= 1.4.2)
|
||||||
byebug
|
byebug
|
||||||
capybara (>= 2.15)
|
capybara (>= 2.15)
|
||||||
|
composite_primary_keys
|
||||||
devise (= 4.7.1)
|
devise (= 4.7.1)
|
||||||
devise-encryptable (= 0.2.0)
|
devise-encryptable (= 0.2.0)
|
||||||
httparty (= 0.18.0)
|
httparty (= 0.18.0)
|
||||||
@ -232,4 +237,4 @@ RUBY VERSION
|
|||||||
ruby 2.7.0p0
|
ruby 2.7.0p0
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.1.2
|
2.1.4
|
||||||
|
|||||||
@ -119,3 +119,18 @@ input[type=text], input[type=url], input[type=email], input[type=password], inpu
|
|||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
border: 1px solid #bbb;
|
border: 1px solid #bbb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
background-color: white;
|
||||||
|
border: solid #3F51B5;
|
||||||
|
border-width: 1px;
|
||||||
|
color: #3F51B5;
|
||||||
|
padding: 3px 3px;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 16px;
|
||||||
|
margin-right: 0.1em;
|
||||||
|
font-weight: bolder;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
@ -40,7 +40,10 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
:nth-child(2) {
|
:nth-child(2) {
|
||||||
color: darkred;
|
-webkit-text-fill-color: #ffffff;
|
||||||
|
background-color: #ff1919;
|
||||||
|
border-radius: 4px;
|
||||||
|
border-color: #ff1919;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
17
app/assets/stylesheets/print.css
Normal file
17
app/assets/stylesheets/print.css
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
@media print {
|
||||||
|
nav, input, button, .favNav {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@page {
|
||||||
|
size: A4;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
counter-reset: chapternum figurenum;
|
||||||
|
font-family: "Trebuchet MS", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Tahoma, sans-serif;
|
||||||
|
line-height: 1.5;
|
||||||
|
font-size: 11pt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -1,3 +1,8 @@
|
|||||||
// Place all the styles related to the tiss_crawler controller here.
|
// Place all the styles related to the tiss_crawler controller here.
|
||||||
// They will automatically be included in application.css.
|
// They will automatically be included in application.css.
|
||||||
// You can use Sass (SCSS) here: https://sass-lang.com/
|
// You can use Sass (SCSS) here: https://sass-lang.com/
|
||||||
|
|
||||||
|
.annotationField {
|
||||||
|
width: 99.5%;
|
||||||
|
height: 8em;
|
||||||
|
}
|
||||||
@ -26,6 +26,8 @@ class Crawlers::CoursesCrawlerController < Crawlers::TissCrawlerController
|
|||||||
params[:semester] = regex[:semester]
|
params[:semester] = regex[:semester]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@personal_annotation = get_stored_annotation FavoriteCourse, {number: params[:number]}
|
||||||
|
|
||||||
puts params
|
puts params
|
||||||
|
|
||||||
# TissCrawler fetches the course's detail information
|
# TissCrawler fetches the course's detail information
|
||||||
@ -82,4 +84,8 @@ class Crawlers::CoursesCrawlerController < Crawlers::TissCrawlerController
|
|||||||
redirect_back(fallback_location: search)
|
redirect_back(fallback_location: search)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def add_annotation
|
||||||
|
store_annotation FavoriteCourse, 'Course', {number: params[:id]}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -22,6 +22,8 @@ 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]
|
||||||
|
|
||||||
|
@personal_annotation = get_stored_annotation FavoritePerson, {tiss_id: params[:tiss_id]}
|
||||||
|
|
||||||
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 +52,8 @@ 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
|
||||||
|
store_annotation FavoritePerson, 'Person', {tiss_id: params[:id]}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -21,6 +21,8 @@ class Crawlers::ProjectsCrawlerController < Crawlers::TissCrawlerController
|
|||||||
|
|
||||||
@id = params[:id]
|
@id = params[:id]
|
||||||
|
|
||||||
|
@personal_annotation = get_stored_annotation FavoriteProject, {id: @id}
|
||||||
|
|
||||||
puts params
|
puts params
|
||||||
# TissCrawler fetches the project's detail information
|
# TissCrawler fetches the project's detail information
|
||||||
@project = TissCrawler.get_project_details(params)
|
@project = TissCrawler.get_project_details(params)
|
||||||
@ -34,9 +36,9 @@ class Crawlers::ProjectsCrawlerController < Crawlers::TissCrawlerController
|
|||||||
@project = TissCrawler.get_project_details(params)
|
@project = TissCrawler.get_project_details(params)
|
||||||
|
|
||||||
# create stores the object to the db after creation
|
# create stores the object to the db after creation
|
||||||
favorite_hash = {id: params[:id],
|
favorite_hash = {id: [params[:id], current_user.id],
|
||||||
# the user who is currently active
|
# the user who is currently active
|
||||||
user_id: current_user.id,
|
# user_id: current_user.id,
|
||||||
title: @project['titleDe']}
|
title: @project['titleDe']}
|
||||||
if FavoriteProject.create(favorite_hash).valid?
|
if FavoriteProject.create(favorite_hash).valid?
|
||||||
FavoriteProject.create(favorite_hash)
|
FavoriteProject.create(favorite_hash)
|
||||||
@ -46,4 +48,8 @@ class Crawlers::ProjectsCrawlerController < Crawlers::TissCrawlerController
|
|||||||
end
|
end
|
||||||
redirect_back(fallback_location: search)
|
redirect_back(fallback_location: search)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def add_annotation
|
||||||
|
store_annotation FavoriteProject, 'Project', {id: params[:id]}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -21,6 +21,8 @@ class Crawlers::ThesesCrawlerController < Crawlers::TissCrawlerController
|
|||||||
|
|
||||||
@id = params[:id]
|
@id = params[:id]
|
||||||
|
|
||||||
|
@personal_annotation = get_stored_annotation FavoriteThesis, {id: @id}
|
||||||
|
|
||||||
puts params
|
puts params
|
||||||
# TissCrawler fetches the thesis' detail information
|
# TissCrawler fetches the thesis' detail information
|
||||||
@thesis = TissCrawler.get_thesis_details(params)
|
@thesis = TissCrawler.get_thesis_details(params)
|
||||||
@ -34,9 +36,9 @@ class Crawlers::ThesesCrawlerController < Crawlers::TissCrawlerController
|
|||||||
@thesis = TissCrawler.get_thesis_details(params)
|
@thesis = TissCrawler.get_thesis_details(params)
|
||||||
|
|
||||||
# create stores the object to the db after creation
|
# create stores the object to the db after creation
|
||||||
favorite_hash = {id: params[:id],
|
favorite_hash = {id: [params[:id], current_user.id],
|
||||||
# the user who is currently active
|
# the user who is currently active
|
||||||
user_id: current_user.id,
|
# user_id: current_user.id,
|
||||||
title: @thesis['title']['de']}
|
title: @thesis['title']['de']}
|
||||||
if FavoriteThesis.create(favorite_hash).valid?
|
if FavoriteThesis.create(favorite_hash).valid?
|
||||||
FavoriteThesis.create(favorite_hash)
|
FavoriteThesis.create(favorite_hash)
|
||||||
@ -46,4 +48,8 @@ class Crawlers::ThesesCrawlerController < Crawlers::TissCrawlerController
|
|||||||
end
|
end
|
||||||
redirect_back(fallback_location: search)
|
redirect_back(fallback_location: search)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def add_annotation
|
||||||
|
store_annotation FavoriteThesis, 'Thesis', {id: params[:id]}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -34,4 +34,31 @@ class Crawlers::TissCrawlerController < ApplicationController
|
|||||||
def add_to_fav
|
def add_to_fav
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def add_annotation
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def get_stored_annotation(object, id_hash)
|
||||||
|
id_hash['user_id'] = current_user
|
||||||
|
if object.exists?(id_hash)
|
||||||
|
object.where(id_hash)[0]['personal_annotation']
|
||||||
|
else
|
||||||
|
""
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def store_annotation(object, object_name, id_hash)
|
||||||
|
id_hash['user_id'] = current_user
|
||||||
|
|
||||||
|
# Allow storing empty strings as a way of "clearing" the stored val
|
||||||
|
if object.exists?(id_hash)
|
||||||
|
object.where(id_hash)[0].update(:personal_annotation => params[:body])
|
||||||
|
flash[:alert] = 'Annotation stored!'
|
||||||
|
else
|
||||||
|
flash[:alert] = object_name + ' has to be favorited first!'
|
||||||
|
end
|
||||||
|
redirect_back(fallback_location: crawlers_tiss_crawler_search_path)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,2 +1,9 @@
|
|||||||
module Crawlers::TissCrawlerHelper
|
module Crawlers::TissCrawlerHelper
|
||||||
|
def render_personal_annotations(id, personal_annotation)
|
||||||
|
render :partial => "crawlers/personal_annotations",
|
||||||
|
:locals => {
|
||||||
|
:cur_id => id,
|
||||||
|
:personal_annotation => personal_annotation
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
class FavoriteCourse < ApplicationRecord
|
class FavoriteCourse < ApplicationRecord
|
||||||
|
self.primary_keys = :id, :user_id
|
||||||
|
|
||||||
validates :title, :semester, :number, presence: true
|
validates :title, :semester, :number, presence: true
|
||||||
validates :semester, :number, uniqueness: {scope: [:semester, :number]}
|
validates :semester, :number, uniqueness: {scope: [:semester, :number, :user_id]}
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
class FavoritePerson < ApplicationRecord
|
class FavoritePerson < ApplicationRecord
|
||||||
self.primary_key = 'tiss_id'
|
self.primary_keys = :tiss_id, :user_id
|
||||||
|
|
||||||
validates :tiss_id, uniqueness: true
|
validates :tiss_id, uniqueness: { scope: [:user_id] }
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
class FavoriteProject < ApplicationRecord
|
class FavoriteProject < ApplicationRecord
|
||||||
self.primary_key = 'id'
|
self.primary_keys = :id, :user_id
|
||||||
|
|
||||||
validates :id, uniqueness: true
|
validates :id, :user_id, uniqueness: {scope: [:id, :user_id]}
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
class FavoriteThesis < ApplicationRecord
|
class FavoriteThesis < ApplicationRecord
|
||||||
self.primary_key = 'id'
|
self.primary_keys = :id, :user_id
|
||||||
|
|
||||||
validates :id, uniqueness: true
|
validates :id, :user_id, uniqueness: {scope: [:id, :user_id]}
|
||||||
end
|
end
|
||||||
|
|||||||
13
app/views/crawlers/_personal_annotations.html.erb
Normal file
13
app/views/crawlers/_personal_annotations.html.erb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<%= form_tag "add_annotation", :id => "id" do -%>
|
||||||
|
<%= hidden_field_tag :authenticity_token, form_authenticity_token %>
|
||||||
|
<p>
|
||||||
|
Add an annotation:
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= text_area_tag 'body', personal_annotation, class: 'annotationField' %>
|
||||||
|
<%= hidden_field_tag :id , cur_id %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= submit_tag "Save annotation" %>
|
||||||
|
</p>
|
||||||
|
<% end -%>
|
||||||
@ -1,6 +1,8 @@
|
|||||||
<% if @course != nil %>
|
<% if @course != nil %>
|
||||||
<%-# TODO parse more fields and style them appropriately -%>
|
<%-# TODO parse more fields and style them appropriately -%>
|
||||||
<h2><%= @course['title']['de'] %></h2>
|
<h2>Course: <%= @course['title']['de'] %></h2>
|
||||||
|
<%= button_to "PRINT", '#', onclick: "print()" %>
|
||||||
|
|
||||||
<h5><%= @course['courseType'] %> <%= @course['semesterCode'] %>, <%= @course['weeklyHours'] %> SWS, <%= @course['instituteCode'] %> <%= @course['instituteName']['de'] %> </h5>
|
<h5><%= @course['courseType'] %> <%= @course['semesterCode'] %>, <%= @course['weeklyHours'] %> SWS, <%= @course['instituteCode'] %> <%= @course['instituteName']['de'] %> </h5>
|
||||||
<%= button_to 'Add to favorites', action: :add_to_fav, number: @course['courseNumber'], semester: @course['semesterCode'] %>
|
<%= button_to 'Add to favorites', action: :add_to_fav, number: @course['courseNumber'], semester: @course['semesterCode'] %>
|
||||||
<% if @lecturers_names != nil %>
|
<% if @lecturers_names != nil %>
|
||||||
@ -13,4 +15,6 @@
|
|||||||
<h3>Inhalt</h3>
|
<h3>Inhalt</h3>
|
||||||
<%= raw @course['objective']['de'] %>
|
<%= raw @course['objective']['de'] %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<%= render_personal_annotations @course['courseNumber'], @personal_annotation %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<% if @person != nil %>
|
<% if @person != nil %>
|
||||||
<h2><%= @person['first_name'] %> <%= @person['last_name'] %></h2>
|
<h2>Person: <%= @person['first_name'] %> <%= @person['last_name'] %></h2>
|
||||||
|
<%= button_to "PRINT", '#', onclick: "print()" %>
|
||||||
|
|
||||||
<div class="profile-picture">
|
<div class="profile-picture">
|
||||||
<% if @person['picture_uri'] != nil %>
|
<% if @person['picture_uri'] != nil %>
|
||||||
<%= image_tag @host + @person['picture_uri'] %>
|
<%= image_tag @host + @person['picture_uri'] %>
|
||||||
@ -14,8 +16,12 @@
|
|||||||
<p>Other E-Mails: <%= @person['other_emails'] %></p>
|
<p>Other E-Mails: <%= @person['other_emails'] %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @person['main_addresses'] != nil %>
|
<% if @person['main_addresses'] != nil %>
|
||||||
<p>Address: <%= @person['main_addresses'][0]['street'] %>, <%= @person['main_addresses'][0]['zip_code'] %> <%= @person['main_addresses'][0]['city'] %></p>
|
<p>Address: <%= @person['main_addresses'][0]['street'] %>
|
||||||
|
, <%= @person['main_addresses'][0]['zip_code'] %> <%= @person['main_addresses'][0]['city'] %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<!-- <p>Employee: <%#= @person.employee %></p>-->
|
<!-- <p>Employee: <%#= @person.employee %></p>-->
|
||||||
<%= button_to 'Add to favorites', action: :add_to_fav, tiss_id: @person['tiss_id'] %>
|
<%= button_to 'Add to favorites', action: :add_to_fav, tiss_id: @person['tiss_id'], class: 'button' %>
|
||||||
|
|
||||||
|
<%= render_personal_annotations @person['tiss_id'], @personal_annotation %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
@ -1,5 +1,7 @@
|
|||||||
<% if @project != nil %>
|
<% if @project != nil %>
|
||||||
<h2><%= @project['titleDe'] %></h2>
|
<h2>Project: <%= @project['titleDe'] %></h2>
|
||||||
|
<%= button_to "PRINT", '#', onclick: "print()" %>
|
||||||
|
|
||||||
<h5><%= @project['contractBegin'] %> - <%= @project['contractEnd'] %></h5>
|
<h5><%= @project['contractBegin'] %> - <%= @project['contractEnd'] %></h5>
|
||||||
<%= button_to 'Add to favorites', action: :add_to_fav, id: @id, title: @project['titleDe'] %>
|
<%= button_to 'Add to favorites', action: :add_to_fav, id: @id, title: @project['titleDe'] %>
|
||||||
<% if @project['abstractDe'] != nil %>
|
<% if @project['abstractDe'] != nil %>
|
||||||
@ -11,4 +13,7 @@
|
|||||||
<p><%= raw @project['abstractEn'] %></p>
|
<p><%= raw @project['abstractEn'] %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<%= render_personal_annotations @id, @personal_annotation %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<% if @thesis != nil %>
|
<% if @thesis != nil %>
|
||||||
<h2><%= @thesis['title']['de'] %></h2>
|
<h2>Thesis: <%= @thesis['title']['de'] %></h2>
|
||||||
|
<%= button_to "PRINT", '#', onclick: "print()" %>
|
||||||
|
|
||||||
<h5><%= @thesis['thesisType'] %>, <%= @thesis['instituteCode'] %> <%= @thesis['instituteName']['de'] %></h5>
|
<h5><%= @thesis['thesisType'] %>, <%= @thesis['instituteCode'] %> <%= @thesis['instituteName']['de'] %></h5>
|
||||||
<%= button_to 'Add to favorites', action: :add_to_fav, id: @id, title: @thesis['title']['de'] %>
|
<%= button_to 'Add to favorites', action: :add_to_fav, id: @id, title: @thesis['title']['de'] %>
|
||||||
<% if @thesis['advisor'] != nil %>
|
<% if @thesis['advisor'] != nil %>
|
||||||
@ -10,4 +12,6 @@
|
|||||||
<h4>Assistant</h4>
|
<h4>Assistant</h4>
|
||||||
<p><%= @thesis['assistant']['familyName'] %> <%= @thesis['assistant']['givenName'] %></p>
|
<p><%= @thesis['assistant']['familyName'] %> <%= @thesis['assistant']['givenName'] %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<%= render_personal_annotations @id, @personal_annotation %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@ -3,4 +3,6 @@
|
|||||||
<%= link_to 'Courses', favorites_courses_url %>
|
<%= link_to 'Courses', favorites_courses_url %>
|
||||||
<%= link_to 'Theses', favorites_theses_url %>
|
<%= link_to 'Theses', favorites_theses_url %>
|
||||||
<%= link_to 'Projects', favorites_projects_url %>
|
<%= link_to 'Projects', favorites_projects_url %>
|
||||||
|
|
||||||
|
<%= link_to "PRINT", '#', onclick: "print()" %>
|
||||||
</div>
|
</div>
|
||||||
@ -43,6 +43,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
<%= button_to 'Delete', {:action => "delete_project", :id => project['id']}, :method => 'delete' %>
|
<%= button_to 'Delete', {:action => "delete_project", :id => project['id']}, :method => 'delete' %>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
<%= button_to 'Delete', {:action => "delete_thesis", :id => thesis['id']}, :method => 'delete' %>
|
<%= button_to 'Delete', {:action => "delete_thesis", :id => thesis['id']}, :method => 'delete' %>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@ -5,7 +5,9 @@
|
|||||||
<%= csrf_meta_tags %>
|
<%= csrf_meta_tags %>
|
||||||
<%= csp_meta_tag %>
|
<%= csp_meta_tag %>
|
||||||
|
|
||||||
|
|
||||||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||||
|
<%= stylesheet_link_tag 'print', media: 'print' %>
|
||||||
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||||
|
|
||||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
|
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
|
||||||
@ -43,4 +45,5 @@
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -13,6 +13,7 @@ Rails.application.routes.draw do
|
|||||||
post 'show_detail'
|
post 'show_detail'
|
||||||
get 'add_to_fav'
|
get 'add_to_fav'
|
||||||
post 'add_to_fav'
|
post 'add_to_fav'
|
||||||
|
post 'add_annotation'
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :courses_crawler do
|
namespace :courses_crawler do
|
||||||
@ -21,6 +22,7 @@ Rails.application.routes.draw do
|
|||||||
post 'show_detail'
|
post 'show_detail'
|
||||||
get 'add_to_fav'
|
get 'add_to_fav'
|
||||||
post 'add_to_fav'
|
post 'add_to_fav'
|
||||||
|
post 'add_annotation'
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :theses_crawler do
|
namespace :theses_crawler do
|
||||||
@ -29,6 +31,7 @@ Rails.application.routes.draw do
|
|||||||
post 'show_detail'
|
post 'show_detail'
|
||||||
get 'add_to_fav'
|
get 'add_to_fav'
|
||||||
post 'add_to_fav'
|
post 'add_to_fav'
|
||||||
|
post 'add_annotation'
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :projects_crawler do
|
namespace :projects_crawler do
|
||||||
@ -37,6 +40,7 @@ Rails.application.routes.draw do
|
|||||||
post 'show_detail'
|
post 'show_detail'
|
||||||
get 'add_to_fav'
|
get 'add_to_fav'
|
||||||
post 'add_to_fav'
|
post 'add_to_fav'
|
||||||
|
post 'add_annotation'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,13 @@
|
|||||||
class CreateFavoritePeople < ActiveRecord::Migration[6.0]
|
class CreateFavoritePeople < ActiveRecord::Migration[6.0]
|
||||||
def change
|
def change
|
||||||
create_table :favorite_people, id: false do |t|
|
create_table :favorite_people, primary_key: [:tiss_id, :user_id] do |t|
|
||||||
t.integer :tiss_id, null: false
|
t.integer :tiss_id, null: false
|
||||||
t.integer :user_id, null: false
|
t.belongs_to :user
|
||||||
t.string :first_name
|
t.string :first_name
|
||||||
t.string :last_name
|
t.string :last_name
|
||||||
t.string :picture_uri
|
t.string :picture_uri
|
||||||
|
t.string :personal_annotation
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
add_index :favorite_people, :tiss_id, unique: true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,13 +1,14 @@
|
|||||||
class CreateFavoriteCourses < ActiveRecord::Migration[6.0]
|
class CreateFavoriteCourses < ActiveRecord::Migration[6.0]
|
||||||
def change
|
def change
|
||||||
create_table :favorite_courses do |t|
|
create_table :favorite_courses , primary_key: [:id, :user_id] do |t|
|
||||||
|
t.integer :id
|
||||||
|
t.belongs_to :user
|
||||||
t.string :number, null: false
|
t.string :number, null: false
|
||||||
t.string :semester, null: false
|
t.string :semester, null: false
|
||||||
t.string :title, null: false
|
t.string :title, null: false
|
||||||
t.integer :user_id, null: false
|
t.string :personal_annotation
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
add_index :favorite_courses, [:number, :semester], unique: true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
class CreateFavoriteTheses < ActiveRecord::Migration[6.0]
|
class CreateFavoriteTheses < ActiveRecord::Migration[6.0]
|
||||||
def change
|
def change
|
||||||
create_table :favorite_theses, id: false do |t|
|
create_table :favorite_theses, primary_key: [:id, :user_id] do |t|
|
||||||
t.integer :id, null: false
|
t.integer :id, null: false
|
||||||
t.integer :user_id, null: false
|
t.belongs_to :user
|
||||||
t.string :title
|
t.string :title
|
||||||
|
t.string :personal_annotation
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
add_index :favorite_theses, :id, unique: true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
class CreateFavoriteProjects < ActiveRecord::Migration[6.0]
|
class CreateFavoriteProjects < ActiveRecord::Migration[6.0]
|
||||||
def change
|
def change
|
||||||
create_table :favorite_projects, id: false do |t|
|
create_table :favorite_projects, primary_key: [:id, :user_id] do |t|
|
||||||
t.integer :id, null: false
|
t.integer :id, null: false
|
||||||
t.integer :user_id, null: false
|
t.belongs_to :user
|
||||||
t.string :title
|
t.string :title
|
||||||
|
t.string :personal_annotation
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
add_index :favorite_projects, :id, unique: true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
29
db/schema.rb
29
db/schema.rb
@ -12,43 +12,48 @@
|
|||||||
|
|
||||||
ActiveRecord::Schema.define(version: 2020_05_29_081537) do
|
ActiveRecord::Schema.define(version: 2020_05_29_081537) do
|
||||||
|
|
||||||
create_table "favorite_courses", force: :cascade do |t|
|
create_table "favorite_courses", primary_key: ["id", "user_id"], force: :cascade do |t|
|
||||||
|
t.integer "id"
|
||||||
|
t.integer "user_id"
|
||||||
t.string "number", null: false
|
t.string "number", null: false
|
||||||
t.string "semester", null: false
|
t.string "semester", null: false
|
||||||
t.string "title", null: false
|
t.string "title", null: false
|
||||||
t.integer "user_id", null: false
|
t.string "personal_annotation"
|
||||||
t.datetime "created_at", precision: 6, null: false
|
t.datetime "created_at", precision: 6, null: false
|
||||||
t.datetime "updated_at", precision: 6, null: false
|
t.datetime "updated_at", precision: 6, null: false
|
||||||
t.index ["number", "semester"], name: "index_favorite_courses_on_number_and_semester", unique: true
|
t.index ["user_id"], name: "index_favorite_courses_on_user_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "favorite_people", id: false, force: :cascade do |t|
|
create_table "favorite_people", primary_key: ["tiss_id", "user_id"], force: :cascade do |t|
|
||||||
t.integer "tiss_id", null: false
|
t.integer "tiss_id", null: false
|
||||||
t.integer "user_id", null: false
|
t.integer "user_id"
|
||||||
t.string "first_name"
|
t.string "first_name"
|
||||||
t.string "last_name"
|
t.string "last_name"
|
||||||
t.string "picture_uri"
|
t.string "picture_uri"
|
||||||
|
t.string "personal_annotation"
|
||||||
t.datetime "created_at", precision: 6, null: false
|
t.datetime "created_at", precision: 6, null: false
|
||||||
t.datetime "updated_at", precision: 6, null: false
|
t.datetime "updated_at", precision: 6, null: false
|
||||||
t.index ["tiss_id"], name: "index_favorite_people_on_tiss_id", unique: true
|
t.index ["user_id"], name: "index_favorite_people_on_user_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "favorite_projects", id: false, force: :cascade do |t|
|
create_table "favorite_projects", primary_key: ["id", "user_id"], force: :cascade do |t|
|
||||||
t.integer "id", null: false
|
t.integer "id", null: false
|
||||||
t.integer "user_id", null: false
|
t.integer "user_id"
|
||||||
t.string "title"
|
t.string "title"
|
||||||
|
t.string "personal_annotation"
|
||||||
t.datetime "created_at", precision: 6, null: false
|
t.datetime "created_at", precision: 6, null: false
|
||||||
t.datetime "updated_at", precision: 6, null: false
|
t.datetime "updated_at", precision: 6, null: false
|
||||||
t.index ["id"], name: "index_favorite_projects_on_id", unique: true
|
t.index ["user_id"], name: "index_favorite_projects_on_user_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "favorite_theses", id: false, force: :cascade do |t|
|
create_table "favorite_theses", primary_key: ["id", "user_id"], force: :cascade do |t|
|
||||||
t.integer "id", null: false
|
t.integer "id", null: false
|
||||||
t.integer "user_id", null: false
|
t.integer "user_id"
|
||||||
t.string "title"
|
t.string "title"
|
||||||
|
t.string "personal_annotation"
|
||||||
t.datetime "created_at", precision: 6, null: false
|
t.datetime "created_at", precision: 6, null: false
|
||||||
t.datetime "updated_at", precision: 6, null: false
|
t.datetime "updated_at", precision: 6, null: false
|
||||||
t.index ["id"], name: "index_favorite_theses_on_id", unique: true
|
t.index ["user_id"], name: "index_favorite_theses_on_user_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "users", force: :cascade do |t|
|
create_table "users", force: :cascade do |t|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user