link to prev/next info page in bottom

This commit is contained in:
jomo
2014-10-02 23:02:52 +02:00
parent a4338154ba
commit 8f8c1daa1e
3 changed files with 44 additions and 4 deletions

View File

@@ -930,4 +930,35 @@ nav.pagination {
font-size: 20px;
padding: 0 5px;
}
}
.center {
text-align: center;
margin-right: auto;
margin-left: auto;
}
.info-suggestions {
border-top: 1px solid #fff;
box-shadow: 0 -1px 0 0 #ddd;
font-size: 0;
margin-top: 50px;
padding-top: 30px;
a {
color: #444;
display: inline-block;
padding: 4px 1em;
width: 50%;
font-size: 18px;
vertical-align: middle;
&:first-child {
text-align: right;
border-right: 1px solid black;
}
&:last-child {
text-align: left; // just in case it's changed in a parent node
}
}
}

View File

@@ -8,6 +8,8 @@ class InfoController < ApplicationController
end
def show
@prev = Info.where(["id < ?", @info.id]).last || Info.last
@next = Info.where(["id > ?", @info.id]).first || Info.first
end
def new

View File

@@ -1,9 +1,16 @@
<% title @info.title %>
<%= link_to "Info", info_index_path %> → <%= @info.title %>
<% if mod? %>
<%= link_to "Edit Info", edit_info_path(@info), class: "btn blue right" %>
<% end %>
<div class="clear"></div>
<h1 class="info-title"><%= @info.title %></h1>
<div class="post"><%= render_trusted_md(@info.content).html_safe %></div>
<h1 class="info-title"><%= title @info.title %></h1>
<div class="post">
<%= render_trusted_md(@info.content).html_safe %>
</div>
<div class="info-suggestions center">
<%= link_to "« #{@prev}", @prev %>
<%= link_to "#{@next} »", @next %>
</div>