Skip to content

A platform for community discussion. Free, open, simple.

FEATURE: change layout when default page is category to tabular for _… (#7270)

Saurabh Patel90fc2d15c41c
diff --git a/app/views/categories/index.html.erb b/app/views/categories/index.html.erb
index 012c5ff9990..3e476eabcc2 100644
--- a/app/views/categories/index.html.erb
+++ b/app/views/categories/index.html.erb
@@ -1,17 +1,34 @@
-<div class='category-list' itemscope itemtype='http://schema.org/ItemList'>
- <meta itemprop='itemListOrder' content='http://schema.org/ItemListOrderDescending'>
- <% @category_list.categories.each_with_index do |c, index| %>
- <div class='category' itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
- <meta itemprop='position' content='<%= index %>'>
- <meta itemprop='url' content='<%= "#{c.url}" %>'>
- <h2>
- <a href='<%= "#{c.url}" %>' itemprop='item'>
- <span itemprop='name'><%= c.name %></span>
- </a>
- </h2>
- <span itemprop='description'><%= c.description&.html_safe %></span>
- </div>
- <% end %>
+<div itemscope itemtype='http://schema.org/ItemList'>
+ <table class='category-list'>
+ <thead>
+ <tr>
+ <th class='category'><%= t 'js.categories.category' %></th>
+ <th class='topics'><%= t 'js.topic.list' %></th>
+ </tr>
+ </thead>
+ <tbody>
+ <meta itemprop='itemListOrder' content='http://schema.org/ItemListOrderDescending'>
+ <% @category_list.categories.each_with_index do |c, index| %>
+ <tr>
+ <td class='category' style='border-color: #<%= c.color %>;'>
+ <div itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
+ <meta itemprop='position' content='<%= index %>'>
+ <meta itemprop='url' content='<%= c.url %>'>
+ <h3>
+ <a href='<%= c.url %>'>
+ <span itemprop='name'><%= c.name %></span>
+ </a>
+ </h3>
+ <div itemprop='description'><%= c.description&.html_safe %></div>
+ </div>
+ </td>
+ <td class='topics'>
+ <div title='<%= c.topic_count %> <%= t 'js.topic.list' %>'><%= c.topic_count %></div>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
</div>
<% content_for :title do %><%= @title %><% end %>