From 6c92c0ebeedd2ef42282d8d4e12dc065c66f9381 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Mon, 6 Sep 2021 14:49:07 +0200
Subject: [PATCH] wip

---
 .../communication/websites_controller.rb      |  2 +-
 app/controllers/application_controller.rb     |  2 +-
 .../application_controller/with_context.rb    | 28 -------------------
 .../application_controller/with_university.rb | 10 +++++++
 app/models/communication/website.rb           | 28 +++++--------------
 .../communication/websites/_form.html.erb     |  6 ++++
 .../communication/websites/index.html.erb     |  6 ++--
 .../_communication_website_page.json.jbuilder |  2 --
 .../website/pages/index.html.erb              | 20 -------------
 .../website/pages/index.json.jbuilder         |  1 -
 .../communication/website/pages/show.html.erb |  3 --
 .../website/pages/show.json.jbuilder          |  1 -
 .../journal/articles/_volume.html.erb         |  9 ------
 .../research/journal/articles/index.html.erb  | 13 ---------
 .../journal/articles/index.json.jbuilder      |  4 ---
 .../research/journal/articles/show.html.erb   |  7 -----
 .../journal/articles/show.json.jbuilder       |  8 ------
 .../research/journal/volumes/_volume.html.erb |  8 ------
 .../research/journal/volumes/index.html.erb   |  9 ------
 .../journal/volumes/index.json.jbuilder       |  4 ---
 .../research/journal/volumes/show.html.erb    | 20 -------------
 .../journal/volumes/show.json.jbuilder        |  6 ----
 app/views/research/journals/index.html.erb    | 16 -----------
 .../research/journals/index.json.jbuilder     |  4 ---
 app/views/research/journals/show.html.erb     | 28 -------------------
 .../research/journals/show.json.jbuilder      | 10 -------
 config/locales/communication/fr.yml           |  4 +++
 config/routes.rb                              | 20 ++++++++-----
 config/routes/admin.rb                        |  8 ------
 config/routes/admin/administration.rb         |  6 ----
 config/routes/admin/communication.rb          |  5 ----
 config/routes/admin/education.rb              |  3 --
 config/routes/admin/research.rb               |  6 ----
 config/routes/administration.rb               |  5 +++-
 config/routes/communication.rb                |  4 +--
 config/routes/education.rb                    |  2 +-
 config/routes/research.rb                     |  6 ++--
 config/routes/server.rb                       |  4 ---
 ...013_add_about_to_communication_websites.rb |  5 ++++
 db/schema.rb                                  |  5 +++-
 40 files changed, 65 insertions(+), 273 deletions(-)
 delete mode 100644 app/controllers/application_controller/with_context.rb
 create mode 100644 app/controllers/application_controller/with_university.rb
 delete mode 100644 app/views/communication/website/pages/_communication_website_page.json.jbuilder
 delete mode 100644 app/views/communication/website/pages/index.html.erb
 delete mode 100644 app/views/communication/website/pages/index.json.jbuilder
 delete mode 100644 app/views/communication/website/pages/show.html.erb
 delete mode 100644 app/views/communication/website/pages/show.json.jbuilder
 delete mode 100644 app/views/research/journal/articles/_volume.html.erb
 delete mode 100644 app/views/research/journal/articles/index.html.erb
 delete mode 100644 app/views/research/journal/articles/index.json.jbuilder
 delete mode 100644 app/views/research/journal/articles/show.html.erb
 delete mode 100644 app/views/research/journal/articles/show.json.jbuilder
 delete mode 100644 app/views/research/journal/volumes/_volume.html.erb
 delete mode 100644 app/views/research/journal/volumes/index.html.erb
 delete mode 100644 app/views/research/journal/volumes/index.json.jbuilder
 delete mode 100644 app/views/research/journal/volumes/show.html.erb
 delete mode 100644 app/views/research/journal/volumes/show.json.jbuilder
 delete mode 100644 app/views/research/journals/index.html.erb
 delete mode 100644 app/views/research/journals/index.json.jbuilder
 delete mode 100644 app/views/research/journals/show.html.erb
 delete mode 100644 app/views/research/journals/show.json.jbuilder
 delete mode 100644 config/routes/admin.rb
 delete mode 100644 config/routes/admin/administration.rb
 delete mode 100644 config/routes/admin/communication.rb
 delete mode 100644 config/routes/admin/education.rb
 delete mode 100644 config/routes/admin/research.rb
 delete mode 100644 config/routes/server.rb
 create mode 100644 db/migrate/20210906121013_add_about_to_communication_websites.rb

