Make it easier to customize JavaScript functions

When there was a custom JavaScript file, we weren't loading the original
one, meaning that, in order to customize it, it was necessary to copy
the whole original file and then changing it.

Now we're loading both the original and the custom file, so the custom
file can simply add more functions or overwrite the ones we'd like to
customize, without copying the whole file.

Existing copies of original files will still overwrite the whole file
and won't be affected.
This commit is contained in:
Javi Martín
2022-03-18 14:22:56 +01:00
parent 9b76a5a19e
commit 95c1999cca
2 changed files with 2 additions and 1 deletions

View File

@@ -114,6 +114,7 @@
//= require_tree ./admin
//= require_tree ./sdg
//= require_tree ./sdg_management
//= require_tree ./custom
var initialize_modules = function() {
"use strict";

View File

@@ -114,7 +114,7 @@ end
class Rails::Engine
initializer :prepend_custom_assets_path, group: :all do |app|
if self.class.name == "Consul::Application"
%w[images fonts javascripts].each do |asset|
%w[images fonts].each do |asset|
app.config.assets.paths.unshift(Rails.root.join("app", "assets", asset, "custom").to_s)
end
end