diff --git a/app/views/scores/_score.html.erb b/app/views/scores/_score.html.erb
index c4006ec..213ef67 100644
--- a/app/views/scores/_score.html.erb
+++ b/app/views/scores/_score.html.erb
@@ -9,8 +9,8 @@
<%= score.created_at %>
- <%= render partial: 'common/button', locals: {path: score, icon: :eye, tooltip: 'open score'} %>
- <%= render partial: 'common/button', locals: {path: edit_score_path(score), icon: :edit, tooltip: 'edit score'} %>
+ <%= render partial: 'common/button', locals: {path: score, icon: :eye, tooltip: 'open score',data:{ turbo_frame: '_top'}} %>
+ <%= render partial: 'common/button', locals: {path: edit_score_path(score), icon: :edit, tooltip: 'edit score',data:{ turbo_frame: '_top'}} %>
<%= render partial: 'common/button', locals: {path: score, icon: :trash, tooltip: 'delete score',data:{ turbo_method: :delete}} %>
|
\ No newline at end of file
diff --git a/config/environments/development.rb b/config/environments/development.rb
index b4230ce..513ecae 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -88,10 +88,6 @@ Rails.application.configure do # rubocop:disable Metrics/BlockLength
end
elsif Rails.application.server?
config.after_initialize do
- # force module preloading
- Semantic::AnsiColors.class
- Semantic::AnsiDimensions.class
-
Semantic::DevLoader.new
end
end
diff --git a/lib/semantic/dev_loader.rb b/lib/semantic/dev_loader.rb
index 90ea651..d8eb391 100644
--- a/lib/semantic/dev_loader.rb
+++ b/lib/semantic/dev_loader.rb
@@ -2,16 +2,26 @@ module Semantic
# use the Zeitwerk autoloader to reattach_appender for development autoreloading feature
class DevLoader
def initialize
+ @subscribers = []
+ force_preload_module
Rails.autoloaders.main.on_load('ApplicationController') do
append_ansi_formatter
- append_subscriber_once
+ register_log_subscriber
end
append_ansi_formatter
+
+ # FIXME: when final
# Rails.logger.level = :error
end
private
+ def force_preload_module
+ self.class.module_parent.constants.each do |const|
+ self.class.module_parent.const_get(const)
+ end
+ end
+
def append_ansi_formatter
SemanticLogger.clear_appenders!
formatter = Semantic::AnsiFormatter.new
@@ -20,15 +30,16 @@ module Semantic
filter: ->(log) { !formatter.reject(log) })
end
- def append_subscriber_once
- return unless @previous_subscribe.nil?
+ def register_log_subscriber
+ @subscribers.each { |sub| ActiveSupport::Notifications.unsubscribe(sub) }
+ @subscribers.clear
- subscriber = Semantic::LogSubscriber.new('toto1')
- @previous_subscribe = ActiveSupport::Notifications.subscribe 'start_processing.action_controller' do |event|
- subscriber.start_processing(event)
+ log_subscriber = Semantic::LogSubscriber.new('toto1')
+ @subscribers << ActiveSupport::Notifications.subscribe('start_processing.action_controller') do |event|
+ log_subscriber.start_processing(event)
end
- ActiveSupport::Notifications.subscribe 'process_action.action_controller' do |event|
- subscriber.finish_processing(event)
+ @subscribers << ActiveSupport::Notifications.subscribe('process_action.action_controller') do |event|
+ log_subscriber.finish_processing(event)
end
end
end
diff --git a/lib/semantic/log_subscriber.rb b/lib/semantic/log_subscriber.rb
index 9771c01..33d38b2 100644
--- a/lib/semantic/log_subscriber.rb
+++ b/lib/semantic/log_subscriber.rb
@@ -38,9 +38,8 @@ module Semantic
end
additions << "GC: #{event.gc_time.round(1)}ms"
-
- logger.info("Completed #{status} #{Rack::Utils::HTTP_STATUS_CODES[status]} in #{event.duration.round}ms " \
- "(#{additions.join(' | ')})")
+ logger.debug("Processed in #{event.duration.round}ms (#{additions.join(' | ')})")
+ logger.info("Completed #{status} #{Rack::Utils::HTTP_STATUS_CODES[status]}")
end
end