Table notifications
This commit is contained in:
parent
2002651e8a
commit
c5435ac412
|
@ -9,6 +9,7 @@
|
|||
--secondary-text-color: #777;
|
||||
|
||||
--inset-bg-color: #eee;
|
||||
--notification-bg-color: #eee;
|
||||
|
||||
--border-radius: .5em;
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
#table-notifications {
|
||||
position: fixed;
|
||||
width: 60em;
|
||||
max-width: 80%;
|
||||
top: 1em; left: 0;
|
||||
transform: translate(calc(50vw - 50%));
|
||||
li {
|
||||
background-color: var(--notification-bg-color);
|
||||
list-style-type: none;
|
||||
padding: .5em;
|
||||
border-radius: var(--border-radius);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
setTimeout(() => {
|
||||
this.element.remove()
|
||||
}, 5000)
|
||||
}
|
||||
}
|
|
@ -9,6 +9,8 @@ class DiceRoll < ApplicationRecord
|
|||
|
||||
after_create_commit do
|
||||
broadcast_append_to table, target: "events"
|
||||
broadcast_append_to table, target: "table-notifications",
|
||||
partial: "shared/notification", locals: { object: self }
|
||||
end
|
||||
|
||||
def display_text
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
<body>
|
||||
<header>
|
||||
<%= yield(:header_content) if content_for?(:header_content) %>
|
||||
<h1><%= link_to t("site_name"), root_path %></h1>
|
||||
<nav>
|
||||
<ul>
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
<%= content_for :header_content do %>
|
||||
<ul id="table-notifications"></ul>
|
||||
<% end %>
|
||||
|
||||
<% content_for :submenu do %>
|
||||
<%= turbo_stream_from @table %>
|
||||
<h2><%= @table.name %></h2>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<div data-controller="notifications">
|
||||
<%= render object %>
|
||||
</div>
|
Loading…
Reference in New Issue