1
0
mirror of https://github.com/projekteuler/projekteuler.git synced 2026-01-27 02:28:50 +01:00

Add check whether problem has a translation

This commit is contained in:
2014-12-29 20:28:33 +01:00
parent cbf17cfce0
commit 4c16813c92
8 changed files with 41 additions and 5 deletions

View File

@@ -6,6 +6,9 @@ class ProblemsController < ApplicationController
end
def show
unless @problem.is_translated?
render action: "untranslated"
end
end
private

View File

@@ -5,4 +5,9 @@ class Problem < ActiveRecord::Base
has_many :translations, inverse_of: :problem
self.per_page = 50
def is_translated?
!!self.translation
end
end

View File

@@ -13,7 +13,14 @@
<% @problems.each do |problem| %>
<tr>
<td><%= problem.id %></td>
<td><%= link_to problem.title, problem %></td>
<td>
<% if problem.is_translated? %>
<%= link_to problem.title, problem %>
<% else %>
<i>Dieses Problem wurde noch nicht übersetzt.</i>
<% end %>
</td>
</tr>
<% end %>
</tbody>

View File

@@ -0,0 +1 @@
Dieses Problem wurde noch nicht übersetzt.