diff --git a/app/models/communication/extranet.rb b/app/models/communication/extranet.rb index 1a4615b3d6c6865f180dd318b43f9c1268235907..0dc31636314ab864924471003317609996665e7c 100644 --- a/app/models/communication/extranet.rb +++ b/app/models/communication/extranet.rb @@ -2,35 +2,34 @@ # # Table name: communication_extranets # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# allow_experiences_modification :boolean default(TRUE) -# color :string -# cookies_policy :text -# css :text -# feature_alumni :boolean default(FALSE) -# feature_contacts :boolean default(FALSE) -# feature_jobs :boolean default(FALSE) -# feature_library :boolean default(FALSE) -# feature_posts :boolean default(FALSE) -# has_sso :boolean default(FALSE) -# home_sentence :text -# host :string -# name :string -# privacy_policy :text -# registration_contact :string -# sass :text -# sso_button_label :string -# sso_cert :text -# sso_mapping :jsonb -# sso_name_identifier_format :string -# sso_provider :integer default("saml") -# sso_target_url :string -# terms :text -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# color :string +# cookies_policy :text +# css :text +# feature_alumni :boolean default(FALSE) +# feature_contacts :boolean default(FALSE) +# feature_jobs :boolean default(FALSE) +# feature_library :boolean default(FALSE) +# feature_posts :boolean default(FALSE) +# has_sso :boolean default(FALSE) +# home_sentence :text +# host :string +# name :string +# privacy_policy :text +# registration_contact :string +# sass :text +# sso_button_label :string +# sso_cert :text +# sso_mapping :jsonb +# sso_name_identifier_format :string +# sso_provider :integer default("saml") +# sso_target_url :string +# terms :text +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# university_id :uuid not null, indexed # # Indexes # diff --git a/app/models/communication/website.rb b/app/models/communication/website.rb index be1dea930f4fd74ca200f261ac669a6d443cacd2..5762b6d2202412cf495a28da5f7a7ac56f8880f6 100644 --- a/app/models/communication/website.rb +++ b/app/models/communication/website.rb @@ -2,25 +2,26 @@ # # Table name: communication_websites # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# access_token :string -# git_branch :string -# git_endpoint :string -# git_provider :integer default("github") -# in_production :boolean default(FALSE) -# name :string -# plausible_url :string -# repository :string -# style :text -# style_updated_at :date -# theme_version :string default("NA") -# url :string -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# default_language_id :uuid not null, indexed -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# access_token :string +# deployment_status_badge :text +# git_branch :string +# git_endpoint :string +# git_provider :integer default("github") +# in_production :boolean default(FALSE) +# name :string +# plausible_url :string +# repository :string +# style :text +# style_updated_at :date +# theme_version :string default("NA") +# url :string +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# default_language_id :uuid not null, indexed +# university_id :uuid not null, indexed # # Indexes # diff --git a/app/models/communication/website/configs/base.rb b/app/models/communication/website/configs/base.rb index 2cc59f41047c557dfa03aff67084dae40f353934..b14fd096b81c949010d47183ce85d759c7d77704 100644 --- a/app/models/communication/website/configs/base.rb +++ b/app/models/communication/website/configs/base.rb @@ -2,25 +2,26 @@ # # Table name: communication_websites # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# access_token :string -# git_branch :string -# git_endpoint :string -# git_provider :integer default("github") -# in_production :boolean default(FALSE) -# name :string -# plausible_url :string -# repository :string -# style :text -# style_updated_at :date -# theme_version :string default("NA") -# url :string -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# default_language_id :uuid not null, indexed -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# access_token :string +# deployment_status_badge :text +# git_branch :string +# git_endpoint :string +# git_provider :integer default("github") +# in_production :boolean default(FALSE) +# name :string +# plausible_url :string +# repository :string +# style :text +# style_updated_at :date +# theme_version :string default("NA") +# url :string +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# default_language_id :uuid not null, indexed +# university_id :uuid not null, indexed # # Indexes # diff --git a/app/models/communication/website/configs/default_languages.rb b/app/models/communication/website/configs/default_languages.rb index 53bac0a2bf5a7c489521235808b397348d8fa813..14a78fdd45b56d6b550a0f92d44e07ba14d9e8fb 100644 --- a/app/models/communication/website/configs/default_languages.rb +++ b/app/models/communication/website/configs/default_languages.rb @@ -2,25 +2,26 @@ # # Table name: communication_websites # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# access_token :string -# git_branch :string -# git_endpoint :string -# git_provider :integer default("github") -# in_production :boolean default(FALSE) -# name :string -# plausible_url :string -# repository :string -# style :text -# style_updated_at :date -# theme_version :string default("NA") -# url :string -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# default_language_id :uuid not null, indexed -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# access_token :string +# deployment_status_badge :text +# git_branch :string +# git_endpoint :string +# git_provider :integer default("github") +# in_production :boolean default(FALSE) +# name :string +# plausible_url :string +# repository :string +# style :text +# style_updated_at :date +# theme_version :string default("NA") +# url :string +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# default_language_id :uuid not null, indexed +# university_id :uuid not null, indexed # # Indexes # diff --git a/app/models/communication/website/configs/default_permalinks.rb b/app/models/communication/website/configs/default_permalinks.rb index c0feec9c1b9375f9c19499e56634a9af64f35d79..9251792cd61b14941324c492b084fa49375a5ae0 100644 --- a/app/models/communication/website/configs/default_permalinks.rb +++ b/app/models/communication/website/configs/default_permalinks.rb @@ -2,25 +2,26 @@ # # Table name: communication_websites # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# access_token :string -# git_branch :string -# git_endpoint :string -# git_provider :integer default("github") -# in_production :boolean default(FALSE) -# name :string -# plausible_url :string -# repository :string -# style :text -# style_updated_at :date -# theme_version :string default("NA") -# url :string -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# default_language_id :uuid not null, indexed -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# access_token :string +# deployment_status_badge :text +# git_branch :string +# git_endpoint :string +# git_provider :integer default("github") +# in_production :boolean default(FALSE) +# name :string +# plausible_url :string +# repository :string +# style :text +# style_updated_at :date +# theme_version :string default("NA") +# url :string +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# default_language_id :uuid not null, indexed +# university_id :uuid not null, indexed # # Indexes # diff --git a/app/models/communication/website/configs/development_config.rb b/app/models/communication/website/configs/development_config.rb index e6c253f00e3a39818515f760ee531b5e0ed8e27e..b6f29a2359c48289a1d05ee59e224840199e9e87 100644 --- a/app/models/communication/website/configs/development_config.rb +++ b/app/models/communication/website/configs/development_config.rb @@ -2,25 +2,26 @@ # # Table name: communication_websites # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# access_token :string -# git_branch :string -# git_endpoint :string -# git_provider :integer default("github") -# in_production :boolean default(FALSE) -# name :string -# plausible_url :string -# repository :string -# style :text -# style_updated_at :date -# theme_version :string default("NA") -# url :string -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# default_language_id :uuid not null, indexed -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# access_token :string +# deployment_status_badge :text +# git_branch :string +# git_endpoint :string +# git_provider :integer default("github") +# in_production :boolean default(FALSE) +# name :string +# plausible_url :string +# repository :string +# style :text +# style_updated_at :date +# theme_version :string default("NA") +# url :string +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# default_language_id :uuid not null, indexed +# university_id :uuid not null, indexed # # Indexes # diff --git a/app/models/communication/website/configs/production_config.rb b/app/models/communication/website/configs/production_config.rb index 7a5ca3cd6d3a37e17f4c4e73cccf528715b36702..0761e697239a98038c5d61ce351f47e37fc5dab5 100644 --- a/app/models/communication/website/configs/production_config.rb +++ b/app/models/communication/website/configs/production_config.rb @@ -2,25 +2,26 @@ # # Table name: communication_websites # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# access_token :string -# git_branch :string -# git_endpoint :string -# git_provider :integer default("github") -# in_production :boolean default(FALSE) -# name :string -# plausible_url :string -# repository :string -# style :text -# style_updated_at :date -# theme_version :string default("NA") -# url :string -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# default_language_id :uuid not null, indexed -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# access_token :string +# deployment_status_badge :text +# git_branch :string +# git_endpoint :string +# git_provider :integer default("github") +# in_production :boolean default(FALSE) +# name :string +# plausible_url :string +# repository :string +# style :text +# style_updated_at :date +# theme_version :string default("NA") +# url :string +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# default_language_id :uuid not null, indexed +# university_id :uuid not null, indexed # # Indexes # diff --git a/app/models/research/hal/publication.rb b/app/models/research/hal/publication.rb index 9682b57fb4da7b323272410c52ad7705777e7a09..65c90848787e633bee102d433495418f873e54f7 100644 --- a/app/models/research/hal/publication.rb +++ b/app/models/research/hal/publication.rb @@ -3,10 +3,15 @@ # Table name: research_hal_publications # # id :uuid not null, primary key +# abstract :text +# citation_full :text # data :jsonb # docid :string indexed # doi :string +# file :text # hal_url :string +# journal_title :string +# open_access :boolean # publication_date :date # ref :string # slug :string @@ -43,10 +48,15 @@ class Research::Hal::Publication < ApplicationRecord 'docid', 'title_s', 'citationRef_s', + 'citationFull_s', 'uri_s', 'doiId_s', 'publicationDate_tdate', 'linkExtUrl_s', + 'abstract_s', + 'openAccess_bool', + 'journalTitle_s', + 'files_s' # '*', ] publications = [] @@ -63,10 +73,15 @@ class Research::Hal::Publication < ApplicationRecord puts "HAL sync publication #{doc.docid}" publication.title = Osuny::Sanitizer.sanitize doc.title_s.first, 'string' publication.ref = doc.attributes['citationRef_s'] + publication.citation_full = doc.attributes['citationFull_s'] + publication.abstract = doc.attributes['abstract_s']&.first publication.hal_url = doc.attributes['uri_s'] publication.doi = doc.attributes['doiId_s'] publication.publication_date = doc.attributes['publicationDate_tdate'] publication.url = doc.attributes['linkExtUrl_s'] + publication.open_access = doc.attributes['openAccess_bool'] + publication.journal_title = doc.attributes['journalTitle_s'] + publication.file = doc.attributes['files_s']&.first publication.save publication end diff --git a/app/views/admin/research/hal/publications/show.html.erb b/app/views/admin/research/hal/publications/show.html.erb index 5c84a479d4022d96e45562ce5a8e1e5905371664..da9578ae684431b314a4035dec57694c8afee425 100644 --- a/app/views/admin/research/hal/publications/show.html.erb +++ b/app/views/admin/research/hal/publications/show.html.erb @@ -2,8 +2,20 @@ <div class="row"> <div class="col-lg-8"> - <p class="lead mb-4"><%= sanitize @publication.ref %></p> + <% if @publication.abstract.present? %> + <p class="lead mb-5"> + <%= sanitize @publication.abstract %> + </p> + <% end %> <div class="row"> + <div class="col-lg-6"> + <%= osuny_label Research::Hal::Publication.human_attribute_name('citation_full') %> + <p><%= sanitize @publication.citation_full %></p> + </div> + <div class="col-lg-6"> + <%= osuny_label Research::Hal::Publication.human_attribute_name('ref') %> + <p><%= sanitize @publication.ref %></p> + </div> <div class="col-lg-6"> <%= osuny_label Research::Hal::Publication.human_attribute_name('docid') %> <p><%= @publication.docid %></p> @@ -12,6 +24,10 @@ <%= osuny_label Research::Hal::Publication.human_attribute_name('publication_date') %> <p><%= l @publication.publication_date %></p> </div> + <div class="col-lg-6"> + <%= osuny_label Research::Hal::Publication.human_attribute_name('open_access') %> + <p><%= t @publication.open_access %></p> + </div> </div> </div> <div class="col-lg-4"> @@ -35,7 +51,7 @@ </div> </div> -<% [:url, :hal_url, :doi_url].each do |key| %> +<% [:url, :hal_url, :doi_url, :file].each do |key| %> <% value = @publication.send key %> <% next if value.blank? %> <%= osuny_label Research::Hal::Publication.human_attribute_name(key) %> diff --git a/app/views/admin/research/hal/publications/static.html.erb b/app/views/admin/research/hal/publications/static.html.erb index 5910efe141522de01b82ee8447c1558390ce224e..8a0b146c6560ee2c33009db84b5d3523f81d374c 100644 --- a/app/views/admin/research/hal/publications/static.html.erb +++ b/app/views/admin/research/hal/publications/static.html.erb @@ -3,12 +3,17 @@ title: "<%= @about.title %>" date: "<%= @about.publication_date&.iso8601 %>" slug: "<%= @about.slug %>" docid: "<%= @about.docid %>" -ref: > +abstract: >- + <%= prepare_html_for_static @about.abstract, current_university %> +citation_full: >- + <%= prepare_html_for_static @about.citation_full, current_university %> +ref: >- <%= sanitize @about.ref %> url: hal: "<%= @about.hal_url %>" doi: "<%= @about.doi_url %>" raw: "<%= @about.url %>" + file: "<%= @about.file %>" researchers: <% @about.researchers.each do |researcher| %> - <%= researcher.slug %> diff --git a/app/views/admin/university/people/researchers/_researcher.html.erb b/app/views/admin/university/people/researchers/_researcher.html.erb index d79fa151e8ef1e81602c753dd175c591f542e032..cfea76c9135439d0efa35d439752b0836093a947 100644 --- a/app/views/admin/university/people/researchers/_researcher.html.erb +++ b/app/views/admin/university/people/researchers/_researcher.html.erb @@ -1,8 +1,10 @@ <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"> + <% if researcher.best_picture.attached? %> + <div class="me-3" style="width: 80px"> + <%= kamifusen_tag researcher.best_picture, width: 80, class: 'img-circle' %> + </div> + <% end %> + <div> <%= link_to researcher, admin_research_researcher_path(researcher), class: 'stretched-link' %> </div> </article> diff --git a/db/migrate/20230705073214_add_fields_to_research_hal_publication.rb b/db/migrate/20230705073214_add_fields_to_research_hal_publication.rb new file mode 100644 index 0000000000000000000000000000000000000000..680756b70fb3f876f9dfd098dc156e9b4a3a2dc4 --- /dev/null +++ b/db/migrate/20230705073214_add_fields_to_research_hal_publication.rb @@ -0,0 +1,9 @@ +class AddFieldsToResearchHalPublication < ActiveRecord::Migration[7.0] + def change + add_column :research_hal_publications, :citation_full, :text + add_column :research_hal_publications, :open_access, :boolean + add_column :research_hal_publications, :abstract, :text + add_column :research_hal_publications, :journal_title, :string + add_column :research_hal_publications, :file, :text + end +end diff --git a/db/schema.rb b/db/schema.rb index 548674c3aa1144c91760977417adf4b1fe8b34d7..aa152d1d03a34d5fd473958ded55f877bb0df390 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_07_04_113222) do +ActiveRecord::Schema[7.0].define(version: 2023_07_05_073214) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -738,6 +738,11 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_04_113222) do t.date "publication_date" t.string "doi" t.string "slug" + t.text "citation_full" + t.boolean "open_access" + t.text "abstract" + t.string "journal_title" + t.text "file" t.index ["docid"], name: "index_research_hal_publications_on_docid" end diff --git a/test/fixtures/communication/extranets.yml b/test/fixtures/communication/extranets.yml index 5b00f559b78ac19b9a3871e2736923e92e325c4b..c4a72564511a4905256b44eff1b90d9ad95d76db 100644 --- a/test/fixtures/communication/extranets.yml +++ b/test/fixtures/communication/extranets.yml @@ -2,35 +2,34 @@ # # Table name: communication_extranets # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# allow_experiences_modification :boolean default(TRUE) -# color :string -# cookies_policy :text -# css :text -# feature_alumni :boolean default(FALSE) -# feature_contacts :boolean default(FALSE) -# feature_jobs :boolean default(FALSE) -# feature_library :boolean default(FALSE) -# feature_posts :boolean default(FALSE) -# has_sso :boolean default(FALSE) -# home_sentence :text -# host :string -# name :string -# privacy_policy :text -# registration_contact :string -# sass :text -# sso_button_label :string -# sso_cert :text -# sso_mapping :jsonb -# sso_name_identifier_format :string -# sso_provider :integer default("saml") -# sso_target_url :string -# terms :text -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# color :string +# cookies_policy :text +# css :text +# feature_alumni :boolean default(FALSE) +# feature_contacts :boolean default(FALSE) +# feature_jobs :boolean default(FALSE) +# feature_library :boolean default(FALSE) +# feature_posts :boolean default(FALSE) +# has_sso :boolean default(FALSE) +# home_sentence :text +# host :string +# name :string +# privacy_policy :text +# registration_contact :string +# sass :text +# sso_button_label :string +# sso_cert :text +# sso_mapping :jsonb +# sso_name_identifier_format :string +# sso_provider :integer default("saml") +# sso_target_url :string +# terms :text +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# university_id :uuid not null, indexed # # Indexes # diff --git a/test/fixtures/communication/websites.yml b/test/fixtures/communication/websites.yml index 8f739d38af84415d173df302117170720604e07d..1a331e18999b2829449964614d8d0c01ffb3b5fb 100644 --- a/test/fixtures/communication/websites.yml +++ b/test/fixtures/communication/websites.yml @@ -2,25 +2,26 @@ # # Table name: communication_websites # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# access_token :string -# git_branch :string -# git_endpoint :string -# git_provider :integer default("github") -# in_production :boolean default(FALSE) -# name :string -# plausible_url :string -# repository :string -# style :text -# style_updated_at :date -# theme_version :string default("NA") -# url :string -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# default_language_id :uuid not null, indexed -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# access_token :string +# deployment_status_badge :text +# git_branch :string +# git_endpoint :string +# git_provider :integer default("github") +# in_production :boolean default(FALSE) +# name :string +# plausible_url :string +# repository :string +# style :text +# style_updated_at :date +# theme_version :string default("NA") +# url :string +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# default_language_id :uuid not null, indexed +# university_id :uuid not null, indexed # # Indexes # diff --git a/test/fixtures/research/hal/publications.yml b/test/fixtures/research/hal/publications.yml index 8580abd33e5ddfa09d5929af7d96930803a92e87..e94b3c2eadf87e2a671f983703cc5bfa786f3591 100644 --- a/test/fixtures/research/hal/publications.yml +++ b/test/fixtures/research/hal/publications.yml @@ -3,10 +3,15 @@ # Table name: research_hal_publications # # id :uuid not null, primary key +# abstract :text +# citation_full :text # data :jsonb # docid :string indexed # doi :string +# file :text # hal_url :string +# journal_title :string +# open_access :boolean # publication_date :date # ref :string # slug :string