diff --git a/app/controllers/admin/communication/websites_controller.rb b/app/controllers/admin/communication/websites_controller.rb
index 2f40b095a..987ea7573 100644
--- a/app/controllers/admin/communication/websites_controller.rb
+++ b/app/controllers/admin/communication/websites_controller.rb
@@ -51,6 +51,6 @@ class Admin::Communication::WebsitesController < Admin::Communication::Applicati
   end
 
   def website_params
-    params.require(:communication_website).permit(:name, :domain, :repository, :access_token)
+    params.require(:communication_website).permit(:name, :domain, :repository, :access_token, :about_type, :about_id)
   end
 end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 9af4384eb..5e9e5eb44 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -1,5 +1,5 @@
 class ApplicationController < ActionController::Base
-  include WithContext
+  include WithUniversity
 
   def breadcrumb
     add_breadcrumb t('home'), root_path
diff --git a/app/controllers/application_controller/with_context.rb b/app/controllers/application_controller/with_context.rb
deleted file mode 100644
index 73688317f..000000000
--- a/app/controllers/application_controller/with_context.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-module ApplicationController::WithContext
-  extend ActiveSupport::Concern
-
-  included do
-
-    def current_university
-      @current_university ||= current_website ? current_website.university
-                                              : University.with_host(request.host)
-    end
-    helper_method :current_university
-
-    def current_website
-      @current_website ||= Communication::Website.with_host(request.host)
-    end
-    helper_method :current_website
-
-    def is_university?
-      @is_university ||= !University.with_host(request.host).nil?
-    end
-    helper_method :is_university?
-
-    def is_website?
-      @is_website ||= !Communication::Website.with_host(request.host).nil?
-    end
-    helper_method :is_website?
-
-  end
-end
diff --git a/app/controllers/application_controller/with_university.rb b/app/controllers/application_controller/with_university.rb
new file mode 100644
index 000000000..8e9b06f0b
--- /dev/null
+++ b/app/controllers/application_controller/with_university.rb
@@ -0,0 +1,10 @@
+module ApplicationController::WithUniversity
+  extend ActiveSupport::Concern
+
+  included do
+    def current_university
+      @current_university ||= University.with_host(request.host)
+    end
+    helper_method :current_university
+  end
+end
diff --git a/app/models/communication/website.rb b/app/models/communication/website.rb
index c5ac8d1d5..1964228e7 100644
--- a/app/models/communication/website.rb
+++ b/app/models/communication/website.rb
@@ -3,16 +3,19 @@
 # Table name: communication_websites
 #
 #  id            :uuid             not null, primary key
+#  about_type    :string
 #  access_token  :string
 #  domain        :string
 #  name          :string
 #  repository    :string
 #  created_at    :datetime         not null
 #  updated_at    :datetime         not null
+#  about_id      :uuid
 #  university_id :uuid             not null
 #
 # Indexes
 #
+#  index_communication_websites_on_about          (about_type,about_id)
 #  index_communication_websites_on_university_id  (university_id)
 #
 # Foreign Keys
@@ -21,32 +24,15 @@
 #
 class Communication::Website < ApplicationRecord
   belongs_to :university
+  belongs_to :about, polymorphic: true, optional: true
   has_many :pages, foreign_key: :communication_website_id
 
-  def self.with_host(host)
-    find_by domain: extract_domain_from(host)
-  end
-
-  # Website domain
-  # Production with domain    www.iut.u-bordeaux-montaigne.fr
-  # Production without        www.iut.u-bordeaux-montaigne.fr.websites.osuny.org
-  # Staging                   www.iut.u-bordeaux-montaigne.fr.websites.osuny.dev
-  # Dev                       www.iut.u-bordeaux-montaigne.fr.websites.osuny
-  def self.extract_domain_from(host)
-    host.remove('.websites.osuny.org')
-        .remove('.websites.osuny.dev')
-        .remove('.websites.osuny')
+  def self.about_types
+    [nil, :research_journal, :school]
   end
 
   def domain_url
