Skip to content
Snippets Groups Projects
Commit 29af85db authored by pabois's avatar pabois
Browse files

import categories

parent fcc6aa3f
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,7 @@ class Admin::Communication::WebsitesController < Admin::Communication::Applicati ...@@ -22,6 +22,7 @@ class Admin::Communication::WebsitesController < Admin::Communication::Applicati
@imported_website = @website.imported_website @imported_website = @website.imported_website
@imported_pages = @imported_website.pages.page params[:pages_page] @imported_pages = @imported_website.pages.page params[:pages_page]
@imported_posts = @imported_website.posts.page params[:posts_page] @imported_posts = @imported_website.posts.page params[:posts_page]
@imported_categories = @imported_website.categories
@imported_media = @imported_website.media.includes(file_attachment: :blob ).page params[:media_page] @imported_media = @imported_website.media.includes(file_attachment: :blob ).page params[:media_page]
@imported_media_total_size = @imported_website.media.joins(file_attachment: :blob).sum(:byte_size) @imported_media_total_size = @imported_website.media.joins(file_attachment: :blob).sum(:byte_size)
breadcrumb breadcrumb
......
...@@ -36,7 +36,8 @@ class Communication::Website::Category < ApplicationRecord ...@@ -36,7 +36,8 @@ class Communication::Website::Category < ApplicationRecord
optional: true optional: true
has_many :children, has_many :children,
class_name: 'Communication::Website::Category', class_name: 'Communication::Website::Category',
foreign_key: :parent_id foreign_key: :parent_id,
dependent: :destroy
has_and_belongs_to_many :posts, has_and_belongs_to_many :posts,
class_name: 'Communication::Website::Post', class_name: 'Communication::Website::Post',
join_table: 'communication_website_categories_posts', join_table: 'communication_website_categories_posts',
......
...@@ -103,3 +103,31 @@ ...@@ -103,3 +103,31 @@
<%= paginate @imported_media, param_name: :media_page, theme: 'bootstrap-5' %> <%= paginate @imported_media, param_name: :media_page, theme: 'bootstrap-5' %>
</div> </div>
</div> </div>
<div class="card mt-5">
<div class="card-header">
<h2><%= @imported_categories.count %> categories</h2>
</div>
<table class="<%= table_classes %>">
<thead>
<tr>
<th><%= Communication::Website::Category.human_attribute_name('name') %></th>
<th><%= Communication::Website::Imported::Category.human_attribute_name('original') %></th>
<th class="text-end" width="150">&nbsp;</th>
</tr>
</thead>
<tbody>
<% @imported_categories.each do |category| %>
<tr>
<td><%= category.name %></td>
<td class="small"><%= link_to category.url, category.url, target: :_blank %></td>
<td class="text-end">
<%= link_to t('show'),
admin_communication_website_category_path(website_id: category.category.website.id, id: category.category.id),
class: button_classes %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
...@@ -52,13 +52,15 @@ en: ...@@ -52,13 +52,15 @@ en:
communication/website/category: communication/website/category:
children: Children categories children: Children categories
description: Description description: Description
name: Name
parent: Parent category parent: Parent category
slug: slug slug: slug
title: Title communication/website/imported/category:
original: Original
communication/website/imported/medium: communication/website/imported/medium:
filename: Filename filename: Filename
communication/website/page: communication/website/page:
children: Children pages children: Children pages
title: Title title: Title
description: Description (SEO) description: Description (SEO)
featured_image: Featured image featured_image: Featured image
......
...@@ -51,9 +51,11 @@ fr: ...@@ -51,9 +51,11 @@ fr:
communication/website/category: communication/website/category:
children: Catégories enfantes children: Catégories enfantes
description: Description description: Description
name: Nom
parent: Catégorie parente parent: Catégorie parente
slug: slug slug: slug
title: Titre communication/website/imported/category:
original: Original
communication/website/imported/medium: communication/website/imported/medium:
filename: Nom du fichier filename: Nom du fichier
communication/website/page: communication/website/page:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment