From 9ecdc2f6a5007c5a83972cbea507c097ea794546 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com>
Date: Mon, 13 Feb 2023 12:53:38 +0100
Subject: [PATCH] brought back summernote

---
 app/models/communication/website/page.rb | 2 ++
 app/models/communication/website/post.rb | 2 ++
 app/models/concerns/with_inheritance.rb  | 2 ++
 app/models/research/journal/paper.rb     | 1 +
 app/models/research/journal/volume.rb    | 2 ++
 app/models/research/laboratory/axis.rb   | 2 ++
 app/models/university/organization.rb    | 2 ++
 app/models/university/person.rb          | 2 ++
 8 files changed, 15 insertions(+)

diff --git a/app/models/communication/website/page.rb b/app/models/communication/website/page.rb
index a58825dc5..1a3317f75 100644
--- a/app/models/communication/website/page.rb
+++ b/app/models/communication/website/page.rb
@@ -61,6 +61,8 @@ class Communication::Website::Page < ApplicationRecord
   include WithPermalink
   include WithTranslations
 
+  has_summernote :text # TODO: Remove text attribute
+
   belongs_to :website,
              foreign_key: :communication_website_id
   belongs_to :parent,
diff --git a/app/models/communication/website/post.rb b/app/models/communication/website/post.rb
index 8a94a8b75..e2095f2f0 100644
--- a/app/models/communication/website/post.rb
+++ b/app/models/communication/website/post.rb
@@ -49,6 +49,8 @@ class Communication::Website::Post < ApplicationRecord
   include WithSlug # We override slug_unavailable? method
   include WithTranslations
 
+  has_summernote :text # TODO: Remove text attribute
+
   has_one :imported_post,
           class_name: 'Communication::Website::Imported::Post',
           dependent: :destroy
diff --git a/app/models/concerns/with_inheritance.rb b/app/models/concerns/with_inheritance.rb
index a9398bd31..9df918ddd 100644
--- a/app/models/concerns/with_inheritance.rb
+++ b/app/models/concerns/with_inheritance.rb
@@ -4,6 +4,8 @@ module WithInheritance
   included do
     def self.rich_text_areas_with_inheritance(*properties)
       properties.each do |property|
+        has_summernote property
+
         class_eval <<-CODE, __FILE__, __LINE__ + 1
           def best_#{property}
             best("#{property}")
diff --git a/app/models/research/journal/paper.rb b/app/models/research/journal/paper.rb
index 017e87f3b..1b0e1502f 100644
--- a/app/models/research/journal/paper.rb
+++ b/app/models/research/journal/paper.rb
@@ -47,6 +47,7 @@ class Research::Journal::Paper < ApplicationRecord
   include WithPosition
   include WithSlug
 
+  has_summernote :text
   has_one_attached :pdf
 
   belongs_to :journal, foreign_key: :research_journal_id
diff --git a/app/models/research/journal/volume.rb b/app/models/research/journal/volume.rb
index ac61537dc..ea545dcd8 100644
--- a/app/models/research/journal/volume.rb
+++ b/app/models/research/journal/volume.rb
@@ -38,6 +38,8 @@ class Research::Journal::Volume < ApplicationRecord
   include WithPermalink
   include WithSlug
 
+  has_summernote :text
+
   belongs_to :journal, foreign_key: :research_journal_id
   has_many :papers, foreign_key: :research_journal_volume_id, dependent: :nullify
   has_many :websites, -> { distinct }, through: :journal
diff --git a/app/models/research/laboratory/axis.rb b/app/models/research/laboratory/axis.rb
index ef568cf06..69b47c682 100644
--- a/app/models/research/laboratory/axis.rb
+++ b/app/models/research/laboratory/axis.rb
@@ -28,6 +28,8 @@ class Research::Laboratory::Axis < ApplicationRecord
   include WithUniversity
   include WithPosition
 
+  has_summernote :text
+
   belongs_to :laboratory, foreign_key: :research_laboratory_id
 
   def to_s
diff --git a/app/models/university/organization.rb b/app/models/university/organization.rb
index eaac9b6b8..4f58c17bd 100644
--- a/app/models/university/organization.rb
+++ b/app/models/university/organization.rb
@@ -45,6 +45,8 @@ class University::Organization < ApplicationRecord
 
   attr_accessor :created_from_extranet
 
+  has_summernote :text
+
   has_many :experiences,
            class_name: 'University::Person::Experience',
            dependent: :destroy
diff --git a/app/models/university/person.rb b/app/models/university/person.rb
index 79fa067b9..6a84914ad 100644
--- a/app/models/university/person.rb
+++ b/app/models/university/person.rb
@@ -80,6 +80,8 @@ class University::Person < ApplicationRecord
 
   enum gender: { male: 0, female: 1, non_binary: 2 }
 
+  has_summernote :biography
+
   belongs_to :user, optional: true
 
   has_and_belongs_to_many :research_journal_papers,
-- 
GitLab