diff --git a/app/controllers/admin/communication/website/posts_controller.rb b/app/controllers/admin/communication/website/posts_controller.rb index 8e9f6891597e490fbc9bd05d8219b9f93d0c5551..f4ade6c8ae8e6d8e5685735abe03c1eb7f71cf27 100644 --- a/app/controllers/admin/communication/website/posts_controller.rb +++ b/app/controllers/admin/communication/website/posts_controller.rb @@ -57,7 +57,7 @@ class Admin::Communication::Website::PostsController < Admin::Communication::Web def post_params params.require(:communication_website_post) .permit( - :university_id, :website_id, :title, :description, :text, :text_wysiwyg, + :university_id, :website_id, :title, :description, :text, :text_new, :published, :published_at, :featured_image, :featured_image_delete, :featured_image_infos, :featured_image_alt, :slug, :pinned, :author_id, category_ids: [] diff --git a/app/models/communication/website/post.rb b/app/models/communication/website/post.rb index b861b3ebc60aeda2746c8f70dffc9f9cc4aa0ff0..5fbed0f7e8f3327e2df0472f7b5a6466bbf37dc6 100644 --- a/app/models/communication/website/post.rb +++ b/app/models/communication/website/post.rb @@ -66,14 +66,14 @@ class Communication::Website::Post < ApplicationRecord scope :ordered, -> { order(published_at: :desc, created_at: :desc) } scope :recent, -> { order(published_at: :desc).limit(5) } - def text_summernote + def text_new # TODO hydrate action-text-attachment - self.text + attributes['text_new'].gsub('</action', 'coucou</action') end - def text_summernote=(value) + def text_new=(value) # TODO dehydrate action-text-attachment - self.text = value + attributes['text_new'] = value end def path diff --git a/app/views/admin/communication/website/posts/_form.html.erb b/app/views/admin/communication/website/posts/_form.html.erb index 722a8a1d61511b2dfc885a6a18c6858be2e7c35b..41281bd67e2048a8f040ac13c6dc74b65800682e 100644 --- a/app/views/admin/communication/website/posts/_form.html.erb +++ b/app/views/admin/communication/website/posts/_form.html.erb @@ -9,7 +9,7 @@ <%= f.input :title %> <%= f.input :description %> <%= f.input :text, as: :rich_text_area %> - <%= f.input :text_summernote, as: :summernote %> + <%= f.input :text_new, as: :summernote %> </div> </div> <div class="card flex-fill w-100">