12 changed files with 112 additions and 77 deletions
-
1.vscode/extensions.json
-
2.vscode/settings.json
-
16app/controllers/application_controller.rb
-
45app/controllers/notification_controller.rb
-
6app/views/layouts/application.html.erb
-
6app/views/layouts/components/_flash.html.erb
-
27app/views/layouts/components/_flashbar.html.erb
-
6app/views/layouts/components/_footer.html.erb
-
2app/views/layouts/components/_navbar.html.erb
-
3app/views/notification/_turbo_placeholder.html.erb
-
3app/views/notification/_turbo_placeholder2.html.erb
-
64app/views/notification/index.html.erb
@ -1,4 +1,20 @@ |
|||
class ApplicationController < ActionController::Base |
|||
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has. |
|||
allow_browser versions: :modern |
|||
|
|||
def render_stream(notice: nil, alert: nil, &) |
|||
flash.now[:notice] = notice if notice |
|||
flash.now[:alert] = alert if alert |
|||
streams = [] |
|||
streams << turbo_stream.replace(:flash, partial: 'layouts/components/flash') if flash.any? |
|||
if block_given? |
|||
yields = yield(turbo_stream) |
|||
if yields.is_a? Array |
|||
streams += yields |
|||
else |
|||
streams << yields |
|||
end |
|||
end |
|||
render turbo_stream: streams |
|||
end |
|||
end |
@ -1,24 +1,21 @@ |
|||
<div |
|||
id='flashbar' |
|||
class='flex justify-center' |
|||
data-turbo-permanent |
|||
> |
|||
<div id="flashbar" class="flex justify-center" data-turbo-permanent="yes"> |
|||
<!-- |
|||
here is a shadow root which serves as a placeholder for the toaster area. |
|||
data-turbo-permant prevents morphing to dismiss active toasts |
|||
--> |
|||
|
|||
<%# <div role="alert" class="toastify on toastify-center alert alert-success inset-ring-2"> |
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 shrink-0 stroke-current" fill="none" viewBox="0 0 24 24"> |
|||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" /> |
|||
</svg> |
|||
<div> |
|||
super long sentence which should wrap at least once or various lines. |
|||
super long sentence which should wrap at least once or various lines. |
|||
<%# |
|||
<div role="alert" class="toastify on toastify-center alert alert-success inset-ring-2"> |
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 shrink-0 stroke-current" fill="none" viewBox="0 0 24 24"> |
|||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" /> |
|||
</svg> |
|||
<div> |
|||
super long sentence which should wrap at least once or various lines. |
|||
super long sentence which should wrap at least once or various lines. |
|||
</div> |
|||
<button class='toast-close'>x</button> |
|||
</div> |
|||
<button class='toast-close'>x</button> |
|||
</div> %> |
|||
|
|||
%> |
|||
</div> |
|||
|
|||
<%= render 'layouts/components/flash' %> |
@ -1,7 +1,7 @@ |
|||
<footer class="footer sm:footer-horizontal footer-center bg-base-300 text-base-content p-4"> |
|||
<aside> |
|||
<%= Rails.application.name.upcase %> app is free software<br/> |
|||
Copyleft: AGPLv3<br/> |
|||
source code<br/> |
|||
<%= Rails.application.name.upcase %> app is free software<br> |
|||
Copyleft: AGPLv3<br> |
|||
source code<br> |
|||
</aside> |
|||
</footer> |
@ -0,0 +1,3 @@ |
|||
<%= turbo_frame_tag :turbo_placeholder do %> |
|||
<%= Time.now %> |
|||
<% end %> |
@ -0,0 +1,3 @@ |
|||
<%= turbo_frame_tag :turbo_placeholder2 do %> |
|||
<%= Time.now %> |
|||
<% end %> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue