admin global nav
This commit is contained in:
9
app/views/admin/_nav.html.erb
Normal file
9
app/views/admin/_nav.html.erb
Normal file
@ -0,0 +1,9 @@
|
||||
<nav>
|
||||
<%= link_to("Users", admin_users_url) if policy(User).index? %>
|
||||
<% #= link_to("Departments", admin_departments_url) if policy(Department).index? %>
|
||||
<%= link_to("Quizzes", admin_quizzes_url) if policy(Quiz).index? %>
|
||||
<%= link_to("Candidates", admin_candidates_url) if policy(Candidate).index? %>
|
||||
<%= link_to("Results", admin_results_url) if policy(Quiz).index? %>
|
||||
<%= link_to("Profile", admin_profile_url) %>
|
||||
<%= link_to("Logout", admin_logout_url) %>
|
||||
</nav>
|
@ -1,9 +1,10 @@
|
||||
<%
|
||||
content_for :section_title, "Candidates"
|
||||
%>
|
||||
<main class="summary_tpl">
|
||||
<h1>Candidates</h1>
|
||||
|
||||
<%= link_to(admin_new_candidate_path, { class: 'secondary-btn' }) do %>
|
||||
<button>Create New Candidate</button>
|
||||
<% end %>
|
||||
<% end if policy(User).create? %>
|
||||
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
|
@ -1,35 +0,0 @@
|
||||
<%
|
||||
content_for :section_title, "Admin Dashboard"
|
||||
%>
|
||||
|
||||
<pre>
|
||||
## Admin
|
||||
Users | Dept/Unit | Quizzes | Candidates | Results | Profile | Logout
|
||||
|
||||
## Manager
|
||||
Quizzes | Results | Profile | Logout
|
||||
|
||||
## Recruiter
|
||||
Results | Profile | Logout
|
||||
|
||||
## Reviewer
|
||||
Candidates | Profile | Logout
|
||||
</pre>
|
||||
|
||||
<% if policy(Quiz).index? %>
|
||||
<section>
|
||||
<h1>Quizzes</h1>
|
||||
<%= render partial: 'admin/quiz/table_list', locals: { quizzes: @quizzes } %>
|
||||
<%= link_to('New Quiz', admin_new_quiz_path, { class: 'btn' }) %>
|
||||
</section>
|
||||
<% end %>
|
||||
|
||||
<% if policy(User).index? %>
|
||||
<section>
|
||||
<h1>Users</h1>
|
||||
<%= render partial: 'admin/user/table_list', locals: { users: @users } %>
|
||||
<%= link_to('New User', admin_new_user_path, { class: 'btn' }) %>
|
||||
</section>
|
||||
<% end %>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
<td><%= quiz.dept %></td>
|
||||
<td><%= quiz.unit %></td>
|
||||
<td><%= quiz.questions.count %></td>
|
||||
<td><%= link_to 'edit', admin_edit_quiz_path(quiz.to_i), { class: 'btn tertiary-btn' } %></td>
|
||||
<td><%= link_to 'edit', admin_edit_quiz_path(quiz.to_i), { class: 'btn tertiary-btn' } if policy(quiz).edit? %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
@ -1,6 +1,7 @@
|
||||
<%
|
||||
content_for :section_title, "Completed Tests"
|
||||
%>
|
||||
<main class="summary_tpl">
|
||||
<h1>Completed Tests</h1>
|
||||
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<th>Test ID</th>
|
||||
|
@ -11,7 +11,7 @@
|
||||
<td><%= link_to user.name, admin_user_path(user.to_i) %></td>
|
||||
<td><%= mail_to(user.email) %></td>
|
||||
<td><%= user.role %></td>
|
||||
<td><%= link_to 'edit', admin_edit_user_path(user.to_i), { class: 'btn tertiary-btn' } %></td>
|
||||
<td><%= link_to 'edit', admin_edit_user_path(user.to_i), { class: 'btn tertiary-btn' } if policy(user).edit? %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
@ -4,4 +4,4 @@
|
||||
|
||||
<h1>Users</h1>
|
||||
<%= render partial: 'admin/user/table_list', locals: { users: @users } %>
|
||||
<%= link_to('New User', admin_new_user_path, { class: 'btn' }) %>
|
||||
<%= link_to('New User', admin_new_user_path, { class: 'btn' }) if policy(User).create? %>
|
||||
|
Reference in New Issue
Block a user