<%= will_paginate @discussions %>

<% @discussions.each do |discussion| %>
  <div class="discussion-listing two-thirds column alpha omega row">
    <% listing_posts_array = listing_posts(discussion) %>
    <%= render listing_posts_array.shift if !listing_posts_array.nil? %>

    <% if !listing_posts_array.nil? %>
      <div class="discussion-listing-replies offset-by-one">
        <% if discussion.posts.size > 3 %>
          <span class="vellip">&vellip;</span>
        <% end %>

        <%= render listing_posts_array %>
      </div>
    <% end %>

    <%= pluralize(discussion.posts.size - 1, 'reply') %>.
    <%= link_to 'Go to discussion', discussion %>

    <div class="admin-controls sixteen columns alpha omega row">
        <%= link_to 'D (Discussion)', discussion, method: :delete, data: { confirm: 'Are you sure?' } %>
    </div>
  </div>

  <hr>
<% end %>

<%= will_paginate @discussions %>
<%= will_paginate @discussions %>

<% @discussions.each do |discussion| %>
  <div class="discussion-listing two-thirds column alpha omega row">
    <% listing_posts_array = listing_posts(discussion) %>
    <%= render listing_posts_array.shift if !listing_posts_array.nil? %>

    <% if !listing_posts_array.nil? %>
      <div class="discussion-listing-replies offset-by-one">
        <% if discussion.posts.size > 3 %>
          <span class="vellip">&vellip;</span>
        <% end %>

        <%= render listing_posts_array %>
      </div>
    <% end %>

    <%= pluralize(discussion.posts.size - 1, 'reply') %>.
    <%= link_to 'Go to discussion', discussion %>

    <% if session[:user_id] %>
      <div class="admin-controls sixteen columns alpha omega row">
          <%= link_to 'D (Discussion)', discussion, method: :delete, data: { confirm: 'Are you sure?' } %>
      </div>
    <% end %>
  </div>

  <hr>
<% end %>

<%= will_paginate @discussions %>
Hide delete discussion from non-admins at discussion list
Hide delete discussion from non-admins at discussion list
