diff --git a/app/controllers/admin/communication/website/categories_controller.rb b/app/controllers/admin/communication/website/categories_controller.rb index d755ae142070e7b7e10ccf33a1dc57e725f5f235..c3e9a0608e1970216cd4292ff9891b91b6d45f21 100644 --- a/app/controllers/admin/communication/website/categories_controller.rb +++ b/app/controllers/admin/communication/website/categories_controller.rb @@ -90,7 +90,7 @@ class Admin::Communication::Website::CategoriesController < Admin::Communication def category_params params.require(:communication_website_category) .permit( - :website_id, :name, :description, :slug, :parent_id, + :website_id, :name, :description, :text, :slug, :parent_id, :featured_image, :featured_image_delete, :featured_image_infos, :featured_image_alt) .merge(university_id: current_university.id) end diff --git a/app/controllers/admin/communication/website/pages_controller.rb b/app/controllers/admin/communication/website/pages_controller.rb index 25f582de143931aa282f6995966693b0db726d78..87855f6d9f6c0d27f3619ea375ec63d2bb59c4c7 100644 --- a/app/controllers/admin/communication/website/pages_controller.rb +++ b/app/controllers/admin/communication/website/pages_controller.rb @@ -87,7 +87,7 @@ class Admin::Communication::Website::PagesController < Admin::Communication::Web def page_params params.require(:communication_website_page) .permit(:communication_website_id, :title, - :description, :text, :about_type, :about_id, :slug, :published, + :description, :description_short, :text, :about_type, :about_id, :slug, :published, :featured_image, :featured_image_delete, :featured_image_infos, :featured_image_alt, :parent_id, :related_category_id) .merge(university_id: current_university.id) diff --git a/app/controllers/admin/communication/website/posts_controller.rb b/app/controllers/admin/communication/website/posts_controller.rb index 7574a6220fff395b7f9fbd51816b7f4b0f312031..95bddee72ff187923f2de4cb9e45277b3563da8e 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, + :university_id, :website_id, :title, :description, :description_short, :text, :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/category.rb b/app/models/communication/website/category.rb index 82f9ca9b8e984a18dca8619645fc7a48fb8c89c5..d4a32e3922d7af4d40e265f56439bf078034a8cf 100644 --- a/app/models/communication/website/category.rb +++ b/app/models/communication/website/category.rb @@ -11,6 +11,7 @@ # path :string # position :integer # slug :string +# text :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 731fef109d73140da179fa0b1076b223d05d83e6..24e4499cf6350f122c24af56edd51b30c6e7d15d 100644 --- a/app/models/communication/website/page.rb +++ b/app/models/communication/website/page.rb @@ -4,12 +4,10 @@ # # id :uuid not null, primary key # about_type :string indexed => [about_id] -# breadcrumb_title :string # description :text +# description_short :text # featured_image_alt :string # github_path :text -# header_text :text -# kind :integer # old_text :text # path :text # position :integer default(0), not null diff --git a/app/models/communication/website/post.rb b/app/models/communication/website/post.rb index 0a2250b06d975d66a7e28c2707aa6cb048ed4e48..72910c15fe2c6f169dfe8886c1f850e1e3e1940d 100644 --- a/app/models/communication/website/post.rb +++ b/app/models/communication/website/post.rb @@ -4,6 +4,7 @@ # # id :uuid not null, primary key # description :text +# description_short :text # featured_image_alt :string # github_path :text # old_text :text diff --git a/app/views/admin/communication/website/categories/_form.html.erb b/app/views/admin/communication/website/categories/_form.html.erb index c0c122f02dbd918b662d6556f3bf1ba7944ec2e0..6fa1142149b0703e0855e2d88ed0451c2912b511 100644 --- a/app/views/admin/communication/website/categories/_form.html.erb +++ b/app/views/admin/communication/website/categories/_form.html.erb @@ -8,6 +8,7 @@ <div class="card-body"> <%= f.input :name %> <%= f.input :description %> + <%= f.input :text, as: :summernote %> </div> </div> </div> diff --git a/app/views/admin/communication/website/categories/show.html.erb b/app/views/admin/communication/website/categories/show.html.erb index 6b2cd098034cb6d3ee3716d4fb66d4d67839c582..a5b6bf332df3c6646881154162e30307ea20b801 100644 --- a/app/views/admin/communication/website/categories/show.html.erb +++ b/app/views/admin/communication/website/categories/show.html.erb @@ -9,7 +9,9 @@ </div> <div class="card-body"> <h3 class="h5"><%= Communication::Website::Category.human_attribute_name('description') %></h3> - <%= sanitize @category.description %> + <p><%= sanitize @category.description %></p> + <h3 class="h5"><%= Communication::Website::Category.human_attribute_name('text') %></h3> + <%= sanitize @category.text %> </div> </div> </div> diff --git a/app/views/admin/communication/website/categories/static.html.erb b/app/views/admin/communication/website/categories/static.html.erb index 500d4021ef6426c6b36bf579f3c623fdae768200..ef0142538858efa7bcea609f9d79077a9f892135 100644 --- a/app/views/admin/communication/website/categories/static.html.erb +++ b/app/views/admin/communication/website/categories/static.html.erb @@ -6,5 +6,7 @@ position: <%= @about.position %> image: "<%= @about.best_featured_image.blob.id %>" image_alt: "<%= @about.featured_image_alt %>" <% end %> +description: > + <%= prepare_text_for_static @about.description %> --- -<%= prepare_html_for_static @about.description, @about.university %> +<%= prepare_html_for_static @about.text, @about.university %> diff --git a/app/views/admin/communication/website/pages/_form.html.erb b/app/views/admin/communication/website/pages/_form.html.erb index 2781e1729e265ea7e183b6cd7815823ffd3f4f6d..06ac463306ef7bd1774aa7566290de62ee3a5292 100644 --- a/app/views/admin/communication/website/pages/_form.html.erb +++ b/app/views/admin/communication/website/pages/_form.html.erb @@ -8,6 +8,7 @@ <div class="card-body"> <%= f.input :title %> <%= f.input :description %> + <%= f.input :description_short %> <%= f.input :text, as: :summernote %> <%= f.association :related_category, collection: collection_tree(@website.categories), diff --git a/app/views/admin/communication/website/pages/show.html.erb b/app/views/admin/communication/website/pages/show.html.erb index 36b7e13ffbf8d1597aee42ba98b29467b1aacdf4..8522695fb5c41da445144963bf6906097deca556 100644 --- a/app/views/admin/communication/website/pages/show.html.erb +++ b/app/views/admin/communication/website/pages/show.html.erb @@ -10,6 +10,7 @@ </div> <div class="card-body"> <%= render 'admin/application/property/text', object: @page, property: :description %> + <%= render 'admin/application/property/text', object: @page, property: :description_short %> <%= render 'admin/application/property/text', object: @page, property: :text %> </div> </div> diff --git a/app/views/admin/communication/website/pages/static.html.erb b/app/views/admin/communication/website/pages/static.html.erb index 23c3d9aae117fc66c73ccb9fd4ed0f3553834ebc..ac51c4aa5fc7e8b70f42a8b1832b90e4271d7fd6 100644 --- a/app/views/admin/communication/website/pages/static.html.erb +++ b/app/views/admin/communication/website/pages/static.html.erb @@ -12,6 +12,8 @@ category: "<%= @about.related_category.path %>/" <% end %> description: > <%= prepare_text_for_static @about.description %> +description_short: > + <%= prepare_text_for_static @about.description_short %> <%= render 'admin/communication/blocks/static', about: @about %> --- <%= prepare_html_for_static @about.text, @about.university %> diff --git a/app/views/admin/communication/website/posts/_form.html.erb b/app/views/admin/communication/website/posts/_form.html.erb index c82cdb4b22eecf8375735497c3deb1abaee4c3e8..9965c8536f358ceb37f6cf697cdc5d73b43806c3 100644 --- a/app/views/admin/communication/website/posts/_form.html.erb +++ b/app/views/admin/communication/website/posts/_form.html.erb @@ -8,6 +8,7 @@ <div class="card-body"> <%= f.input :title %> <%= f.input :description %> + <%= f.input :description_short %> <%= f.input :text, as: :summernote %> </div> </div> diff --git a/app/views/admin/communication/website/posts/show.html.erb b/app/views/admin/communication/website/posts/show.html.erb index 079d3548b840e3dae8348ed2a04fecfd51c47bf1..ba186de893e773502f618479fb0765eaae02e762 100644 --- a/app/views/admin/communication/website/posts/show.html.erb +++ b/app/views/admin/communication/website/posts/show.html.erb @@ -9,6 +9,7 @@ </div> <div class="card-body"> <%= render 'admin/application/property/text', object: @post, property: :description %> + <%= render 'admin/application/property/text', object: @post, property: :description_short %> <%= render 'admin/application/property/text', object: @post, property: :text %> <%= render 'admin/application/property/summernote_embeds', object: @post, property: :medias %> <p><%= prepare_text_for_static @post.description %></p> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index b54ff487ee62790ed87d108116179b8d1a1095bc..3beeb6eebd3899da3af1ecccd77ad25866aaa51e 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -57,6 +57,7 @@ en: communication/website/category: children: Children categories description: Description (SEO) + text: Text featured_image: Featured image featured_image_alt: Alt text name: Name @@ -89,6 +90,7 @@ en: related_category: Related category children: Children pages description: Description (SEO) + description_short: Short description featured_image: Featured image featured_image_alt: Alt text parent: Parent page @@ -102,6 +104,7 @@ en: category: Category categories: Categories description: Description (SEO) + description_short: Short description featured_image: Featured image featured_image_alt: Alt text pinned: Pinned? diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 26d7dba92d6ce36c210063067cccbc62d7191060..b6c3edd4f045f2bfea96acca57928d784cf83f37 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -57,6 +57,7 @@ fr: communication/website/category: children: Catégories enfants description: Description (SEO) + text: Texte featured_image: Image à la une featured_image_alt: Texte alternatif name: Nom @@ -89,6 +90,7 @@ fr: related_category: Catégorie liée children: Pages enfants description: Description (SEO) + description_short: Description courte featured_image: Image à la une featured_image_alt: Texte alternatif parent: Page parente @@ -102,6 +104,7 @@ fr: category: Catégorie categories: Catégories description: Description (SEO) + description_short: Description courte featured_image: Image à la une featured_image_alt: Texte alternatif pinned: Mis en avant ? diff --git a/db/migrate/20220401154318_add_description_short_to_page.rb b/db/migrate/20220401154318_add_description_short_to_page.rb new file mode 100644 index 0000000000000000000000000000000000000000..b4c1efc11f613dcec360e2e426cad247b27ea264 --- /dev/null +++ b/db/migrate/20220401154318_add_description_short_to_page.rb @@ -0,0 +1,5 @@ +class AddDescriptionShortToPage < ActiveRecord::Migration[6.1] + def change + add_column :communication_website_pages, :description_short, :text + end +end diff --git a/db/migrate/20220401180504_add_description_short_to_post.rb b/db/migrate/20220401180504_add_description_short_to_post.rb new file mode 100644 index 0000000000000000000000000000000000000000..e302f39b7ea1d0d111e0dfb175535c34064ffbc1 --- /dev/null +++ b/db/migrate/20220401180504_add_description_short_to_post.rb @@ -0,0 +1,5 @@ +class AddDescriptionShortToPost < ActiveRecord::Migration[6.1] + def change + add_column :communication_website_posts, :description_short, :text + end +end diff --git a/db/migrate/20220404140813_add_description_to_category.rb b/db/migrate/20220404140813_add_description_to_category.rb new file mode 100644 index 0000000000000000000000000000000000000000..f6e47636a1ace5fa004aece0bdee95dbb235de6d --- /dev/null +++ b/db/migrate/20220404140813_add_description_to_category.rb @@ -0,0 +1,5 @@ +class AddDescriptionToCategory < ActiveRecord::Migration[6.1] + def change + add_column :communication_website_categories, :text, :text + end +end diff --git a/db/schema.rb b/db/schema.rb index 60ee56ca81080324136c99a2ef559296efd7cc4e..655cdc66a9e8d6e2e3d34aec7bd43761ec8c73a9 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_04_01_105007) do +ActiveRecord::Schema.define(version: 2022_04_04_140813) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" @@ -117,6 +117,7 @@ ActiveRecord::Schema.define(version: 2022_04_01_105007) do t.boolean "is_programs_root", default: false t.string "path" t.string "featured_image_alt" + t.text "text" t.index ["communication_website_id"], name: "idx_communication_website_post_cats_on_communication_website_id" t.index ["parent_id"], name: "index_communication_website_categories_on_parent_id" t.index ["program_id"], name: "index_communication_website_categories_on_program_id" @@ -318,6 +319,7 @@ ActiveRecord::Schema.define(version: 2022_04_01_105007) do t.uuid "related_category_id" t.string "featured_image_alt" t.text "text" + t.text "description_short" 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" @@ -341,6 +343,7 @@ ActiveRecord::Schema.define(version: 2022_04_01_105007) do t.boolean "pinned", default: false t.string "featured_image_alt" t.text "text" + t.text "description_short" t.index ["author_id"], name: "index_communication_website_posts_on_author_id" t.index ["communication_website_id"], name: "index_communication_website_posts_on_communication_website_id" t.index ["university_id"], name: "index_communication_website_posts_on_university_id" diff --git a/test/fixtures/communication/website/posts.yml b/test/fixtures/communication/website/posts.yml index aa5498d02486b6145071853198c254c3eaeca95c..0bc85c0f7d3a8fd095a209660748ede658f845ff 100644 --- a/test/fixtures/communication/website/posts.yml +++ b/test/fixtures/communication/website/posts.yml @@ -4,6 +4,7 @@ # # id :uuid not null, primary key # description :text +# description_short :text # featured_image_alt :string # github_path :text # old_text :text