From 8dce998932837a99cc76260ea6a40f2bd210ee3d Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Sat, 18 Feb 2023 17:23:30 +0100 Subject: [PATCH] complete --- app/models/ability.rb | 7 ++ app/models/concerns/with_university.rb | 2 + app/models/research.rb | 2 +- app/models/research/hal/author.rb | 10 ++- app/models/research/hal/publication.rb | 18 +++-- app/models/university/person.rb | 73 +++++++++---------- app/models/university/person/administrator.rb | 73 +++++++++---------- app/models/university/person/alumnus.rb | 73 +++++++++---------- app/models/university/person/author.rb | 73 +++++++++---------- app/models/university/person/researcher.rb | 73 +++++++++---------- app/models/university/person/teacher.rb | 73 +++++++++---------- app/models/university/person/with_research.rb | 14 +--- app/services/icon.rb | 1 + app/views/admin/dashboard/namespace.html.erb | 1 + .../admin/research/hal/authors/_list.html.erb | 2 - .../admin/research/hal/authors/show.html.erb | 18 +++++ .../research/hal/publications/_list.html.erb | 7 +- .../research/hal/publications/show.html.erb | 41 ++++++----- .../admin/research/researchers/show.html.erb | 6 +- .../people/researchers/_researcher.html.erb | 8 ++ config/locales/research/en.yml | 16 ++-- config/locales/research/fr.yml | 17 +++-- ...30218162239_remove_hal_from_researchers.rb | 7 ++ db/schema.rb | 5 +- test/fixtures/university/people.yml | 73 +++++++++---------- 25 files changed, 367 insertions(+), 326 deletions(-) create mode 100644 app/views/admin/university/people/researchers/_researcher.html.erb create mode 100644 db/migrate/20230218162239_remove_hal_from_researchers.rb diff --git a/app/models/ability.rb b/app/models/ability.rb index c92627605..0873c6403 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -6,10 +6,17 @@ class Ability def initialize(user) @user = user ||= User.new # guest user (not logged in) send @user.role.to_sym + common_abilities end protected + def common_abilities + can :read, Research::Hal + can :read, Research::Hal::Publication + can :read, Research::Hal::Author + end + def visitor end diff --git a/app/models/concerns/with_university.rb b/app/models/concerns/with_university.rb index d0433b792..bf2fc0ee5 100644 --- a/app/models/concerns/with_university.rb +++ b/app/models/concerns/with_university.rb @@ -4,5 +4,7 @@ module WithUniversity included do belongs_to :university validates_presence_of :university + + scope :in_university, -> (university) { where(university: university) } end end diff --git a/app/models/research.rb b/app/models/research.rb index ed1172dce..633d16d2a 100644 --- a/app/models/research.rb +++ b/app/models/research.rb @@ -12,7 +12,7 @@ module Research [Research::Laboratory, :admin_research_laboratories_path], [Research::Thesis, :admin_research_theses_path], [Research::Journal, :admin_research_journals_path], - [Research::Hal::Publication, :admin_research_hal_publications_path], + [Research::Hal, :admin_research_hal_root_path], ] end end diff --git a/app/models/research/hal/author.rb b/app/models/research/hal/author.rb index ed35b86de..726c98e54 100644 --- a/app/models/research/hal/author.rb +++ b/app/models/research/hal/author.rb @@ -63,17 +63,23 @@ class Research::Hal::Author < ApplicationRecord end def import_research_hal_publications! - # Do not use the API if no researcher is concerned + publications.clear + # Do not overuse the API if no researcher is concerned return if researchers.none? - Research::Hal::Publication.import_from_hal_for_author(self) + Research::Hal::Publication.import_from_hal_for_author(self).each do |publication| + publications << publication + end + publications end def connect_researcher(researcher) researchers << researcher + researcher.import_research_hal_publications! end def disconnect_researcher(researcher) researchers.delete researcher + researcher.import_research_hal_publications! end def to_s diff --git a/app/models/research/hal/publication.rb b/app/models/research/hal/publication.rb index 1fbbbbb25..75d03b57a 100644 --- a/app/models/research/hal/publication.rb +++ b/app/models/research/hal/publication.rb @@ -22,15 +22,17 @@ class Research::Hal::Publication < ApplicationRecord include WithGit include WithSlug + + DOI_PREFIX = 'http://dx.doi.org/'.freeze has_and_belongs_to_many :researchers, class_name: 'University::Person', foreign_key: 'university_person_id', association_foreign_key: 'research_hal_publication_id' - DOI_PREFIX = 'http://dx.doi.org/'.freeze - - before_destroy { research_people.clear } + has_and_belongs_to_many :authors, + foreign_key: 'research_hal_author_id', + association_foreign_key: 'research_hal_publication_id' validates_presence_of :docid @@ -47,11 +49,13 @@ class Research::Hal::Publication < ApplicationRecord 'linkExtUrl_s', # '*', ] - response = HalOpenscience::Document.search "authIdForm_i:#{author.form_identifier}", fields: fields, limit: 1000 + publications = [] + response = HalOpenscience::Document.search "authIdFormPerson_s:#{author.docid}", fields: fields, limit: 1000 response.results.each do |doc| - publication = Research::Hal::Publication.create_from doc - author.publications << publication unless publication.in?(author.publications) + publication = create_from doc + publications << publication end + publications end def self.create_from(doc) @@ -77,7 +81,7 @@ class Research::Hal::Publication < ApplicationRecord end def best_url - doi_url || url || hal_url + url || doi_url || hal_url end def to_s diff --git a/app/models/university/person.rb b/app/models/university/person.rb index 6a84914ad..59a9e253f 100644 --- a/app/models/university/person.rb +++ b/app/models/university/person.rb @@ -2,44 +2,41 @@ # # Table name: university_people # -# id :uuid not null, primary key -# address :string -# biography :text -# birthdate :date -# city :string -# country :string -# email :string -# first_name :string -# gender :integer -# habilitation :boolean default(FALSE) -# hal_doc_identifier :string -# hal_form_identifier :string -# hal_person_identifier :string -# is_administration :boolean -# is_alumnus :boolean default(FALSE) -# is_author :boolean -# is_researcher :boolean -# is_teacher :boolean -# last_name :string -# linkedin :string -# mastodon :string -# meta_description :text -# name :string -# phone_mobile :string -# phone_personal :string -# phone_professional :string -# slug :string -# summary :text -# tenure :boolean default(FALSE) -# twitter :string -# url :string -# zipcode :string -# created_at :datetime not null -# updated_at :datetime not null -# language_id :uuid not null, indexed -# original_id :uuid indexed -# university_id :uuid not null, indexed -# user_id :uuid indexed +# id :uuid not null, primary key +# address :string +# biography :text +# birthdate :date +# city :string +# country :string +# email :string +# first_name :string +# gender :integer +# habilitation :boolean default(FALSE) +# is_administration :boolean +# is_alumnus :boolean default(FALSE) +# is_author :boolean +# is_researcher :boolean +# is_teacher :boolean +# last_name :string +# linkedin :string +# mastodon :string +# meta_description :text +# name :string +# phone_mobile :string +# phone_personal :string +# phone_professional :string +# slug :string +# summary :text +# tenure :boolean default(FALSE) +# twitter :string +# url :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# language_id :uuid not null, indexed +# original_id :uuid indexed +# university_id :uuid not null, indexed +# user_id :uuid indexed # # Indexes # diff --git a/app/models/university/person/administrator.rb b/app/models/university/person/administrator.rb index c0978fc99..0e2fcd0e1 100644 --- a/app/models/university/person/administrator.rb +++ b/app/models/university/person/administrator.rb @@ -2,44 +2,41 @@ # # Table name: university_people # -# id :uuid not null, primary key -# address :string -# biography :text -# birthdate :date -# city :string -# country :string -# email :string -# first_name :string -# gender :integer -# habilitation :boolean default(FALSE) -# hal_doc_identifier :string -# hal_form_identifier :string -# hal_person_identifier :string -# is_administration :boolean -# is_alumnus :boolean default(FALSE) -# is_author :boolean -# is_researcher :boolean -# is_teacher :boolean -# last_name :string -# linkedin :string -# mastodon :string -# meta_description :text -# name :string -# phone_mobile :string -# phone_personal :string -# phone_professional :string -# slug :string -# summary :text -# tenure :boolean default(FALSE) -# twitter :string -# url :string -# zipcode :string -# created_at :datetime not null -# updated_at :datetime not null -# language_id :uuid not null, indexed -# original_id :uuid indexed -# university_id :uuid not null, indexed -# user_id :uuid indexed +# id :uuid not null, primary key +# address :string +# biography :text +# birthdate :date +# city :string +# country :string +# email :string +# first_name :string +# gender :integer +# habilitation :boolean default(FALSE) +# is_administration :boolean +# is_alumnus :boolean default(FALSE) +# is_author :boolean +# is_researcher :boolean +# is_teacher :boolean +# last_name :string +# linkedin :string +# mastodon :string +# meta_description :text +# name :string +# phone_mobile :string +# phone_personal :string +# phone_professional :string +# slug :string +# summary :text +# tenure :boolean default(FALSE) +# twitter :string +# url :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# language_id :uuid not null, indexed +# original_id :uuid indexed +# university_id :uuid not null, indexed +# user_id :uuid indexed # # Indexes # diff --git a/app/models/university/person/alumnus.rb b/app/models/university/person/alumnus.rb index 4bd99ef46..9d0679e92 100644 --- a/app/models/university/person/alumnus.rb +++ b/app/models/university/person/alumnus.rb @@ -2,44 +2,41 @@ # # Table name: university_people # -# id :uuid not null, primary key -# address :string -# biography :text -# birthdate :date -# city :string -# country :string -# email :string -# first_name :string -# gender :integer -# habilitation :boolean default(FALSE) -# hal_doc_identifier :string -# hal_form_identifier :string -# hal_person_identifier :string -# is_administration :boolean -# is_alumnus :boolean default(FALSE) -# is_author :boolean -# is_researcher :boolean -# is_teacher :boolean -# last_name :string -# linkedin :string -# mastodon :string -# meta_description :text -# name :string -# phone_mobile :string -# phone_personal :string -# phone_professional :string -# slug :string -# summary :text -# tenure :boolean default(FALSE) -# twitter :string -# url :string -# zipcode :string -# created_at :datetime not null -# updated_at :datetime not null -# language_id :uuid not null, indexed -# original_id :uuid indexed -# university_id :uuid not null, indexed -# user_id :uuid indexed +# id :uuid not null, primary key +# address :string +# biography :text +# birthdate :date +# city :string +# country :string +# email :string +# first_name :string +# gender :integer +# habilitation :boolean default(FALSE) +# is_administration :boolean +# is_alumnus :boolean default(FALSE) +# is_author :boolean +# is_researcher :boolean +# is_teacher :boolean +# last_name :string +# linkedin :string +# mastodon :string +# meta_description :text +# name :string +# phone_mobile :string +# phone_personal :string +# phone_professional :string +# slug :string +# summary :text +# tenure :boolean default(FALSE) +# twitter :string +# url :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# language_id :uuid not null, indexed +# original_id :uuid indexed +# university_id :uuid not null, indexed +# user_id :uuid indexed # # Indexes # diff --git a/app/models/university/person/author.rb b/app/models/university/person/author.rb index 2abf65216..a19bc5d64 100644 --- a/app/models/university/person/author.rb +++ b/app/models/university/person/author.rb @@ -2,44 +2,41 @@ # # Table name: university_people # -# id :uuid not null, primary key -# address :string -# biography :text -# birthdate :date -# city :string -# country :string -# email :string -# first_name :string -# gender :integer -# habilitation :boolean default(FALSE) -# hal_doc_identifier :string -# hal_form_identifier :string -# hal_person_identifier :string -# is_administration :boolean -# is_alumnus :boolean default(FALSE) -# is_author :boolean -# is_researcher :boolean -# is_teacher :boolean -# last_name :string -# linkedin :string -# mastodon :string -# meta_description :text -# name :string -# phone_mobile :string -# phone_personal :string -# phone_professional :string -# slug :string -# summary :text -# tenure :boolean default(FALSE) -# twitter :string -# url :string -# zipcode :string -# created_at :datetime not null -# updated_at :datetime not null -# language_id :uuid not null, indexed -# original_id :uuid indexed -# university_id :uuid not null, indexed -# user_id :uuid indexed +# id :uuid not null, primary key +# address :string +# biography :text +# birthdate :date +# city :string +# country :string +# email :string +# first_name :string +# gender :integer +# habilitation :boolean default(FALSE) +# is_administration :boolean +# is_alumnus :boolean default(FALSE) +# is_author :boolean +# is_researcher :boolean +# is_teacher :boolean +# last_name :string +# linkedin :string +# mastodon :string +# meta_description :text +# name :string +# phone_mobile :string +# phone_personal :string +# phone_professional :string +# slug :string +# summary :text +# tenure :boolean default(FALSE) +# twitter :string +# url :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# language_id :uuid not null, indexed +# original_id :uuid indexed +# university_id :uuid not null, indexed +# user_id :uuid indexed # # Indexes # diff --git a/app/models/university/person/researcher.rb b/app/models/university/person/researcher.rb index ede0bf421..70847b670 100644 --- a/app/models/university/person/researcher.rb +++ b/app/models/university/person/researcher.rb @@ -2,44 +2,41 @@ # # Table name: university_people # -# id :uuid not null, primary key -# address :string -# biography :text -# birthdate :date -# city :string -# country :string -# email :string -# first_name :string -# gender :integer -# habilitation :boolean default(FALSE) -# hal_doc_identifier :string -# hal_form_identifier :string -# hal_person_identifier :string -# is_administration :boolean -# is_alumnus :boolean default(FALSE) -# is_author :boolean -# is_researcher :boolean -# is_teacher :boolean -# last_name :string -# linkedin :string -# mastodon :string -# meta_description :text -# name :string -# phone_mobile :string -# phone_personal :string -# phone_professional :string -# slug :string -# summary :text -# tenure :boolean default(FALSE) -# twitter :string -# url :string -# zipcode :string -# created_at :datetime not null -# updated_at :datetime not null -# language_id :uuid not null, indexed -# original_id :uuid indexed -# university_id :uuid not null, indexed -# user_id :uuid indexed +# id :uuid not null, primary key +# address :string +# biography :text +# birthdate :date +# city :string +# country :string +# email :string +# first_name :string +# gender :integer +# habilitation :boolean default(FALSE) +# is_administration :boolean +# is_alumnus :boolean default(FALSE) +# is_author :boolean +# is_researcher :boolean +# is_teacher :boolean +# last_name :string +# linkedin :string +# mastodon :string +# meta_description :text +# name :string +# phone_mobile :string +# phone_personal :string +# phone_professional :string +# slug :string +# summary :text +# tenure :boolean default(FALSE) +# twitter :string +# url :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# language_id :uuid not null, indexed +# original_id :uuid indexed +# university_id :uuid not null, indexed +# user_id :uuid indexed # # Indexes # diff --git a/app/models/university/person/teacher.rb b/app/models/university/person/teacher.rb index 515a4f47e..48cf9b6ad 100644 --- a/app/models/university/person/teacher.rb +++ b/app/models/university/person/teacher.rb @@ -2,44 +2,41 @@ # # Table name: university_people # -# id :uuid not null, primary key -# address :string -# biography :text -# birthdate :date -# city :string -# country :string -# email :string -# first_name :string -# gender :integer -# habilitation :boolean default(FALSE) -# hal_doc_identifier :string -# hal_form_identifier :string -# hal_person_identifier :string -# is_administration :boolean -# is_alumnus :boolean default(FALSE) -# is_author :boolean -# is_researcher :boolean -# is_teacher :boolean -# last_name :string -# linkedin :string -# mastodon :string -# meta_description :text -# name :string -# phone_mobile :string -# phone_personal :string -# phone_professional :string -# slug :string -# summary :text -# tenure :boolean default(FALSE) -# twitter :string -# url :string -# zipcode :string -# created_at :datetime not null -# updated_at :datetime not null -# language_id :uuid not null, indexed -# original_id :uuid indexed -# university_id :uuid not null, indexed -# user_id :uuid indexed +# id :uuid not null, primary key +# address :string +# biography :text +# birthdate :date +# city :string +# country :string +# email :string +# first_name :string +# gender :integer +# habilitation :boolean default(FALSE) +# is_administration :boolean +# is_alumnus :boolean default(FALSE) +# is_author :boolean +# is_researcher :boolean +# is_teacher :boolean +# last_name :string +# linkedin :string +# mastodon :string +# meta_description :text +# name :string +# phone_mobile :string +# phone_personal :string +# phone_professional :string +# slug :string +# summary :text +# tenure :boolean default(FALSE) +# twitter :string +# url :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# language_id :uuid not null, indexed +# original_id :uuid indexed +# university_id :uuid not null, indexed +# user_id :uuid indexed # # Indexes # diff --git a/app/models/university/person/with_research.rb b/app/models/university/person/with_research.rb index a2eb61202..521441ff5 100644 --- a/app/models/university/person/with_research.rb +++ b/app/models/university/person/with_research.rb @@ -10,7 +10,7 @@ module University::Person::WithResearch has_and_belongs_to_many :research_hal_publications, class_name: 'Research::Hal::Publication', - foreign_key: 'research_publication_id', + foreign_key: 'research_hal_publication_id', association_foreign_key: 'university_person_id' alias :hal_publications :research_hal_publications alias :publications :research_hal_publications @@ -19,17 +19,11 @@ module University::Person::WithResearch end def import_research_hal_publications! + publications.clear hal_authors.each do |author| - author.import_research_hal_publications! - end - response = HalOpenscience::Document.search "authIdForm_i:#{hal_form_identifier}", - fields: ["*"], - limit: 1000 - response.results.each do |doc| - publication = Research::Hal::Publication.create_from doc - publications << publication unless publication.in?(publications) + # TODO manage same researcher in different universities + publications.concat author.import_research_hal_publications! end end - handle_asynchronously :import_research_hal_publications! end diff --git a/app/services/icon.rb b/app/services/icon.rb index 9d9210585..debcd5881 100644 --- a/app/services/icon.rb +++ b/app/services/icon.rb @@ -33,6 +33,7 @@ class Icon UNIVERSITY_PERSON_RESEARCHER = RESEARCH_RESEARCHER RESEARCH_THESIS = RESEARCH_THESE RESEARCH_HAL_PUBLICATION = RESEARCH_PUBLICATION + RESEARCH_HAL = RESEARCH_PUBLICATION ADMINISTRATION_CAMPUS = 'fas fa-map-marker-alt' ADMINISTRATION_ADMISSIONS = 'fas fa-door-open' diff --git a/app/views/admin/dashboard/namespace.html.erb b/app/views/admin/dashboard/namespace.html.erb index 28069ead4..9521b0e09 100644 --- a/app/views/admin/dashboard/namespace.html.erb +++ b/app/views/admin/dashboard/namespace.html.erb @@ -15,6 +15,7 @@ description = class_name.human_attribute_name('description') # TODO description = t 'administration.qualiopi.description' if class_name == Administration::Qualiopi + description = t 'activerecord.attributes.research/hal.description' if class_name == Research::Hal %> <div class="col-lg-6 mt-5"> <%= osuny_panel title do %> diff --git a/app/views/admin/research/hal/authors/_list.html.erb b/app/views/admin/research/hal/authors/_list.html.erb index a51003642..00855e7f1 100644 --- a/app/views/admin/research/hal/authors/_list.html.erb +++ b/app/views/admin/research/hal/authors/_list.html.erb @@ -5,7 +5,6 @@ <th><%= Research::Hal::Author.human_attribute_name('full_name') %></th> <th><%= Research::Hal::Publication.human_attribute_name('docid') %></th> <th><%= Research::Hal::Publication.human_attribute_name('publications') %></th> - <th><%= Research::Hal::Publication.human_attribute_name('researchers') %></th> </tr> </thead> <tbody> @@ -14,7 +13,6 @@ <td><%= link_to author, [:admin, author] %></td> <td><%= author.docid %></td> <td><%= author.publications.count %></td> - <td><%= author.researchers.count %></td> </tr> <% end %> </tbody> diff --git a/app/views/admin/research/hal/authors/show.html.erb b/app/views/admin/research/hal/authors/show.html.erb index 364d41d5e..f3b2e9371 100644 --- a/app/views/admin/research/hal/authors/show.html.erb +++ b/app/views/admin/research/hal/authors/show.html.erb @@ -1,5 +1,23 @@ <% content_for :title, @author %> +<div class="row"> + <div class="col-lg-8"> + <%= osuny_label Research::Hal::Author.human_attribute_name :docid %> + <p><%= @author.docid %></p> + </div> + <div class="col-lg-4"> + <%= osuny_panel University::Person::Researcher.model_name.human do %> + <% @author.researchers.in_university(current_university).each do |researcher| %> + <%= render 'admin/university/people/researchers/researcher', researcher: researcher %> + <% end %> + <% end %> + </div> +</div> + +<%= osuny_panel Research::Hal::Publication.model_name.human(count: 2), subtitle: @author.publications.count do %> + <%= render 'admin/research/hal/publications/list', publications: @author.publications.ordered %> +<% end %> + <% content_for :action_bar_left do %> <%= destroy_link @author %> <% end %> diff --git a/app/views/admin/research/hal/publications/_list.html.erb b/app/views/admin/research/hal/publications/_list.html.erb index 259490a54..62de27ec4 100644 --- a/app/views/admin/research/hal/publications/_list.html.erb +++ b/app/views/admin/research/hal/publications/_list.html.erb @@ -3,8 +3,8 @@ <thead> <tr> <th><%= Research::Hal::Publication.human_attribute_name('title') %></th> - <th><%= Research::Hal::Publication.human_attribute_name('publication_date') %></th> - <th><%= University::Person::Researcher.model_name.human(count: 2) %></th> + <th width="150"><%= Research::Hal::Publication.human_attribute_name('publication_date') %></th> + <th width="200"><%= University::Person::Researcher.model_name.human(count: 2) %></th> </tr> </thead> <tbody> @@ -13,8 +13,7 @@ <td><%= link_to publication, admin_research_hal_publication_path(publication) %></td> <td><%= l publication.publication_date %></td> <td> - <% publication.researchers.each do |researcher| %> - <% next if researcher.university != current_university %> + <% publication.researchers.in_university(current_university).each do |researcher| %> <%= link_to_if researcher.university == current_university, researcher, admin_research_researcher_path(researcher) %> diff --git a/app/views/admin/research/hal/publications/show.html.erb b/app/views/admin/research/hal/publications/show.html.erb index bd3db6861..5c84a479d 100644 --- a/app/views/admin/research/hal/publications/show.html.erb +++ b/app/views/admin/research/hal/publications/show.html.erb @@ -12,31 +12,36 @@ <%= osuny_label Research::Hal::Publication.human_attribute_name('publication_date') %> <p><%= l @publication.publication_date %></p> </div> - <% [:url, :hal_url, :doi_url].each do |key| %> - <% value = @publication.send key %> - <% next if value.blank? %> - <div class="col-lg-6"> - <%= osuny_label Research::Hal::Publication.human_attribute_name(key) %> - <p><%= link_to value, value, target: :_blank %></p> - </div> - <% end %> </div> </div> <div class="col-lg-4"> - <% @publication.researchers.each do |researcher| %> - <% next if researcher.university != current_university %> - <article class="mb-4 d-flex align-items-center position-relative"> - <div style="width: 80px"> - <%= kamifusen_tag researcher.best_picture, width: 80, class: 'img-circle' if researcher.best_picture.attached? %> - </div> - <div class="ms-3"> - <%= link_to researcher, admin_research_researcher_path(researcher), class: 'stretched-link' %> - </div> - </article> + <%= osuny_panel University::Person::Researcher.model_name.human(count: 2) do %> + <% @publication.researchers.in_university(current_university).each do |researcher| %> + <%= render 'admin/university/people/researchers/researcher', researcher: researcher %> + <% end %> + <% end %> + <%= osuny_panel Research::Hal::Author.model_name.human(count: 2) do %> + <ul class="list-unstyled"> + <% @publication.authors.each do |author| %> + <li> + <%= link_to [:admin, author] do %> + <%= author %> + (<%= author.docid %>) + <% end %> + </li> + <% end %> + </ul> <% end %> </div> </div> +<% [:url, :hal_url, :doi_url].each do |key| %> + <% value = @publication.send key %> + <% next if value.blank? %> + <%= osuny_label Research::Hal::Publication.human_attribute_name(key) %> + <p><%= link_to value, value, target: :_blank %></p> +<% end %> + <% content_for :action_bar_left do %> <% if current_user.server_admin? %> <%= link_to t('delete'), diff --git a/app/views/admin/research/researchers/show.html.erb b/app/views/admin/research/researchers/show.html.erb index 1a8630be8..25b69cf65 100644 --- a/app/views/admin/research/researchers/show.html.erb +++ b/app/views/admin/research/researchers/show.html.erb @@ -17,8 +17,10 @@ <% @hal_authors_with_same_name.each do |author| %> <tr> <td width="300"> - <%= Research::Hal::Author.human_attribute_name('docid') %> : <%= author.docid %><br> - <small><%= author.full_name %></small> + <%= link_to [:admin, author] do %> + <%= Research::Hal::Author.human_attribute_name('docid') %> : <%= author.docid %><br> + <small><%= author.full_name %></small> + <% end %> </td> <td class="ps-3" width="200"> <% path = researcher_admin_research_hal_author_path author, researcher_id: @researcher %> diff --git a/app/views/admin/university/people/researchers/_researcher.html.erb b/app/views/admin/university/people/researchers/_researcher.html.erb new file mode 100644 index 000000000..d79fa151e --- /dev/null +++ b/app/views/admin/university/people/researchers/_researcher.html.erb @@ -0,0 +1,8 @@ +<article class="mb-4 d-flex align-items-center position-relative"> + <div style="width: 80px"> + <%= kamifusen_tag researcher.best_picture, width: 80, class: 'img-circle' if researcher.best_picture.attached? %> + </div> + <div class="ms-3"> + <%= link_to researcher, admin_research_researcher_path(researcher), class: 'stretched-link' %> + </div> +</article> diff --git a/config/locales/research/en.yml b/config/locales/research/en.yml index e66d57571..b38348b1a 100644 --- a/config/locales/research/en.yml +++ b/config/locales/research/en.yml @@ -9,11 +9,11 @@ en: one: Researcher other: Researchers research/hal/author: - one: HAL author - other: HAL authors + one: Author + other: Authors research/hal/publication: - one: HAL publication - other: HAL publications + one: Publication + other: Publications research/journal: one: Journal other: Journals @@ -36,11 +36,13 @@ en: one: Thesis other: Theses attributes: + research/hal: + description: Publications et auteur·e·s dans la base de données HAL research/hal/author: docid: HAL identifier first_name: First name - last_name: Last name full_name: Full name + last_name: Last name research/hal/publication: description: Publications scientifiques importées automatiquement de HAL docid: Identifier @@ -96,6 +98,10 @@ en: laboratory: Laboratory started_at: Started at title: Title + research/hal: + description: + text: "HAL signifie Hyper Article en Ligne. C’est une plateforme pluridisciplinaire nationale pour le dépôt et la consultation des écrits, travaux et résultats de recherches scientifiques des chercheur·e·s et enseignant·e·s-chercheur·e·s. HAL est un bien commun pour la recherche : Les plus grands organismes de recherche et la majorité des universités françaises ont choisi et soutiennent HAL, une infrastructure publique, pérenne et responsable." + source: HAL.science research: description: text: La recherche scientifique est, à la fois, une démarche créatrice de connaissances motivée par la curiosité pure et une activité génératrice d’innovations qui augmentent les moyens d’action et de diagnostic sur la nature, l’homme et la société. Ces deux aspects de la recherche, le fondamental et l’appliqué, loin de s’opposer, sont complémentaires l’un de l’autre. La recherche fondamentale crée le socle de connaissances à partir duquel naissent les applications et, inversement, les avancées technologiques procurent les outils d’investigation de plus en plus perfectionnés qui conduisent à approfondir nos connaissances fondamentales. diff --git a/config/locales/research/fr.yml b/config/locales/research/fr.yml index 6b9872882..230046973 100644 --- a/config/locales/research/fr.yml +++ b/config/locales/research/fr.yml @@ -9,11 +9,11 @@ fr: one: Chercheur·e other: Chercheur·e·s research/hal/author: - one: Auteur·e HAL - other: Auteur·e·s HAL + one: Auteur·e + other: Auteur·e·s research/hal/publication: - one: Publication HAL - other: Publications HAL + one: Publication + other: Publications research/journal: one: Revue scientifique other: Revues scientifiques @@ -36,11 +36,14 @@ fr: one: Thèse other: Thèses attributes: + research/hal: + description: Publications et auteur·e·s dans la base de données HAL research/hal/author: + description: Profils des chercheur·e·s dans la base de données HAL docid: Identifiant HAL first_name: Prénom - last_name: Nom full_name: Nom complet + last_name: Nom research/hal/publication: description: Publications scientifiques importées automatiquement de HAL docid: Identifiant @@ -96,6 +99,10 @@ fr: laboratory: Laboratoire started_at: Commencée le title: Titre + research/hal: + description: + text: "HAL signifie Hyper Article en Ligne. C’est une plateforme pluridisciplinaire nationale pour le dépôt et la consultation des écrits, travaux et résultats de recherches scientifiques des chercheur·e·s et enseignant·e·s-chercheur·e·s. HAL est un bien commun pour la recherche : Les plus grands organismes de recherche et la majorité des universités françaises ont choisi et soutiennent HAL, une infrastructure publique, pérenne et responsable." + source: HAL.science research: description: text: La recherche scientifique est, à la fois, une démarche créatrice de connaissances motivée par la curiosité pure et une activité génératrice d’innovations qui augmentent les moyens d’action et de diagnostic sur la nature, l’homme et la société. Ces deux aspects de la recherche, le fondamental et l’appliqué, loin de s’opposer, sont complémentaires l’un de l’autre. La recherche fondamentale crée le socle de connaissances à partir duquel naissent les applications et, inversement, les avancées technologiques procurent les outils d’investigation de plus en plus perfectionnés qui conduisent à approfondir nos connaissances fondamentales. diff --git a/db/migrate/20230218162239_remove_hal_from_researchers.rb b/db/migrate/20230218162239_remove_hal_from_researchers.rb new file mode 100644 index 000000000..4680da784 --- /dev/null +++ b/db/migrate/20230218162239_remove_hal_from_researchers.rb @@ -0,0 +1,7 @@ +class RemoveHalFromResearchers < ActiveRecord::Migration[7.0] + def change + remove_column :university_people, :hal_person_identifier + remove_column :university_people, :hal_doc_identifier + remove_column :university_people, :hal_form_identifier + end +end diff --git a/db/schema.rb b/db/schema.rb index 50d6e446f..bb44937d4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_02_18_074127) do +ActiveRecord::Schema[7.0].define(version: 2023_02_18_162239) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -845,9 +845,6 @@ ActiveRecord::Schema[7.0].define(version: 2023_02_18_074127) do t.string "zipcode" t.string "city" t.string "country" - t.string "hal_person_identifier" - t.string "hal_doc_identifier" - t.string "hal_form_identifier" t.string "mastodon" t.uuid "language_id", null: false t.uuid "original_id" diff --git a/test/fixtures/university/people.yml b/test/fixtures/university/people.yml index 877859d4d..c8c32545e 100644 --- a/test/fixtures/university/people.yml +++ b/test/fixtures/university/people.yml @@ -2,44 +2,41 @@ # # Table name: university_people # -# id :uuid not null, primary key -# address :string -# biography :text -# birthdate :date -# city :string -# country :string -# email :string -# first_name :string -# gender :integer -# habilitation :boolean default(FALSE) -# hal_doc_identifier :string -# hal_form_identifier :string -# hal_person_identifier :string -# is_administration :boolean -# is_alumnus :boolean default(FALSE) -# is_author :boolean -# is_researcher :boolean -# is_teacher :boolean -# last_name :string -# linkedin :string -# mastodon :string -# meta_description :text -# name :string -# phone_mobile :string -# phone_personal :string -# phone_professional :string -# slug :string -# summary :text -# tenure :boolean default(FALSE) -# twitter :string -# url :string -# zipcode :string -# created_at :datetime not null -# updated_at :datetime not null -# language_id :uuid not null, indexed -# original_id :uuid indexed -# university_id :uuid not null, indexed -# user_id :uuid indexed +# id :uuid not null, primary key +# address :string +# biography :text +# birthdate :date +# city :string +# country :string +# email :string +# first_name :string +# gender :integer +# habilitation :boolean default(FALSE) +# is_administration :boolean +# is_alumnus :boolean default(FALSE) +# is_author :boolean +# is_researcher :boolean +# is_teacher :boolean +# last_name :string +# linkedin :string +# mastodon :string +# meta_description :text +# name :string +# phone_mobile :string +# phone_personal :string +# phone_professional :string +# slug :string +# summary :text +# tenure :boolean default(FALSE) +# twitter :string +# url :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# language_id :uuid not null, indexed +# original_id :uuid indexed +# university_id :uuid not null, indexed +# user_id :uuid indexed # # Indexes # -- GitLab