-
-
Notifications
You must be signed in to change notification settings - Fork 484
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
Feat: Added "My Cases" dropdown for volunteers #5272
Changes from 9 commits
8a2df7e
8df4f6c
74b8d92
361f6e0
fd2906f
b786513
88d10b4
1af281f
8f81e0b
5d880e9
7cf3ebf
5d20320
4ad4f95
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,12 +35,35 @@ | |
<% if current_user.casa_admin? || current_user.supervisor? %> | ||
<%= render partial: "layouts/other_duties_nav_item" %> | ||
<% end %> | ||
<li class="<%= active_class(casa_cases_path) %> nav-item"> | ||
<%= link_to casa_cases_path do %> | ||
<i class="lni lni-folder mr-10"></i> | ||
<%= cases_index_title %> | ||
<% end %> | ||
</li> | ||
|
||
<% if !policy(Volunteer).index? %> | ||
<li class="nav-item nav-item-has-children"> | ||
<a | ||
href="#0" | ||
class="collapsed" | ||
data-bs-toggle="collapse" | ||
data-bs-target="#ddmenu_cases" | ||
aria-controls="ddmenu_cases" | ||
aria-expanded="true" | ||
aria-label="Toggle navigation"> | ||
<span class="icon"> | ||
<i class="lni lni-folder mr-10"></i> | ||
</span> | ||
<span class="text"><%= cases_index_title %></span> | ||
</a> | ||
<%= render partial: 'shared/sidebar_dropdown', locals: { all_link_path: casa_cases_path, dropdown_id: "ddmenu_cases", link_generator: method(:edit_casa_case_path) } %> | ||
</li> | ||
<% end %> | ||
|
||
<% if policy(Volunteer).index? %> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same can be applied here accordingly |
||
<li class="<%= active_class(casa_cases_path) %> nav-item"> | ||
<%= link_to casa_cases_path do %> | ||
<i class="lni lni-folder mr-10"></i> | ||
<%= cases_index_title %> | ||
<% end %> | ||
</li> | ||
<% end %> | ||
|
||
<% if policy(CasaAdmin).index? %> | ||
<li class="<%= active_class(casa_admins_path) %> nav-item"> | ||
<%= link_to casa_admins_path do %> | ||
|
@@ -61,7 +84,7 @@ | |
<li class="nav-item nav-item-has-children"> | ||
<a | ||
href="#0" | ||
class="" | ||
class="collapsed" | ||
data-bs-toggle="collapse" | ||
data-bs-target="#ddmenu_case_contacts" | ||
aria-controls="ddmenu_case_contacts" | ||
|
@@ -72,18 +95,7 @@ | |
</span> | ||
<span class="text">Case Contacts</span> | ||
</a> | ||
<ul id="ddmenu_case_contacts" class="collapse dropdown-nav"> | ||
<li> | ||
<%= link_to 'All', case_contacts_path %> | ||
</li> | ||
<% current_user.casa_cases.each do |casa_case| %> | ||
<li> | ||
<%= link_to case_contacts_path(casa_case_id: casa_case.id) do %> | ||
<%= casa_case.case_number %> | ||
<% end %> | ||
</li> | ||
<% end %> | ||
</ul> | ||
<%= render partial: 'shared/sidebar_dropdown', locals: { all_link_path: case_contacts_path, dropdown_id: "ddmenu_case_contacts", link_generator: method(:get_case_contact_link) } %> | ||
</li> | ||
<li class="<%= active_class(volunteer_learning_hours_path(volunteer_id: current_user.id || 0)) %> nav-item"> | ||
<%= link_to volunteer_learning_hours_path(volunteer_id: current_user.id || 0) do %> | ||
|
@@ -104,7 +116,7 @@ | |
<%= render partial: "layouts/other_duties_nav_item" %> | ||
<% end %> | ||
|
||
<% if policy(:application).see_banner_page? %> | ||
<% if policy(:application).see_banner_page? %> | ||
<li class="<%= active_class(casa_admins_path) %> nav-item"> | ||
<%= link_to banners_path, class: "#{active_class(banners_path)}" do %> | ||
<i class="lni lni-flag mr-10"></i> | ||
|
@@ -116,6 +128,7 @@ | |
<li class="nav-item nav-item-has-children"> | ||
<a | ||
href="#0" | ||
class="collapsed" | ||
class="group-actions" | ||
data-bs-toggle="collapse" | ||
data-bs-target="#ddmenu_55" | ||
|
@@ -181,7 +194,6 @@ | |
<% end %> | ||
</li> | ||
<% end %> | ||
|
||
</ul> | ||
</li> | ||
<li> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This name could be more specific, since it's not for all dropdowns in the sidebar, but instead for the my_cases dropdown. That being said, don't change this; it will go away with the merge of PR 5086. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<ul id="<%= dropdown_id %>" class="collapse dropdown-nav"> | ||
<li> | ||
<%= link_to 'All', all_link_path %> | ||
</li> | ||
<% current_user.casa_cases.each do |casa_case| %> | ||
<li> | ||
<%= link_to link_generator.call(casa_case) do %> | ||
<%= casa_case.case_number %> | ||
<% end %> | ||
</li> | ||
<% end %> | ||
</ul> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rafael-Martins - That's a good catch. Please leverage the user's role checking methods here i.e.
<% if current_user.volunteer? %>
:casa/app/models/user.rb
Lines 60 to 70 in 8f08a6a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I was thinking in something like this, thanks!