84 lines
3 KiB
Elixir
84 lines
3 KiB
Elixir
<%= for post <- @posts do %>
|
|
<article class="ui text container <%= post_class(post) %> h-entry">
|
|
<div class="ui main padded text container">
|
|
<h1 class="ui header p-name">
|
|
<%= link to: Routes.posts_path(@conn, :show, post), class: "u-url" do %>
|
|
<%= raw post.title %>
|
|
<% end %>
|
|
</h1>
|
|
<%= post_topmatter(@conn, post) %>
|
|
</div>
|
|
<div class="Article-content <%= if post.format, do: post.format.slug %> e-content">
|
|
<%= if authenticated_for_post?(@conn, post) do %>
|
|
<%= render "thumb.html", post: post, thumbs: @thumbs %>
|
|
<div class="Article-content-words" style="padding-bottom: 4em; padding-top: 4em;">
|
|
<%= raw post |> Content.Post.content_page(1) |> Content.Post.before_more |> process_content |> raw %>
|
|
<%= if post.content =~ "<!--more-->" do %>
|
|
<p>
|
|
<%= link "Keep Reading", to: Routes.posts_path(@conn, :show, post) %>
|
|
</p>
|
|
<% end %>
|
|
<%= render "pagination.html", conn: @conn, post: post %>
|
|
</div>
|
|
<% else %>
|
|
<%= render "password_form.html", post: post, conn: @conn %>
|
|
<% end %>
|
|
</div>
|
|
<div class="ui grid">
|
|
<div class="ui center aligned one column row CategoryBlock" style="padding-top: 2rem;">
|
|
<div class="ui column">
|
|
<%= case post.categories || [] do %>
|
|
<% [] -> %>
|
|
<%= "" %>
|
|
<% categories -> %>
|
|
<%= for term <- categories do %>
|
|
<div class="ui label">
|
|
<%= link term.name, to: Routes.category_path(@conn, :index_posts, term.slug), class: "p-category" %>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</article>
|
|
<% end %>
|
|
|
|
<nav class="ui text container paginator">
|
|
<div class="ui grid">
|
|
<div class="ui center aligned one column row">
|
|
<div class="column">
|
|
<h3 class="ui header">
|
|
Pages
|
|
</h3>
|
|
|
|
<div class="ui buttons">
|
|
<%= if @page > 1 do %>
|
|
<%= link 1, to: paginated_posts_path(@conn, @category, 1), class: "ui button" %>
|
|
<% end %>
|
|
|
|
<%= if @page > 3 do %>
|
|
<span class="paginator-page ui button disabled">...</span>
|
|
<% end %>
|
|
|
|
<%= if @page > 2 do %>
|
|
<%= link @page - 1, to: paginated_posts_path(@conn, @category, @page - 1), class: "ui button" %>
|
|
<% end %>
|
|
|
|
<span class="paginator-page ui button disabled"><%= @page %></span>
|
|
|
|
<%= if @page + 1 < @last_page do %>
|
|
<%= link @page + 1, to: paginated_posts_path(@conn, @category, @page + 1), class: "ui button" %>
|
|
<% end %>
|
|
|
|
<%= if @page + 2 < @last_page do %>
|
|
<span class="paginator-page ui button disabled">...</span>
|
|
<% end %>
|
|
|
|
<%= if @page < @last_page do %>
|
|
<%= link @last_page, to: paginated_posts_path(@conn, @category, @last_page), class: "ui button" %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|