diff --git a/app/models/communication/website/page/research_hal_publication.rb b/app/models/communication/website/page/research_hal_publication.rb new file mode 100644 index 0000000000000000000000000000000000000000..0c4f6e9f1ea3af5860b7115e1156f9a86a2e9783 --- /dev/null +++ b/app/models/communication/website/page/research_hal_publication.rb @@ -0,0 +1,23 @@ +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 diff --git a/app/models/communication/website/page/with_type.rb b/app/models/communication/website/page/with_type.rb index c60722771519df44324689112b0b490e2e23d521..dd1333e11bd8de027a238c2237c6ba93708f984b 100644 --- a/app/models/communication/website/page/with_type.rb +++ b/app/models/communication/website/page/with_type.rb @@ -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, diff --git a/app/models/communication/website/permalink/publication.rb b/app/models/communication/website/permalink/publication.rb new file mode 100644 index 0000000000000000000000000000000000000000..6eca77b20e4e5b8303936527553d37514bd2891d --- /dev/null +++ b/app/models/communication/website/permalink/publication.rb @@ -0,0 +1,26 @@ +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 diff --git a/app/models/communication/website/with_connected_objects.rb b/app/models/communication/website/with_connected_objects.rb index edcd2e610ac3b61d476e40664b7cd643c32fc2ff..92da5f081dbc6397056a07dc2c632ee297d94d0c 100644 --- a/app/models/communication/website/with_connected_objects.rb +++ b/app/models/communication/website/with_connected_objects.rb @@ -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 diff --git a/app/models/concerns/with_translations.rb b/app/models/concerns/with_translations.rb index 50d90c41243c6b321629814a5021c3c45a935fdb..761aa5a40526e3de3dce3fd9b50b3bc61cd3b340 100644 --- a/app/models/concerns/with_translations.rb +++ b/app/models/concerns/with_translations.rb @@ -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) diff --git a/app/models/education/school.rb b/app/models/education/school.rb index 81467db462a229a5df7832c346bad8de34ca1cee..9941eb6814f472623dcfd99f20bc50ab1e37eaf9 100644 --- a/app/models/education/school.rb +++ b/app/models/education/school.rb @@ -75,7 +75,8 @@ class Education::School < ApplicationRecord active_storage_blobs + programs + diplomas + - administrators.map(&:administrator) + administrators.map(&:administrator) + + researchers.map(&:researcher) end ##################### diff --git a/app/models/research/hal/publication.rb b/app/models/research/hal/publication.rb index 65c90848787e633bee102d433495418f873e54f7..913b1dc2b9fe5bf9b7b2a98861dfdfd432c2cab6 100644 --- a/app/models/research/hal/publication.rb +++ b/app/models/research/hal/publication.rb @@ -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 diff --git a/app/models/university/person/researcher.rb b/app/models/university/person/researcher.rb index 6fbd666ad02fadd718e0c2390fe702851f926757..43c4da82367f84cb65a36fe571f32b96bd3ece62 100644 --- a/app/models/university/person/researcher.rb +++ b/app/models/university/person/researcher.rb @@ -66,7 +66,8 @@ class University::Person::Researcher < University::Person end def dependencies - [person] + [person] + + research_hal_publications end def references diff --git a/app/views/admin/research/hal/publications/static.html.erb b/app/views/admin/research/hal/publications/static.html.erb index 8a0b146c6560ee2c33009db84b5d3523f81d374c..e86bfcff2141013ec8367074c8195109fd82fb6e 100644 --- a/app/views/admin/research/hal/publications/static.html.erb +++ b/app/views/admin/research/hal/publications/static.html.erb @@ -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: diff --git a/config/application.sample.yml b/config/application.sample.yml index 998c1a2b9f7e6a66e11b3daf282e9b2c661261ef..5e3269d246b7d2fdc8139cd4d3f24f1bced034be 100644 --- a/config/application.sample.yml +++ b/config/application.sample.yml @@ -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: +