mirror of
https://github.com/projekteuler/projekteuler.git
synced 2025-12-10 08:46:41 +01:00
Add translation tips
This commit is contained in:
parent
71ffb30880
commit
2fbd9d6a32
@ -1,38 +1,38 @@
|
|||||||
class TranslationsController < ApplicationController
|
class TranslationsController < ApplicationController
|
||||||
before_action :set_problem, only: [:new, :create]
|
before_action :set_problem, only: [:new, :create]
|
||||||
|
|
||||||
# GET /translations/new
|
# GET /translations/new
|
||||||
def new
|
def new
|
||||||
@translation = @problem.translations.build
|
@translation = @problem.translations.build
|
||||||
if @problem.is_translated?
|
if @problem.is_translated?
|
||||||
@translation.title = @problem.translation.title
|
@translation.title = @problem.translation.title
|
||||||
@translation.content = @problem.translation.content
|
@translation.content = @problem.translation.content
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /translations
|
# POST /translations
|
||||||
# POST /translations.json
|
# POST /translations.json
|
||||||
def create
|
def create
|
||||||
@translation = @problem.translations.new(translation_params)
|
@translation = @problem.translations.new(translation_params)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @translation.save
|
if @translation.save
|
||||||
format.html { redirect_to @problem, notice: t('translations.notice.successfully_created') }
|
format.html { redirect_to @problem, notice: t('translations.notice.successfully_created') }
|
||||||
format.json { render :show, status: :created, location: @translation }
|
format.json { render :show, status: :created, location: @translation }
|
||||||
else
|
else
|
||||||
format.html { render :new }
|
format.html { render :new }
|
||||||
format.json { render json: @translation.errors, status: :unprocessable_entity }
|
format.json { render json: @translation.errors, status: :unprocessable_entity }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def translation_params
|
def translation_params
|
||||||
params.require(:translation).permit(:title, :content)
|
params.require(:translation).permit(:title, :content)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_problem
|
def set_problem
|
||||||
@problem = Problem.find(params[:problem_id])
|
@problem = Problem.find(params[:problem_id])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
11
app/views/translations/_translation-tips.de.html.erb
Normal file
11
app/views/translations/_translation-tips.de.html.erb
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<%= panel heading: 'Hinweise zur Erstellung von Übersetzungen', context: :info do %>
|
||||||
|
<div class='panel-body'>
|
||||||
|
<ul>
|
||||||
|
<li>Zurzeit müssen Sie den HTML-Quellcode noch manuell von projecteuler.net holen. In Zukunft soll dies automatisch passieren.</li>
|
||||||
|
<li>Die Sie-Form benutzen.</li>
|
||||||
|
<li>Der HTML-Quellcode sollte im Allgemeinen unverändert bleiben.</li>
|
||||||
|
<li>Querverweise zu anderen Problemen sollten in der Form <code>/problem=??</code> erfolgen.</li>
|
||||||
|
<li>Wenn Grafiken oder Dateien verwendet werden, sollte die URL <code>https://projecteuler.net/...</code> verwendet werden.</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
@ -1,5 +1,6 @@
|
|||||||
<% provide(:title, t('.new_translation', id: @problem.id)) %>
|
<% provide(:title, t('.new_translation', id: @problem.id)) %>
|
||||||
|
|
||||||
<h1><%= t '.new_translation', id: @problem.id %></h1>
|
<h1><%= t '.new_translation', id: @problem.id %></h1>
|
||||||
|
|
||||||
<%= render 'form' %>
|
<%= render 'translation-tips' %>
|
||||||
|
<%= render 'form' %>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user