Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename application_old and only include where relevant #4374

Merged
merged 3 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app/assets/config/manifest.js
app/assets/javascripts/application_old.js
app/assets/javascripts/ace_editor.js
app/assets/javascripts/i18n/translations.js
app/assets/javascripts/types/index.d.ts
app/assets/javascripts/inputServiceWorker.js
2 changes: 1 addition & 1 deletion app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
//= link_tree ../images
//= link application_old.js
//= link ace_editor.js
//= link_tree ../builds
11 changes: 11 additions & 0 deletions app/assets/javascripts/ace_editor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This is legacy code that is not compiled by webpack but fully depended on the sprockets pipeline.
// It is used by the ace editor to provide syntax highlighting and code completion.
// New code should not be added here.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//

//= require ace-rails-ap
//= require ace/ext-language_tools

16 changes: 0 additions & 16 deletions app/assets/javascripts/application_old.js

This file was deleted.

1 change: 1 addition & 0 deletions app/views/activities/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<%= javascript_include_tag 'exercise' %>
<% if @activity.exercise? %>
<%= javascript_include_tag 'submission' %>
<%= javascript_include_tag 'ace_editor' %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure and it's hard to test, but exercise.ts uses the ace global which I think is defined in the ace editor file. Because the order of inclusion changed (app_old was included as the first js file) this might break in some cases. To be sure, I think it's better to add this include first here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ace is only used inside a function, which is only executed upon document ready, so I don't think it matters.
But I switched the inclusion order anyway

<script>
window.dodona.initMathJax();
</script>
Expand Down
1 change: 0 additions & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
<%= javascript_include_tag 'application_pack' %>
<%= javascript_include_tag 'commons' %>
<%= javascript_include_tag 'runtime' %>
<%= javascript_include_tag 'application_old' %>
<%= yield :javascripts %>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
Expand Down
1 change: 0 additions & 1 deletion app/views/layouts/frame.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
<%= javascript_include_tag 'frame' %>
<%= javascript_include_tag 'commons' %>
<%= javascript_include_tag 'runtime' %>
<%= javascript_include_tag 'application_old' %>
<%= yield :javascripts %>
</head>
<body>
Expand Down
1 change: 0 additions & 1 deletion app/views/layouts/lti.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
<%= javascript_include_tag 'application_pack' %>
<%= javascript_include_tag 'commons' %>
<%= javascript_include_tag 'runtime' %>
<%= javascript_include_tag 'application_old' %>
<%= yield :javascripts %>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
Expand Down