diff --git a/app/controllers/translations_controller.rb b/app/controllers/translations_controller.rb index f3b0e70..96b7977 100644 --- a/app/controllers/translations_controller.rb +++ b/app/controllers/translations_controller.rb @@ -1,38 +1,38 @@ -class TranslationsController < ApplicationController - before_action :set_problem, only: [:new, :create] - - # GET /translations/new - def new - @translation = @problem.translations.build - if @problem.is_translated? - @translation.title = @problem.translation.title - @translation.content = @problem.translation.content - end - end - - # POST /translations - # POST /translations.json - def create - @translation = @problem.translations.new(translation_params) - - respond_to do |format| - if @translation.save - format.html { redirect_to @problem, notice: t('translations.notice.successfully_created') } - format.json { render :show, status: :created, location: @translation } - else - format.html { render :new } - format.json { render json: @translation.errors, status: :unprocessable_entity } - end - end - end - - private - # Never trust parameters from the scary internet, only allow the white list through. - def translation_params - params.require(:translation).permit(:title, :content) - end - - def set_problem - @problem = Problem.find(params[:problem_id]) - end -end +class TranslationsController < ApplicationController + before_action :set_problem, only: [:new, :create] + + # GET /translations/new + def new + @translation = @problem.translations.build + if @problem.is_translated? + @translation.title = @problem.translation.title + @translation.content = @problem.translation.content + end + end + + # POST /translations + # POST /translations.json + def create + @translation = @problem.translations.new(translation_params) + + respond_to do |format| + if @translation.save + format.html { redirect_to @problem, notice: t('translations.notice.successfully_created') } + format.json { render :show, status: :created, location: @translation } + else + format.html { render :new } + format.json { render json: @translation.errors, status: :unprocessable_entity } + end + end + end + + private + # Never trust parameters from the scary internet, only allow the white list through. + def translation_params + params.require(:translation).permit(:title, :content) + end + + def set_problem + @problem = Problem.find(params[:problem_id]) + end +end diff --git a/app/views/translations/_translation-tips.de.html.erb b/app/views/translations/_translation-tips.de.html.erb new file mode 100644 index 0000000..c2246ab --- /dev/null +++ b/app/views/translations/_translation-tips.de.html.erb @@ -0,0 +1,11 @@ +<%= panel heading: 'Hinweise zur Erstellung von Übersetzungen', context: :info do %> +
+ +
+<% end %> \ No newline at end of file diff --git a/app/views/translations/new.html.erb b/app/views/translations/new.html.erb index 3f0fc9b..5783824 100644 --- a/app/views/translations/new.html.erb +++ b/app/views/translations/new.html.erb @@ -1,5 +1,6 @@ -<% provide(:title, t('.new_translation', id: @problem.id)) %> - -

<%= t '.new_translation', id: @problem.id %>

- -<%= render 'form' %> +<% provide(:title, t('.new_translation', id: @problem.id)) %> + +

<%= t '.new_translation', id: @problem.id %>

+ +<%= render 'translation-tips' %> +<%= render 'form' %>