<div class="single-article <%= "single-article-unpublished" unless article.published %> <%= "single-article-archived hidden" if article.archived %>">
  <div class="dashboard-collection-org-details">
    <% if article.organization_id %>
      <span class="dashboard-top-pill"><%= article.organization&.name %></span>
    <% end %>
    <% if article.collection_id %>
      <span class="dashboard-top-pill"><strong>Series:</strong> <%= article.series %></span>
    <% end %>
  </div>

  <div class="ellipsis-menu">
    <button class="ellipsis-menu-btn"><img src="<%= asset_path("three-dots.svg") %>" class="dropdown-icon" alt="dropdown menu icon"></button>
    <ul class="ellipsis-menu hidden">
      <hr />
      <li class="ellipsis-menu-item">
        <%= form_for(article, method: :patch, remote: true, authenticity_token: true, html: { "data-type": "json" }) do |f| %>
          <%= f.hidden_field :archived, value: !article.archived %>
          <%= f.submit article.archived ? "Unarchive Post" : "Archive Post" %>
        <% end %>
      </li>
    </ul>
  </div>

  <a href="<%= article.current_state_path %>"><h2><%= "[Archived] " if article.archived %><%= article.title %></h2></a>
  <div class="dashboard-meta-details">
    <% if article.published %>
      <span>
        Published: <time datetime="<%= article.published_timestamp %>"><%= article.readable_publish_date %></time>
      </span>

      <% if article.edited? %>
        <span>
          · Edited: <time datetime="<%= article.edited_at.utc.iso8601 %>"><%= article.readable_edit_date %></time>
        </span>
      <% end %>

      <% article.cached_tag_list_array.each do |tag| %>
        <a href="/t/<%= tag %>"><span class="tag">#<%= tag %></span></a>
      <% end %>
    <% end %>
  </div>
  <div class="dashboard-actions">
    <% if !article.published %>
      <a href="<%= article.current_state_path %>" class="pill cta yellow">DRAFT</a>
    <% end %>
    <a href="<%= article.path %>/edit" class="pill cta green">EDIT</a>
    <% if manage_view %>
      <a href="<%= article.path %>/delete_confirm" data-no-instant class="cta pill black">DELETE</a>
      <% if article.profile_pins.any? %>
        <%= form_for(article.profile_pins.first) do |f| %>
          <button class="pill cta">UNPIN</button>
        <% end %>
      <% else %>
        <%= form_for(ProfilePin.new) do |f| %>
          <%= f.hidden_field :pinnable_id, value: article.id %>
          <button class="pill cta">PIN TO PROFILE</button>
        <% end %>
      <% end %>
    <% elsif article.published %>
      <a href="<%= article.path %>/manage" class="cta pill black">MANAGE</a>
    <% elsif @user == article.user %>
      <a href="<%= article.path %>/delete_confirm" data-no-instant class="cta pill black">DELETE</a>
    <% end %>
    <% if @current_user_pro %>
      <a href="<%= article.path %>/stats" data-no-instant class="cta pill blue">STATS</a>
    <% end %>

    <% if article.published %>
      <span id="pageviews-<%= article.id %>" class="cta pill dashboard-pageviews-indicator" data-analytics-pageviews data-article-id="<%= article.id %>">
        <span class="page-views-count">
          <span class="value">
            <% if article.page_views_count > 25 %>
               <span class="value"><%= article.page_views_count %></span>
            <% else %>
              under 25
            <% end %>
          </span>
          views
        </span>
        //
        <span class="reactions-count">
          <span class="value">
            <%= article.positive_reactions_count %>
          </span>
          <%= "reaction".pluralize(count: article.positive_reactions_count) %>
        </span>
        //
        <span class="comments-count">
          <span class="value">
            <%= article.comments_count %>
          </span>
          <%= "comment".pluralize(count: article.comments_count) %>
        </span>
      </span>
    <% end %>
  </div>
  <% if organization && org_admin %>
    <%= form_for(article) do |f| %>
      <input type="hidden" name="destination" value="/dashboard/organization/<%= organization.id %>" />
      AUTHOR: <%= f.select(:user_id, options_for_select(organization.users.pluck(:name, :id), article.user_id)) %>
      <%= f.submit "SUBMIT AUTHOR CHANGE", class: "cta pill black" %>
    <% end %>
  <% end %>
</div>
