Add admin panel and make it work for user resource

This commit is contained in:
riggraz
2019-08-21 16:13:39 +02:00
parent 462002c416
commit ecc0d1cb27
17 changed files with 321 additions and 4 deletions

View File

@@ -0,0 +1,19 @@
<%#
# 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 site", root_path, class: "navigation__link", "data-turbolinks": "false" %>
<% 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>

View File

@@ -0,0 +1 @@
<%= f.text_field field.attribute, hidden: :true %>

View File

@@ -0,0 +1 @@
<%= field.to_s %>

View File

@@ -0,0 +1 @@
<%= field.to_s %>

View File

@@ -0,0 +1,6 @@
<div class="field-unit__label">
<%= f.label field.attribute %>
</div>
<div class="field-unit__field">
<%= f.select field.attribute, field.select_field_values(f) %>
</div>

View File

@@ -0,0 +1 @@
<%= field.to_s.titleize %>

View File

@@ -0,0 +1 @@
<%= field.to_s.titleize %>

View File

@@ -8,6 +8,11 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<% if user_signed_in? %>
<% if current_user.moderator? || current_user.admin? %>
<li class="nav-item">
<%= link_to "Admin Panel", admin_root_path, class: "nav-link", 'data-turbolinks': 'false' %>
</li>
<% end %>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<%= image_tag(current_user.gravatar_url, class: "gravatar", alt: current_user.full_name, size: 24) %>