mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 11:17:49 +01:00
Add admin panel and make it work for user resource
This commit is contained in:
19
app/views/admin/application/_navigation.html.erb
Normal file
19
app/views/admin/application/_navigation.html.erb
Normal 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>
|
||||
1
app/views/fields/id_field/_form.html.erb
Normal file
1
app/views/fields/id_field/_form.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= f.text_field field.attribute, hidden: :true %>
|
||||
1
app/views/fields/id_field/_index.html.erb
Normal file
1
app/views/fields/id_field/_index.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= field.to_s %>
|
||||
1
app/views/fields/id_field/_show.html.erb
Normal file
1
app/views/fields/id_field/_show.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= field.to_s %>
|
||||
6
app/views/fields/role_field/_form.html.erb
Normal file
6
app/views/fields/role_field/_form.html.erb
Normal 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>
|
||||
1
app/views/fields/role_field/_index.html.erb
Normal file
1
app/views/fields/role_field/_index.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= field.to_s.titleize %>
|
||||
1
app/views/fields/role_field/_show.html.erb
Normal file
1
app/views/fields/role_field/_show.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= field.to_s.titleize %>
|
||||
@@ -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) %>
|
||||
|
||||
Reference in New Issue
Block a user