feat: added navbar links

Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
Louis Vallat 2023-02-04 14:38:27 +01:00
parent 1ab28933e7
commit a56a2854a4
No known key found for this signature in database
GPG Key ID: 0C87282F76E61283
3 changed files with 22 additions and 6 deletions

View File

@ -16,11 +16,16 @@
<div class="d-flex flex-wrap align-items-center justify-content-center justify-content-lg-start"> <div class="d-flex flex-wrap align-items-center justify-content-center justify-content-lg-start">
<ul class="nav col-12 col-lg-auto me-lg-auto mb-2 justify-content-center mb-md-0"> <ul class="nav col-12 col-lg-auto me-lg-auto mb-2 justify-content-center mb-md-0">
<li><%= link_to t("fields.home"), root_path, class: "nav-link px-2 text-secondary" %></li> <li><%= link_to t("fields.home"), root_path, class: "nav-link px-2 #{current_page?(root_path) ? "text-secondary" : "text-white"}" %></li>
<% if current_user %>
<li><%= link_to t("fields.count"), count_root_path, class: "nav-link px-2 #{current_page?(count_root_path) ? "text-secondary" : "text-white"}" %></li>
<li><%= link_to t("fields.profile"), profile_root_path, class: "nav-link px-2 #{current_page?(profile_root_path) ? "text-secondary" : "text-white"}" %></li>
<% end %>
</ul> </ul>
<div class="text-end"> <div class="nav text-end">
<% if current_user %> <% if current_user %>
<a class="nav-link disabled"><%= current_user.email %></a>
<%= button_to t("fields.logout"), destroy_user_session_path, method: "delete", class: "btn btn-danger me-2" %> <%= button_to t("fields.logout"), destroy_user_session_path, method: "delete", class: "btn btn-danger me-2" %>
<% else %> <% else %>
<%= link_to t("fields.login"), new_user_session_path, class: "btn btn-outline-light me-2" %> <%= link_to t("fields.login"), new_user_session_path, class: "btn btn-outline-light me-2" %>
@ -29,9 +34,16 @@
</div> </div>
</div> </div>
</header> </header>
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
<%= yield %> <div class="container">
<% if notice %>
<p class="notice"><%= notice %></p>
<% end %>
<% if alert %>
<p class="alert"><%= alert %></p>
<% end %>
<%= yield %>
</div>
</body> </body>
</html> </html>

View File

@ -3,3 +3,5 @@ en:
home: "Home" home: "Home"
login: "Login" login: "Login"
logout: "Logout" logout: "Logout"
count: "Count"
profile: "Profile"

View File

@ -3,3 +3,5 @@ fr:
home: "Accueil" home: "Accueil"
login: "Se connecter" login: "Se connecter"
logout: "Se déconnecter" logout: "Se déconnecter"
count: "Compte"
profile: "Profil"