Skip to content

Commit

Permalink
Chore: Fix club ambassador mentor mode
Browse files Browse the repository at this point in the history
This will allow club ambassadors to become mentors.

Refs: #5349
  • Loading branch information
shaun-technovation committed Feb 6, 2025
1 parent 25018cc commit f1e0c6a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/models/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,8 @@ def can_be_a_mentor?(**options)
!mentor_profile.present? &&
(judge_profile.present? ||
chapter_ambassador_profile.present? ||
(options[:admin] && student_profile.present? && age >= MINIMUM_MENTOR_AGE))
club_ambassador_profile.present? ||
(options[:admin] && student_profile.present? && age >= MINIMUM_MENTOR_AGE))
end

def can_be_a_judge?
Expand Down
6 changes: 6 additions & 0 deletions app/technovation/create_mentor_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ def self.setup_attributes(account)
job_title: account.chapter_ambassador_profile.job_title,
mentor_type_ids: [MentorType.find_by(name: "Industry professional")&.id]
}
elsif account.club_ambassador_profile.present?
{
school_company_name: account.club_ambassador_profile.club.name,
job_title: account.club_ambassador_profile.job_title,
mentor_type_ids: [MentorType.find_by(name: "Industry professional")&.id]
}
elsif account.judge_profile.present?
{
school_company_name: account.judge_profile.company_name,
Expand Down
11 changes: 10 additions & 1 deletion app/views/mentor/dashboards/_header.en.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,19 @@
</template>
<% end %>

<% if current_mentor.is_an_ambassador? %>
<% if current_mentor.chapter_ambassador? %>
<template slot="chapter-ambassador-switch-link">
<%= link_to "Switch to Chapter Ambassador mode",
chapter_ambassador_dashboard_path,
data: { turbolinks: false } %>
</template>
<% end %>

<% if current_mentor.club_ambassador? %>
<template slot="chapter-ambassador-switch-link">
<%= link_to "Switch to Club Ambassador mode",
club_ambassador_dashboard_path,
data: { turbolinks: false } %>
</template>
<% end %>

0 comments on commit f1e0c6a

Please sign in to comment.