<%= humanize(@post_type) %>s

<%= link "New " <> humanize(@post_type), to: Routes.posts_path(@conn, :new, post_type: @post_type), class: "button" %>
<%= for post <- @posts do %> <% end %>
Title Author Categories Tags Comments Date
<%= link post.post_title, to: Routes.posts_path(@conn, :edit, post) %> <%= if !is_nil(post.author) do %> <%= post.author.display_name %> <% end %> <%= post.categories |> Enum.map(&(&1.name)) |> Enum.join(", ") %> <%= post.tags |> Enum.map(&(&1.name)) |> Enum.join(", ") %> <%= post.comments |> Enum.count() %> <%= case post.post_status do %> <% "publish" -> %> <%= "Published" %> <% "future" -> %> <%= "Scheduled" %> <% "draft" -> %> <%= "Last Modified" %> <% "pending" -> %> <%= "Scheduled" %> <% "private" -> %> <%= "Published Privately" %> <% "inherit" -> %> <%= "Inherit" %> <% end %>
<%= post.post_date |> Timex.format!("%F", :strftime) %>

<%= if @page > 1 do %> <%= link 1, to: Routes.admin_posts_path(@conn, :index, page: 1) %> <% end %> <%= if @page > 3 do %> ... <% end %> <%= if @page > 2 do %> <%= link @page - 1, to: Routes.admin_posts_path(@conn, :index, page: @page - 1) %> <% end %> <%= @page %> <%= if @page + 1 < @last_page do %> <%= link @page + 1, to: Routes.admin_posts_path(@conn, :index, page: @page + 1) %> <% end %> <%= if @page + 2 < @last_page do %> ... <% end %> <%= if @page < @last_page do %> <%= link @last_page, to: Routes.admin_posts_path(@conn, :index, page: @last_page) %> <% end %>