Skip to content

Commit 93ffbae

Browse files
feat/add logout button views (#254)
* test: add shared context for unauthenticated access * feat:add logout button only in view admins * add logout button to sidebar
1 parent 8fbd03c commit 93ffbae

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

app/assets/stylesheets/custom.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.navigation {
2+
display: flex;
3+
flex-direction: column;
4+
justify-content: space-between;
5+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<%#
2+
# Navigation
3+
4+
This partial is used to display the navigation in Administrate.
5+
By default, the navigation contains navigation links
6+
for all resources in the admin dashboard,
7+
as defined by the routes in the `admin/` namespace
8+
%>
9+
10+
<nav class="navigation">
11+
<div>
12+
<%= link_to(t("administrate.navigation.back_to_app"), root_url, class: "button button--alt button--nav") if defined?(root_url) %>
13+
14+
<% Administrate::Namespace.new(namespace).resources_with_index_route.each do |resource| %>
15+
<%= link_to(
16+
display_resource_name(resource),
17+
resource_index_route(resource),
18+
class: "navigation__link navigation__link--#{nav_link_state(resource)}"
19+
) if accessible_action?(model_from_resource(resource), :index) %>
20+
<% end %>
21+
</div>
22+
23+
<div >
24+
<%= link_to "Logout", destroy_user_session_path, method: :delete, class: "button button--danger w-full" %>
25+
</div>
26+
</nav>
27+
28+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Administrate::Engine.add_stylesheet("custom.css")

config/initializers/assets.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@
1212
# application.js, application.css, and all non-JS/CSS in the app/assets
1313
# folder are already added.
1414
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
15+
16+
Rails.application.config.assets.precompile += %w[custom.css]

0 commit comments

Comments
 (0)