Skip to content
Snippets Groups Projects
Commit 398fd60e authored by Arnaud Levy's avatar Arnaud Levy
Browse files

Issue #948

parent da9e0f68
No related branches found
No related tags found
No related merge requests found
......@@ -72,7 +72,7 @@ class Admin::Research::Journals::PapersController < Admin::Research::Journals::A
params.require(:research_journal_paper)
.permit(
:title, :slug, :text, :published, :published_at, :received_at, :accepted_at,
:summary, :abstract, :meta_description,
:summary, :abstract, :meta_description, :doi,
:pdf, :references, :keywords, :research_journal_volume_id, :kind_id, person_ids: [])
.merge(university_id: current_university.id)
end
......
......@@ -24,8 +24,6 @@ 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',
......@@ -77,8 +75,7 @@ class Research::Hal::Publication < ApplicationRecord
end
def doi_url
return unless doi.present?
"#{DOI_PREFIX}#{doi}"
Doi.url doi
end
def best_url
......
......@@ -5,6 +5,7 @@
# id :uuid not null, primary key
# abstract :text
# accepted_at :date
# doi :string
# keywords :text
# meta_description :text
# position :integer
......@@ -96,6 +97,10 @@ class Research::Journal::Paper < ApplicationRecord
dependencies.flatten.compact
end
def doi_url
Doi.url doi
end
def to_s
"#{ title }"
end
......
class Doi
PREFIX = 'https://dx.doi.org/'.freeze
def self.url(doi)
return nil if doi.blank?
return doi if PREFIX.in?(doi)
"#{PREFIX}#{doi}"
end
end
\ No newline at end of file
......@@ -8,6 +8,7 @@
<%= f.input :title, as: :text, input_html: { rows: 3 } %>
<%= f.input :abstract, as: :text, input_html: { rows: 8 } %>
<%= f.input :pdf %>
<%= f.input :doi %>
<%= f.input :text,
as: :summernote,
input_html: {
......
......@@ -9,6 +9,10 @@
<%= osuny_label Research::Journal::Paper.human_attribute_name('pdf') %>
<p><%= link_to @paper.pdf.filename, url_for(@paper.pdf) %></p>
<% end %>
<% if @paper.doi.present?%>
<%= osuny_label Research::Journal::Paper.human_attribute_name('doi') %>
<p><%= link_to @paper.doi_url, @paper.doi_url, target: :_blank %></p>
<% end %>
<% if has_content?(@paper.text)%>
<%= osuny_label Research::Journal::Paper.human_attribute_name('text') %>
<%= sanitize @paper.text %>
......
......@@ -57,6 +57,7 @@ en:
title: Title
research/journal/paper:
abstract: Abstract
doi: DOI
keywords: Keywords
pdf: PDF
published: Published?
......@@ -113,5 +114,7 @@ en:
select_identifier: Select all the HAL authors that correspond to this researcher. Use the publications to be sure it's the same person.
simple_form:
hints:
research_journal_paper:
doi: "You can type the DOI identifier without https://, for example “10.19182/perspective/31918”"
research_journal_volume:
cover: JPG or PNG file
......@@ -58,6 +58,7 @@ fr:
title: Titre
research/journal/paper:
abstract: Extrait
doi: DOI
keywords: Mots clés
pdf: PDF
published: Publié ?
......@@ -113,5 +114,7 @@ fr:
select_identifier: Choisissez tou·te·s les auteur·e·s HAL correspondant à cette personne. Appuyez-vous sur les publications pour vérifier qu'il s'agit de la bonne personne.
simple_form:
hints:
research_journal_paper:
doi: "Vous pouvez saisir l'identifiant DOI sans https://, par exemple “10.19182/perspective/31918”"
research_journal_volume:
cover: Fichier JPG ou PNG
class AddDoiToResearchJournalPaper < ActiveRecord::Migration[7.0]
def change
add_column :research_journal_papers, :doi, :string
end
end
......@@ -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_03_15_142604) do
ActiveRecord::Schema[7.0].define(version: 2023_03_15_170508) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"
......@@ -758,6 +758,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_03_15_142604) do
t.uuid "kind_id"
t.date "received_at"
t.date "accepted_at"
t.string "doi"
t.index ["kind_id"], name: "index_research_journal_papers_on_kind_id"
t.index ["research_journal_id"], name: "index_research_journal_papers_on_research_journal_id"
t.index ["research_journal_volume_id"], name: "index_research_journal_papers_on_research_journal_volume_id"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment