diff --git a/app/views/admin/communication/website/authors/edit.html.erb b/app/views/admin/communication/website/authors/edit.html.erb index e0ab11a98a11c3623983e005c562803027c58fc2..c5bbc5356138d7562e2cb1bf84eb422682388cbb 100644 --- a/app/views/admin/communication/website/authors/edit.html.erb +++ b/app/views/admin/communication/website/authors/edit.html.erb @@ -1,3 +1,5 @@ <% content_for :title, @author %> -<%= render 'form', author: @author %> +<%= render 'admin/communication/websites/sidebar' do %> + <%= render 'form', author: @author %> +<% end %> diff --git a/app/views/admin/communication/website/authors/index.html.erb b/app/views/admin/communication/website/authors/index.html.erb index bc327971e6e980600cf53d55b00356d3be865caf..e5d344d3dbb3cd8c81de2fd534fe28b8f294272a 100644 --- a/app/views/admin/communication/website/authors/index.html.erb +++ b/app/views/admin/communication/website/authors/index.html.erb @@ -1,8 +1,13 @@ <% content_for :title, "#{Communication::Website::Author.model_name.human(count: 2)} (#{@authors.total_count})" %> -<%= render 'admin/communication/website/authors/list', authors: @authors %> -<%= paginate @authors, theme: 'bootstrap-5' %> - +<%= render 'admin/communication/websites/sidebar' do %> + <div class="card"> + <%= render 'admin/communication/website/authors/list', authors: @authors %> + <div class="card-body"> + <%= paginate @authors, theme: 'bootstrap-5' %> + </div> + </div> +<% end %> <% content_for :action_bar_right do %> <%= create_link Communication::Website::Author %> diff --git a/app/views/admin/communication/website/authors/new.html.erb b/app/views/admin/communication/website/authors/new.html.erb index 65a90853c26a7cbaa0a6cbce4778da5ef3556dda..1d9894c1e9486eee19eeb7584a479b59a7614b6a 100644 --- a/app/views/admin/communication/website/authors/new.html.erb +++ b/app/views/admin/communication/website/authors/new.html.erb @@ -1,3 +1,5 @@ <% content_for :title, Communication::Website::Author.model_name.human %> -<%= render 'form', author: @author %> +<%= render 'admin/communication/websites/sidebar' do %> + <%= render 'form', author: @author %> +<% end %> diff --git a/app/views/admin/communication/website/authors/show.html.erb b/app/views/admin/communication/website/authors/show.html.erb index 70548a20a3659b215e01a1bdbbfbdd66a9dc622d..5cd49d3c5d55ea96cf93007951b58dfb090851ad 100644 --- a/app/views/admin/communication/website/authors/show.html.erb +++ b/app/views/admin/communication/website/authors/show.html.erb @@ -1,42 +1,41 @@ <% content_for :title, @author %> -<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::Author.human_attribute_name('biography') %></h3> - <%= @author.biography %> +<%= 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::Author.human_attribute_name('biography') %></h3> + <%= @author.biography %> + </div> </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> - <tr> - <td width="150"><%= Communication::Website::Author.human_attribute_name('slug') %></td> - <td><%= @author.slug %></td> - </tr> - <% if @author.user %> + <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> <tr> - <td width="150"><%= Communication::Website::Author.human_attribute_name('user') %></td> - <td><%= link_to_if can?(:read, @author.user), @author.user, admin_user_path(@author.user) %></td> + <td width="150"><%= Communication::Website::Author.human_attribute_name('slug') %></td> + <td><%= @author.slug %></td> </tr> - <% end %> - </tbody> - </table> + <% if @author.user %> + <tr> + <td width="150"><%= Communication::Website::Author.human_attribute_name('user') %></td> + <td><%= link_to_if can?(:read, @author.user), @author.user, admin_user_path(@author.user) %></td> + </tr> + <% end %> + </tbody> + </table> + </div> </div> </div> - -</div> +<% end %> <% if @posts.total_count > 0 %> <h2><%= "#{Communication::Website::Post.model_name.human(count: 2)} (#{@posts.total_count})" %></h2> diff --git a/app/views/admin/communication/website/categories/edit.html.erb b/app/views/admin/communication/website/categories/edit.html.erb index 123bc888b09752ba30b4db4eba62ec37bcbd07d2..bbb03b3722882854e97a30c6a2c6cdf48c51a91b 100644 --- a/app/views/admin/communication/website/categories/edit.html.erb +++ b/app/views/admin/communication/website/categories/edit.html.erb @@ -1,3 +1,5 @@ <% content_for :title, @category %> -<%= render 'form', category: @category %> +<%= render 'admin/communication/websites/sidebar' do %> + <%= render 'form', category: @category %> +<% end %> diff --git a/app/views/admin/communication/website/categories/index.html.erb b/app/views/admin/communication/website/categories/index.html.erb index dde54f4b5d2b768fc7ae793bc2dac21a680bbbc5..37c76d8b756561e4225e0a303e334acece5ba99c 100644 --- a/app/views/admin/communication/website/categories/index.html.erb +++ b/app/views/admin/communication/website/categories/index.html.erb @@ -1,8 +1,16 @@ <% content_for :title, "#{Communication::Website::Category.model_name.human(count: 2)} (#{@categories.count})" %> -<ul class="list-unstyled treeview treeview--sortable js-treeview js-treeview-sortable js-treeview-sortable-container" data-id="" data-sort-url="<%= reorder_admin_communication_website_categories_path %>"> - <%= render 'treebranch', categories: @root_categories %> -</ul> +<%= render 'admin/communication/websites/sidebar' do %> + <div class="card"> + <div class="card-body"> + <ul class="list-unstyled treeview treeview--sortable js-treeview js-treeview-sortable js-treeview-sortable-container" + data-id="" + data-sort-url="<%= reorder_admin_communication_website_categories_path %>"> + <%= render 'treebranch', categories: @root_categories %> + </ul> + </div> + </div> +<% end %> <% content_for :action_bar_right do %> <%= create_link Communication::Website::Category %> diff --git a/app/views/admin/communication/website/categories/new.html.erb b/app/views/admin/communication/website/categories/new.html.erb index f92532bde4aa34d077cb23a65cfdc18643b689a7..9f8ca435e75464618dd790d03b651a7ac2388862 100644 --- a/app/views/admin/communication/website/categories/new.html.erb +++ b/app/views/admin/communication/website/categories/new.html.erb @@ -1,3 +1,5 @@ <% content_for :title, Communication::Website::Category.model_name.human %> -<%= render 'form', category: @category %> +<%= render 'admin/communication/websites/sidebar' do %> + <%= render 'form', category: @category %> +<% end %> diff --git a/app/views/admin/communication/website/categories/show.html.erb b/app/views/admin/communication/website/categories/show.html.erb index 49186315e655b5f845092d070465023ef7d2d3c3..e10d8ee4aba65b0b3da574e2847aad0512cdda29 100644 --- a/app/views/admin/communication/website/categories/show.html.erb +++ b/app/views/admin/communication/website/categories/show.html.erb @@ -1,64 +1,64 @@ <% content_for :title, @category %> -<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('description') %></h3> - <%= sanitize @category.description %> +<%= 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('description') %></h3> + <%= sanitize @category.description %> + </div> </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> - <tr> - <td width="150"><%= Communication::Website::Category.human_attribute_name('slug') %></td> - <td><%= @category.slug %></td> - </tr> - <% if @category.parent %> + <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> <tr> - <td><%= Communication::Website::Category.human_attribute_name('parent') %></td> - <td><%= link_to_if can?(:read, @category.parent), - @category.parent, - admin_communication_website_category_path( - website_id: @website.id, - id: @category.parent.id - ) %></td> + <td width="150"><%= Communication::Website::Category.human_attribute_name('slug') %></td> + <td><%= @category.slug %></td> </tr> - <% end %> - <% if @category.children.any? %> - <tr> - <td><%= Communication::Website::Category.human_attribute_name('children') %></td> - <td> - <ul class="list-unstyled mb-0"> - <% @category.children.each do |child| %> - <li><%= link_to_if can?(:read, child), - child, - admin_communication_website_category_path( - website_id: @website.id, - id: child.id - ) %></li> - <% end %> - </ul> - </td> - </tr> - <% end %> - </tbody> - </table> + <% if @category.parent %> + <tr> + <td><%= Communication::Website::Category.human_attribute_name('parent') %></td> + <td><%= link_to_if can?(:read, @category.parent), + @category.parent, + admin_communication_website_category_path( + website_id: @website.id, + id: @category.parent.id + ) %></td> + </tr> + <% end %> + <% if @category.children.any? %> + <tr> + <td><%= Communication::Website::Category.human_attribute_name('children') %></td> + <td> + <ul class="list-unstyled mb-0"> + <% @category.children.each do |child| %> + <li><%= link_to_if can?(:read, child), + child, + admin_communication_website_category_path( + website_id: @website.id, + id: child.id + ) %></li> + <% end %> + </ul> + </td> + </tr> + <% end %> + </tbody> + </table> + </div> </div> </div> - -</div> +<% end %> <% if @posts.total_count > 0 %> <h2><%= "#{Communication::Website::Post.model_name.human(count: 2)} (#{@posts.total_count})" %></h2> diff --git a/app/views/admin/communication/website/home/edit.html.erb b/app/views/admin/communication/website/home/edit.html.erb index 0ed10d7c326e974165510f78f280b8040b2b1018..9677b2abe88d0c6294ead65fbe3a8ae97dd20084 100644 --- a/app/views/admin/communication/website/home/edit.html.erb +++ b/app/views/admin/communication/website/home/edit.html.erb @@ -1,35 +1,37 @@ <% content_for :title, t('activerecord.models.communication/website/home.one') %> -<%= simple_form_for @home, url: admin_communication_website_home_path(website_id: @website.id) do |f| %> - <div class="row"> - <div class="col-md-8"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('content') %></h5> - </div> - <div class="card-body"> - <%= f.input :text, as: :rich_text_area %> +<%= render 'admin/communication/websites/sidebar' do %> + <%= simple_form_for @home, url: admin_communication_website_home_path(website_id: @website.id) do |f| %> + <div class="row"> + <div class="col-md-8"> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('content') %></h5> + </div> + <div class="card-body"> + <%= f.input :text, as: :rich_text_area %> + </div> </div> </div> - </div> - <div class="col-md-4"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('activerecord.attributes.communication/website/page.featured_image') %></h5> - </div> - <div class="card-body"> - <%= f.input :featured_image, - as: :single_deletable_file, - direct_upload: true, - label: false, - input_html: { accept: '.jpg,.jpeg,.png' }, - preview: true - %> + <div class="col-md-4"> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('activerecord.attributes.communication/website/page.featured_image') %></h5> + </div> + <div class="card-body"> + <%= f.input :featured_image, + as: :single_deletable_file, + direct_upload: true, + label: false, + input_html: { accept: '.jpg,.jpeg,.png' }, + preview: true + %> + </div> </div> </div> </div> - </div> - <% content_for :action_bar_right do %> - <%= submit f %> + <% content_for :action_bar_right do %> + <%= submit f %> + <% end %> <% end %> <% end %> diff --git a/app/views/admin/communication/website/menu/items/edit.html.erb b/app/views/admin/communication/website/menu/items/edit.html.erb index 5bcb31238860a047db15c43ff33222c5a708e3db..abefdcd56c36a888343eabf8f6cae390e546b7b6 100644 --- a/app/views/admin/communication/website/menu/items/edit.html.erb +++ b/app/views/admin/communication/website/menu/items/edit.html.erb @@ -1,3 +1,5 @@ <% content_for :title, @item %> -<%= render 'form', item: @item %> +<%= render 'admin/communication/websites/sidebar' do %> + <%= render 'form', item: @item %> +<% end %> diff --git a/app/views/admin/communication/website/menu/items/new.html.erb b/app/views/admin/communication/website/menu/items/new.html.erb index 6f5acfa83284b3087240c59ba3c1c61332c3f4c0..04b495969c8bb7372b5436e52c37ac49b104913a 100644 --- a/app/views/admin/communication/website/menu/items/new.html.erb +++ b/app/views/admin/communication/website/menu/items/new.html.erb @@ -1,3 +1,5 @@ <% content_for :title, Communication::Website::Menu::Item.model_name.human %> -<%= render 'form', item: @item %> +<%= render 'admin/communication/websites/sidebar' do %> + <%= render 'form', item: @item %> +<% end %> 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 e8a5cd2217f0e0fd701a7cd4b081979ab8cc95f1..8c8a1be1be8ed04319608b88d3530f6024ccbb66 100644 --- a/app/views/admin/communication/website/menu/items/show.html.erb +++ b/app/views/admin/communication/website/menu/items/show.html.erb @@ -1,46 +1,48 @@ <% content_for :title, @item %> -<div class="row"> - <div class="col-md-8"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h2 class="card-title mb-2 h5"> - <%= "#{Communication::Website::Menu::Item.human_attribute_name('children')} (#{@children.size})" %> - </h2> - <%= render 'admin/communication/website/menu/items/list', items: @children, item: @item if @children.any? %> - <%= link_to t('create'), - new_admin_communication_website_menu_item_path(website_id: @website, menu_id: @menu.id, parent_id: @item.id), - class: button_classes if can?(:create, Communication::Website::Menu::Item) %> +<%= 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-2 h5"> + <%= "#{Communication::Website::Menu::Item.human_attribute_name('children')} (#{@children.size})" %> + </h2> + <%= render 'admin/communication/website/menu/items/list', items: @children, item: @item if @children.any? %> + <%= link_to t('create'), + new_admin_communication_website_menu_item_path(website_id: @website, menu_id: @menu.id, parent_id: @item.id), + class: button_classes if can?(:create, Communication::Website::Menu::Item) %> + </div> </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> - <tr> - <td width="150"><%= Communication::Website::Menu::Item.human_attribute_name('kind') %></td> - <td><%= @item.kind %></td> - </tr> - <% if @item.kind_url? %> - <tr> - <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> - <% elsif @item.kind_page? %> + <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> <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> + <td width="150"><%= Communication::Website::Menu::Item.human_attribute_name('kind') %></td> + <td><%= @item.kind %></td> </tr> - <% end %> - </tbody> - </table> + <% if @item.kind_url? %> + <tr> + <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> + <% 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> + </tr> + <% end %> + </tbody> + </table> + </div> </div> </div> -</div> +<% end %> <% content_for :action_bar_right do %> <%= link_to t('edit'), diff --git a/app/views/admin/communication/website/menus/edit.html.erb b/app/views/admin/communication/website/menus/edit.html.erb index 7a24a4ecbc12a56febf3e95b27ff9bd1fe97edb5..28d18c58adadb69e2976bda7158426c72bf1c378 100644 --- a/app/views/admin/communication/website/menus/edit.html.erb +++ b/app/views/admin/communication/website/menus/edit.html.erb @@ -1,3 +1,5 @@ <% content_for :title, @menu %> -<%= render 'form', menu: @menu %> +<%= render 'admin/communication/websites/sidebar' do %> + <%= render 'form', menu: @menu %> +<% end %> diff --git a/app/views/admin/communication/website/menus/index.html.erb b/app/views/admin/communication/website/menus/index.html.erb index 77c0e8d76b91287bf8b6321940dee8d1c35f52dd..03a573ee74a12188af759608e0a1c46422526f36 100644 --- a/app/views/admin/communication/website/menus/index.html.erb +++ b/app/views/admin/communication/website/menus/index.html.erb @@ -1,7 +1,13 @@ <% content_for :title, "#{Communication::Website::Menu.model_name.human(count: 2)} (#{@menus.count})" %> -<%= render 'admin/communication/website/menus/list', menus: @menus %> -<%= paginate @menus, theme: 'bootstrap-5' %> +<%= render 'admin/communication/websites/sidebar' do %> + <div class="card"> + <%= render 'admin/communication/website/menus/list', menus: @menus %> + <div class="card-footer"> + <%= paginate @menus, theme: 'bootstrap-5' %> + </div> + </div> +<% end %> <% content_for :action_bar_right do %> <%= create_link Communication::Website::Menu %> diff --git a/app/views/admin/communication/website/menus/new.html.erb b/app/views/admin/communication/website/menus/new.html.erb index 5db2a657b7b46a165c690a1c0d034e72a018f55f..9cb75e57958e49197b27d52d9be35e4199a0606d 100644 --- a/app/views/admin/communication/website/menus/new.html.erb +++ b/app/views/admin/communication/website/menus/new.html.erb @@ -1,3 +1,5 @@ <% content_for :title, Communication::Website::Menu.model_name.human %> -<%= render 'form', menu: @menu %> +<%= render 'admin/communication/websites/sidebar' do %> + <%= render 'form', menu: @menu %> +<% end %> diff --git a/app/views/admin/communication/website/menus/show.html.erb b/app/views/admin/communication/website/menus/show.html.erb index 4742e3eaa6ded5c355d1b0be99f8f2d2171029d6..a37b82c3df1878a09f13776bdd39c121fc53a548 100644 --- a/app/views/admin/communication/website/menus/show.html.erb +++ b/app/views/admin/communication/website/menus/show.html.erb @@ -1,35 +1,37 @@ <% content_for :title, @menu %> -<div class="row"> - <div class="col-md-8"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h2 class="card-title mb-2 h5"> - <%= "#{Communication::Website::Menu::Item.model_name.human(count: 2)} (#{@root_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) %> +<%= 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-2 h5"> + <%= "#{Communication::Website::Menu::Item.model_name.human(count: 2)} (#{@root_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> - <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 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> + <tr> + <td width="150"><%= Communication::Website::Menu.human_attribute_name('identifier') %></td> + <td><%= @menu.identifier %></td> + </tr> + </tbody> + </table> </div> - <table class="<%= table_classes %>"> - <tbody> - <tr> - <td width="150"><%= Communication::Website::Menu.human_attribute_name('identifier') %></td> - <td><%= @menu.identifier %></td> - </tr> - </tbody> - </table> </div> </div> -</div> +<% end %> <% content_for :action_bar_right do %> <%= edit_link @menu %> diff --git a/app/views/admin/communication/website/pages/edit.html.erb b/app/views/admin/communication/website/pages/edit.html.erb index a2efa068b2ce5c8e9233cca095dc2f82317c2456..b5b741635e401a62e7e77f566fd11f34f7d6f5a7 100644 --- a/app/views/admin/communication/website/pages/edit.html.erb +++ b/app/views/admin/communication/website/pages/edit.html.erb @@ -1,3 +1,5 @@ <% content_for :title, @page %> -<%= render 'form', page: @page %> +<%= render 'admin/communication/websites/sidebar' do %> + <%= render 'form', page: @page %> +<% end %> diff --git a/app/views/admin/communication/website/pages/index.html.erb b/app/views/admin/communication/website/pages/index.html.erb index 5d2300df0dd4455d06ee5bfd378db0b494924e88..296d0c46f3477c46819ffb97cea0cc5b0cc1e25a 100644 --- a/app/views/admin/communication/website/pages/index.html.erb +++ b/app/views/admin/communication/website/pages/index.html.erb @@ -1,8 +1,16 @@ <% content_for :title, "#{Communication::Website::Page.model_name.human(count: 2)} (#{@website.pages.count})" %> -<ul class="list-unstyled treeview js-treeview <%= 'treeview--sortable js-treeview-sortable js-treeview-sortable-container' if can?(:reorder, @root_pages.first) %>" data-id="" data-sort-url="<%= reorder_admin_communication_website_pages_path %>"> - <%= render 'treebranch', pages: @root_pages %> -</ul> +<%= render 'admin/communication/websites/sidebar' do %> + <div class="card"> + <div class="card-body"> + <ul class="list-unstyled treeview js-treeview <%= 'treeview--sortable js-treeview-sortable js-treeview-sortable-container' if can?(:reorder, @root_pages.first) %>" + data-id="" + data-sort-url="<%= reorder_admin_communication_website_pages_path %>"> + <%= render 'treebranch', pages: @root_pages %> + </ul> + </div> + </div> +<% end %> <% content_for :action_bar_right do %> <%= create_link Communication::Website::Page %> diff --git a/app/views/admin/communication/website/pages/new.html.erb b/app/views/admin/communication/website/pages/new.html.erb index 7f249a1c4448fddeafc77223d502d9679877259a..fe2ab686605072ef7e4e38ae90415c2ebeb6d411 100644 --- a/app/views/admin/communication/website/pages/new.html.erb +++ b/app/views/admin/communication/website/pages/new.html.erb @@ -1,3 +1,5 @@ <% content_for :title, Communication::Website::Page.model_name.human %> -<%= render 'form', page: @page %> +<%= render 'admin/communication/websites/sidebar' do %> + <%= render 'form', page: @page %> +<% end %> diff --git a/app/views/admin/communication/website/pages/show.html.erb b/app/views/admin/communication/website/pages/show.html.erb index a6618ccffd4660cf7bbe247245677b859b9c809a..d9ae753d65c1a0cd4996e9c4a20952dbb91133d3 100644 --- a/app/views/admin/communication/website/pages/show.html.erb +++ b/app/views/admin/communication/website/pages/show.html.erb @@ -1,96 +1,99 @@ <% content_for :title, @page %> -<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::Page.human_attribute_name('description') %></h3> - <%= sanitize @page.description %> +<%= 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::Page.human_attribute_name('description') %></h3> + <%= sanitize @page.description %> - <h3 class="h5 mt-4"><%= Communication::Website::Page.human_attribute_name('text') %></h3> - <%= @page.text %> + <h3 class="h5 mt-4"><%= Communication::Website::Page.human_attribute_name('text') %></h3> + <%= @page.text %> + </div> </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> - <tr> - <td width="150"><%= Communication::Website::Page.human_attribute_name('slug') %></td> - <td><%= @page.slug %></td> - </tr> - <tr> - <td><%= Communication::Website::Page.human_attribute_name('path') %></td> - <td><%= @page.path %></td> - </tr> - <tr> - <td><%= Communication::Website::Page.human_attribute_name('published') %></td> - <td> - <%= t @page.published %> - </td> - </tr> - <% if @page.parent %> + <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> <tr> - <td><%= Communication::Website::Page.human_attribute_name('parent') %></td> - <td><%= link_to_if can?(:read, @page.parent), - @page.parent, - admin_communication_website_page_path( - website_id: @website.id, - id: @page.parent.id - ), - class: "#{'opacity-50' unless @page.parent.published?}" %></td> + <td width="150"><%= Communication::Website::Page.human_attribute_name('slug') %></td> + <td><%= @page.slug %></td> </tr> - <% end %> - <% if @page.related_category %> <tr> - <td><%= Communication::Website::Page.human_attribute_name('related_category') %></td> - <td><%= link_to_if can?(:read, @page.related_category), - @page.related_category, - admin_communication_website_category_path( - website_id: @website.id, - id: @page.related_category.id - ) %></td> + <td><%= Communication::Website::Page.human_attribute_name('path') %></td> + <td><%= @page.path %></td> </tr> - <% end %> - <% if @page.children.any? %> <tr> - <td><%= Communication::Website::Page.human_attribute_name('children') %></td> + <td><%= Communication::Website::Page.human_attribute_name('published') %></td> <td> - <ul class="list-unstyled mb-0"> - <% @page.children.each do |child| %> - <li> - <%= link_to_if can?(:read, child), - child, - admin_communication_website_page_path( website_id: @website.id, id: child.id), - class: "#{'opacity-50' unless child.published?}" %> - </li> - <% end %> - </ul> + <%= t @page.published %> </td> </tr> - <% end %> - </tbody> - </table> - </div> - <% if @page.featured_image.attached? && @page.featured_image.variable? %> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('activerecord.attributes.communication/website/page.featured_image') %></h5> - </div> - <div class="card-body"> - <%= image_tag @page.featured_image.variant(resize: '600'), class: 'img-fluid mb-3' %><br> - </div> + <% if @page.parent %> + <tr> + <td><%= Communication::Website::Page.human_attribute_name('parent') %></td> + <td><%= link_to_if can?(:read, @page.parent), + @page.parent, + admin_communication_website_page_path( + website_id: @website.id, + id: @page.parent.id + ), + class: "#{'opacity-50' unless @page.parent.published?}" %></td> + </tr> + <% end %> + <% if @page.related_category %> + <tr> + <td><%= Communication::Website::Page.human_attribute_name('related_category') %></td> + <td><%= link_to_if can?(:read, @page.related_category), + @page.related_category, + admin_communication_website_category_path( + website_id: @website.id, + id: @page.related_category.id + ) %></td> + </tr> + <% end %> + <% if @page.children.any? %> + <tr> + <td><%= Communication::Website::Page.human_attribute_name('children') %></td> + <td> + <ul class="list-unstyled mb-0"> + <% @page.children.each do |child| %> + <li> + <%= link_to_if can?(:read, child), + child, + admin_communication_website_page_path( website_id: @website.id, id: child.id), + class: "#{'opacity-50' unless child.published?}" %> + </li> + <% end %> + </ul> + </td> + </tr> + <% end %> + </tbody> + </table> </div> - <% end %> + <% if @page.featured_image.attached? && @page.featured_image.variable? %> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('activerecord.attributes.communication/website/page.featured_image') %></h5> + </div> + <div class="card-body"> + <%= image_tag @page.featured_image.variant(resize: '600'), class: 'img-fluid mb-3' %><br> + </div> + </div> + <% end %> + </div> </div> -</div> +<% end %> <% content_for :action_bar_left do %> <%= link_to t('communication.website.force_publication'), diff --git a/app/views/admin/communication/website/posts/_list.html.erb b/app/views/admin/communication/website/posts/_list.html.erb index 9ff933ca6169baee54d80086e66e9591b8fddcbe..d5a9cd7afec736b335b1acdf8e7f7bf2b384eada 100644 --- a/app/views/admin/communication/website/posts/_list.html.erb +++ b/app/views/admin/communication/website/posts/_list.html.erb @@ -13,8 +13,7 @@ <% unless hide_category %> <th><%= Communication::Website::Post.human_attribute_name('categories') %></th> <% end %> - <th><%= Communication::Website::Post.human_attribute_name('published_at') %></th> - <th></th> + <th colspan="2"><%= Communication::Website::Post.human_attribute_name('published_at') %></th> </tr> </thead> <tbody> diff --git a/app/views/admin/communication/website/posts/edit.html.erb b/app/views/admin/communication/website/posts/edit.html.erb index 6a9e1ccb8f225e98346ec3fcd28816463eebd780..8e3193a58bb846fd71fb5beb3d6c182c99520cb5 100644 --- a/app/views/admin/communication/website/posts/edit.html.erb +++ b/app/views/admin/communication/website/posts/edit.html.erb @@ -1,3 +1,5 @@ <% content_for :title, @post %> -<%= render 'form', post: @post %> +<%= render 'admin/communication/websites/sidebar' do %> + <%= render 'form', post: @post %> +<% end %> diff --git a/app/views/admin/communication/website/posts/index.html.erb b/app/views/admin/communication/website/posts/index.html.erb index 4de0d8b74aa67c6d08ed8a92bbadef03868a0b1f..94204ff9780be21d655d41b8fd72f3ee2fc7c38d 100644 --- a/app/views/admin/communication/website/posts/index.html.erb +++ b/app/views/admin/communication/website/posts/index.html.erb @@ -1,7 +1,13 @@ <% content_for :title, "#{Communication::Website::Post.model_name.human(count: 2)} (#{@posts.total_count})" %> -<%= render 'admin/communication/website/posts/list', posts: @posts %> -<%= paginate @posts, theme: 'bootstrap-5' %> +<%= render 'admin/communication/websites/sidebar' do %> + <div class="card"> + <%= render 'admin/communication/website/posts/list', posts: @posts %> + <div class="card-footer"> + <%= paginate @posts, theme: 'bootstrap-5' %> + </div> + </div> +<% end %> <% content_for :action_bar_right do %> <%= create_link Communication::Website::Post %> diff --git a/app/views/admin/communication/website/posts/new.html.erb b/app/views/admin/communication/website/posts/new.html.erb index e004e29efa3947da1c4e6ee1df75a91f9f054c2f..a89e424a994ae3ab694d5232fe5d98df10c1d475 100644 --- a/app/views/admin/communication/website/posts/new.html.erb +++ b/app/views/admin/communication/website/posts/new.html.erb @@ -1,3 +1,5 @@ <% content_for :title, Communication::Website::Post.model_name.human %> -<%= render 'form', post: @post %> +<%= render 'admin/communication/websites/sidebar' do %> + <%= render 'form', post: @post %> +<% end %> diff --git a/app/views/admin/communication/website/posts/show.html.erb b/app/views/admin/communication/website/posts/show.html.erb index c8a0354c1005371d2905eadbb8be9703f9c01f4c..717be3494729b6ed30a4655debe3310329bd7386 100644 --- a/app/views/admin/communication/website/posts/show.html.erb +++ b/app/views/admin/communication/website/posts/show.html.erb @@ -1,73 +1,62 @@ <% content_for :title, @post %> -<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::Post.human_attribute_name('description') %></h3> - <%= sanitize @post.description %> +<%= 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::Post.human_attribute_name('description') %></h3> + <%= sanitize @post.description %> - <h3 class="h5 mt-4"><%= Communication::Website::Post.human_attribute_name('text') %></h3> - <%= @post.text %> - </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> + <h3 class="h5 mt-4"><%= Communication::Website::Post.human_attribute_name('text') %></h3> + <%= @post.text %> + </div> </div> - <table class="<%= table_classes %>"> - <tbody> - <% if @post.author %> - <tr> - <td width="150"><%= Communication::Website::Post.human_attribute_name('author') %></td> - <td><%= link_to_if can?(:read, @post.author), @post.author, admin_communication_website_author_path(@post.author) %></td> - </tr> - <% end %> - <tr> - <td width="150"><%= Communication::Website::Post.human_attribute_name('slug') %></td> - <td><%= @post.slug %></td> - </tr> - <tr> - <td><%= Communication::Website::Post.human_attribute_name('published') %></td> - <td> - <%= t @post.published %> - <% if @post.published & @post.published_at %> - <p><small><%= l @post.published_at, format: :long if @post.published_at %></small></p> - <% end %> - </td> - </tr> - <% if @post.categories.any? %> - <tr> - <td><%= Communication::Website::Post.human_attribute_name('categories') %></td> - <td> - <ul class="list-unstyled mb-0"> - <% @post.categories.each do |category| %> - <li><%= link_to_if can?(:read, category), category, [:admin, category] %></li> - <% end %> - </ul> - </td> - </tr> - <% end %> - </tbody> - </table> </div> - <% if @post.featured_image.attached? && @post.featured_image.variable? %> + <div class="col-md-4"> <div class="card flex-fill w-100"> <div class="card-header"> - <h5 class="card-title mb-0"><%= t('activerecord.attributes.communication/website/post.featured_image') %></h5> + <h2 class="card-title mb-0 h5"><%= t('metadata') %></h2> </div> <div class="card-body"> - <%= image_tag @post.featured_image.variant(resize: '600'), class: 'img-fluid mb-3' %><br> + <% if @post.author %> + <h3 class="h5"><%= Communication::Website::Post.human_attribute_name('author') %></h3> + <p><%= link_to_if can?(:read, @post.author), @post.author, admin_communication_website_author_path(@post.author) %></p> + <% end %> + <h3 class="h5"><%= Communication::Website::Post.human_attribute_name('slug') %></h3> + <p><%= @post.slug %></p> + <h3 class="h5"><%= Communication::Website::Post.human_attribute_name('published') %></h3> + <p> + <%= t @post.published %><% if @post.published & @post.published_at %>, + <%= l @post.published_at, format: :long if @post.published_at %> + <% end %> + </p> + <% if @post.categories.any? %> + <h3 class="h5"><%= Communication::Website::Post.human_attribute_name('categories') %></h3> + <ul class="list-unstyled mb-0"> + <% @post.categories.each do |category| %> + <li><%= link_to_if can?(:read, category), category, [:admin, category] %></li> + <% end %> + </ul> + <% end %> </div> </div> - <% end %> + <% if @post.featured_image.attached? && @post.featured_image.variable? %> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('activerecord.attributes.communication/website/post.featured_image') %></h5> + </div> + <div class="card-body"> + <%= image_tag @post.featured_image.variant(resize: '600'), class: 'img-fluid mb-3' %><br> + </div> + </div> + <% end %> + </div> </div> -</div> +<% end %> <% content_for :action_bar_left do %> <%= link_to t('communication.website.force_publication'), diff --git a/app/views/admin/communication/websites/_sidebar.html.erb b/app/views/admin/communication/websites/_sidebar.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..c2747ac953f3a02bbfa52c53271397b714b454cc --- /dev/null +++ b/app/views/admin/communication/websites/_sidebar.html.erb @@ -0,0 +1,48 @@ +<div class="row mt-2"> + <div class="col-md-3 col-lg-2"> + <div class="card"> + <div class="list-group list-group-flush" role="tablist"> + <% + [ + { + title: @website.to_s, + path: admin_communication_website_path(id: @website) + }, + { + title: Communication::Website::Post.model_name.human(count: 2), + path: admin_communication_website_posts_path(website_id: @website) + }, + { + title: Communication::Website::Home.model_name.human, + path: admin_communication_website_home_path(website_id: @website) + }, + { + title: Communication::Website::Page.model_name.human(count: 2), + path: admin_communication_website_pages_path(website_id: @website) + }, + { + title: Communication::Website::Category.model_name.human(count: 2), + path: admin_communication_website_categories_path(website_id: @website) + }, + { + title: Communication::Website::Author.model_name.human(count: 2), + path: admin_communication_website_authors_path(website_id: @website) + }, + { + title: Communication::Website::Menu.model_name.human(count: 2), + path: admin_communication_website_menus_path(website_id: @website) + }, + ].each do |object| + active = object[:path].in? request.path + %> + <a class="list-group-item list-group-item-action<%= ' active' if active %>" href="<%= object[:path] %>"> + <%= object[:title] %> + </a> + <% end %> + </div> + </div> + </div> + <div class="col-md-9 col-lg-10"> + <%= yield %> + </div> +</div> diff --git a/app/views/admin/communication/websites/show.html.erb b/app/views/admin/communication/websites/show.html.erb index 70c6eca9fc183f8e8f14d30d78a90f336116a69f..fd89fee9d468789a84ce85a69a956abc64cac7bb 100644 --- a/app/views/admin/communication/websites/show.html.erb +++ b/app/views/admin/communication/websites/show.html.erb @@ -10,27 +10,17 @@ <% end %> <% end %> -<%= render 'admin/communication/websites/show/posts' %> - -<div class="row"> - <div class="col-md-4"> - <%= render 'admin/communication/websites/show/home' %> - </div> - <div class="col-md-8"> - <%= render 'admin/communication/websites/show/pages' %> - </div> -</div> -<div class="row"> - <div class="col-md-4"> - <%= render 'admin/communication/websites/show/authors' %> +<%= render 'admin/communication/websites/sidebar' do %> + <%= render 'admin/communication/websites/show/posts' %> + <div class="row"> + <div class="col-md-8"> + <%= render 'admin/communication/websites/show/pages' %> + </div> + <div class="col-md-4"> + <%= render 'admin/communication/websites/show/home' %> + </div> </div> - <div class="col-md-4"> - <%= render 'admin/communication/websites/show/menus' %> - </div> - <div class="col-md-4"> - <%= render 'admin/communication/websites/show/categories' %> - </div> -</div> +<% end %> <% content_for :action_bar_left do %> <%= link_to t('communication.website.force_publication'), diff --git a/app/views/admin/communication/websites/show/_authors.html.erb b/app/views/admin/communication/websites/show/_authors.html.erb index 84195690fddd9c067974b7b19a20dbf34b890393..ff6bf3f1e64c8238454cd823fc9a2ccca2e5cff0 100644 --- a/app/views/admin/communication/websites/show/_authors.html.erb +++ b/app/views/admin/communication/websites/show/_authors.html.erb @@ -1,4 +1,4 @@ -<div class="card mt-5"> +<div class="card mb-5"> <div class="card-header"> <div class="float-end"> <%= link_to t('create'), @@ -15,5 +15,5 @@ <% end %> </h2> </div> - <%= render 'admin/communication/website/authors/list', authors: @website.authors.ordered %> + <%= render 'admin/communication/website/authors/list', authors: @website.authors.ordered.limit(10) %> </div> diff --git a/app/views/admin/communication/websites/show/_categories.html.erb b/app/views/admin/communication/websites/show/_categories.html.erb index 910e134c784ecd0d864810dfa63fb9ec2d87c81b..e4bcfbbf47507f74bc1f7ac75b284477e83d3a9f 100644 --- a/app/views/admin/communication/websites/show/_categories.html.erb +++ b/app/views/admin/communication/websites/show/_categories.html.erb @@ -1,4 +1,4 @@ -<div class="card mt-5"> +<div class="card mb-5"> <div class="card-header"> <div class="float-end"> <%= link_to t('create'), diff --git a/app/views/admin/communication/websites/show/_home.html.erb b/app/views/admin/communication/websites/show/_home.html.erb index 945adde6052e9eea0b16a0f6b9c879fd1b2b6c3d..f6a12f5b56b247b44245c5d282c9a95fd5b504f9 100644 --- a/app/views/admin/communication/websites/show/_home.html.erb +++ b/app/views/admin/communication/websites/show/_home.html.erb @@ -1,4 +1,4 @@ -<div class="card mt-5"> +<div class="card mb-5"> <div class="card-header"> <div class="float-end"> <%= link_to t('edit'), diff --git a/app/views/admin/communication/websites/show/_menus.html.erb b/app/views/admin/communication/websites/show/_menus.html.erb index dfd6240b29874b7977ed27e95711ad5a19d26c0e..c5bec2217bc91238ea756b36d1a6d43fafb3c577 100644 --- a/app/views/admin/communication/websites/show/_menus.html.erb +++ b/app/views/admin/communication/websites/show/_menus.html.erb @@ -1,4 +1,4 @@ -<div class="card mt-5"> +<div class="card mb-5"> <div class="card-header"> <div class="float-end"> <%= link_to t('create'), diff --git a/app/views/admin/communication/websites/show/_pages.html.erb b/app/views/admin/communication/websites/show/_pages.html.erb index 10572b83cb34b9773e388ae9be55444da62e2456..7d08d81264b493aff2b68c5b70c4ba381161e761 100644 --- a/app/views/admin/communication/websites/show/_pages.html.erb +++ b/app/views/admin/communication/websites/show/_pages.html.erb @@ -1,4 +1,4 @@ -<div class="card mt-5"> +<div class="card mb-5"> <div class="card-header"> <div class="float-end"> <%= link_to t('create'), diff --git a/app/views/admin/communication/websites/show/_posts.html.erb b/app/views/admin/communication/websites/show/_posts.html.erb index 0942701dc82fa4365e546437581f3a8abab55271..f71aff248cdb98576f92617b3e4fa8dd7237a9a7 100644 --- a/app/views/admin/communication/websites/show/_posts.html.erb +++ b/app/views/admin/communication/websites/show/_posts.html.erb @@ -1,4 +1,4 @@ -<div class="card mt-5"> +<div class="card mb-5"> <div class="card-header"> <div class="float-end"> <%= link_to t('communication.website.posts.new_curation'),