-    case Rails.env
-    when 'development'
-      "http://#{domain}.websites.osuny:3000"
-    when 'staging'
-      "https://#{domain}.websites.osuny.dev"
-    when 'production'
-      "https://#{domain}"
-    end
+    "https://#{ domain }"
   end
 
   def to_s
diff --git a/app/views/admin/communication/websites/_form.html.erb b/app/views/admin/communication/websites/_form.html.erb
index a4161a45d..09160d49c 100644
--- a/app/views/admin/communication/websites/_form.html.erb
+++ b/app/views/admin/communication/websites/_form.html.erb
@@ -2,6 +2,12 @@
   <div class="row">
     <div class="col-md-4">
       <%= f.input :name %>
+      <%= f.input :about_type,
+                  collection: Communication::Website.about_types,
+                  label_method: lambda { |object|
+                    I18n.t("activerecord.attributes.communication/website.about_#{object}")
+                  },
+                  include_blank: false %>
     </div>
     <div class="col-md-4">
       <%= f.input :domain %>
diff --git a/app/views/admin/communication/websites/index.html.erb b/app/views/admin/communication/websites/index.html.erb
index 9fbf772c3..fd54aa8fc 100644
--- a/app/views/admin/communication/websites/index.html.erb
+++ b/app/views/admin/communication/websites/index.html.erb
@@ -5,7 +5,8 @@
     <tr>
       <th><%= Communication::Website.human_attribute_name('name') %></th>
       <th><%= Communication::Website.human_attribute_name('domain') %></th>
-      <th><%= Communication::Website.human_attribute_name('pages') %></th>
+      <th><%= Communication::Website.human_attribute_name('about_type') %></th>
+      <th><%= Communication::Website.human_attribute_name('about') %></th>
       <th></th>
     </tr>
   </thead>
@@ -14,7 +15,8 @@
       <tr>
         <td><%= link_to website, [:admin, website] %></td>
         <td><%= link_to website.domain_url, website.domain_url, target: :_blank %></td>
-        <td><%= website.pages.count %></td>
+        <td><%= I18n.t("activerecord.attributes.communication/website.about_#{website.about_type}") %></td>
+        <td><%= website.about %></td>
         <td class="text-end">
           <%= edit_link website %>
           <%= destroy_link website %>
diff --git a/app/views/communication/website/pages/_communication_website_page.json.jbuilder b/app/views/communication/website/pages/_communication_website_page.json.jbuilder
deleted file mode 100644
index 76353d73c..000000000
--- a/app/views/communication/website/pages/_communication_website_page.json.jbuilder
+++ /dev/null
@@ -1,2 +0,0 @@
-json.extract! communication_website_page, :id, :university_id, :communication_website_id, :title, :description, :kind, :about_id, :created_at, :updated_at
-json.url communication_website_page_url(communication_website_page, format: :json)
diff --git a/app/views/communication/website/pages/index.html.erb b/app/views/communication/website/pages/index.html.erb
deleted file mode 100644
index d3ac7cc09..000000000
--- a/app/views/communication/website/pages/index.html.erb
+++ /dev/null
@@ -1,20 +0,0 @@
-<% content_for :title, Communication::Website::Page.model_name.human(count: 2) %>
-
-<table class="table">
-  <thead>
-    <tr>
-      <th>Title</th>
-      <th>Description</th>
-      <th>Path</th>
-    </tr>
-  </thead>
-  <tbody>
-    <% @pages.each do |page| %>
-      <tr>
-        <td><%= link_to page, page %></td>
-        <td><%= page.description %></td>
-        <td><%= page.path %></td>
-      </tr>
-    <% end %>
-  </tbody>
-</table>
diff --git a/app/views/communication/website/pages/index.json.jbuilder b/app/views/communication/website/pages/index.json.jbuilder
deleted file mode 100644
index 1f1ff9a1a..000000000
--- a/app/views/communication/website/pages/index.json.jbuilder
+++ /dev/null
@@ -1 +0,0 @@
-json.array! @communication_website_pages, partial: "communication_website_pages/communication_website_page", as: :communication_website_page
diff --git a/app/views/communication/website/pages/show.html.erb b/app/views/communication/website/pages/show.html.erb
deleted file mode 100644
index 0a4c0bc99..000000000
--- a/app/views/communication/website/pages/show.html.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-<% content_for :title, @page %>
-
-<%= @page.description %>
diff --git a/app/views/communication/website/pages/show.json.jbuilder b/app/views/communication/website/pages/show.json.jbuilder
deleted file mode 100644
index 56fa105a1..000000000
--- a/app/views/communication/website/pages/show.json.jbuilder
+++ /dev/null
@@ -1 +0,0 @@
-json.partial! "communication_website_pages/communication_website_page", communication_website_page: @communication_website_page
diff --git a/app/views/research/journal/articles/_volume.html.erb b/app/views/research/journal/articles/_volume.html.erb
deleted file mode 100644
index dccb276fb..000000000
--- a/app/views/research/journal/articles/_volume.html.erb
+++ /dev/null
@@ -1,9 +0,0 @@
-<article class="card mt-4">
-  <div class="card-body">
-    <h1 class="h4">
-      <%= link_to volume,
-      research_journal_volume_path(journal_id: volume.journal, id: volume),
-      class: 'stretched-link' %>
-    </h1>
-  </div>
-</article>
diff --git a/app/views/research/journal/articles/index.html.erb b/app/views/research/journal/articles/index.html.erb
deleted file mode 100644
index 6308ba227..000000000
--- a/app/views/research/journal/articles/index.html.erb
+++ /dev/null
@@ -1,13 +0,0 @@
-<% content_for :title, Research::Journal::Article.model_name.human(count: 2) %>
-
-<h1><%= Research::Journal::Article.model_name.human(count: 2) %></h1>
-
-<table class="table">
-  <tbody>
-    <% @articles.each do |article| %>
-      <tr>
-        <td><%= link_to article, research_journal_article_path(journal_id: @journal.id, id: article.id) %></td>
-      </tr>
-    <% end %>
-  </tbody>
-</table>
diff --git a/app/views/research/journal/articles/index.json.jbuilder b/app/views/research/journal/articles/index.json.jbuilder
deleted file mode 100644
index 2f50f62c7..000000000
--- a/app/views/research/journal/articles/index.json.jbuilder
+++ /dev/null
@@ -1,4 +0,0 @@
-json.array! @articles do |article|
-  json.extract! article, :id, :title, :text, :published_at
-  json.url research_journal_article_url(journal_id: article.journal, id: article, format: :json)
-end
diff --git a/app/views/research/journal/articles/show.html.erb b/app/views/research/journal/articles/show.html.erb
deleted file mode 100644
index eea345529..000000000
--- a/app/views/research/journal/articles/show.html.erb
+++ /dev/null
@@ -1,7 +0,0 @@
-<% content_for :title, @article %>
-
-<h1><%= @article.title %></h1>
-
-<p><%= @article.published_at %></p>
-
-<%= @article.text.html_safe %>
diff --git a/app/views/research/journal/articles/show.json.jbuilder b/app/views/research/journal/articles/show.json.jbuilder
deleted file mode 100644
index 6b2cdca9a..000000000
--- a/app/views/research/journal/articles/show.json.jbuilder
+++ /dev/null
@@ -1,8 +0,0 @@
-json.extract! @article, :id, :title, :text, :published_at
-if @article.volume
-  json.volume do
-    json.extract! @article.volume, :id, :title, :number, :published_at
-    json.url research_journal_volume_url(journal: @volume.journal, id: @volume, format: :json)
-
-  end
-end
diff --git a/app/views/research/journal/volumes/_volume.html.erb b/app/views/research/journal/volumes/_volume.html.erb
deleted file mode 100644
index 30603618b..000000000
--- a/app/views/research/journal/volumes/_volume.html.erb
+++ /dev/null
@@ -1,8 +0,0 @@
-<article class="card mt-4 border-0">
-  <img src="https://picsum.photos/200/300" alt="<%= volume %>">
-  <h1 class="h5 mt-3">
-    <%= link_to volume,
-                research_journal_volume_path(journal_id: volume.journal, id: volume),
-                class: 'stretched-link' %>
-  </h1>
-</article>
diff --git a/app/views/research/journal/volumes/index.html.erb b/app/views/research/journal/volumes/index.html.erb
deleted file mode 100644
index 47fdd6703..000000000
--- a/app/views/research/journal/volumes/index.html.erb
+++ /dev/null
@@ -1,9 +0,0 @@
-<% content_for :title, Research::Journal::Volume.model_name.human(count: 2) %>
-
-<div class="row">
-  <% @journal.volumes.each do |volume| %>
-    <div class="col-md-3">
-      <%= render volume %>
-    </div>
-  <% end %>
-</div>
diff --git a/app/views/research/journal/volumes/index.json.jbuilder b/app/views/research/journal/volumes/index.json.jbuilder
deleted file mode 100644
index 3894f90d2..000000000
--- a/app/views/research/journal/volumes/index.json.jbuilder
+++ /dev/null
@@ -1,4 +0,0 @@
-json.array! @volumes do |volume|
-  json.extract! volume, :id, :title, :number, :published_at
-  json.url research_journal_volume_url(journal_id: volume.journal, id: volume, format: :json)
-end
diff --git a/app/views/research/journal/volumes/show.html.erb b/app/views/research/journal/volumes/show.html.erb
deleted file mode 100644
index ec07c92fa..000000000
--- a/app/views/research/journal/volumes/show.html.erb
+++ /dev/null
@@ -1,20 +0,0 @@
-<% content_for :title, @volume %>
-
-<h1><%= @volume.title %></h1>
-
-<p>#<%= @volume.number %></p>
-
-<p>
-  <%= @volume.published_at&.to_date %>
-</p>
-
-<h2><%= Research::Journal::Article.model_name.human(count: 2) %></h2>
-<table class="table">
-  <tbody>
-    <% @articles.each do |article| %>
-      <tr>
-        <td><%= link_to article, research_journal_article_path(journal_id: @journal.id, id: article.id) %></td>
-      </tr>
-    <% end %>
-  </tbody>
-</table>
diff --git a/app/views/research/journal/volumes/show.json.jbuilder b/app/views/research/journal/volumes/show.json.jbuilder
deleted file mode 100644
index 298b2d7d4..000000000
--- a/app/views/research/journal/volumes/show.json.jbuilder
+++ /dev/null
@@ -1,6 +0,0 @@
-json.extract! @volume, :id, :title, :number, :published_at
-json.url research_journal_volume_url(journal: @volume.journal, id: @volume, format: :json)
-json.articles @volume.articles do |article|
-  json.extract! article, :id, :title, :published_at
-  json.url research_journal_article_url(journal_id: article.journal, id: article, format: :json)
-end
diff --git a/app/views/research/journals/index.html.erb b/app/views/research/journals/index.html.erb
deleted file mode 100644
index 48478c237..000000000
--- a/app/views/research/journals/index.html.erb
+++ /dev/null
@@ -1,16 +0,0 @@
-<% content_for :title, Research::Journal.model_name.human(count: 2) %>
-
-<h1><%= Research::Journal.model_name.human(count: 2) %></h1>
-
-<% @journals.each do |journal| %>
-  <div class="row">
-    <div class="col-md-8">
-      <h2 class="mt-5"><%= journal %></h2>
-      <p><%= journal.description %></p>
-      <%= link_to 'Lire', journal, class: 'btn btn-primary stretched-link' %>
-    </div>
-    <div class="offset-md-1 col-md-3">
-      <%= render journal.volumes.first if journal.volumes.any? %>
-    </div>
-  </div>
-<% end %>
diff --git a/app/views/research/journals/index.json.jbuilder b/app/views/research/journals/index.json.jbuilder
deleted file mode 100644
index 465e2b7cc..000000000
--- a/app/views/research/journals/index.json.jbuilder
+++ /dev/null
@@ -1,4 +0,0 @@
-json.array! @journals do |journal|
-  json.extract! journal, :id, :title, :description
-  json.url research_journal_url(journal, format: :json)
-end
diff --git a/app/views/research/journals/show.html.erb b/app/views/research/journals/show.html.erb
deleted file mode 100644
index 707d4f0ce..000000000
--- a/app/views/research/journals/show.html.erb
+++ /dev/null
@@ -1,28 +0,0 @@
-<% content_for :title, @journal %>
-
-<div class="row">
-  <div class="col-md-8">
-    <h1><%= @journal %></h1>
-    <p><%= @journal.description %></p>
-  </div>
-</div>
-
-<h2><%= Research::Journal::Volume.model_name.human(count: 2) %></h2>
-<div class="row">
-  <% @journal.volumes.each do |volume| %>
-    <div class="col-md-3">
-      <%= render volume %>
-    </div>
-  <% end %>
-</div>
-
-<h2><%= Research::Journal::Article.model_name.human(count: 2) %></h2>
-<table class="table">
-  <tbody>
-    <% @journal.articles.each do |article| %>
-      <tr>
-        <td><%= link_to article, research_journal_article_path(journal_id: @journal.id, id: article.id) %></td>
-      </tr>
-    <% end %>
-  </tbody>
-</table>
diff --git a/app/views/research/journals/show.json.jbuilder b/app/views/research/journals/show.json.jbuilder
deleted file mode 100644
index 1dd8bbd7c..000000000
--- a/app/views/research/journals/show.json.jbuilder
+++ /dev/null
@@ -1,10 +0,0 @@
-json.extract! @journal, :id, :title, :description
-json.url research_journal_url(@journal, format: :json)
-json.volumes @journal.volumes do |volume|
-  json.extract! volume, :id, :title, :published_at
-  json.url research_journal_volume_url(journal_id: volume.journal, id: volume, format: :json)
-end
-json.articles @journal.articles do |article|
-  json.extract! article, :id, :title, :published_at
-  json.url research_journal_article_url(journal_id: article.journal, id: article, format: :json)
-end
diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml
index 474e8cd1c..cb8b96135 100644
--- a/config/locales/communication/fr.yml
+++ b/config/locales/communication/fr.yml
@@ -14,3 +14,7 @@ fr:
       communication/website:
         name: Nom
         domain: Domaine
