From 8767b183cf56a73c966a69c685626e9d9ffcc6a9 Mon Sep 17 00:00:00 2001 From: Karol Date: Tue, 22 Oct 2019 18:41:06 +0200 Subject: [PATCH] rename action, translation fixes --- app/controllers/exercises_controller.rb | 9 ++++----- config/locales/en.yml | 2 +- config/routes.rb | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 48ac4dbd..d2a90f98 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -12,9 +12,9 @@ class ExercisesController < ApplicationController before_action :set_file_types, only: [:create, :edit, :new, :update] before_action :set_course_token, only: [:implement] - skip_before_action :verify_authenticity_token, only: [:import_proforma_xml, :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_policy_scoped, only: [:import_proforma_xml, :import_uuid_check, :export_external_confirm], raise: false + skip_before_action :verify_authenticity_token, only: [:import_exercise, :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_exercise, :import_uuid_check, :export_external_confirm], raise: false def authorize! authorize(@exercise || @exercises) @@ -36,7 +36,6 @@ class ExercisesController < ApplicationController } end - def experimental_course?(course_token) experimental_courses.has_value?(course_token) end @@ -183,7 +182,7 @@ class ExercisesController < ApplicationController render json: {exercise_found: true, update_right: true, message: t('exercises.import_codeharbor.check.exercise_found')} end - def import_proforma_xml + def import_exercise tempfile = Tempfile.new('codeharbor_import.zip') tempfile.write request.body.read.force_encoding('UTF-8') tempfile.rewind diff --git a/config/locales/en.yml b/config/locales/en.yml index 77d79d4f..a80ea006 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -330,7 +330,7 @@ en: successfully_exported: 'Exercise has successfully been exported.
ID: %{id}
Title: %{title}' export_failed: 'Export has failed.
ID: %{id}
Title: %{title}

Error: %{error}' error: 'An error occurred while contacting Codeharbor
Error: %{message}' - checking_codeharbor: Checking whether exercise exists on Codeharbor. + checking_codeharbor: Checking if the exercise exists on Codeharbor. buttons: retry: ' Retry' export: ' Export' diff --git a/config/routes.rb b/config/routes.rb index 5f562661..7f552b2d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -66,7 +66,7 @@ Rails.application.routes.draw do end end - post '/import_proforma_xml' => 'exercises#import_proforma_xml' + post '/import_exercise' => 'exercises#import_exercise' post '/import_uuid_check' => 'exercises#import_uuid_check' resources :exercises do