From 283572d1dce81ca60aed77694c3e90c64ac5d342 Mon Sep 17 00:00:00 2001 From: pvincent Date: Tue, 14 May 2024 21:54:08 +0400 Subject: [PATCH] wrap --- app/views/layouts/_notification.html.erb | 4 +- app/views/layouts/application.html.erb | 2 +- app/views/layouts/toaster/_toaster.html.erb | 68 --------------------- lib/formatters/basic_formatter.rb | 4 +- 4 files changed, 5 insertions(+), 73 deletions(-) delete mode 100644 app/views/layouts/toaster/_toaster.html.erb diff --git a/app/views/layouts/_notification.html.erb b/app/views/layouts/_notification.html.erb index af3e5f0..4edb1bb 100644 --- a/app/views/layouts/_notification.html.erb +++ b/app/views/layouts/_notification.html.erb @@ -9,8 +9,8 @@ offset: { y: '1em' }, close: true } - const notice={ className: 'toastify-notice text-black', ...common } - const alert={ className: 'text-black toastify-alert', ...common } + const notice={ className: 'toastify-notice', ...common } + const alert={ className: 'toastify-alert', ...common } <% if flash.notice%> Toastify({ text: '<%=flash.notice%>', ...notice}).showToast(); diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 15217e2..002dca7 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -19,7 +19,7 @@ - <%=render '/layouts/notification' %> + <%=render 'layouts/notification' %>
<%= yield %> diff --git a/app/views/layouts/toaster/_toaster.html.erb b/app/views/layouts/toaster/_toaster.html.erb deleted file mode 100644 index 176b625..0000000 --- a/app/views/layouts/toaster/_toaster.html.erb +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - -

Snackbar / Toast

-

Snackbars are often used as a tooltips/popups to show a message at the bottom of the screen.

-

Click on the button to show the snackbar. It will disappear after 3 seconds.

- - - -
Some text some message..
- - - - - diff --git a/lib/formatters/basic_formatter.rb b/lib/formatters/basic_formatter.rb index 08f4b35..2e8895f 100644 --- a/lib/formatters/basic_formatter.rb +++ b/lib/formatters/basic_formatter.rb @@ -210,7 +210,7 @@ class BasicFormatter < SemanticLogger::Formatters::Color # rubocop:disable Metri def wrap_message(message) message, space_prefix = split_spaces_in_front(message) message = Wrapper.wrap("#{CONTENT_COLOR_MAP[log.level]}#{message}", - before_message(wrapped: true) + space_prefix.to_s, + before_message(true) + space_prefix.to_s, compute_useful_length - space_prefix.length) "#{space_prefix}#{message}" end @@ -226,7 +226,7 @@ class BasicFormatter < SemanticLogger::Formatters::Color # rubocop:disable Metri 100 # FIXME: CONSTANTIZE, only useful in DEBUGGER, no IO.console detected! end - def before_message(wrapped: false) + def before_message(wrapped = false) [name, wrapped ? continuation : level, tags, named_tags, duration].compact.join(' ') + CONTENT_PREFIX end