+        about_type: Sujet du site
+        about_: Aucun sujet (site indépendant)
+        about_research_journal: Site de revue scientifique
+        about_school: Site d'école
diff --git a/config/routes.rb b/config/routes.rb
index a77f1b43c..92dfc427e 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -4,13 +4,19 @@ Rails.application.routes.draw do
     sessions: 'users/sessions'
   }
 
-  draw 'admin'
-  draw 'server'
+  namespace :admin do
+    resources :users
+    draw 'education'
+    draw 'research'
+    draw 'communication'
+    draw 'administration'
+    root to: 'dashboard#index'
+  end
 
-  draw 'education'
-  draw 'research'
-  draw 'communication'
-  draw 'administration'
+  namespace :server do
+    resources :universities
+    root to: 'dashboard#index'
+  end
 
-  root to: 'communication/website/pages#index'
+  root to: 'admin/dashboard#index'
 end
diff --git a/config/routes/admin.rb b/config/routes/admin.rb
deleted file mode 100644
index ad026bc2a..000000000
--- a/config/routes/admin.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace :admin do
-  resources :users
-  draw 'admin/education'
-  draw 'admin/research'
-  draw 'admin/communication'
-  draw 'admin/administration'
-  root to: 'dashboard#index'
-end
diff --git a/config/routes/admin/administration.rb b/config/routes/admin/administration.rb
deleted file mode 100644
index f5b69fe50..000000000
--- a/config/routes/admin/administration.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace :administration do
-  namespace :qualiopi do
-    resources :criterions, only: [:index, :show]
-    resources :indicators, only: [:index, :show]
-  end
-end
diff --git a/config/routes/admin/communication.rb b/config/routes/admin/communication.rb
deleted file mode 100644
index 2568a3265..000000000
--- a/config/routes/admin/communication.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-namespace :communication do
-  resources :websites do
-    resources :pages, controller: 'website/pages'
-  end
-end
diff --git a/config/routes/admin/education.rb b/config/routes/admin/education.rb
deleted file mode 100644
index c6f58926f..000000000
--- a/config/routes/admin/education.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-namespace :education do
-  resources :programs
-end
diff --git a/config/routes/admin/research.rb b/config/routes/admin/research.rb
deleted file mode 100644
index 1bec5b3fc..000000000
--- a/config/routes/admin/research.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace :research do
-  resources :journals do
-    resources :volumes, controller: 'journal/volumes'
-    resources :articles, controller: 'journal/articles'
-  end
-end
diff --git a/config/routes/administration.rb b/config/routes/administration.rb
index a7f66bc51..f5b69fe50 100644
--- a/config/routes/administration.rb
+++ b/config/routes/administration.rb
@@ -1,3 +1,6 @@
 namespace :administration do
