Skip to content
Snippets Groups Projects
Unverified Commit 68f9817c authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

menu research

parent 8e9f421c
No related branches found
No related tags found
No related merge requests found
Showing
with 116 additions and 43 deletions
...@@ -76,11 +76,11 @@ GEM ...@@ -76,11 +76,11 @@ GEM
annotate (3.1.1) annotate (3.1.1)
activerecord (>= 3.2, < 7.0) activerecord (>= 3.2, < 7.0)
rake (>= 10.4, < 14.0) rake (>= 10.4, < 14.0)
autoprefixer-rails (10.4.0.0) autoprefixer-rails (10.4.2.0)
execjs (~> 2) execjs (~> 2)
aws-eventstream (1.2.0) aws-eventstream (1.2.0)
aws-partitions (1.543.0) aws-partitions (1.548.0)
aws-sdk-core (3.125.0) aws-sdk-core (3.125.3)
aws-eventstream (~> 1, >= 1.0.2) aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.525.0) aws-partitions (~> 1, >= 1.525.0)
aws-sigv4 (~> 1.1) aws-sigv4 (~> 1.1)
...@@ -88,7 +88,7 @@ GEM ...@@ -88,7 +88,7 @@ GEM
aws-sdk-kms (1.53.0) aws-sdk-kms (1.53.0)
aws-sdk-core (~> 3, >= 3.125.0) aws-sdk-core (~> 3, >= 3.125.0)
aws-sigv4 (~> 1.1) aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.110.0) aws-sdk-s3 (1.111.1)
aws-sdk-core (~> 3, >= 3.125.0) aws-sdk-core (~> 3, >= 3.125.0)
aws-sdk-kms (~> 1) aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4) aws-sigv4 (~> 1.4)
...@@ -96,7 +96,7 @@ GEM ...@@ -96,7 +96,7 @@ GEM
aws-eventstream (~> 1, >= 1.0.2) aws-eventstream (~> 1, >= 1.0.2)
bcrypt (3.1.16) bcrypt (3.1.16)
bindex (0.8.1) bindex (0.8.1)
bootsnap (1.9.3) bootsnap (1.9.4)
msgpack (~> 1.0) msgpack (~> 1.0)
bootstrap (5.1.3) bootstrap (5.1.3)
autoprefixer-rails (>= 9.1.0) autoprefixer-rails (>= 9.1.0)
...@@ -123,7 +123,7 @@ GEM ...@@ -123,7 +123,7 @@ GEM
xpath (~> 3.2) xpath (~> 3.2)
childprocess (4.1.0) childprocess (4.1.0)
concurrent-ruby (1.1.9) concurrent-ruby (1.1.9)
countries (4.1.3) countries (4.2.1)
i18n_data (~> 0.15.0) i18n_data (~> 0.15.0)
sixarm_ruby_unaccent (~> 1.1) sixarm_ruby_unaccent (~> 1.1)
country_select (6.0.0) country_select (6.0.0)
...@@ -154,22 +154,23 @@ GEM ...@@ -154,22 +154,23 @@ GEM
domain_name (0.5.20190701) domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0) unf (>= 0.0.5, < 1.0.0)
encryptor (3.0.0) encryptor (3.0.0)
enum_help (0.0.17) enum_help (0.0.18)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
erubi (1.10.0) erubi (1.10.0)
ethon (0.15.0) ethon (0.15.0)
ffi (>= 1.15.0) ffi (>= 1.15.0)
execjs (2.8.1) execjs (2.8.1)
faraday (1.8.0) faraday (1.9.3)
faraday-em_http (~> 1.0) faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0) faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1) faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0.1) faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0) faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.1) faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0) faraday-patron (~> 1.0)
faraday-rack (~> 1.0) faraday-rack (~> 1.0)
multipart-post (>= 1.2, < 3) faraday-retry (~> 1.0)
ruby2_keywords (>= 0.0.4) ruby2_keywords (>= 0.0.4)
faraday-cookie_jar (0.0.7) faraday-cookie_jar (0.0.7)
faraday (>= 0.8.0) faraday (>= 0.8.0)
...@@ -182,14 +183,17 @@ GEM ...@@ -182,14 +183,17 @@ GEM
faraday-http-cache (2.2.0) faraday-http-cache (2.2.0)
faraday (>= 0.8) faraday (>= 0.8)
faraday-httpclient (1.0.1) faraday-httpclient (1.0.1)
faraday-multipart (1.0.3)
multipart-post (>= 1.2, < 3)
faraday-net_http (1.0.1) faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0) faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0) faraday-patron (1.0.0)
faraday-rack (1.0.0) faraday-rack (1.0.0)
faraday-retry (1.0.3)
faraday_middleware (1.2.0) faraday_middleware (1.2.0)
faraday (~> 1.0) faraday (~> 1.0)
fastimage (2.2.6) fastimage (2.2.6)
ffi (1.15.4) ffi (1.15.5)
figaro (1.2.0) figaro (1.2.0)
thor (>= 0.14.0, < 2) thor (>= 0.14.0, < 2)
front_matter_parser (1.0.1) front_matter_parser (1.0.1)
...@@ -211,7 +215,7 @@ GEM ...@@ -211,7 +215,7 @@ GEM
jbuilder (2.11.5) jbuilder (2.11.5)
actionview (>= 5.0.0) actionview (>= 5.0.0)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
jmespath (1.4.0) jmespath (1.5.0)
jquery-rails (4.4.0) jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3) rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0) railties (>= 4.2.0)
...@@ -234,7 +238,7 @@ GEM ...@@ -234,7 +238,7 @@ GEM
activerecord activerecord
kaminari-core (= 1.2.2) kaminari-core (= 1.2.2)
kaminari-core (1.2.2) kaminari-core (1.2.2)
listen (3.7.0) listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10) rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.13.0) loofah (2.13.0)
...@@ -257,7 +261,7 @@ GEM ...@@ -257,7 +261,7 @@ GEM
method_source (1.0.0) method_source (1.0.0)
mini_magick (4.11.0) mini_magick (4.11.0)
mini_mime (1.1.2) mini_mime (1.1.2)
mini_portile2 (2.6.1) mini_portile2 (2.7.1)
minitest (5.15.0) minitest (5.15.0)
msgpack (1.4.2) msgpack (1.4.2)
multipart-post (2.1.1) multipart-post (2.1.1)
...@@ -266,10 +270,10 @@ GEM ...@@ -266,10 +270,10 @@ GEM
nested_form (0.3.2) nested_form (0.3.2)
nesty (1.0.2) nesty (1.0.2)
nio4r (2.5.8) nio4r (2.5.8)
nokogiri (1.12.5) nokogiri (1.13.1)
mini_portile2 (~> 2.6.1) mini_portile2 (~> 2.7.0)
racc (~> 1.4) racc (~> 1.4)
octokit (4.21.0) octokit (4.22.0)
faraday (>= 0.9) faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3) sawyer (~> 0.8.0, >= 0.5.3)
orm_adapter (0.5.0) orm_adapter (0.5.0)
...@@ -348,7 +352,8 @@ GEM ...@@ -348,7 +352,8 @@ GEM
childprocess (>= 0.5, < 5.0) childprocess (>= 0.5, < 5.0)
rexml (~> 3.2, >= 3.2.5) rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2) rubyzip (>= 1.2.2)
sib-api-v3-sdk (7.5.0) sib-api-v3-sdk (8.0.0)
addressable (~> 2.3, >= 2.3.0)
json (~> 2.1, >= 2.1.0) json (~> 2.1, >= 2.1.0)
typhoeus (~> 1.0, >= 1.0.1) typhoeus (~> 1.0, >= 1.0.1)
simple-navigation (4.3.0) simple-navigation (4.3.0)
...@@ -379,7 +384,7 @@ GEM ...@@ -379,7 +384,7 @@ GEM
actionpack (>= 5.2) actionpack (>= 5.2)
activesupport (>= 5.2) activesupport (>= 5.2)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
thor (1.1.0) thor (1.2.1)
tilt (2.0.10) tilt (2.0.10)
typhoeus (1.4.0) typhoeus (1.4.0)
ethon (>= 0.9.0) ethon (>= 0.9.0)
......
...@@ -73,7 +73,9 @@ class Admin::Communication::WebsitesController < Admin::Communication::Applicati ...@@ -73,7 +73,9 @@ class Admin::Communication::WebsitesController < Admin::Communication::Applicati
def website_params def website_params
params.require(:communication_website).permit( params.require(:communication_website).permit(
:name, :url, :repository, :access_token, :about_type, :about_id, :name, :url, :repository, :access_token, :about_type, :about_id,
:authors_github_directory, :posts_github_directory, :programs_github_directory, :staff_github_directory :authors_github_directory, :posts_github_directory, :programs_github_directory,
:research_articles_github_directory, :research_volumes_github_directory,
:staff_github_directory
) )
end end
end end
...@@ -2,20 +2,22 @@ ...@@ -2,20 +2,22 @@
# #
# Table name: communication_websites # Table name: communication_websites
# #
# id :uuid not null, primary key # id :uuid not null, primary key
# about_type :string # about_type :string
# access_token :string # access_token :string
# authors_github_directory :string default("authors") # authors_github_directory :string default("authors")
# name :string # name :string
# posts_github_directory :string default("posts") # posts_github_directory :string default("posts")
# programs_github_directory :string default("programs") # programs_github_directory :string default("programs")
# repository :string # repository :string
# staff_github_directory :string default("staff") # research_articles_github_directory :string default("articles")
# url :string # research_volumes_github_directory :string default("volumes")
# created_at :datetime not null # staff_github_directory :string default("staff")
# updated_at :datetime not null # url :string
# about_id :uuid # created_at :datetime not null
# university_id :uuid not null # updated_at :datetime not null
# about_id :uuid
# university_id :uuid not null
# #
# Indexes # Indexes
# #
......
...@@ -56,7 +56,11 @@ class Communication::Website::Menu::Item < ApplicationRecord ...@@ -56,7 +56,11 @@ class Communication::Website::Menu::Item < ApplicationRecord
news: 40, news: 40,
news_category: 41, news_category: 41,
news_article: 42, news_article: 42,
staff: 50 staff: 50,
research_volumes: 60,
research_volume: 61,
research_articles: 62,
research_article: 63
}, _prefix: :kind }, _prefix: :kind
validates :title, presence: true validates :title, presence: true
...@@ -81,6 +85,14 @@ class Communication::Website::Menu::Item < ApplicationRecord ...@@ -81,6 +85,14 @@ class Communication::Website::Menu::Item < ApplicationRecord
target = "/#{website.posts_github_directory}" target = "/#{website.posts_github_directory}"
when 'staff' when 'staff'
target = "/#{website.staff_github_directory}" target = "/#{website.staff_github_directory}"
when 'research_volumes'
target = "/#{website.research_volumes_github_directory}"
when 'research_volume'
target = "/#{website.research_volumes_github_directory}#{about.path}"
when 'research_articles'
target = "/#{website.research_articles_github_directory}"
when 'research_article'
target = "/#{website.research_articles_github_directory}#{about.path}"
when 'blank' when 'blank'
target = '' target = ''
else else
...@@ -110,7 +122,9 @@ class Communication::Website::Menu::Item < ApplicationRecord ...@@ -110,7 +122,9 @@ class Communication::Website::Menu::Item < ApplicationRecord
end end
def has_about? def has_about?
kind_page? || kind_program? || kind_news_category? || kind_news_article? kind_page? || kind_program? ||
kind_news_category? || kind_news_article? ||
kind_research_volume? || kind_research_article?
end end
def sync_menu def sync_menu
......
...@@ -45,7 +45,11 @@ module Communication::Website::WithAbouts ...@@ -45,7 +45,11 @@ module Communication::Website::WithAbouts
about_school? ? about.programs : Education::Program.none about_school? ? about.programs : Education::Program.none
end end
def articles def research_volumes
about_journal? ? about.volumes : Research::Journal::Volume.none
end
def research_articles
about_journal? ? about.articles : Research::Journal::Article.none about_journal? ? about.articles : Research::Journal::Article.none
end end
...@@ -58,8 +62,8 @@ module Communication::Website::WithAbouts ...@@ -58,8 +62,8 @@ module Communication::Website::WithAbouts
people += about.university_people_through_administrators people += about.university_people_through_administrators
people += about.university_people_through_administrators.map(&:administrator) people += about.university_people_through_administrators.map(&:administrator)
elsif about_journal? elsif about_journal?
people += articles.collect(&:researchers).flatten people += research_articles.collect(&:researchers).flatten
people += articles.collect(&:researchers).flatten.map(&:researcher) people += research_articles.collect(&:researchers).flatten.map(&:researcher)
end end
end end
people.uniq.compact people.uniq.compact
......
...@@ -68,6 +68,10 @@ class Research::Journal::Article < ApplicationRecord ...@@ -68,6 +68,10 @@ class Research::Journal::Article < ApplicationRecord
"#{ title }" "#{ title }"
end end
def path
"/#{slug}"
end
protected protected
def last_ordered_element def last_ordered_element
......
...@@ -60,7 +60,7 @@ class Research::Journal::Volume < ApplicationRecord ...@@ -60,7 +60,7 @@ class Research::Journal::Volume < ApplicationRecord
end end
def path def path
"#{published_at&.year}/#{slug}" if published_at "/#{published_at&.year}/#{slug}" if published_at
end end
def to_s def to_s
......
...@@ -36,7 +36,7 @@ class University::Person::Researcher < University::Person ...@@ -36,7 +36,7 @@ class University::Person::Researcher < University::Person
end end
def for_website?(website) def for_website?(website)
is_researcher && website.about_journal? && website.articles is_researcher && website.about_journal? && website.research_articles
.joins(:researchers) .joins(:researchers)
.where(university_people: { id: id }) .where(university_people: { id: id })
.any? .any?
......
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
about_collection = collection_tree(@website.categories) about_collection = collection_tree(@website.categories)
elsif item.kind_news_article? elsif item.kind_news_article?
about_collection = @website.posts.ordered.map { |e| { label: e.to_s, id: e.id } } about_collection = @website.posts.ordered.map { |e| { label: e.to_s, id: e.id } }
elsif item.kind_research_volume?
about_collection = @website.research_volumes.ordered.map { |e| { label: e.to_s, id: e.id } }
elsif item.kind_research_article?
about_collection = @website.research_articles.ordered.map { |e| { label: e.to_s, id: e.id } }
end end
else else
about_collection = [] about_collection = []
......
...@@ -44,6 +44,22 @@ function hideAbout() { ...@@ -44,6 +44,22 @@ function hideAbout() {
end end
%> %>
displayAbout('Communication::Website::Post', "<%= j(raw(options.join(''))) %>"); displayAbout('Communication::Website::Post', "<%= j(raw(options.join(''))) %>");
<% elsif @kind == 'research_volume' %>
<%
options = ['<option value="" label=" "></option>']
@website.research_volumes.ordered.each do |volume|
options << "<option value=\"#{volume.id}\">#{volume.to_s}</option>"
end
%>
displayAbout('Research::Journal::Volume', "<%= j(raw(options.join(''))) %>");
<% elsif @kind == 'research_article' %>
<%
options = ['<option value="" label=" "></option>']
@website.research_articles.ordered.each do |article|
options << "<option value=\"#{article.id}\">#{article.to_s}</option>"
end
%>
displayAbout('Research::Journal::Article', "<%= j(raw(options.join(''))) %>");
<% else %> <% else %>
$('.js-url-field').addClass('d-none'); $('.js-url-field').addClass('d-none');
hideAbout(); hideAbout();
......
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
<%= f.input :authors_github_directory %> <%= f.input :authors_github_directory %>
<%= f.input :posts_github_directory %> <%= f.input :posts_github_directory %>
<%= f.input :programs_github_directory %> <%= f.input :programs_github_directory %>
<%= f.input :research_articles_github_directory %>
<%= f.input :research_volumes_github_directory %>
<%= f.input :staff_github_directory %> <%= f.input :staff_github_directory %>
</div> </div>
</div> </div>
......
...@@ -45,6 +45,8 @@ en: ...@@ -45,6 +45,8 @@ en:
name: Name name: Name
posts_github_directory: Posts' GitHub directory posts_github_directory: Posts' GitHub directory
programs_github_directory: Programs' GitHub directory programs_github_directory: Programs' GitHub directory
research_articles_github_directory: Research articles' GitHub directory
research_volumes_github_directory: Research volumes' GitHub directory
staff_github_directory: Staff's GitHub directory staff_github_directory: Staff's GitHub directory
url: URL url: URL
communication/website/author: communication/website/author:
...@@ -141,5 +143,9 @@ en: ...@@ -141,5 +143,9 @@ en:
page: Specific Page page: Specific Page
program: Specific program program: Specific program
programs: Programs index programs: Programs index
research_article: Specific research article
research_articles: Research articles index
research_volume: Specific research volume
research_volumes: Research volumes index
staff: Staff staff: Staff
url: URL url: URL
...@@ -42,6 +42,8 @@ fr: ...@@ -42,6 +42,8 @@ fr:
name: Nom name: Nom
posts_github_directory: Dossier GitHub des actualités posts_github_directory: Dossier GitHub des actualités
programs_github_directory: Dossier GitHub des formations programs_github_directory: Dossier GitHub des formations
research_articles_github_directory: Dossier GitHub des articles de recherche
research_volumes_github_directory: Dossier GitHub des volumes de recherche
staff_github_directory: Dossier GitHub de l'équipe staff_github_directory: Dossier GitHub de l'équipe
url: URL url: URL
communication/website/category: communication/website/category:
...@@ -131,5 +133,9 @@ fr: ...@@ -131,5 +133,9 @@ fr:
page: Page spécifique page: Page spécifique
program: Formation spécifique program: Formation spécifique
programs: Index des formations programs: Index des formations
research_article: Article de recherche spécifique
research_articles: Index des articles de recherche
research_volume: Volume de recherche spécifique
research_volumes: Index des volumes de recherche
staff: Équipe staff: Équipe
url: URL url: URL
class AddResearchGithubDirectoriesToCommunicationWebsites < ActiveRecord::Migration[6.1]
def change
add_column :communication_websites, :research_volumes_github_directory, :string, default: 'volumes'
add_column :communication_websites, :research_articles_github_directory, :string, default: 'articles'
end
end
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2022_01_12_085221) do ActiveRecord::Schema.define(version: 2022_01_13_155300) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto" enable_extension "pgcrypto"
...@@ -327,6 +327,8 @@ ActiveRecord::Schema.define(version: 2022_01_12_085221) do ...@@ -327,6 +327,8 @@ ActiveRecord::Schema.define(version: 2022_01_12_085221) do
t.string "posts_github_directory", default: "posts" t.string "posts_github_directory", default: "posts"
t.string "programs_github_directory", default: "programs" t.string "programs_github_directory", default: "programs"
t.string "staff_github_directory", default: "staff" t.string "staff_github_directory", default: "staff"
t.string "research_volumes_github_directory", default: "volumes"
t.string "research_articles_github_directory", default: "articles"
t.index ["about_type", "about_id"], name: "index_communication_websites_on_about" t.index ["about_type", "about_id"], name: "index_communication_websites_on_about"
t.index ["university_id"], name: "index_communication_websites_on_university_id" t.index ["university_id"], name: "index_communication_websites_on_university_id"
end end
......
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