<div id="stats" class="vote-container">
  <h5><%= t('.title') %></h5>
  <ul>
    <li><%= t('.id') %>: <%= @post.id %></li>
    <li><%= t('.posted') %>: <%= t('.posted_data_html', :time => link_to(t('time.x_ago', :t => time_ago_in_words(@post.created_at)), {:action => "index", :tags => "date:" + @post.created_at.strftime("%Y-%m-%d")}, :title => @post.created_at.strftime("%c")), :user => link_to_unless(@post.user_id.nil?, @post.author, :controller => "user", :action => "show", :id => @post.user_id)) %></li>
    <% if @current_user.is_admin? && @post.approver %>
      <li><%= t('.approver') %>: <%= @post.approver.name %></li>
    <% end %>
    <% if @post.image? %>
      <li><%= t('.size') %>: <%= @post.width %>x<%= @post.height %></li>
    <% end %>
    <% unless @post.source.blank? %>
      <% if @post.source[%r{\Ahttps?://}] %>
        <li><%= t('.source') %>: <%= link_to @post.source.sub(%r{\Ahttps?://}, "")[0, 20] + "...", @post.normalized_source, :rel => 'nofollow noopener noreferrer', :target => "_blank" %></li>
      <% else %>
        <li><%= t('.source') %>: <%= @post.source %></li>
      <% end %>
    <% end %>
    <li><%= t('.rating') %>: <%= @post.pretty_rating %> <%= vote_tooltip_widget() %></li>

    <li>
      <%= t('.score') %>: <span id="post-score-<%= @post.id %>"><%= @post.score %></span>
      <%= vote_widget(@current_user) %>
    </li>

    <li><%= t('.favorited_by') %>: <span id="favorited-by"><%= favorite_list(@post) %></span></li>
  </ul>
</div>

<% content_for :post_cookie_javascripts do %>
<script type="text/javascript">
  jQuery(function ($) {
    var vote = new Vote($('#stats'), <%= @post.id %>);
    vote.updateWidget(Post.votes.get('<%= @post.id %>'), <%= @post.score %>);
    vote.initShortcut();
  });

  Post.init_add_to_favs(<%= @post.id %>, $("add-to-favs"), $("remove-from-favs"));
</script>
<% end %>