-
+  namespace :qualiopi do
+    resources :criterions, only: [:index, :show]
+    resources :indicators, only: [:index, :show]
+  end
 end
diff --git a/config/routes/communication.rb b/config/routes/communication.rb
index 8cb89f645..2568a3265 100644
--- a/config/routes/communication.rb
+++ b/config/routes/communication.rb
@@ -1,5 +1,5 @@
 namespace :communication do
-  namespace :website do
-    resources :pages, only: [:index, :show]
+  resources :websites do
+    resources :pages, controller: 'website/pages'
   end
 end
diff --git a/config/routes/education.rb b/config/routes/education.rb
index ff0e30c2f..c6f58926f 100644
--- a/config/routes/education.rb
+++ b/config/routes/education.rb
@@ -1,3 +1,3 @@
 namespace :education do
-  resources :programs, only: [:index, :show]
+  resources :programs
 end
diff --git a/config/routes/research.rb b/config/routes/research.rb
index e7eb2815a..1bec5b3fc 100644
--- a/config/routes/research.rb
+++ b/config/routes/research.rb
@@ -1,6 +1,6 @@
 namespace :research do
-  resources :journals, only: [:index, :show] do
-    resources :volumes, only: [:index, :show], controller: 'journal/volumes'
-    resources :articles, only: [:index, :show], controller: 'journal/articles'
+  resources :journals do
+    resources :volumes, controller: 'journal/volumes'
+    resources :articles, controller: 'journal/articles'
   end
 end
