diff --git a/app/models/communication/website.rb b/app/models/communication/website.rb index dc939770197e5d782eb77a4b383dfde968f0944e..c41cac826474e3dfc420fe3c9bb66f92960ab53a 100644 --- a/app/models/communication/website.rb +++ b/app/models/communication/website.rb @@ -32,7 +32,7 @@ class Communication::Website < ApplicationRecord dependent: :destroy def self.about_types - [nil, Research::Journal.name] + [nil, Education::School.name, Research::Journal.name] end def domain_url diff --git a/app/models/education/school.rb b/app/models/education/school.rb index f5352ef5a6e0644f899173dca02bf6777c94b60e..422d7f10269ad1fe0e85a650feee8c3a381f9cd2 100644 --- a/app/models/education/school.rb +++ b/app/models/education/school.rb @@ -24,6 +24,7 @@ # class Education::School < ApplicationRecord belongs_to :university + has_one :website, class_name: 'Communication::Website', foreign_key: :about def to_s "#{name}" diff --git a/app/views/admin/communication/websites/_form.html.erb b/app/views/admin/communication/websites/_form.html.erb index 3ad7c36fae29967d3ecf8cdc7fa32781fa9bf8db..c9cf878a4fe8a23da656a555ea3cb0e62c0f947c 100644 --- a/app/views/admin/communication/websites/_form.html.erb +++ b/app/views/admin/communication/websites/_form.html.erb @@ -13,6 +13,8 @@ case website.about_type when Research::Journal.name collection = current_university.research_journals + when Education::School.name + collection = current_university.education_schools end %> <%= f.input :about_id, diff --git a/app/views/admin/communication/websites/show.html.erb b/app/views/admin/communication/websites/show.html.erb index 2a7724826a8ae3cb0517631b1d62863ade529b03..38ef5110d548bba347ed370cafe498d5600e0caa 100644 --- a/app/views/admin/communication/websites/show.html.erb +++ b/app/views/admin/communication/websites/show.html.erb @@ -1,9 +1,11 @@ <% content_for :title, @website %> <% content_for :title_right do %> - <%= link_to @website.domain_url, @website.domain_url, target: :_blank %><br> + <% unless @website.domain.blank? %> + <%= link_to @website.domain_url, @website.domain_url, target: :_blank %><br> + <% end %> <%= I18n.t("activerecord.attributes.communication/website.about_#{@website.about_type}") %> - <%= link_to @website.about, [:admin, @website.about] unless @website.about.nil? %> + (<%= link_to @website.about, [:admin, @website.about] unless @website.about.nil? %>) <% end %> <div class="card mt-5"> diff --git a/app/views/admin/education/schools/show.html.erb b/app/views/admin/education/schools/show.html.erb index 94882003380bd2d36c2c0cea903f0c5aeefef19c..2947ba58b407a651e38fbc0e1a673a89f416b974 100644 --- a/app/views/admin/education/schools/show.html.erb +++ b/app/views/admin/education/schools/show.html.erb @@ -1,5 +1,13 @@ <% content_for :title, @school %> +<% content_for :title_right do %> + <% if @school.website %> + <%= Communication::Website.model_name.human %> + <i class="fas fa-arrow-right small"></i> + <%= link_to @school.website, [:admin, @school.website] %><br> + <% end %> +<% end %> + <p> <%= @school.address %><br> <%= @school.zipcode %> <%= @school.city %><br> diff --git a/app/views/admin/research/journals/show.html.erb b/app/views/admin/research/journals/show.html.erb index 5104e350588650535d6b1d337d9166bda46675a7..674a37a04f68355ec1d1953767ba39e0d96538c3 100644 --- a/app/views/admin/research/journals/show.html.erb +++ b/app/views/admin/research/journals/show.html.erb @@ -1,14 +1,15 @@ <% content_for :title, @journal %> -<p>ISSN : <%= @journal.issn %></p> - -<% if @journal.website %> - <p> - Site : - <%= link_to @journal.website, [:admin, @journal.website] %> - </p> +<% content_for :title_right do %> + <% if @journal.website %> + <%= Communication::Website.model_name.human %> + <i class="fas fa-arrow-right small"></i> + <%= link_to @journal.website, [:admin, @journal.website] %><br> + <% end %> + <% if @journal.issn %><%= Research::Journal.human_attribute_name('issn') %> <%= @journal.issn %><% end %> <% end %> + <div class="card mt-5"> <div class="card-header"> <div class="float-end"> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index 1484428fb5382715dc9073b078be803d202e159f..436711bfce5cea3ccc7ae8b709e123cc66a95720 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -40,7 +40,7 @@ en: about_type: About about_: Nothing (independent website) about_Research::Journal: Journal website - about_School: School website + about_Education::School: School website communication/website/imported/medium: filename: Filename communication/website/page: diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 8bc2e040fb782c6485defc8277b14bb0138a5d9f..1faa0dfd95b69afcbd35df0826c9e2d0924b255b 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -40,7 +40,7 @@ fr: about_type: Sujet du site about_: Aucun sujet (site indépendant) about_Research::Journal: Site de revue scientifique - about_School: Site d'école + about_Education::School: Site d'école communication/website/imported/medium: filename: Nom du fichier communication/website/page: diff --git a/config/locales/research/en.yml b/config/locales/research/en.yml index 986e1e44d7deb9872ac358a9d765083f2b3b993a..b135f9ccb6c35d701608e9643e5f81bf62a061b7 100644 --- a/config/locales/research/en.yml +++ b/config/locales/research/en.yml @@ -19,6 +19,7 @@ en: attributes: research/journal: title: Title + issn: ISSN research/journal/article: title: Title researchers: Authors diff --git a/config/locales/research/fr.yml b/config/locales/research/fr.yml index 69b5a722876660f5d95466c6bac445912fef2ea1..8bc0da52991b77319d535d68c0526359cdc5500c 100644 --- a/config/locales/research/fr.yml +++ b/config/locales/research/fr.yml @@ -19,6 +19,7 @@ fr: attributes: research/journal: title: Titre + issn: ISSN research/journal/article: title: Titre researchers: Auteu·rs·rices