Skip to content

Commit

Permalink
Display my team in admin also.
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Guo committed Nov 14, 2024
1 parent ca27331 commit f4b122c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
3 changes: 1 addition & 2 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ class HomeController < ApplicationController
before_action :set_breadcrumbs, if: -> { request.format.html? }

def index
@first_level_user_job_roles = current_user&.user_job_roles
@first_level_user_job_roles = current_user&.user_job_roles || []
@second_level_user_job_roles = []

@first_level_user_job_roles.each do |ujr|
ujr.managed_user_job_roles.each do |second_ujr|
@second_level_user_job_roles << second_ujr if second_ujr.managed_user_job_roles.present?
end
end
redirect_to admin_root_path if current_user&.admin?
end

protected
Expand Down
5 changes: 4 additions & 1 deletion app/views/layouts/sidebars/_admin.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
<button class="sidebar-toggler" type="button" data-coreui-toggle="unfoldable" data-action="click->sidebar#click"></button>
</div>
<ul class="sidebar-nav" data-coreui="navigation" data-simplebar>
<%= nav_item(t('.dashboard'), root_path, 'free.svg#cil-speedometer') do %>
<%= nav_item(t('.dashboard'), admin_root_path, 'free.svg#cil-speedometer') do %>
<span class="badge bg-primary ms-auto">NEW</span>
<% end %>
<%= nav_item(t('.my_team'), root_path, 'free.svg#cil-speedometer') do %>
<span class="badge bg-primary ms-auto">NEW</span>
<% end %>

Expand Down
1 change: 1 addition & 0 deletions config/locales/views/layouts/sidebar/admin/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ en:
admin:
header: "Home"
dashboard: "Admin dashboard"
my_team: "My team"
account: "Account"
1 change: 1 addition & 0 deletions config/locales/views/layouts/sidebar/admin/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ zh-CN:
admin:
header: "首页"
dashboard: "管理员仪表板"
my_team: "我的团队"
account: "账号"

0 comments on commit f4b122c

Please sign in to comment.