diff --git a/app/controllers/ambassador/participants_controller.rb b/app/controllers/ambassador/participants_controller.rb
new file mode 100644
index 0000000000..00730f156d
--- /dev/null
+++ b/app/controllers/ambassador/participants_controller.rb
@@ -0,0 +1,18 @@
+module Ambassador
+ class ParticipantsController < AmbassadorController
+ def show
+ @account = Account
+ .joins(:chapterable_assignments)
+ .where(
+ chapterable_assignments: {
+ chapterable_type: current_ambassador.chapterable_type.capitalize,
+ chapterable_id: current_ambassador.current_chapterable.id
+ }
+ )
+ .find(params[:id])
+
+ @teams = Team.current.in_region(current_ambassador)
+ @season_flag = SeasonFlag.new(@account)
+ end
+ end
+end
diff --git a/app/controllers/concerns/datagrid_controller.rb b/app/controllers/concerns/datagrid_controller.rb
index 9398afad3c..4b1bc33a93 100644
--- a/app/controllers/concerns/datagrid_controller.rb
+++ b/app/controllers/concerns/datagrid_controller.rb
@@ -49,7 +49,8 @@ def index
}
)
- if controller_name == "unaffiliated_participants"
+ if controller_name == "participants" ||
+ controller_name == "unaffiliated_participants"
render "data_grids/#{controller_name}/index"
end
end
diff --git a/app/controllers/chapter_ambassador/participants_controller.rb b/app/controllers/data_grids/ambassador/participants_controller.rb
similarity index 65%
rename from app/controllers/chapter_ambassador/participants_controller.rb
rename to app/controllers/data_grids/ambassador/participants_controller.rb
index cd30abdbc3..c8366cb797 100644
--- a/app/controllers/chapter_ambassador/participants_controller.rb
+++ b/app/controllers/data_grids/ambassador/participants_controller.rb
@@ -1,26 +1,38 @@
-module ChapterAmbassador
- class ParticipantsController < ChapterAmbassadorController
+module DataGrids::Ambassador
+ class ParticipantsController < AmbassadorController
include DatagridController
+ layout "ambassador"
+
use_datagrid with: AccountsGrid,
html_scope: ->(scope, user, params) {
scope
.joins(:chapterable_assignments)
- .where(chapterable_assignments: {chapterable_type: "Chapter", chapterable_id: user.current_chapter.id})
+ .where(
+ chapterable_assignments: {
+ chapterable_type: user.chapterable_type.capitalize,
+ chapterable_id: user.current_chapterable.id
+ }
+ )
.page(params[:page])
},
csv_scope: "->(scope, user, _params) {
scope
.joins(:chapterable_assignments)
- .where(chapterable_assignments: {chapterable_type: 'Chapter', chapterable_id: user.current_chapter.id})
+ .where(chapterable_assignments: {chapterable_type: user.chapterable_type.capitalize, chapterable_id: user.current_chapterable.id})
}"
def show
@account = Account
.joins(:chapterable_assignments)
- .where(chapterable_assignments: {chapterable_type: "Chapter", chapterable_id: current_ambassador.current_chapter.id})
+ .where(
+ chapterable_assignments: {
+ chapterable_type: current_ambassador.chapterable_type.capitalize,
+ chapterable_id: current_ambassador.current_chapterable.id
+ }
+ )
.find(params[:id])
@teams = Team.current.in_region(current_ambassador)
diff --git a/app/models/club_ambassador_profile.rb b/app/models/club_ambassador_profile.rb
index 66a310cbbb..5ce71ef434 100644
--- a/app/models/club_ambassador_profile.rb
+++ b/app/models/club_ambassador_profile.rb
@@ -64,4 +64,12 @@ def chapterable_type
def scope_name
"club_ambassador"
end
+
+ def secondary_regions
+ []
+ end
+
+ def other_regions
+ secondary_regions
+ end
end
diff --git a/app/views/admin/participants/_student_debugging.html.erb b/app/views/admin/participants/_student_debugging.html.erb
index b0f704e381..95170cb40d 100644
--- a/app/views/admin/participants/_student_debugging.html.erb
+++ b/app/views/admin/participants/_student_debugging.html.erb
@@ -61,28 +61,30 @@
-<% if not profile.team.present? %>
-
Help them with their team matching
+<% if current_scope != "club_ambassador" %>
+ <% if !profile.team.present? %>
+ Help them with their team matching
-
- <%= form_tag(send("#{current_scope}_team_memberships_path")) do %>
- <%= hidden_field_tag :account_id, profile.account_id %>
+
+ <%= form_tag(send("#{current_scope}_team_memberships_path")) do %>
+ <%= hidden_field_tag :account_id, profile.account_id %>
-
Add <%= profile.full_name %> to a team
+
Add <%= profile.full_name %> to a team
-
+
<%= select_tag "team_id",
- options_from_collection_for_select(@teams, "id", "name"),
- prompt: "Select a team",
- required: true,
- class: "chosen" %>
+ options_from_collection_for_select(@teams, "id", "name"),
+ prompt: "Select a team",
+ required: true,
+ class: "chosen" %>
- <%= submit_tag 'Add', class: "button" %>
+ <%= submit_tag 'Add', class: "button" %>
<% end %>
-
+
+ <% end %>
<% end %>
<% if (current_account.is_admin? && profile.age >= 14) ||
diff --git a/app/views/chapter_ambassador/participants/show.en.html.erb b/app/views/ambassador/participants/show.en.html.erb
similarity index 98%
rename from app/views/chapter_ambassador/participants/show.en.html.erb
rename to app/views/ambassador/participants/show.en.html.erb
index eeb64f82c2..60690dc949 100644
--- a/app/views/chapter_ambassador/participants/show.en.html.erb
+++ b/app/views/ambassador/participants/show.en.html.erb
@@ -1,7 +1,5 @@
<% provide :title, "Viewing #{@account.scope_name.titleize}" %>
-<% provide :subnav, render('chapter_ambassador/participants/sub_menu') %>
-
<%= render "participant_flags/season", flag: @season_flag %>
diff --git a/app/views/chapter_ambassador/participants/_sub_menu.en.html.erb b/app/views/chapter_ambassador/participants/_sub_menu.en.html.erb
deleted file mode 100644
index 8ccbac5216..0000000000
--- a/app/views/chapter_ambassador/participants/_sub_menu.en.html.erb
+++ /dev/null
@@ -1,37 +0,0 @@
-
diff --git a/app/views/chapter_ambassador/participants/index.en.html.erb b/app/views/chapter_ambassador/participants/index.en.html.erb
deleted file mode 100644
index d8215a907f..0000000000
--- a/app/views/chapter_ambassador/participants/index.en.html.erb
+++ /dev/null
@@ -1,16 +0,0 @@
-<% provide :title, "Chapter Ambassador Data • Participants" %>
-
-<%= render 'datagrid/datagrid',
- grid: @accounts_grid,
- form_url: chapter_ambassador_participants_path,
- model_name: "account",
- scope: :chapter_ambassador do %>
-
-
- <%= link_to 'Find a missing participant',
- new_chapter_ambassador_missing_participant_search_path,
- data: { turbolinks: false },
- class: "button small subnav--help-link" %>
-
-
-<% end %>
diff --git a/app/views/club_ambassador/_navigation.en.html.erb b/app/views/club_ambassador/_navigation.en.html.erb
index cee19a929a..101f6c806e 100644
--- a/app/views/club_ambassador/_navigation.en.html.erb
+++ b/app/views/club_ambassador/_navigation.en.html.erb
@@ -3,7 +3,7 @@