1
0
mirror of https://github.com/projekteuler/projekteuler.git synced 2025-12-10 08:46:41 +01:00

Add links to previous and next problem

This commit is contained in:
Philipp Fischbeck 2019-10-15 21:49:07 +02:00
parent 76bffa7361
commit 6a6859fc20
2 changed files with 23 additions and 2 deletions

View File

@ -10,9 +10,9 @@
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope. * file per style scope.
* *
*= require_tree .
*= require codemirror/codemirror *= require codemirror/codemirror
*= require_self *= require_self
*= require_tree .
*/ */
@import "bootstrap-sprockets"; @import "bootstrap-sprockets";
@ -44,6 +44,17 @@ body {
margin: 10px 0; margin: 10px 0;
} }
/* Style for links to previous and next problem */
.problem-prev {
@extend .pull-left;
margin: 20px -30px 0;
}
.problem-next {
@extend .pull-right;
margin: 20px -30px 0;
}
/* Custom css for fixing styles within problem content */ /* Custom css for fixing styles within problem content */
.problem-content { .problem-content {

View File

@ -6,8 +6,18 @@
</p> </p>
<h1><%= @problem.title %> <small><%= t '.problem_subtitle', id: @problem.id %></small></h1> <h1><%= @problem.title %> <small><%= t '.problem_subtitle', id: @problem.id %></small></h1>
</div> </div>
<% if Problem.exists?(@problem.id-1) %>
<%= link_to problem_path(@problem.id-1), title: t('problems.show.problem_subtitle', id: @problem.id-1), class: 'problem-prev' do %>
<%= icon :menu_left %>
<% end %>
<% end %>
<% if Problem.exists?(@problem.id+1) %>
<%= link_to problem_path(@problem.id+1), title: t('problems.show.problem_subtitle', id: @problem.id+1), class: 'problem-next' do %>
<%= icon :menu_right %>
<% end %>
<% end %>
<%= link_to new_problem_translation_path(@problem), class: 'btn btn-default btn-sm pull-right' do %> <%= link_to new_problem_translation_path(@problem), class: 'btn btn-default btn-sm pull-right' do %>
<%= icon :pencil %> <%= t '.improve_translation' %> <%= icon :pencil %> <%= t '.improve_translation' %>
<% end %> <% end %>
<%= panel do %> <%= panel do %>
<div class="panel-body problem-content"> <div class="panel-body problem-content">