Browse Source

Add link back to app in admin navigation

Chris Oliver 6 năm trước cách đây
mục cha
commit
350df372f4
1 tập tin đã thay đổi với 24 bổ sung0 xóa
  1. 24 0
      app/views/admin/application/_navigation.html.erb

+ 24 - 0
app/views/admin/application/_navigation.html.erb

@@ -0,0 +1,24 @@
+<%#
+# Navigation
+
+This partial is used to display the navigation in Administrate.
+By default, the navigation contains navigation links
+for all resources in the admin dashboard,
+as defined by the routes in the `admin/` namespace
+%>
+
+<nav class="navigation" role="navigation">
+  <%= link_to(
+    "← Back to App",
+    root_path,
+    class: "navigation__link"
+  ) %>
+
+  <% Administrate::Namespace.new(namespace).resources.each do |resource| %>
+    <%= link_to(
+      display_resource_name(resource),
+      [namespace, resource_index_route_key(resource)],
+      class: "navigation__link navigation__link--#{nav_link_state(resource)}"
+    ) %>
+  <% end %>
+</nav>