diff --git a/app/models/communication/website/home.rb b/app/models/communication/website/home.rb index e35d331f377e598439ec04feb6943c2d1aeb18a6..00353bdc29900672e5fe998248be50318b553a78 100644 --- a/app/models/communication/website/home.rb +++ b/app/models/communication/website/home.rb @@ -6,6 +6,7 @@ # description :text # featured_image_alt :string # github_path :text +# text_new :text # created_at :datetime not null # updated_at :datetime not null # communication_website_id :uuid not null, indexed diff --git a/app/models/communication/website/page.rb b/app/models/communication/website/page.rb index 4a81253e0070ce429948cdf519765335cfd96bca..c72e01cc657d6382c1048e1f9ce4e13592462362 100644 --- a/app/models/communication/website/page.rb +++ b/app/models/communication/website/page.rb @@ -12,6 +12,7 @@ # position :integer default(0), not null # published :boolean default(FALSE) # slug :string +# text_new :text # title :string # created_at :datetime not null # updated_at :datetime not null diff --git a/app/models/education/program.rb b/app/models/education/program.rb index 4396afb139e0ed0ba87bb3148ae45937dbc4a7a6..9abd988e96d3f1c9c75cb32f48b67e4630aa1557 100644 --- a/app/models/education/program.rb +++ b/app/models/education/program.rb @@ -3,16 +3,29 @@ # Table name: education_programs # # id :uuid not null, primary key +# accessibility_new :text # capacity :integer +# contacts_new :text +# content_new :text # continuing :boolean # description :text +# duration_new :text # ects :integer +# evaluation_new :text # featured_image_alt :string # level :integer # name :string +# objectives_new :text +# opportunities_new :text +# other_new :text # path :string +# pedagogy_new :text # position :integer default(0) +# prerequisites_new :text +# pricing_new :text # published :boolean default(FALSE) +# registration_new :text +# results_new :text # slug :string # created_at :datetime not null # updated_at :datetime not null diff --git a/app/models/research/journal/article.rb b/app/models/research/journal/article.rb index bfe4270b1f2ebc51197cebd6e0d5abcd76fd2678..3ff64d1093a41146aa9c9ee78e2b7fc03833624f 100644 --- a/app/models/research/journal/article.rb +++ b/app/models/research/journal/article.rb @@ -5,12 +5,12 @@ # id :uuid not null, primary key # abstract :text # keywords :text -# old_text :text # position :integer # published :boolean default(FALSE) # published_at :datetime # references :text # slug :string +# text_new :text # title :string # created_at :datetime not null # updated_at :datetime not null diff --git a/app/models/research/laboratory/axis.rb b/app/models/research/laboratory/axis.rb index 372f8165f5f7340b4ad1749e4fe27f8b48faf77d..5556990de730a60877322bdc79974b3085253335 100644 --- a/app/models/research/laboratory/axis.rb +++ b/app/models/research/laboratory/axis.rb @@ -7,6 +7,7 @@ # name :string # position :integer # short_name :string +# text_new :text # created_at :datetime not null # updated_at :datetime not null # research_laboratory_id :uuid not null, indexed diff --git a/app/models/university/person.rb b/app/models/university/person.rb index 311541fc3cbd5ef26c5e72858c0243da12a238aa..3c449c8f66ba10882c0cb6cd5917beb0c4e9aab9 100644 --- a/app/models/university/person.rb +++ b/app/models/university/person.rb @@ -3,6 +3,7 @@ # Table name: university_people # # id :uuid not null, primary key +# biography_new :text # description :text # email :string # first_name :string @@ -158,6 +159,6 @@ class University::Person < ApplicationRecord end def sanitize_email - self.email = self.email.downcase.strip + self.email = self.email.to_s.downcase.strip end end diff --git a/app/models/university/person/administrator.rb b/app/models/university/person/administrator.rb index 422bbd69544b4216ae726f1afd368d7eda1c3c79..45c0cf4c7c389a6029fadf3018d75465cccc01b2 100644 --- a/app/models/university/person/administrator.rb +++ b/app/models/university/person/administrator.rb @@ -3,6 +3,7 @@ # Table name: university_people # # id :uuid not null, primary key +# biography_new :text # description :text # email :string # first_name :string diff --git a/app/models/university/person/author.rb b/app/models/university/person/author.rb index eee35eb4270c38c23a153466120b59931f94b2ac..1bb44c1eb9111e6857654761c402c169e7b2db21 100644 --- a/app/models/university/person/author.rb +++ b/app/models/university/person/author.rb @@ -3,6 +3,7 @@ # Table name: university_people # # id :uuid not null, primary key +# biography_new :text # description :text # email :string # first_name :string diff --git a/app/models/university/person/researcher.rb b/app/models/university/person/researcher.rb index 165f8868de5ca732c2aaba98710ed05c2a8d40f0..207a0919a838b9554625946d10b22f74952b33e1 100644 --- a/app/models/university/person/researcher.rb +++ b/app/models/university/person/researcher.rb @@ -3,6 +3,7 @@ # Table name: university_people # # id :uuid not null, primary key +# biography_new :text # description :text # email :string # first_name :string diff --git a/app/models/university/person/teacher.rb b/app/models/university/person/teacher.rb index 59c75c7b3ee28e7ba59219af8296e984e58c0047..18518ba9231e6231cbe06d3b9aa4b3b96f6cce7d 100644 --- a/app/models/university/person/teacher.rb +++ b/app/models/university/person/teacher.rb @@ -3,6 +3,7 @@ # Table name: university_people # # id :uuid not null, primary key +# biography_new :text # description :text # email :string # first_name :string diff --git a/db/migrate/20220214125058_add_new_texts.rb b/db/migrate/20220214125058_add_new_texts.rb new file mode 100644 index 0000000000000000000000000000000000000000..b4ef363ef7039a864583323de47be98aedd97ae0 --- /dev/null +++ b/db/migrate/20220214125058_add_new_texts.rb @@ -0,0 +1,24 @@ +class AddNewTexts < ActiveRecord::Migration[6.1] + def change + add_column :communication_website_homes, :text_new, :text + add_column :communication_website_pages, :text_new, :text + add_column :research_journal_articles, :text_new, :text + add_column :research_laboratory_axes, :text_new, :text + add_column :university_people, :biography_new, :text + add_column :education_programs, :accessibility_new, :text + add_column :education_programs, :contacts_new, :text + add_column :education_programs, :duration_new, :text + add_column :education_programs, :evaluation_new, :text + add_column :education_programs, :objectives_new, :text + add_column :education_programs, :opportunities_new, :text + add_column :education_programs, :other_new, :text + add_column :education_programs, :pedagogy_new, :text + add_column :education_programs, :prerequisites_new, :text + add_column :education_programs, :pricing_new, :text + add_column :education_programs, :registration_new, :text + add_column :education_programs, :content_new, :text + add_column :education_programs, :results_new, :text + # Clean an old field + remove_column :research_journal_articles, :old_text + end +end diff --git a/db/schema.rb b/db/schema.rb index f18cf9d8e339870c4fa2278fd359150f27a4ac29..cbcac4afe769d9e681632644d0025f2bf4c91ced 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: 2022_02_10_105040) do +ActiveRecord::Schema.define(version: 2022_02_14_125058) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" @@ -126,6 +126,7 @@ ActiveRecord::Schema.define(version: 2022_02_10_105040) do t.text "github_path" t.string "featured_image_alt" t.text "description" + t.text "text_new" t.index ["communication_website_id"], name: "idx_comm_website_homes_on_communication_website_id" t.index ["university_id"], name: "index_communication_website_homes_on_university_id" end @@ -288,6 +289,7 @@ ActiveRecord::Schema.define(version: 2022_02_10_105040) do t.text "github_path" t.uuid "related_category_id" t.string "featured_image_alt" + t.text "text_new" t.index ["about_type", "about_id"], name: "index_communication_website_pages_on_about" t.index ["communication_website_id"], name: "index_communication_website_pages_on_communication_website_id" t.index ["parent_id"], name: "index_communication_website_pages_on_parent_id" @@ -407,6 +409,19 @@ ActiveRecord::Schema.define(version: 2022_02_10_105040) do t.text "description" t.boolean "published", default: false t.string "featured_image_alt" + t.text "accessibility_new" + t.text "contacts_new" + t.text "duration_new" + t.text "evaluation_new" + t.text "objectives_new" + t.text "opportunities_new" + t.text "other_new" + t.text "pedagogy_new" + t.text "prerequisites_new" + t.text "pricing_new" + t.text "registration_new" + t.text "content_new" + t.text "results_new" t.index ["parent_id"], name: "index_education_programs_on_parent_id" t.index ["university_id"], name: "index_education_programs_on_university_id" end @@ -448,7 +463,6 @@ ActiveRecord::Schema.define(version: 2022_02_10_105040) do create_table "research_journal_articles", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "title" - t.text "old_text" t.datetime "published_at" t.uuid "university_id", null: false t.uuid "research_journal_id", null: false @@ -462,6 +476,7 @@ ActiveRecord::Schema.define(version: 2022_02_10_105040) do t.string "slug" t.boolean "published", default: false t.integer "position" + t.text "text_new" t.index ["research_journal_id"], name: "index_research_journal_articles_on_research_journal_id" t.index ["research_journal_volume_id"], name: "index_research_journal_articles_on_research_journal_volume_id" t.index ["university_id"], name: "index_research_journal_articles_on_university_id" @@ -525,6 +540,7 @@ ActiveRecord::Schema.define(version: 2022_02_10_105040) do t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false t.string "short_name" + t.text "text_new" t.index ["research_laboratory_id"], name: "index_research_laboratory_axes_on_research_laboratory_id" t.index ["university_id"], name: "index_research_laboratory_axes_on_university_id" end @@ -578,6 +594,7 @@ ActiveRecord::Schema.define(version: 2022_02_10_105040) do t.text "description" t.boolean "habilitation", default: false t.boolean "tenure", default: false + t.text "biography_new" t.index ["university_id"], name: "index_university_people_on_university_id" t.index ["user_id"], name: "index_university_people_on_user_id" end diff --git a/docs/communication/wysiwyg.md b/docs/communication/wysiwyg.md index c6bb42959c974ec233ee2403016baae81d89d985..7f4327452ba23b764d599bc98df40f17c0f6ec4c 100644 --- a/docs/communication/wysiwyg.md +++ b/docs/communication/wysiwyg.md @@ -97,6 +97,7 @@ Si un programme a 5 champs Summernote avec 3 images dans chaque champ, cela fait Si on enlève une image d'un champ, il faut mettre à jour la liste pour avoir les 14 bons attachments. Etapes de migration : +-[x] Ajouter des champs _new -[x] Au rails app:fix, transformer le markup Trix en markup Summernote (application_record) dans les propriétés _new -[ ] Enlever les scripts de l'application_record -[ ] Supprimer les champs ActionText dans les modèles diff --git a/lib/tasks/app.rake b/lib/tasks/app.rake index a266e020f2e9f96934e3fbf3f48d49e067ed8d56..27c2330ed8caf5a18ad2b868a015ae2025668f5e 100644 --- a/lib/tasks/app.rake +++ b/lib/tasks/app.rake @@ -8,12 +8,43 @@ namespace :app do desc 'Fix things' task fix: :environment do - Communication::Website::Post.find_each do |post| - post.update text_new: clean_for_summernote(post.text) + Communication::Website::Home.find_each do |object| + object.update text_new: clean_for_summernote(object.text) + end + Communication::Website::Post.find_each do |object| + object.update text_new: clean_for_summernote(object.text) + end + Communication::Website::Page.find_each do |object| + object.update text_new: clean_for_summernote(object.text) + end + Research::Journal::Article.find_each do |object| + object.update text_new: clean_for_summernote(object.text) + end + Research::Laboratory::Axis.find_each do |object| + object.update text_new: clean_for_summernote(object.text) + end + University::Person.find_each do |object| + object.update biography_new: clean_for_summernote(object.biography) + end + Education::Program.find_each do |object| + object.update accessibility_new: clean_for_summernote(object.accessibility), + contacts_new: clean_for_summernote(object.contacts), + duration_new: clean_for_summernote(object.duration), + evaluation_new: clean_for_summernote(object.evaluation), + objectives_new: clean_for_summernote(object.objectives), + opportunities_new: clean_for_summernote(object.opportunities), + other_new: clean_for_summernote(object.other), + pedagogy_new: clean_for_summernote(object.pedagogy), + prerequisites_new: clean_for_summernote(object.prerequisites), + pricing_new: clean_for_summernote(object.pricing), + registration_new: clean_for_summernote(object.registration), + content_new: clean_for_summernote(object.content), + results_new: clean_for_summernote(object.results) end end def clean_for_summernote(actiontext) + return '' if actiontext.nil? actiontext.body .to_html .gsub('<div>', '<p>')