Add app menu with sign in/out links

This commit is contained in:
cryptogopher 2023-04-02 00:54:18 +02:00
parent 66f098f479
commit c72144ff22
4 changed files with 37 additions and 34 deletions

View File

@ -13,3 +13,24 @@
*= require_tree .
*= require_self
*/
.app-menu {
height: 2.1em;
}
.app-menu a {
color: black;
float: right;
font-size: 0.9em;
padding: 0.6em;
}
.app-menu a:hover {
background-color: #009ade;
border-radius: 0.2em;
color: white;
cursor: pointer;
text-decoration: none;
}
a:not(:hover) {
text-decoration: none;
}

View File

@ -11,6 +11,20 @@
</head>
<body>
<div class="app-menu">
<%= link_to_if user_signed_in?, t(:sign_out), destroy_user_session_path,
data: { turbo_method: :delete } do
link_to t(:sign_in), new_user_session_path
end %>
</div>
<% if flash[:notice] %>
<div style="border: green"><%= flash[:notice] %></div>
<% end %>
<% if flash[:alert] %>
<div style="border: red"><%= flash[:alert] %></div>
<% end %>
<%= yield %>
</body>
</html>

View File

@ -1,5 +1,3 @@
<p style="color: green"><%= notice %></p>
<h1>Users</h1>
<div id="users">

View File

@ -1,33 +1,3 @@
# Files in the config/locales directory are used for internationalization
# and are automatically loaded by Rails. If you want to use locales other
# than English, add the necessary files in this directory.
#
# To use the locales, use `I18n.t`:
#
# I18n.t "hello"
#
# In views, this is aliased to just `t`:
#
# <%= t("hello") %>
#
# To use a different locale, set it with `I18n.locale`:
#
# I18n.locale = :es
#
# This would use the information in config/locales/es.yml.
#
# The following keys must be escaped otherwise they will not be retrieved by
# the default I18n backend:
#
# true, false, on, off, yes, no
#
# Instead, surround them with single quotes.
#
# en:
# "true": "foo"
#
# To learn more, please read the Rails Internationalization guide
# available at https://guides.rubyonrails.org/i18n.html.
en:
hello: "Hello world"
sign_in: "Sign in"
sign_out: "Sign out"