diff --git a/app/assets/javascripts/exercise.ts b/app/assets/javascripts/exercise.ts index a53864711b..1d8acd682b 100644 --- a/app/assets/javascripts/exercise.ts +++ b/app/assets/javascripts/exercise.ts @@ -461,6 +461,7 @@ function initExerciseShow(exerciseId: number, programmingLanguage: string, logge editor.setValue(rawBoilerplate); editor.focus(); + editor.clearSelection(); restoreWarning.hidden = true; }); } diff --git a/app/views/activities/show.html.erb b/app/views/activities/show.html.erb index c6f323ffe7..855ecacab3 100644 --- a/app/views/activities/show.html.erb +++ b/app/views/activities/show.html.erb @@ -115,9 +115,9 @@ end %> <% end %> <% if !@edit_submission && !@solution && @last_submission %> -
+
<%= t ".preloaded_info" %> - + <%= t(@activity.boilerplate ? ".preloaded_restore" : ".preloaded_clear") %>
diff --git a/config/locales/views/activities/en.yml b/config/locales/views/activities/en.yml index 2d7ec551f3..35ae41da10 100644 --- a/config/locales/views/activities/en.yml +++ b/config/locales/views/activities/en.yml @@ -96,7 +96,7 @@ en: read_at: "Marked as read on %{timestamp}" preloaded_info: "We have preloaded your latest submission into the editor." preloaded_clear: Clear editor. - preloaded_restore: Restore the boilerplate code. + preloaded_restore: Restore the initial code. series_activities_add_table: course_added_to_usable: "Adding this exercise will allow this course to use all of the private exercises in this exercise's repository. Are you sure?" edit: diff --git a/config/locales/views/activities/nl.yml b/config/locales/views/activities/nl.yml index 4ead22cf5d..2b5d2f1117 100644 --- a/config/locales/views/activities/nl.yml +++ b/config/locales/views/activities/nl.yml @@ -96,7 +96,7 @@ nl: read_at: "Gelezen op %{timestamp}" preloaded_info: We hebben jouw laatste oplossing ingeladen in de editor. preloaded_clear: Maak de editor leeg. - preloaded_restore: Herstel de boilerplate-code. + preloaded_restore: Zet de voorbeeldcode terug. series_activities_add_table: course_added_to_usable: "Deze oefening toevoegen zal deze cursus toegang geven tot alle privΓ© oefeningen in de repository van deze oefening. Ben je zeker?" edit: diff --git a/test/system/activities_test.rb b/test/system/activities_test.rb index 539be48f0c..b1cab2bfa5 100644 --- a/test/system/activities_test.rb +++ b/test/system/activities_test.rb @@ -42,8 +42,8 @@ class ActivitiesTest < ApplicationSystemTestCase Exercise.any_instance.stubs(:boilerplate).returns('boilerplate') create(:submission, exercise: @instance, user: @user, status: :correct, code: 'print("hello")') visit exercise_path(id: @instance.id) - assert_text 'Restore the boilerplate code.' - find('a', text: 'Restore the boilerplate code.').click + assert_text 'Restore the initial code.' + find('a', text: 'Restore the initial code.').click assert_text 'boilerplate' end @@ -55,8 +55,8 @@ class ActivitiesTest < ApplicationSystemTestCase create(:submission, exercise: @instance, user: @user, status: :correct, code: 'print("πŸ˜€")') visit exercise_path(id: @instance.id) assert_text 'print("πŸ˜€")' - assert_text 'Restore the boilerplate code.' - find('a', text: 'Restore the boilerplate code.').click + assert_text 'Restore the initial code.' + find('a', text: 'Restore the initial code.').click assert_text '``' end end