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

publications exported

parent dc2c5481
No related branches found
No related tags found
No related merge requests found
class Communication::Website::Page::ResearchHalPublication < Communication::Website::Page
def editable_width?
false
end
def full_width_by_default?
true
end
def dependencies
super +
[website.config_default_languages] +
website.connected_hal_publications
end
protected
def current_git_path
@current_git_path ||= "#{git_path_prefix}publications/_index.html"
end
end
......@@ -17,6 +17,7 @@ module Communication::Website::Page::WithType
# Research
Communication::Website::Page::ResearchVolume,
Communication::Website::Page::ResearchPaper,
Communication::Website::Page::ResearchHalPublication,
# People facets
Communication::Website::Page::Administrator,
Communication::Website::Page::Author,
......
class Communication::Website::Permalink::Publication < Communication::Website::Permalink
def self.required_in_config?(website)
website.has_communication_posts?
end
def self.static_config_key
:publications
end
def self.pattern_in_website(website, language)
"/#{website.special_page(Communication::Website::Page::ResearchHalPublication, language: language).slug_with_ancestors}/:year/:slug/"
end
protected
def published?
website.id == about.communication_website_id && about.published && about.published_at
end
def substitutions
{
year: about.publication_date.strftime("%Y"),
slug: about.slug
}
end
end
......@@ -69,6 +69,11 @@ module Communication::Website::WithConnectedObjects
University::Organization.where(id: ids)
end
def connected_hal_publications
ids = connections.where(indirect_object_type: 'Research::Hal::Publication').pluck(:indirect_object_id)
Research::Hal::Publication.where(id: ids)
end
# ensure the object "website" respond to both is_direct_object? and is_indirect_object? as website doesn't include neither as_direct_object nor as_indirect_object
def is_direct_object?
true
......
......@@ -94,6 +94,8 @@ module WithTranslations
filename: public_send(attachment_name).filename.to_s,
content_type: public_send(attachment_name).content_type
)
rescue
# Missing attachment
end
def translate_additional_data!(translation)
......
......@@ -75,7 +75,8 @@ class Education::School < ApplicationRecord
active_storage_blobs +
programs +
diplomas +
administrators.map(&:administrator)
administrators.map(&:administrator) +
researchers.map(&:researcher)
end
#####################
......
......@@ -87,7 +87,11 @@ class Research::Hal::Publication < ApplicationRecord
end
def template_static
"admin/research/publications/static"
"admin/research/hal/publications/static"
end
def git_path(website)
"#{git_path_content_prefix(website)}publications/#{created_at.year}/#{slug}.html" if for_website?(website)
end
def doi_url
......
......@@ -66,7 +66,8 @@ class University::Person::Researcher < University::Person
end
def dependencies
[person]
[person] +
research_hal_publications
end
def references
......
......@@ -4,9 +4,9 @@ date: "<%= @about.publication_date&.iso8601 %>"
slug: "<%= @about.slug %>"
docid: "<%= @about.docid %>"
abstract: >-
<%= prepare_html_for_static @about.abstract, current_university %>
<%= prepare_html_for_static @about.abstract, @website.university %>
citation_full: >-
<%= prepare_html_for_static @about.citation_full, current_university %>
<%= prepare_html_for_static @about.citation_full, @website.university %>
ref: >-
<%= sanitize @about.ref %>
url:
......
......@@ -35,6 +35,8 @@ UNSPLASH_ACCESS_KEY:
UNSPLASH_SECRET:
PEXELS_API_KEY:
MAINTENANCE: "false"
# Pour les tests automatisés
TEST_GITHUB_BRANCH:
TEST_GITHUB_ENDPOINT: '' # no use for github
......@@ -45,3 +47,4 @@ TEST_GITLAB_BRANCH:
TEST_GITLAB_ENDPOINT:
TEST_GITLAB_TOKEN:
TEST_GITLAB_REPOSITORY:
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