-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: Refactor participants datagrid to handle clubs
Summary of updates: - create a new ambassador/participants_controller - for the show, edit, and update actions - ChAs and CAs will share this controller - create a new data_grids/participants_controller - ChAs and CAs will share this controller - consolidate the views so ChAs and CAs will use the same views - for the datagrid view it will be shared for admins, ChAs, and CAs Refs: #5319
- Loading branch information
1 parent
b1de69f
commit 410ff36
Showing
13 changed files
with
111 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 17 additions & 5 deletions
22
...ter_ambassador/participants_controller.rb → ...ids/ambassador/participants_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
..._ambassador/participants/show.en.html.erb → .../ambassador/participants/show.en.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
app/views/chapter_ambassador/participants/_sub_menu.en.html.erb
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
app/views/chapter_ambassador/participants/index.en.html.erb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<% provide :title, "Participants" %> | ||
|
||
<%= render "datagrid/datagrid", | ||
grid: @accounts_grid, | ||
form_url: send("#{current_scope}_participants_path"), | ||
model_name: "account", | ||
scope: current_scope.to_sym do %> | ||
|
||
<% if current_account.chapter_ambassador? %> | ||
<p class="float-right"> | ||
<%= link_to "Find a missing participant", | ||
new_chapter_ambassador_missing_participant_search_path, | ||
data: { turbolinks: false }, | ||
class: "button small subnav--help-link" %> | ||
</p> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
spec/controllers/chapter_ambassador/participants_controller_spec.rb
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
spec/controllers/data_grids/ambassador/participants_controller_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe DataGrids::Ambassador::ParticipantsController do | ||
describe "GET #index" do | ||
context "as a chapter ambassador" do | ||
before do | ||
sign_in(:chapter_ambassador) | ||
end | ||
|
||
it "returns an OK 200 status code" do | ||
get :index | ||
|
||
expect(response.status).to eq(200) | ||
end | ||
end | ||
|
||
context "as a club ambassador" do | ||
before do | ||
sign_in(:club_ambassador) | ||
end | ||
|
||
it "returns an OK 200 status code" do | ||
get :index | ||
|
||
expect(response.status).to eq(200) | ||
end | ||
end | ||
end | ||
end |