-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Claims support users index page
- Loading branch information
Showing
10 changed files
with
114 additions
and
7 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 |
---|---|---|
@@ -1,2 +1,9 @@ | ||
class Claims::Support::SchoolsController < Claims::Support::ApplicationController | ||
def index | ||
@schools = Claims::School.includes(:gias_school).order("gias_schools.name ASC") | ||
end | ||
|
||
def show | ||
@school = Claims::School.find(params.require(:id)) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
class Claims::Support::UsersController < Claims::Support::ApplicationController | ||
before_action :set_school | ||
|
||
def index | ||
@users = @school.users | ||
end | ||
|
||
private | ||
|
||
def set_school | ||
@school = Claims::School.find(params[:school_id]) | ||
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
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 |
---|---|---|
@@ -1,5 +1,16 @@ | ||
Support / Schools | ||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<h1 class="govuk-heading-xl"><%= t("organisations") %></h1> | ||
|
||
<ul> | ||
<li><%= link_to "School 1", claims_support_school_path(1) %></li> | ||
</ul> | ||
<% if @schools.any? %> | ||
<h2 class="govuk-heading-l"><%= t("schools") %></h2> | ||
<ul class="govuk-list"> | ||
<% @schools.each do |school| %> | ||
<li> | ||
<%= govuk_link_to school.name, request.env["PATH_INFO"], no_visited_state: true %> | ||
</li> | ||
<% end %> | ||
</ul> | ||
<% end %> | ||
</div> | ||
</div> |
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 |
---|---|---|
@@ -1 +1,22 @@ | ||
Support / Users | ||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<h1 class="govuk-heading-l"><%= t(".heading") %></h1> | ||
</div> | ||
</div> | ||
|
||
<table class="govuk-table"> | ||
<thead class="govuk-table__head"> | ||
<tr class="govuk-table__row"> | ||
<th scope="col" class="govuk-table__header"><%= t(".attributes.users.name") %></th> | ||
<th scope="col" class="govuk-table__header"><%= t(".attributes.users.email") %></th> | ||
</tr> | ||
</thead> | ||
<tbody class="govuk-table__body"> | ||
<% @users.each do |user| %> | ||
<tr class="govuk-table__row"> | ||
<td class="govuk-table__cell"><%= user.full_name %></td> | ||
<td class="govuk-table__cell"><%= user.email %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> |
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
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,36 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe "View users for school", type: :system do | ||
before do | ||
setup_school_and_anne_membership | ||
end | ||
|
||
scenario "I sign in as a support user and view a schools users index page" do | ||
sign_in_as_support_user | ||
visit_claims_support_school_users_page | ||
verify_users_list_for_school | ||
end | ||
|
||
private | ||
|
||
def setup_school_and_anne_membership | ||
@school = create(:school, :claims, urn: "123456") | ||
@anne_persona = create(:persona, :anne, service: "claims") | ||
create(:membership, user: @anne_persona, organisation: @school) | ||
end | ||
|
||
def sign_in_as_support_user | ||
create(:persona, :colin, service: "claims") | ||
visit personas_path | ||
click_on "Sign In as Colin" | ||
end | ||
|
||
def visit_claims_support_school_users_page | ||
visit claims_support_school_users_path(@school) | ||
end | ||
|
||
def verify_users_list_for_school | ||
expect(page).to have_content("Anne Wilson") | ||
expect(page).to have_content("[email protected]") | ||
end | ||
end |