diff --git a/config/routes/server.rb b/config/routes/server.rb
deleted file mode 100644
index ce69e968b..000000000
--- a/config/routes/server.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-namespace :server do
-  resources :universities
-  root to: 'dashboard#index'
-end
diff --git a/db/migrate/20210906121013_add_about_to_communication_websites.rb b/db/migrate/20210906121013_add_about_to_communication_websites.rb
new file mode 100644
index 000000000..88d1cde9b
--- /dev/null
+++ b/db/migrate/20210906121013_add_about_to_communication_websites.rb
@@ -0,0 +1,5 @@
+class AddAboutToCommunicationWebsites < ActiveRecord::Migration[6.1]
+  def change
+    add_reference :communication_websites, :about, polymorphic: true, null: true, type: :uuid
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 9066a2fdc..2a1d9a288 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
 #
 # It's strongly recommended that you check this file into your version control system.
 
-ActiveRecord::Schema.define(version: 2021_09_06_074132) do
+ActiveRecord::Schema.define(version: 2021_09_06_121013) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "pgcrypto"
@@ -66,6 +66,9 @@ ActiveRecord::Schema.define(version: 2021_09_06_074132) do
     t.datetime "updated_at", precision: 6, null: false
     t.string "access_token"
     t.string "repository"
+    t.string "about_type"
+    t.uuid "about_id"
+    t.index ["about_type", "about_id"], name: "index_communication_websites_on_about"
     t.index ["university_id"], name: "index_communication_websites_on_university_id"
   end
 
-- 
GitLab