diff --git a/app/controllers/admin/communication/website/categories_controller.rb b/app/controllers/admin/communication/website/categories_controller.rb index c3e9a0608e1970216cd4292ff9891b91b6d45f21..0db5e29c4ff1a3c543660cfa3425fc76a959e7de 100644 --- a/app/controllers/admin/communication/website/categories_controller.rb +++ b/app/controllers/admin/communication/website/categories_controller.rb @@ -19,8 +19,12 @@ class Admin::Communication::Website::CategoriesController < Admin::Communication parent_id: parent_id, position: index + 1 ) + category.sync_with_git unless parent_id + end + if parent_id + parent = @website.categories.find(parent_id) + parent.sync_with_git end - first_category.sync_with_git if first_category end def children diff --git a/app/models/communication/website/page.rb b/app/models/communication/website/page.rb index b0b9c44e00dd0086c84ec82dad07d3f5f73f4567..5116c340780cc6ed2fdf2f0351569418e0b4e448 100644 --- a/app/models/communication/website/page.rb +++ b/app/models/communication/website/page.rb @@ -124,13 +124,13 @@ class Communication::Website::Page < ApplicationRecord def best_featured_image # we don't want to fallback on homepage featured_image - return featured_image if featured_image.attached? || parent.kind_home? + return featured_image if featured_image.attached? || kind_home? || parent.kind_home? parent&.best_featured_image end def best_bodyclass return bodyclass if bodyclass.present? - parent&.best_bodyclass unless parent.kind_home? + parent&.best_bodyclass unless kind_home? || parent.kind_home? end def update_children_paths diff --git a/app/views/admin/communication/website/menu/items/_form.html.erb b/app/views/admin/communication/website/menu/items/_form.html.erb index fa6d4d31b61f0661fe3a20385060c7ba2bdfd942..4827a49ef7bb6675fb2d18d6126575652ea1fecf 100644 --- a/app/views/admin/communication/website/menu/items/_form.html.erb +++ b/app/views/admin/communication/website/menu/items/_form.html.erb @@ -1,5 +1,6 @@ <%= simple_form_for item, url: item.persisted? ? [:admin, item, { menu_id: @menu.id }] : admin_communication_website_menu_items_path(@menu) do |f| %> + <%= f.input :parent_id, as: :hidden, wrapper: false %> <div class="card flex-fill w-100"> <div class="card-header"> <h5 class="card-title mb-0"><%= t('content') %></h5>