<% title "Manage #{@article.title}" %>
  <div class="dashboard-manage-header">
    <div class="dashboard-manage-header-inner-container">
      <div class="dashboard-manage-nav">
        <a href="/dashboard">Dashboard</a> 👉 Manage Your Post
      </div>
      <% if flash[:pins_error] %>
        <h3 class="manage-page-error">Uh Oh! <%= flash[:pins_error] %> 😬</h3>
      <% end %>
      <% if flash[:pins_success] %>
        <h3 class="manage-page-success"><%= flash[:pins_success] %></h3>
      <% end %>
      <h2>Tools:</h2>
      <p><strong>Suggest a Tweet:</strong> Help get your post in front of more developers by suggesting a tweet that <a href="https://twitter.com/<%= SiteConfig.social_media_handles["twitter"] %>">@<%= SiteConfig.social_media_handles["twitter"] %></a> editors can use.
      <p><strong>Experience Level of Post:</strong> The best target dev experience level— a <em>gentle</em> indicator to help show the post to the people who will benefit the most.
      <h2>Tips:</h2>
      <ol>
        <li>
          Make your own tweet about the post, describing personally why you wrote it or why people might find it useful. <a href="https://twitter.com/<%= SiteConfig.social_media_handles["twitter"] %>">@<%= SiteConfig.social_media_handles["twitter"] %></a> may retweet you.
        </li>
        <li>
          Share to link aggregators such as <a href="https://www.reddit.com/">Reddit</a>. Try to choose the most topic-specific subreddits, such as <a href="https://www.reddit.com/r/javascript">/r/javascript</a> instead of <a href="https://www.reddit.com/r/programming">/r/programming</a>. <em>Warning: jerks and trolls may be lurking.</em>
        </li>
        <li>
          Share with your co-workers or local communities. Ask people to leave questions for you in the comments. It's a great way to spark additional discussion.
        </li>
      </ol>
    </div>
  </div>

<div class="dashboard-container">
  <%= render "dashboards/dashboard_article", article: @article, organization: @article.organization, org_admin: @user.org_admin?(@article.organization), manage_view: true %>
  <% if @buffer_updates.any? %>
    <div class="single-article thanks-for-suggesting-a-tweet">
      Tweet Suggestion Sent 🙏
    </div>
  <% else %>
    <div class="single-article single-article-manage-form-wrapper">
      <%= form_for(BufferUpdate.new) do |f| %>
        <h2>Suggest a Tweet</h2>
        <%= f.hidden_field :article_id, value: @article.id %>
        <%= f.text_area :body_text, minlength: 10, maxlength: 220 %>
        <%= f.submit "Share Tweet Suggestion" %>
        <p>Suggestion can be a quote, summary, or bullet points from the post.</p>
      <% end %>
    </div>
  <% end %>
  <div class="single-article single-article-manage-form-wrapper">
    <%= form_for(RatingVote.new) do |f| %>
      <h2>Experience Level of Post</h2>
      <%= f.hidden_field :article_id, value: @article.id %>
      <%= f.hidden_field :group, value: "experience_level" %>
      <span class="button-section button-section-newbie">
        <button value="1" name="rating_vote[rating]" class="level-rating-button <%= "selected" if @rating_vote&.rating == 1.0 %>">1</button>
        <button value="2" name="rating_vote[rating]" class="level-rating-button <%= "selected" if @rating_vote&.rating == 2.0 %>">2</button>
        <button value="3" name="rating_vote[rating]" class="level-rating-button <%= "selected" if @rating_vote&.rating == 3.0 %>">3</button>
      </span>
      <span class="button-section button-section-intermediate">
        <button value="4" name="rating_vote[rating]" class="level-rating-button <%= "selected" if @rating_vote&.rating == 4.0 %>">4</button>
        <button value="5" name="rating_vote[rating]" class="level-rating-button <%= "selected" if @rating_vote&.rating == 5.0 %>">5</button>
        <button value="6" name="rating_vote[rating]" class="level-rating-button <%= "selected" if @rating_vote&.rating == 6.0 %>">6</button>
        <button value="7" name="rating_vote[rating]" class="level-rating-button <%= "selected" if @rating_vote&.rating == 7.0 %>">7</button>
      </span>
      <span class="button-section button-section-senior">
        <button value="8" name="rating_vote[rating]" class="level-rating-button <%= "selected" if @rating_vote&.rating == 8.0 %>">8</button>
        <button value="9" name="rating_vote[rating]" class="level-rating-button <%= "selected" if @rating_vote&.rating == 9.0 %>">9</button>
        <button value="10" name="rating_vote[rating]" class="level-rating-button <%= "selected" if @rating_vote&.rating == 10.0 %>">10</button>
      </span>
      <p>Who is this post most relevant for?</p>
      <p><span class="scale-pod">👈 Total Newbies</span><span class="scale-pod">Senior Devs 👉</span></p>
    <% end %>
  </div>
</div>
