Skip to content

Commit

Permalink
Reuse notice_box in application layout
Browse files Browse the repository at this point in the history
Previously the notice message was only being displayed on some pages.
This moves it into the application layout so that it can appear on any
page which makes it more consistent with the way the alert message now
works.

Note that this means a slight change in position in
`app/views/users/show.html.erb` where previously the notice message
appeared *below* the page heading. It's not obvious to me that the
latter was intentional and it seems inconsistent, so I'm going to
change it and hope for the best!
  • Loading branch information
floehopper committed Dec 23, 2023
1 parent 6427bb7 commit 750f708
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 9 deletions.
2 changes: 0 additions & 2 deletions app/views/albums/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
)
%>

<%= render('shared/notice_box', message: notice) if notice %>

<div data-controller="player">
<div class="flex flex-row gap-4">
<div class="w-1/2">
Expand Down
2 changes: 0 additions & 2 deletions app/views/interests/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
)
%>

<%= render('shared/notice_box', message: notice) if notice %>

<h1 class="text-4xl tracking-tight leading-10 font-extrabold mb-3">A new music platform. <br /> <span class="text-amber-600">For us.</span></h1>

<div class="max-w-3xl">
Expand Down
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
</nav>
<div class="bg-white p-2 sm:p-6 sm:mt-2 sm:shadow-sm">
<%= render('shared/alert_box', message: alert) if alert %>
<%= render('shared/notice_box', message: notice) if notice %>
<%= yield %>
</div>
<footer class="flex flex-row justify-between mt-2 mb-4 text-slate-400 text-sm px-2 sm:px-0">
Expand Down
2 changes: 0 additions & 2 deletions app/views/sessions/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<%= render('shared/notice_box', message: notice) if notice %>

<h1>Devices & Sessions</h1>

<div id="sessions">
Expand Down
2 changes: 0 additions & 2 deletions app/views/sessions/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<%= render 'shared/page_header', text: 'Log in' %>
<%= form_with(url: log_in_path, builder: TailwindFormBuilder) do |form| %>
<%= render('shared/notice_box', message: notice) if notice %>
<%= form.email_field :email, value: params[:email_hint], required: true, autofocus: true, autocomplete: "email", class: "w-full mb-3" %>
<%= form.password_field :password, required: true, autocomplete: "current-password", class: "w-full mb-3" %>
<%= form.submit "Log in", class: "w-full mt-3" %>
Expand Down
1 change: 0 additions & 1 deletion app/views/users/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<%= render('shared/page_header', text: 'My account') %>
<%= render('shared/notice_box', message: notice) if notice %>

<ul>
<li><%= text_link_to "Change password", edit_password_path %></li>
Expand Down

0 comments on commit 750f708

Please sign in to comment.