discourse/app/views/list/list.erb

165 lines
6.3 KiB
Plaintext
Raw Normal View History

<%- if include_crawler_content? %>
<%= server_plugin_outlet "topic_list_header" %>
<%- if SiteSetting.tagging_enabled && @tag_id %>
<h1>
<%= link_to "#{Discourse.base_url}/tag/#{@tag_id}", itemprop: 'item' do %>
<span itemprop='name'><%= @tag_id %></span>
<% end %>
</h1>
<% end %>
<% if @category %>
<h1>
<% if @category.parent_category %>
<%= link_to @category.parent_category.url, itemprop: 'item' do %>
<span itemprop='name'><%= @category.parent_category.name %></span>
<% end %>
&nbsp;
<% end %>
<%= link_to @category.url, itemprop: 'item' do %>
<span itemprop='name'><%= @category.name %></span>
<% end %>
</h1>
<br/>
<% if params[:page].to_i == 0 && @subcategories.present? %>
2018-06-13 16:20:48 -05:00
<% @subcategories.each do |subcategory| %>
2018-06-29 06:41:04 -05:00
<a href='<%= subcategory.url %>'>
2018-06-13 16:20:48 -05:00
<span itemprop='name'><%= subcategory.name %></span>
</a>
<% if subcategory.description.present? %>
<span itemprop='description'><%= subcategory.description_text %></span>
<% end %>
2018-06-13 16:20:48 -05:00
<% end %>
<br/>
<% end %>
<% end %>
<div itemscope itemtype='http://schema.org/ItemList'>
<meta itemprop='itemListOrder' content='http://schema.org/ItemListOrderDescending'>
<table class='topic-list'>
<thead>
<tr>
<th><%= t 'js.topic.title' %></th>
<th></th>
<th class="replies"><%= t 'js.replies' %></th>
<th class="views"><%= t 'js.views' %></th>
<th><%= t 'js.activity' %></th>
</tr>
</thead>
<tbody>
<% @list.topics.each_with_index do |t,i| %>
<tr class="topic-list-item">
<td class="main-link" itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
<meta itemprop='name' content='<%= t.title %>'>
<meta itemprop='url' content='<%= t.url %>'>
<% if t.image_url.present? %>
<meta itemprop='image' content='<%= t.image_url %>'>
<% end %>
<meta itemprop='position' content='<%= i + 1 %>'>
<span class="link-top-line">
<a href='<%= t.url %>' class='title raw-link raw-topic-link'><%= t.title %></a>
</span>
<div class="link-bottom-line">
<% if (!@category || @category.has_children?) && t.category && !t.category.uncategorized? %>
<a href='<%= t.category.url %>' class='badge-wrapper bullet'>
<span class='badge-category-bg' style='background-color: #<%= t.category.color %>'></span>
<span class='badge-category clear-badge'>
<span class='category-name'><%= t.category.name %></span>
</span>
</a>
<% end %>
<% if t.tags %>
<div class="discourse-tags">
<% t.tags.each_with_index do |tag, index| %>
<a href='<%= tag.full_url %>' class='discourse-tag'><%= tag.name %></a>
<% if index < t.tags.size - 1 %>,&nbsp;<% end %>
<% end %>
</div>
<% end %>
</div>
<% if t.pinned_until && (t.pinned_until > Time.zone.now) && (t.pinned_globally || @list.category) && t.excerpt %>
<p class='excerpt'>
<%= t.excerpt.html_safe %>
</p>
<% end %>
</td>
<td class='posters'>
<% t.posters.each do |poster| %>
Fix i18n issues reported on Crowdin (#11747) * Pluralize `groups.errors.adding_too_many_users` This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-ar#53882 * Pluralize `js.composer.error.title_too_short` This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#41172 * Pluralize `js.composer.error.title_too_long` This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#41174 * Pluralize `js.composer.error.post_length` This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#41178 * Pluralize `js.topic.progress.jump_prompt_of` This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#41958 * Use translations to join strings about posters This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-ar#49334 It also makes some changes to the crawler view: * Removes `poster.moreCount` which is only available on the client for PMs * CSS class names are actually stored in `poster.extras` instead of `poster.extraClasses` * Stop concatenating category stats This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#40740 * Pluralize `js.summary.description` This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#40782 * Pluralize `js.summary.description_time_MF` This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#40784 * Use translation to join list of tags This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#43372 * Pluralize `admin_js.admin.groups.manage.membership.automatic_membership_user_count` This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#43720 * Pluralize `js.post.controls.delete_topic_confirm_modal` This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#54804 * Stop concatenating `js.post.last_edited_on` This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#42358 * Stop concatenating `js.post.wiki_last_edited_on` This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#42356 It also fixes a regression because `js.post.wiki_last_edited_on` wasn't used anymore since 2017.
2021-02-02 03:50:04 -06:00
<a href="<%= Discourse.base_url %>/u/<%= poster.user.username %>" class="<%= poster.extras %>">
<img width="25" height="25" src="<%= poster.user.avatar_template.gsub('{size}', '25') %>" class="avatar" title='<%= h(poster.name_and_description) %>' aria-label='<%= h(poster.name_and_description) %>'>
</a>
<% end %>
</td>
<td class="replies">
<span class='posts' title='<%= t 'posts' %>'><%= t.posts_count - 1 %></span>
</td>
<td class="views">
<span class='views' title='<%= t 'views' %>'><%= t.views %></span>
</td>
<td>
<%= I18n.l(t.last_posted_at || t.created_at, format: :date_only) %>
</td>
</tr>
<% end %>
</tbody>
</table>
2013-02-13 00:43:21 -06:00
</div>
<% if @list.topics.length > 0 && @list.more_topics_url %>
<div role='navigation' itemscope itemtype='http://schema.org/SiteNavigationElement'>
<% if params[:page].to_i > 0 %>
<span itemprop='name'><a href='<%= @list.prev_topics_url %>' rel='prev' itemprop='url'><%= t 'prev_page' %></a> &nbsp;</span>
<% end %>
<% if @list.topics.size == @list.per_page %>
<span itemprop='name'><b><a href='<%= @list.more_topics_url %>' rel='next' itemprop='url'><%= t 'next_page' %></a></b></span>
<% end %>
</div>
<% content_for :head do %>
<% if params[:page].to_i > 0 %>
<link rel="prev" href="<%= @list.prev_topics_url -%>">
<% end %>
<link rel="next" href="<%= @list.more_topics_url -%>">
<% end %>
<% end %>
2013-02-13 00:43:21 -06:00
<%- end %> <!-- include_crawler_content? -->
2013-10-11 11:35:12 -05:00
<% if @rss %>
<% content_for :head do %>
2015-06-09 14:22:11 -05:00
<%= auto_discovery_link_tag(:rss, "#{Discourse.base_url}/posts.rss", title: I18n.t("rss_description.posts")) %>
<%= auto_discovery_link_tag(:rss, { action: "#{@rss}_feed", params: @params || {} }, title: I18n.t("rss_description.#{@rss_description}")) %>
2013-10-11 11:35:12 -05:00
<% end %>
<% end %>
<% if @category %>
<% content_for :head do %>
2015-01-02 06:06:57 -06:00
<%= auto_discovery_link_tag(:rss, { action: :category_feed }, title: t('rss_topics_in_category', category: @category.name)) %>
<%= raw crawlable_meta_data(title: @category.name, description: @category.description, image: @category.uploaded_logo&.url.presence) %>
<% end %>
2017-08-28 12:11:34 -05:00
<% elsif @tag_id %>
<% content_for :head do %>
<%= raw crawlable_meta_data(title: @title, description: @description_meta) %>
<% end %>
<% else %>
<% content_for :head do %>
<%= raw crawlable_meta_data(title: SiteSetting.title, description: SiteSetting.site_description) %>
<% end %>
2014-10-30 13:26:35 -05:00
<% end %>
<% if @title %>
<% content_for :title do %><%= @title %><% end %>
<% elsif @category %>
<% content_for :title do %><%= @category.name %> - <%= SiteSetting.title %><% end %>
<% elsif params[:page].to_i > 1 %>
<% content_for :title do %><%=t 'page_num', num: params[:page].to_i + 1 %> - <%= SiteSetting.title %><% end %>
<% end %>