diff --git a/app/models/communication/website/menu/item.rb b/app/models/communication/website/menu/item.rb index c5cbb1993e917e94d77d381bc0de7fdbec4556c2..d5e7beaf1a84e115cea5adf8d6c6b4b6fb10bdec 100644 --- a/app/models/communication/website/menu/item.rb +++ b/app/models/communication/website/menu/item.rb @@ -44,7 +44,7 @@ class Communication::Website::Menu::Item < ApplicationRecord foreign_key: :parent_id, dependent: :destroy - enum kind: { url: 0, page: 1, blank: 2 }, _prefix: :kind + enum kind: { blank: 0, url: 10, page: 20 }, _prefix: :kind validates :title, presence: true diff --git a/app/views/admin/communication/website/menu/items/_treebranch.html.erb b/app/views/admin/communication/website/menu/items/_treebranch.html.erb index f224ceb44229ab1d08d7214d7687e748387bdcd8..5b553962da246443d03898d73d267e3de6cf6580 100644 --- a/app/views/admin/communication/website/menu/items/_treebranch.html.erb +++ b/app/views/admin/communication/website/menu/items/_treebranch.html.erb @@ -15,6 +15,7 @@ <% end %> <%= link_to item, admin_communication_website_menu_item_path(website_id: item.website.id, menu_id: item.menu.id, id: item.id) %> <span class="move_btn py-2 ps-2"><i class="fas fa-sort"></i></span> + <%= link_to t('edit'), edit_admin_communication_website_menu_item_path(website_id: item.website.id, menu_id: item.menu.id, id: item.id), class: "#{button_classes} float-end" %> </div> <ul class="list-unstyled treeview__children js-treeview-children js-treeview-sortable-container ms-4" data-id="<%= item.id %>"> <li class="treeview__empty"> diff --git a/app/views/admin/communication/website/menu/items/show.html.erb b/app/views/admin/communication/website/menu/items/show.html.erb index 36ec9d431c2ca6ecbf806cf9481e24428dd54abb..faf1a04092c3b90dc73649800d67cfaffe44d1a0 100644 --- a/app/views/admin/communication/website/menu/items/show.html.erb +++ b/app/views/admin/communication/website/menu/items/show.html.erb @@ -17,7 +17,7 @@ <td width="150"><%= Communication::Website::Menu::Item.human_attribute_name('url') %></td> <td><%= link_to @item.url, @item.url, target: :blank unless @item.url.blank? %></td> </tr> - <% else %> + <% elsif @item.kind_page? %> <tr> <td width="150"><%= Communication::Website::Menu::Item.human_attribute_name('about') %></td> <td><%= link_to_if can?(:read, @item.about), @item.about, [:admin, @item.about] %></td> diff --git a/app/views/admin/communication/website/menus/show.html.erb b/app/views/admin/communication/website/menus/show.html.erb index 19afc03b12860f48748e253eab0dd2fb9a1c5de7..e933c13f543c1a9819b915fd50249c6a1072b654 100644 --- a/app/views/admin/communication/website/menus/show.html.erb +++ b/app/views/admin/communication/website/menus/show.html.erb @@ -1,10 +1,23 @@ <% content_for :title, @menu %> <div class="row"> - <div class="col-md-6"> + <div class="col-md-8"> <div class="card flex-fill w-100"> <div class="card-header"> - <h5 class="card-title mb-0"><%= t('metadata') %></h5> + <h2 class="card-title mb-2 h5"> + <%= "#{Communication::Website::Menu::Item.model_name.human(count: 2)} (#{@items.size})" %> + </h2> + <%= render 'admin/communication/website/menu/items/list', items: @root_items if @items.any? %> + <%= link_to t('create'), + new_admin_communication_website_menu_item_path(website_id: @website, menu_id: @menu.id), + class: button_classes if can?(:create, Communication::Website::Menu::Item) %> + </div> + </div> + </div> + <div class="col-md-4"> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h2 class="card-title mb-0 h5"><%= t('metadata') %></h2> </div> <table class="<%= table_classes %>"> <tbody> @@ -18,13 +31,6 @@ </div> </div> -<h2><%= "#{Communication::Website::Menu::Item.model_name.human(count: 2)} (#{@items.size})" %></h2> -<%= link_to t('create'), - new_admin_communication_website_menu_item_path(website_id: @website, menu_id: @menu.id), - class: button_classes %> - -<%= render 'admin/communication/website/menu/items/list', items: @root_items if @items.any? %> - <% content_for :action_bar_right do %> <%= edit_link @menu %> <% end %> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index e4a1070ede02171e24f1fa329bfe686e43d5eae8..5b2fa9ba79775126ab546eb69e7e5e8fd5a292a8 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -107,7 +107,7 @@ en: enums: communication/website/menu/item: kind: - blank: Blank + blank: Title page: Page url: URL simple_form: diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index d27bd0eb48fbb8780d1b936f12e10b832a281c95..01ffdddc93bdd7be1bcc55abf9be4a9b2f6b23ca 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -107,7 +107,7 @@ fr: enums: communication/website/menu/item: kind: - blank: Vide + blank: Titre intermédiaire page: Page url: URL simple_form: