From f51dde4ef7781b8df9a3a419c2a9c8e12ed2c8f8 Mon Sep 17 00:00:00 2001 From: Karol Date: Mon, 21 Oct 2019 18:03:56 +0200 Subject: [PATCH] translations and whitespaces --- app/assets/javascripts/exercises.js.erb | 1 - app/controllers/exercises_controller.rb | 1 - app/models/code_ocean/file.rb | 1 - app/services/proforma_service/import.rb | 4 ++-- app/views/exercises/_export_actions.html.slim | 8 ++++---- app/views/exercises/_export_dialogcontent.html.slim | 2 -- app/views/exercises/_form.html.slim | 2 +- config/locales/en.yml | 7 +++++++ 8 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/assets/javascripts/exercises.js.erb b/app/assets/javascripts/exercises.js.erb index 95b5539e..08d119ad 100644 --- a/app/assets/javascripts/exercises.js.erb +++ b/app/assets/javascripts/exercises.js.erb @@ -236,7 +236,6 @@ $(document).on('turbolinks:load', function() { $('#exercise_unpublished').prop('checked', true); } }) - }; var observeExportButtons = function(){ diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 6df096fe..48ac4dbd 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -141,7 +141,6 @@ class ExercisesController < ApplicationController exported: false } ) - }, status: 200 end diff --git a/app/models/code_ocean/file.rb b/app/models/code_ocean/file.rb index 91ad6e54..a68b585b 100644 --- a/app/models/code_ocean/file.rb +++ b/app/models/code_ocean/file.rb @@ -7,7 +7,6 @@ module CodeOcean def validate(record) existing_files = File.where(name: record.name, path: record.path, file_type_id: record.file_type_id, context_id: record.context_id, context_type: record.context_type).to_a - unless existing_files.empty? if (not record.context.is_a?(Exercise)) || (record.context.new_record?) record.errors[:base] << 'Duplicate' diff --git a/app/services/proforma_service/import.rb b/app/services/proforma_service/import.rb index 7ab31055..b8ec628b 100644 --- a/app/services/proforma_service/import.rb +++ b/app/services/proforma_service/import.rb @@ -55,8 +55,8 @@ module ProformaService end filenames.select { |f| f[/\.xml$/] }.any? - # rescue Zip::Error - # raise Proforma::InvalidZip + rescue Zip::Error + raise Proforma::InvalidZip end end end diff --git a/app/views/exercises/_export_actions.html.slim b/app/views/exercises/_export_actions.html.slim index 6b5a0554..0008670d 100644 --- a/app/views/exercises/_export_actions.html.slim +++ b/app/views/exercises/_export_actions.html.slim @@ -1,18 +1,18 @@ - if error = button_tag type: 'button', class:'btn btn-primary pull-right export-button export-retry-button', data: {exercise_id: exercise.id} do i.fa.fa-refresh.confirm-icon - = ' Retry' + = t('exercises.export_codeharbor.buttons.retry') - else - unless exported - if update_right = button_tag type: 'button', class:'btn btn-primary pull-right export-action export-button', data: {exercise_id: exercise.id, export_type: 'export'} do i.fa.fa-check.confirm-icon - = ' Export' + = t('exercises.export_codeharbor.buttons.export') - else = button_tag type: 'button', class:'btn btn-primary pull-right export-action export-button', data: {exercise_id: exercise.id, export_type: 'create_new'} do i.fa.fa-check.confirm-icon - = ' Create new' + = t('exercises.export_codeharbor.buttons.create_new') = button_tag type: 'submit', class:'btn btn-secondary pull-right export-button', data: {dismiss: 'modal'} do i.fa.fa-remove.abort-icon - = exported ? ' Close' : ' Abort' + = exported ? t('exercises.export_codeharbor.buttons.close') : t('exercises.export_codeharbor.buttons.abort') diff --git a/app/views/exercises/_export_dialogcontent.html.slim b/app/views/exercises/_export_dialogcontent.html.slim index 92066666..bae04880 100644 --- a/app/views/exercises/_export_dialogcontent.html.slim +++ b/app/views/exercises/_export_dialogcontent.html.slim @@ -1,5 +1,3 @@ #export-exercise .export-message - = 'This should not be seen' .export-exercise-actions - = 'This neither' diff --git a/app/views/exercises/_form.html.slim b/app/views/exercises/_form.html.slim index d9ad42f6..dcf31568 100644 --- a/app/views/exercises/_form.html.slim +++ b/app/views/exercises/_form.html.slim @@ -11,7 +11,7 @@ = f.pagedown :description, input_html: { preview: true, rows: 10 } .form-group = f.label(:execution_environment_id) - = f.collection_select(:execution_environment_id, @execution_environments, :id, :name, {include_blank: 'None'}, class: 'form-control') + = f.collection_select(:execution_environment_id, @execution_environments, :id, :name, {include_blank: t('exercises.form.none')}, class: 'form-control') /.form-group = f.label(:instructions) = f.hidden_field(:instructions) diff --git a/config/locales/en.yml b/config/locales/en.yml index fb9f2e55..77d79d4f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -331,6 +331,12 @@ en: 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. + buttons: + retry: ' Retry' + export: ' Export' + create_new: ' Create new' + close: ' Close' + abort: ' Abort' file_form: hints: feedback_message: This message is used as a hint for failing tests. @@ -341,6 +347,7 @@ en: click_to_collapse: "Click to expand/collapse..." unpublish_warning: This will unpublish the exercise. Any student trying to implement it will get an error message, until it is published again. no_execution_environment_selected: Select an execution environment before publishing the exercise. + none: None implement: alert: text: 'Your browser does not support features required for using %{application_name}. Please access %{application_name} using a modern browser.'