From dcaedfa9fe2fcbce78e2ce005bae05420fabc93b Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Wed, 8 May 2024 21:09:42 +0300 Subject: [PATCH] Remove url_helpers from editor.js.erb - Rather than using a Rails helper, we rely on JsRoutes to provide the route. - There is no need to remove the events_path if sending events is disabled, so we drop that. --- app/assets/javascripts/editor/editor.js.erb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/editor/editor.js.erb b/app/assets/javascripts/editor/editor.js.erb index 0a24c12d..29cbc5ea 100644 --- a/app/assets/javascripts/editor/editor.js.erb +++ b/app/assets/javascripts/editor/editor.js.erb @@ -27,15 +27,14 @@ var CodeOceanEditor = { lastCopyText: null, - <% self.class.include Rails.application.routes.url_helpers %> <% @config ||= CodeOcean::Config.new(:code_ocean).read(erb: false) %> // Important notice: Changing the config values requires any content-wise // modification for this file in the development environment. Lacking to do so // will result in the old, server-side cached serving of this file even across // server restarts! sendEvents: <%= @config['codeocean_events'] ? @config['codeocean_events']['enabled'] : false %>, - eventURL: "<%= @config['codeocean_events'] ? events_path : '' %>", - fileTypeURL: "<%= file_types_path %>", + eventURL: Routes.events_path(), + fileTypeURL: Routes.file_types_path(), confirmDestroy: function (event) { event.preventDefault();