diff --git a/app/controllers/admin/communication/websites/categories_controller.rb b/app/controllers/admin/communication/websites/categories_controller.rb index 580c9497cc35ffd75ef28633b6044854c65bbadd..e2c6aefe9ed77c917b198f8e1f076b8f3a7d5292 100644 --- a/app/controllers/admin/communication/websites/categories_controller.rb +++ b/app/controllers/admin/communication/websites/categories_controller.rb @@ -97,7 +97,7 @@ class Admin::Communication::Websites::CategoriesController < Admin::Communicatio def category_params params.require(:communication_website_category) .permit( - :website_id, :name, :description, :text, :slug, :parent_id, + :website_id, :name, :description, :summary, :slug, :parent_id, :featured_image, :featured_image_delete, :featured_image_infos, :featured_image_alt, :featured_image_credit ) .merge(university_id: current_university.id) diff --git a/app/models/communication/website/category.rb b/app/models/communication/website/category.rb index 1d3d87c76bac03cbf4af9916db090c2f35f33c1e..d6d6174e7f6f5e6d2394ba641ef1b65783c5d98d 100644 --- a/app/models/communication/website/category.rb +++ b/app/models/communication/website/category.rb @@ -12,7 +12,7 @@ # path :string # position :integer # slug :string -# text :text +# summary :text # created_at :datetime not null # updated_at :datetime not null # communication_website_id :uuid not null, indexed diff --git a/app/views/admin/communication/websites/categories/_form.html.erb b/app/views/admin/communication/websites/categories/_form.html.erb index ca666d4069c86caa7ba19209dfef336b8cb73d4b..3ac988a84a6c4991de7a74bb8e4f7e1e65364e79 100644 --- a/app/views/admin/communication/websites/categories/_form.html.erb +++ b/app/views/admin/communication/websites/categories/_form.html.erb @@ -10,7 +10,7 @@ </div> <div class="card-body"> <%= f.input :name %> - <%= f.input :text %> + <%= render 'admin/application/summary/form', f: f, about: category %> </div> </div> <div class="card"> diff --git a/app/views/admin/communication/websites/categories/show.html.erb b/app/views/admin/communication/websites/categories/show.html.erb index 851734a6c269fa8048d50a26c96dc5704f2b4ed3..119b03aece26e35530ab559cfc7398939d5b23e1 100644 --- a/app/views/admin/communication/websites/categories/show.html.erb +++ b/app/views/admin/communication/websites/categories/show.html.erb @@ -3,15 +3,7 @@ <%= render 'admin/communication/websites/sidebar' do %> <div class="row"> <div class="col-md-8"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h2 class="card-title mb-0 h5"><%= t('content') %></h2> - </div> - <div class="card-body"> - <h3 class="h5"><%= Communication::Website::Category.human_attribute_name('text') %></h3> - <%= sanitize @category.text %> - </div> - </div> + <%= render 'admin/application/summary/show', about: @category %> <%= render 'admin/communication/blocks/list', about: @category %> </div> <div class="col-md-4"> diff --git a/app/views/admin/communication/websites/categories/static.html.erb b/app/views/admin/communication/websites/categories/static.html.erb index 21d8a6f55435e9388b73cffa8ec714488c1060b6..00c8b304bcdb73c6e72cd2b7feef3e63331fdac8 100644 --- a/app/views/admin/communication/websites/categories/static.html.erb +++ b/app/views/admin/communication/websites/categories/static.html.erb @@ -15,7 +15,6 @@ position: <%= @about.position %> <%= render 'admin/communication/unsplash/static' %> description: > <%= prepare_text_for_static @about.description %> -description_short: > - <%= prepare_text_for_static @about.text %> +<%= render 'admin/application/summary/static' %> <%= render 'admin/communication/blocks/static', about: @about %> --- diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index 1a29bf58bdff5a03aea739e117f8269ca2ee6528..5376cfd591c681333060c897fc76cd7fc1ee366d 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -85,12 +85,12 @@ en: communication/website/category: children: Children categories description: Meta Description - text: Lead text featured_image: Featured image featured_image_alt: Alt text name: Name parent: Parent category slug: Slug + summary: Summary communication/website/imported/category: original: Original communication/website/imported/medium: diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 57a6f9004107332db1ead3de44a6b9ab5398d8fe..d93f914045e715c96832683987ad34d3138cfb86 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -85,12 +85,12 @@ fr: communication/website/category: children: Catégories enfants description: Meta Description - text: Chapô featured_image: Image à la une featured_image_alt: Texte alternatif name: Nom parent: Catégorie parente slug: Slug + summary: Résumé communication/website/imported/category: original: Original communication/website/imported/medium: diff --git a/db/migrate/20230109132016_rename_categories_text_to_summary.rb b/db/migrate/20230109132016_rename_categories_text_to_summary.rb new file mode 100644 index 0000000000000000000000000000000000000000..acbd8d5a85b738c7830931d4b956b6d3d462ef49 --- /dev/null +++ b/db/migrate/20230109132016_rename_categories_text_to_summary.rb @@ -0,0 +1,5 @@ +class RenameCategoriesTextToSummary < ActiveRecord::Migration[7.0] + def change + rename_column :communication_website_categories, :text, :summary + end +end diff --git a/db/schema.rb b/db/schema.rb index 8573f604dc5f3b33e50d9111f4c3169538e3e19f..abc4d39599a2b1c35625b009b498469a7d119fa8 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[7.0].define(version: 2023_01_09_110701) do +ActiveRecord::Schema[7.0].define(version: 2023_01_09_132016) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -132,7 +132,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_09_110701) do t.boolean "is_programs_root", default: false t.string "path" t.string "featured_image_alt" - t.text "text" + t.text "summary" t.text "featured_image_credit" 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"