rename action, translation fixes

This commit is contained in:
Karol
2019-10-22 18:41:06 +02:00
parent f51dde4ef7
commit 8767b183cf
3 changed files with 6 additions and 7 deletions

View File

@ -12,9 +12,9 @@ class ExercisesController < ApplicationController
before_action :set_file_types, only: [:create, :edit, :new, :update] before_action :set_file_types, only: [:create, :edit, :new, :update]
before_action :set_course_token, only: [:implement] before_action :set_course_token, only: [:implement]
skip_before_action :verify_authenticity_token, only: [:import_proforma_xml, :import_uuid_check, :export_external_confirm] skip_before_action :verify_authenticity_token, only: [:import_exercise, :import_uuid_check, :export_external_confirm]
skip_after_action :verify_authorized, only: [:import_proforma_xml, :import_uuid_check, :export_external_confirm] skip_after_action :verify_authorized, only: [:import_exercise, :import_uuid_check, :export_external_confirm]
skip_after_action :verify_policy_scoped, only: [:import_proforma_xml, :import_uuid_check, :export_external_confirm], raise: false skip_after_action :verify_policy_scoped, only: [:import_exercise, :import_uuid_check, :export_external_confirm], raise: false
def authorize! def authorize!
authorize(@exercise || @exercises) authorize(@exercise || @exercises)
@ -36,7 +36,6 @@ class ExercisesController < ApplicationController
} }
end end
def experimental_course?(course_token) def experimental_course?(course_token)
experimental_courses.has_value?(course_token) experimental_courses.has_value?(course_token)
end end
@ -183,7 +182,7 @@ class ExercisesController < ApplicationController
render json: {exercise_found: true, update_right: true, message: t('exercises.import_codeharbor.check.exercise_found')} render json: {exercise_found: true, update_right: true, message: t('exercises.import_codeharbor.check.exercise_found')}
end end
def import_proforma_xml def import_exercise
tempfile = Tempfile.new('codeharbor_import.zip') tempfile = Tempfile.new('codeharbor_import.zip')
tempfile.write request.body.read.force_encoding('UTF-8') tempfile.write request.body.read.force_encoding('UTF-8')
tempfile.rewind tempfile.rewind

View File

@ -330,7 +330,7 @@ en:
successfully_exported: 'Exercise has successfully been exported.<br>ID: %{id}<br>Title: %{title}' successfully_exported: 'Exercise has successfully been exported.<br>ID: %{id}<br>Title: %{title}'
export_failed: 'Export has failed.<br>ID: %{id}<br>Title: %{title}<br><br>Error: %{error}' export_failed: 'Export has failed.<br>ID: %{id}<br>Title: %{title}<br><br>Error: %{error}'
error: 'An error occurred while contacting Codeharbor<br>Error: %{message}' error: 'An error occurred while contacting Codeharbor<br>Error: %{message}'
checking_codeharbor: Checking whether exercise exists on Codeharbor. checking_codeharbor: Checking if the exercise exists on Codeharbor.
buttons: buttons:
retry: ' Retry' retry: ' Retry'
export: ' Export' export: ' Export'

View File

@ -66,7 +66,7 @@ Rails.application.routes.draw do
end end
end end
post '/import_proforma_xml' => 'exercises#import_proforma_xml' post '/import_exercise' => 'exercises#import_exercise'
post '/import_uuid_check' => 'exercises#import_uuid_check' post '/import_uuid_check' => 'exercises#import_uuid_check'
resources :exercises do resources :exercises do