From 8475cb1f202983d309e1eef1ecdaffcd32f0e0a8 Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Thu, 10 Feb 2022 16:27:35 +0100 Subject: [PATCH] basic --- .../admin/communication/website/posts_controller.rb | 2 +- app/models/communication/website/post.rb | 10 ++++++++++ .../admin/communication/website/posts/_form.html.erb | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/communication/website/posts_controller.rb b/app/controllers/admin/communication/website/posts_controller.rb index f4ade6c8a..8e9f68915 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_new, + :university_id, :website_id, :title, :description, :text, :text_wysiwyg, :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 7794c68d3..b861b3ebc 100644 --- a/app/models/communication/website/post.rb +++ b/app/models/communication/website/post.rb @@ -66,6 +66,16 @@ 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 + # TODO hydrate action-text-attachment + self.text + end + + def text_summernote=(value) + # TODO dehydrate action-text-attachment + self.text = value + end + def path # used in menu_item#static_target "/#{published_at.strftime "%Y/%m/%d"}/#{slug}" diff --git a/app/views/admin/communication/website/posts/_form.html.erb b/app/views/admin/communication/website/posts/_form.html.erb index 41281bd67..722a8a1d6 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_new, as: :summernote %> + <%= f.input :text_summernote, as: :summernote %> </div> </div> <div class="card flex-fill w-100"> -- GitLab