Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby
1.9 KB
Raw Blame
<%# Rendered inside the fixed-position wrapper in _htmldoc.html.erb, which
    floats above the page — see that file for how it centers itself on
    layouts with a sidebar. %>
<div id="notification-tray" class="space-y-1 w-full">
  <%= render_flash_notifications %>

  <div id="sync-toast"></div>
  <div id="cta"></div>

  <%# Announces an action that changed the page without leaving anything on
      screen to read — a turbo_stream can update this instead of rendering a
      toast. It has to live here, outside every stream target, and be present
      before the change: a live region that arrives with its own content is not
      announced. Update it (don't append) so messages replace rather than pile
      up. Empty and visually hidden, so it costs nothing when unused. %>
  <div id="aria-announcer" class="sr-only" role="status" aria-live="polite" aria-atomic="true"></div>
</div>

<%# The desktop app has no download list of its own: when a download ends it
    clones one of these into the tray, so the confirmation is an ordinary Sure
    toast, and reads the data attributes for its native notification. A
    template stays inert in a browser. %>
<template id="desktop-download-complete" data-message="<%= t(".download_complete") %>" data-description="<%= t(".download_location") %>">
  <%= render "shared/notifications/notice", message: t(".download_complete"), description: t(".download_location") %>
</template>
<template id="desktop-download-failed" data-message="<%= t(".download_failed") %>">
  <%= render "shared/notifications/alert", message: t(".download_failed") %>
</template>

<%# sortable_list_controller.js clones this when a new order cannot reach
    the server and the list goes back to the saved one, and reads the message
    for #aria-announcer. %>
<template id="sortable-list-save-failed" data-message="<%= t(".order_save_failed") %>">
  <%= render "shared/notifications/alert", message: t(".order_save_failed") %>
</template>