diff --git a/app/controllers/admin/communication/website/categories_controller.rb b/app/controllers/admin/communication/website/categories_controller.rb index d328417e9ff3f5d3eb534acadd25a6b3f0cd40e4..1c609c597a9f754666a133ae0143d6a1845cb4c6 100644 --- a/app/controllers/admin/communication/website/categories_controller.rb +++ b/app/controllers/admin/communication/website/categories_controller.rb @@ -33,12 +33,7 @@ class Admin::Communication::Website::CategoriesController < Admin::Communication @posts = @category.posts.ordered.page(params[:page]) breadcrumb end - - def publish - @category.sync_with_git - redirect_to admin_communication_website_category_path(@category), notice: t('admin.will_be_published_html', model: @category.to_s) - end - + def new @category.website = @website breadcrumb diff --git a/app/controllers/admin/communication/website/home_controller.rb b/app/controllers/admin/communication/website/home_controller.rb index 323e9ba3ccf96dbb7eb0b651bf385632109d3371..195cf52cb3d821abadb9024cc7fc1d4439ed5b8b 100644 --- a/app/controllers/admin/communication/website/home_controller.rb +++ b/app/controllers/admin/communication/website/home_controller.rb @@ -30,7 +30,7 @@ class Admin::Communication::Website::HomeController < Admin::Communication::Webs def home_params params.require(:communication_website_home) .permit( - :title, :text, :featured_image, :featured_image_delete, + :description, :text, :featured_image, :featured_image_delete, :featured_image_infos, :featured_image_alt ) end diff --git a/app/controllers/admin/communication/website/pages_controller.rb b/app/controllers/admin/communication/website/pages_controller.rb index eae14a1cc49462015c3330ff6cf3adcc564b7abc..6588b3a8dbcbd961169dee6ed635da457df08284 100644 --- a/app/controllers/admin/communication/website/pages_controller.rb +++ b/app/controllers/admin/communication/website/pages_controller.rb @@ -31,11 +31,6 @@ class Admin::Communication::Website::PagesController < Admin::Communication::Web breadcrumb end - def publish - @page.sync_with_git - redirect_to admin_communication_website_page_path(@page), notice: t('admin.will_be_published_html', model: @page.to_s) - end - def new @page.website = @website breadcrumb diff --git a/app/controllers/admin/communication/website/posts_controller.rb b/app/controllers/admin/communication/website/posts_controller.rb index d337f5968b90f6a338eb573b67fb3d7d113e8317..7574a6220fff395b7f9fbd51816b7f4b0f312031 100644 --- a/app/controllers/admin/communication/website/posts_controller.rb +++ b/app/controllers/admin/communication/website/posts_controller.rb @@ -10,11 +10,6 @@ class Admin::Communication::Website::PostsController < Admin::Communication::Web breadcrumb end - def publish - @post.sync_with_git - redirect_to admin_communication_website_post_path(@post), notice: t('admin.will_be_published_html', model: @post.to_s) - end - def new @post.website = @website breadcrumb diff --git a/app/controllers/admin/communication/websites_controller.rb b/app/controllers/admin/communication/websites_controller.rb index 5c7c8e6aadff8e5c376809c3ef1408096c7a074b..7080de9403c36b08b3872b4d562013a849303b30 100644 --- a/app/controllers/admin/communication/websites_controller.rb +++ b/app/controllers/admin/communication/websites_controller.rb @@ -33,11 +33,6 @@ class Admin::Communication::WebsitesController < Admin::Communication::Applicati add_breadcrumb Communication::Website::Imported::Website.model_name.human end - def publish - @website.sync_with_git - redirect_to admin_communication_website_path(@website), notice: t('admin.will_be_published_html', model: @website.to_s) - end - def edit breadcrumb add_breadcrumb t('edit') diff --git a/app/models/communication/website/home.rb b/app/models/communication/website/home.rb index 6d0989f060729b5100841df61667698df7c2d733..ab747c8463fbd7bc70eca26bd3c1bd184d74c40f 100644 --- a/app/models/communication/website/home.rb +++ b/app/models/communication/website/home.rb @@ -3,9 +3,9 @@ # Table name: communication_website_homes # # id :uuid not null, primary key +# description :text # featured_image_alt :string # github_path :text -# title :string default("Home") # created_at :datetime not null # updated_at :datetime not null # communication_website_id :uuid not null diff --git a/app/models/communication/website/structure.rb b/app/models/communication/website/structure.rb index 41e414f9704d62d48a6ed78787e749f35513318d..0cb7d3efc7c884abf19ce2934dbf248d717286a5 100644 --- a/app/models/communication/website/structure.rb +++ b/app/models/communication/website/structure.rb @@ -74,8 +74,8 @@ class Communication::Website::Structure < ApplicationRecord def git_dependencies(website) dependencies = [] - dependencies << Communication::Website::Structure::Administrators.find(id) dependencies << Communication::Website::Structure::Persons.find(id) + dependencies << Communication::Website::Structure::Administrators.find(id) dependencies << Communication::Website::Structure::Authors.find(id) if website.authors.any? dependencies << Communication::Website::Structure::CommunicationPosts.find(id) if website.posts.published.any? diff --git a/app/views/admin/communication/website/categories/show.html.erb b/app/views/admin/communication/website/categories/show.html.erb index 04e252e98dd6ef1c1f1bb3a05d33dfd11044af14..1d529ac459f8a3bc421395c407119c43de8767f1 100644 --- a/app/views/admin/communication/website/categories/show.html.erb +++ b/app/views/admin/communication/website/categories/show.html.erb @@ -60,13 +60,6 @@ <% end %> <% end %> -<% content_for :action_bar_left do %> - <%= link_to t('communication.website.force_publication'), - publish_admin_communication_website_category_path(@category), - method: :post, - class: button_classes %> -<% end %> - <% content_for :action_bar_right do %> <%= edit_link @category %> <% end %> diff --git a/app/views/admin/communication/website/homes/edit.html.erb b/app/views/admin/communication/website/homes/edit.html.erb index e341c33b2597e8065660a4983e09c6aa91591363..ca117a77ceb0e53e27cad5d07d7341cbf1a1118c 100644 --- a/app/views/admin/communication/website/homes/edit.html.erb +++ b/app/views/admin/communication/website/homes/edit.html.erb @@ -9,7 +9,7 @@ <h5 class="card-title mb-0"><%= t('content') %></h5> </div> <div class="card-body"> - <%= f.input :title %> + <%= f.input :description %> <%= f.input :text, as: :rich_text_area %> </div> </div> diff --git a/app/views/admin/communication/website/homes/static.html.erb b/app/views/admin/communication/website/homes/static.html.erb index f4868873d820c25004f2fb47bbae927f4120595c..94f6b202441a3f17afed3336c42db6864fab2020 100644 --- a/app/views/admin/communication/website/homes/static.html.erb +++ b/app/views/admin/communication/website/homes/static.html.erb @@ -1,12 +1,12 @@ --- title: > <%= @home.website.name %> -breadcrumb_title: "<%= @home.title %>" +breadcrumb_title: "<%= @website.structure.home_title %>" <% if @home.featured_image.attached? %> image: "<%= @home.featured_image.blob.id %>" image_alt: "<%= @home.featured_image_alt %>" <% end %> description: > - <%= strip_tags prepare_html_for_static(@home.text, @home.university) %> + <%= @home.description %> --- <%= prepare_html_for_static @home.text, @home.university %> diff --git a/app/views/admin/communication/website/pages/show.html.erb b/app/views/admin/communication/website/pages/show.html.erb index b42d6c952c834aa49687b729181dbb442f625ed0..898684ec08ae6278bc47ed3ddf9f1286d7f4d665 100644 --- a/app/views/admin/communication/website/pages/show.html.erb +++ b/app/views/admin/communication/website/pages/show.html.erb @@ -77,14 +77,6 @@ </div> <% end %> -<% content_for :action_bar_left do %> - <%= destroy_link @page %> - <%= link_to t('communication.website.force_publication'), - publish_admin_communication_website_page_path(@page), - method: :post, - class: button_classes %> -<% end %> - <% content_for :action_bar_right do %> <%= edit_link @page %> <% end %> diff --git a/app/views/admin/communication/website/posts/show.html.erb b/app/views/admin/communication/website/posts/show.html.erb index f8d9c7788c8283de8e54749617cfb2393e197105..9ffac8da69451a456233aed2efed0c330e84e3d1 100644 --- a/app/views/admin/communication/website/posts/show.html.erb +++ b/app/views/admin/communication/website/posts/show.html.erb @@ -60,13 +60,6 @@ </div> <% end %> -<% content_for :action_bar_left do %> - <%= link_to t('communication.website.force_publication'), - publish_admin_communication_website_post_path(@post), - method: :post, - class: button_classes %> -<% end %> - <% content_for :action_bar_right do %> <%= edit_link @post %> <% end %> diff --git a/app/views/admin/communication/websites/show.html.erb b/app/views/admin/communication/websites/show.html.erb index 6748a6d0745b13179bb011e3b54a5a56b0325d19..dd872787e17ee7113f41b54fed6ba909a83db7e9 100644 --- a/app/views/admin/communication/websites/show.html.erb +++ b/app/views/admin/communication/websites/show.html.erb @@ -26,13 +26,6 @@ </div> <% end %> -<% content_for :action_bar_left do %> - <%= link_to t('communication.website.force_publication'), - publish_admin_communication_website_path(@website), - method: :post, - class: button_classes %> -<% end %> - <% content_for :action_bar_right do %> <% if can? :read, Communication::Website::Imported::Website %> <% if @website.imported? %> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index dff6d1ca8fba006f3dd2cff2ab86b118c1f456da..afa0575fb77b327c31e45825cf2b67937648015c 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -50,8 +50,8 @@ en: parent: Parent category slug: Slug communication/website/home: + description: Description (SEO) text: Text - title: Title featured_image: Featured image featured_image_alt: Alt text communication/website/imported/category: @@ -130,7 +130,6 @@ en: manage_authors: Manage authors number_of_posts: Nunber of posts website: - force_publication: 'Force publication' git: Git imported: from: Imported from @@ -173,5 +172,5 @@ en: url: URL simple_form: hints: - communication_website_home: - title: Will be used in the breadcrumbs + communication_website_structure: + home_title: Will be used in the breadcrumbs diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 99849e41c1b839c52813e19262b5defc1900c25d..c59adc6e002d75a01a485bf8f9c7a73b1579ff10 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -50,8 +50,8 @@ fr: parent: Catégorie parente slug: Slug communication/website/home: + description: Description (SEO) text: Texte - title: Titre featured_image: Image à la une featured_image_alt: Texte alternatif communication/website/imported/category: @@ -130,7 +130,6 @@ fr: manage_authors: Gérer les auteur·rice·s number_of_posts: Nombre d'actualités website: - force_publication: 'Forcer la publication' git: Git imported: from: Importé depuis @@ -173,5 +172,5 @@ fr: url: URL simple_form: hints: - communication_website_home: - title: Sera utilisé notamment dans le fil d'Ariane + communication_website_structure: + home_title: Sera utilisé notamment dans le fil d'Ariane diff --git a/config/routes/admin/communication.rb b/config/routes/admin/communication.rb index 1bb626b6e6eebdd5e06392543a8fff59cc061307..705d9fb2837234f6e43b74e2a6e065d920712c27 100644 --- a/config/routes/admin/communication.rb +++ b/config/routes/admin/communication.rb @@ -5,7 +5,6 @@ namespace :communication do member do get :import post :import - post :publish end resources :pages, controller: 'website/pages' do collection do @@ -13,7 +12,6 @@ namespace :communication do end member do get :children - post :publish end end resources :categories, controller: 'website/categories' do @@ -22,15 +20,10 @@ namespace :communication do end member do get :children - post :publish end end resources :authors, controller: 'website/authors', only: [:index, :show] - resources :posts, controller: 'website/posts' do - member do - post :publish - end - end + resources :posts, controller: 'website/posts' resources :curations, path: 'posts/curations', as: :post_curations, controller: 'website/posts/curations', only: [:new, :create] resources :menus, controller: 'website/menus' do resources :items, controller: 'website/menu/items', except: :index do diff --git a/db/migrate/20220210095616_add_description_and_remove_title_from_home.rb b/db/migrate/20220210095616_add_description_and_remove_title_from_home.rb new file mode 100644 index 0000000000000000000000000000000000000000..028e52fc406c3eb145c74fce6948f9d02f6704e0 --- /dev/null +++ b/db/migrate/20220210095616_add_description_and_remove_title_from_home.rb @@ -0,0 +1,6 @@ +class AddDescriptionAndRemoveTitleFromHome < ActiveRecord::Migration[6.1] + def change + add_column :communication_website_homes, :description, :text + remove_column :communication_website_homes, :title + end +end diff --git a/db/schema.rb b/db/schema.rb index 3491f21e87f8873670f070ec5d60c38ef2d5ee72..533b7008815f4057558b32cc9036dcf1327806bc 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_07_152152) do +ActiveRecord::Schema.define(version: 2022_02_10_095616) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" @@ -125,7 +125,7 @@ ActiveRecord::Schema.define(version: 2022_02_07_152152) do t.datetime "updated_at", precision: 6, null: false t.text "github_path" t.string "featured_image_alt" - t.string "title", default: "Home" + t.text "description" 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