Skip to content

Commit

Permalink
Add third level.
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Guo committed Nov 14, 2024
1 parent 706a4df commit c7d32e3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ def index
@first_level_user_job_roles = current_user&.user_job_roles || []
@second_level_user_job_roles = @first_level_user_job_roles.flat_map do |user_job_role|
user_job_role.managed_user_job_roles.select(&:managed_user_job_roles)
end
end.reject { |ujr| ujr.managed_user_job_roles.blank? }
@third_level_user_job_roles = @second_level_user_job_roles.flat_map do |user_job_role|
user_job_role.managed_user_job_roles.select(&:managed_user_job_roles)
end.reject { |ujr| ujr.managed_user_job_roles.blank? }
end

protected
Expand Down
10 changes: 10 additions & 0 deletions app/views/home/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,13 @@
</div>
</section>
<% end %>

<% if @third_level_user_job_roles.present? %>
<section class="container mt-4">
<div class="row">
<div class="col-12">
<%= render partial: 'user_job_roles', locals: { user_job_roles: @third_level_user_job_roles } %>
</div>
</div>
</section>
<% end %>

0 comments on commit c7d32e3

Please sign in to comment.