diff --git a/app/controllers/admin/communication/website/pages_controller.rb b/app/controllers/admin/communication/website/pages_controller.rb index f599f794cef1f5aa6af33f006bdbd926fc0d4690..94d6260a8466ec03487826fb33b8d667e609158f 100644 --- a/app/controllers/admin/communication/website/pages_controller.rb +++ b/app/controllers/admin/communication/website/pages_controller.rb @@ -55,7 +55,6 @@ class Admin::Communication::Website::PagesController < Admin::Communication::Web end def update - byebug if @page.update(page_params) redirect_to admin_communication_website_page_path(@page), notice: t('admin.successfully_updated_html', model: @page.to_s) else diff --git a/app/models/communication/website/page.rb b/app/models/communication/website/page.rb index 9c60d9ceb6d4e08d523f8b083a6ea634690d9ebc..5e7b1f45b56247773cfd420db7338f51bf9a7459 100644 --- a/app/models/communication/website/page.rb +++ b/app/models/communication/website/page.rb @@ -63,7 +63,6 @@ class Communication::Website::Page < ApplicationRecord dependent: :nullify validates :title, presence: true - validate :homepage_is_published? before_validation :make_path after_save :update_children_paths if :saved_change_to_path? @@ -91,10 +90,6 @@ class Communication::Website::Page < ApplicationRecord "#{ title }" end - def is_homepage? - path == '/' - end - protected def make_path @@ -105,9 +100,5 @@ class Communication::Website::Page < ApplicationRecord children.each(&:save) end - def homepage_is_published? - if is_homepage? and !published - errors.add(:published, :home_not_published) - end - end + end diff --git a/app/models/concerns/with_slug.rb b/app/models/concerns/with_slug.rb index 81ec3bc25299ccd0f01729c3665ea52eead0fef1..c13d07f016e818ec64cf5be2dfab675273d00ef0 100644 --- a/app/models/concerns/with_slug.rb +++ b/app/models/concerns/with_slug.rb @@ -5,7 +5,6 @@ module WithSlug validates :slug, uniqueness: { scope: :university_id } validates :slug, - format: { with: /\A[a-z0-9\-]+\z/, message: "ne peut contenir que des lettres minuscules, des chiffres et des traits d'union." }, - allow_blank: true + format: { with: /\A[a-z0-9\-]+\z/, message: I18n.t('slug_error') } end end diff --git a/app/views/admin/communication/website/pages/jekyll.html.erb b/app/views/admin/communication/website/pages/jekyll.html.erb index c7f5d008d255bd23ddf78d6187dc1213a91c39b0..c99b7a260ca1a0ea45787634f0e7abe123c76a55 100644 --- a/app/views/admin/communication/website/pages/jekyll.html.erb +++ b/app/views/admin/communication/website/pages/jekyll.html.erb @@ -1,7 +1,4 @@ --- -<% if @page.is_homepage? %> -layout: home -<% end %> title: "<%= @page.title %>" permalink: "<%= @page.path %>" identifier: "<%= @page.id %>" diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index 23975e9a2188b1922b71bfc5b2ace532b114ef71..cd85630bb7e867c5c545a6be9940a9998d8503a8 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -113,19 +113,9 @@ en: text: Text title: Title website: Website - errors: - models: - communication/website/page: - attributes: - published: - home_not_published: must be checked. Homepage has to be published. enums: communication/website/menu/item: kind: blank: Title page: Page url: URL - simple_form: - hints: - communication_website_page: - slug: Leave empty for home page diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 9efca97a4695df9c0af37bf457da2e19ae4b1307..7116b0d67847b21049a2170c576be4cff78398be 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -113,19 +113,9 @@ fr: text: Texte title: Titre website: Site Web - errors: - models: - communication/website/page: - attributes: - published: - home_not_published: doit être coché. La page d'accueil doit être publiée. enums: communication/website/menu/item: kind: blank: Titre intermédiaire page: Page url: URL - simple_form: - hints: - communication_website_page: - slug: Laisser vide pour la page d'accueil du site diff --git a/config/locales/en.yml b/config/locales/en.yml index 683b157c97705fe0fecddbfab1ccd54fa9623697..5401d17f0a016e447185d6f318ff86b3b7dbea70 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -119,6 +119,7 @@ en: simple_form_password_with_hints: test_chars: "%{min_length} characters min." show: Show + slug_error: can only contain downcase letters, numbers, and dashes. terms_of_service: Terms of service terms_of_service_url: https://osuny.org/conditions-d-utilisation time: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index b36549ec4278ac475139f9c2b9545e437ed55128..9ed3416cabc992ab431373503c5ca8c7b7b32bc1 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -119,6 +119,7 @@ fr: simple_form_password_with_hints: test_chars: "%{min_length} caractères min." show: Voir + slug_error: ne peut contenir que des lettres minuscules, des chiffres et des traits d'union. terms_of_service: Conditions d'utilisation terms_of_service_url: https://osuny.org/conditions-d-utilisation time: