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
@imported_website = @website.imported_website
@imported_pages = @imported_website.pages.page params[:pages_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_total_size = @imported_website.media.joins(file_attachment: :blob).sum(:byte_size)
breadcrumb
......
......@@ -36,7 +36,8 @@ class Communication::Website::Category < ApplicationRecord
optional: true
has_many :children,
class_name: 'Communication::Website::Category',
foreign_key: :parent_id
foreign_key: :parent_id,
dependent: :destroy
has_and_belongs_to_many :posts,
class_name: 'Communication::Website::Post',
join_table: 'communication_website_categories_posts',
......
......@@ -103,3 +103,31 @@
<%= paginate @imported_media, param_name: :media_page, theme: 'bootstrap-5' %>
</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:
communication/website/category:
children: Children categories
description: Description
name: Name
parent: Parent category
slug: slug
title: Title
communication/website/imported/category:
original: Original
communication/website/imported/medium:
filename: Filename
communication/website/page:
children: Children pages
children: Children pages
title: Title
description: Description (SEO)
featured_image: Featured image
......
......@@ -51,9 +51,11 @@ fr:
communication/website/category:
children: Catégories enfantes
description: Description
name: Nom
parent: Catégorie parente
slug: slug
title: Titre
communication/website/imported/category:
original: Original
communication/website/imported/medium:
filename: Nom du fichier
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