Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin dashboard route and page #187

Merged
merged 5 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/controllers/organizations/dashboard_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Organizations::DashboardController < Organizations::BaseController
before_action :verified_staff

def index
@hide_footer = true
end
end
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</main>

<% if Current.tenant.present? %>
<%= render partial: "layouts/shared/footer" %>
<%= render partial: "layouts/shared/footer" unless @hide_footer %>
<% else %>
<%= render partial: "layouts/shared/no_tenant_footer" %>
<% end %>
Expand Down
9 changes: 2 additions & 7 deletions app/views/layouts/shared/_navbar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,8 @@
<% end %>
<% if current_user.staff_account && current_user.staff_account.verified %>
<li>
<%= link_to pets_path, class: 'dropdown-item' do %>
<i class="fe fe-star me-2"></i> Our Pets
<% end %>
</li>
<li>
<%= link_to adopter_applications_path, class: 'dropdown-item' do %>
<i class="fe fe-star me-2"></i> Applications
<%= link_to dashboard_index_path, class: 'dropdown-item' do %>
<i class="fe fe-star me-2"></i> Dashboard
<% end %>
</li>
<% end %>
Expand Down
105 changes: 105 additions & 0 deletions app/views/organizations/dashboard/_navbar.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<!-- Sidebar -->
<nav class="navbar-vertical navbar">
<div class="vh-100" data-simplebar>
<!-- Brand logo -->
<a class="navbar-brand" href="@@webRoot/index.html">
<img src="@@webRoot/assets/images/brand/logo/logo-inverse.svg" alt="" >
</a>
<!-- Navbar nav -->
<ul class="navbar-nav flex-column" id="sideNavbar">
<% if current_user.staff_account && current_user.staff_account.has_role?(:admin, current_user.staff_account.organization) %>
<li class="nav-item">
<a class="nav-link @@if (context.page_group !== 'courses') { collapsed }" href="#"
data-bs-toggle="collapse" data-bs-target="#navCourses" aria-expanded="false"
aria-controls="navCourses">
<i class="nav-icon fe fe-book me-2"></i> Organization
</a>
<div id="navCourses" class="collapse @@if (context.page_group === 'courses') { show }"
data-bs-parent="#sideNavbar">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link @@if (context.page === 'allcourses') { active }"
href="@@webRoot/pages/dashboard/admin-course-overview.html">
Settings
</a>
</li>
<li class="nav-item">
<a class="nav-link @@if (context.page === 'coursescategory') { active }"
href="@@webRoot/pages/dashboard/admin-course-category.html">
Staff
</a>
</li>
</ul>
</div>
</li>
<% end %>
<li class="nav-item">
<a class="nav-link @@if (context.page_group !== 'courses') { collapsed }" href="#"
data-bs-toggle="collapse" data-bs-target="#navCourses" aria-expanded="false"
aria-controls="navCourses">
<i class="nav-icon fe fe-book me-2"></i> Pets
</a>
<div id="navCourses" class="collapse @@if (context.page_group === 'courses') { show }"
data-bs-parent="#sideNavbar">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link @@if (context.page === 'allcourses') { active }"
href="@@webRoot/pages/dashboard/admin-course-overview.html">
Manage
</a>
</li>
<li class="nav-item">
<a class="nav-link @@if (context.page === 'allcourses') { active }"
href="@@webRoot/pages/dashboard/admin-course-overview.html">
Checklists
</a>
</li>
</ul>
</div>
</li>
<li class="nav-item">
<a class="nav-link @@if (context.page_group !== 'courses') { collapsed }" href="#"
data-bs-toggle="collapse" data-bs-target="#navCourses" aria-expanded="false"
aria-controls="navCourses">
<i class="nav-icon fe fe-book me-2"></i> Applications
</a>
<div id="navCourses" class="collapse @@if (context.page_group === 'courses') { show }"
data-bs-parent="#sideNavbar">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link @@if (context.page === 'allcourses') { active }"
href="@@webRoot/pages/dashboard/admin-course-overview.html">
Adoption
</a>
</li>
<li class="nav-item">
<a class="nav-link @@if (context.page === 'coursescategory') { active }"
href="@@webRoot/pages/dashboard/admin-course-category.html">
Foster
</a>
</li>
</ul>
</div>
</li>
<!-- Nav item -->
<li class="nav-item">
<a class="nav-link @@if (context.page_group !== 'user') { collapsed }" href="#"
data-bs-toggle="collapse" data-bs-target="#navProfile" aria-expanded="false"
aria-controls="navProfile">
<i class="nav-icon fe fe-user me-2"></i> Donations
</a>
<div id="navProfile" class="collapse @@if (context.page_group === 'user') { show }"
data-bs-parent="#sideNavbar">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link @@if (context.page === 'instructor') { active }"
href="@@webRoot/pages/dashboard/admin-instructor.html">
Sources
</a>
</li>
</ul>
</div>
</li>
</div>
</nav>

4 changes: 4 additions & 0 deletions app/views/organizations/dashboard/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div class="d-flex">
<%= render 'organizations/dashboard/navbar' %>
<%= yield :dashboard_content %>
</div>
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
scope module: :organizations do
resources :home, only: [:index]
resources :pets
resources :dashboard
end

resources :profile_reviews, only: [:show]
Expand Down