UX: Improve posts layout for crawler (#7286)

This commit is contained in:
Saurabh Patel 2019-04-03 15:28:00 +05:30 committed by Gerhard Schlager
parent 66aa871c24
commit da2f659635
4 changed files with 34 additions and 10 deletions

View File

@ -888,3 +888,22 @@ span.highlighted {
} }
} }
} }
.crawler-post {
.post-time {
float: right;
}
.post-likes {
float: right;
}
margin-top: 5px;
}
#breadcrumbs {
.badge-category-bg {
background-color: $secondary-high;
}
.category-title {
color: $primary;
}
}

View File

@ -33,7 +33,7 @@
<div id="main-outlet" class="wrap"> <div id="main-outlet" class="wrap">
<%= yield %> <%= yield %>
</div> </div>
<footer class="container"> <footer class="container wrap">
<nav class='crawler-nav' itemscope itemtype='http://schema.org/SiteNavigationElement'> <nav class='crawler-nav' itemscope itemtype='http://schema.org/SiteNavigationElement'>
<a href='<%= path "/" %>'><%= t 'home_title' %></a> <a href='<%= path "/" %>'><%= t 'home_title' %></a>
<%= link_to t('js.filters.categories.title'), path("/categories") %> <%= link_to t('js.filters.categories.title'), path("/categories") %>

View File

@ -10,8 +10,9 @@
<%-if (i+1) < @breadcrumbs.length%> <%-if (i+1) < @breadcrumbs.length%>
itemref="breadcrumb-<%=(i+1)%>" itemref="breadcrumb-<%=(i+1)%>"
<%-end%>> <%-end%>>
<a href="<%=c[:url]%>" itemprop="url"> <a href="<%=c[:url]%>" itemprop="url" class='badge-wrapper bullet'>
<span itemprop="title"><%=c[:name]%></span> <span class="badge-category-bg"></span>
<span itemprop="title" class='category-title'><%=c[:name]%></span>
</a> </a>
</div> </div>
<% end %> <% end %>
@ -37,12 +38,10 @@
<%= server_plugin_outlet "topic_header" %> <%= server_plugin_outlet "topic_header" %>
<hr>
<%- if include_crawler_content? %> <%- if include_crawler_content? %>
<% @topic_view.posts.each do |post| %> <% @topic_view.posts.each do |post| %>
<div itemscope itemtype='http://schema.org/DiscussionForumPosting'> <div itemscope itemtype='http://schema.org/DiscussionForumPosting' class='topic-body crawler-post'>
<% if (u = post.user) %> <% if (u = post.user) %>
<div class='creator'> <div class='creator'>
<span> <span>
@ -56,12 +55,12 @@
<% end %> <% end %>
<% if post.updated_at > post.created_at %> <% if post.updated_at > post.created_at %>
<meta itemprop='datePublished' content='<%= post.created_at.to_formatted_s(:iso8601) %>'> <meta itemprop='datePublished' content='<%= post.created_at.to_formatted_s(:iso8601) %>'>
<time itemprop='dateModified' datetime='<%= post.updated_at.to_formatted_s(:iso8601) %>'> <time itemprop='dateModified' datetime='<%= post.updated_at.to_formatted_s(:iso8601) %>' class='post-time'>
<%= post.updated_at %> <%= l post.updated_at, format: :long %>
</time> </time>
<% else %> <% else %>
<time itemprop='datePublished' datetime='<%= post.created_at.to_formatted_s(:iso8601) %>'> <time itemprop='datePublished' datetime='<%= post.created_at.to_formatted_s(:iso8601) %>' class='post-time'>
<%= post.created_at %> <%= l post.created_at, format: :long %>
</time> </time>
<% end %> <% end %>
</span> </span>
@ -73,6 +72,9 @@
<meta itemprop='interactionCount' content='UserLikes:<%= post.like_count %>'> <meta itemprop='interactionCount' content='UserLikes:<%= post.like_count %>'>
<meta itemprop='interactionCount' content='UserComments:<%= post.reply_count %>'> <meta itemprop='interactionCount' content='UserComments:<%= post.reply_count %>'>
<meta itemprop='headline' content='<%= @topic_view.title %>'> <meta itemprop='headline' content='<%= @topic_view.title %>'>
<div class='clearfix'>
<span class='post-likes'><%= t('post.has_likes', count: post.like_count) %></span>
</div>
<hr> <hr>
<% if @topic_view.link_counts[post.id] && @topic_view.link_counts[post.id].length > 0 %> <% if @topic_view.link_counts[post.id] && @topic_view.link_counts[post.id].length > 0 %>
<% @topic_view.link_counts[post.id].each do |link| %> <% @topic_view.link_counts[post.id].each do |link| %>

View File

@ -617,6 +617,9 @@ en:
post: post:
image_placeholder: image_placeholder:
broken: "This image is broken" broken: "This image is broken"
has_likes:
one: "%{count} Like"
other: "%{count} Likes"
rate_limiter: rate_limiter:
slow_down: "Youve performed this action too many times, please try again later." slow_down: "Youve performed this action too many times, please try again later."