Skip to content

Commit

Permalink
Merge pull request #597 from DFE-Digital/create-sharepoint-links
Browse files Browse the repository at this point in the history
Create sharepoint folder links on the details page
  • Loading branch information
nwarms authored Dec 19, 2024
2 parents b944955 + 161844c commit a17bbf6
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added

- Added download for Ofsted specific data to Ofsted pages
- Added SharePoint folder link to details page

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public interface IOtherServicesLinkBuilder
string? FindSchoolPerformanceDataListingLink(string uid, TrustType trustType, string? satAcademyUrn);
string GetInformationAboutSchoolsListingLinkForTrust(string trustUid);
string GetInformationAboutSchoolsListingLinkForAcademy(string urn);
string SharepointFolderLink(string groupId);

string? FinancialBenchmarkingInsightsToolListingLink(string? companiesHouseNumber);
}
Expand All @@ -25,6 +26,8 @@ public class OtherServicesLinkBuilder : IOtherServicesLinkBuilder
private const string FindSchoolPerformanceDataBaseUrl =
"https://www.find-school-performance-data.service.gov.uk";

private const string SharepointBaseUrl = "https://educationgovuk.sharepoint.com";

public string GetInformationAboutSchoolsListingLinkForTrust(string trustUid)
{
return $"{GetInformationAboutSchoolsBaseUrl}/Groups/Group/Details/{trustUid}";
Expand Down Expand Up @@ -59,4 +62,10 @@ public string GetInformationAboutSchoolsListingLinkForAcademy(string urn)
_ => null
};
}

public string SharepointFolderLink(string groupId)
{
return
$"{SharepointBaseUrl}/_layouts/15/sharepoint.aspx?oobRefiners=%7B%22FileType%22%3A%5B%22other%22%5D%7D&q={groupId}&v=%2Fsearch";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,45 @@
@Model.TrustOverview.RegionAndTerritory
</dd>
</div>
@if (Model.SharepointLink is not null)
{
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
SharePoint folder (opens in a new tab)
</dt>
<dd class="govuk-summary-list__value" data-testid="sharepoint-link">
<a class="govuk-link" rel="noreferrer noopener" target="_blank" href="@Model.SharepointLink">Find this trust's SharePoint folder</a>
</dd>
</div>
}
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
Information from other services (opens in a new tab)
</dt>
<dd class="govuk-summary-list__value">
@if (Model.CompaniesHouseLink is not null)
{
<p class="govuk-body">
<a class="govuk-link" rel="noreferrer noopener" target="_blank" href="@Model.CompaniesHouseLink">Companies House</a>
</p>
<p class="govuk-body">
<a class="govuk-link" rel="noreferrer noopener" target="_blank" href="@Model.CompaniesHouseLink">Companies House</a>
</p>
}
@if (Model.GetInformationAboutSchoolsLink is not null)
{
<p class="govuk-body">
<a class="govuk-link" rel="noreferrer noopener" target="_blank" href="@Model.GetInformationAboutSchoolsLink">Get information about schools</a>
</p>
<p class="govuk-body">
<a class="govuk-link" rel="noreferrer noopener" target="_blank" href="@Model.GetInformationAboutSchoolsLink">Get information about schools</a>
</p>
}
@if (Model.FinancialBenchmarkingInsightsToolLink is not null)
{
<p class="govuk-body">
<a class="govuk-link" rel="noreferrer noopener" target="_blank" href="@Model.FinancialBenchmarkingInsightsToolLink">Financial Benchmarking and Insights Tool</a>
</p>
<p class="govuk-body">
<a class="govuk-link" rel="noreferrer noopener" target="_blank" href="@Model.FinancialBenchmarkingInsightsToolLink">Financial Benchmarking and Insights Tool</a>
</p>
}
@if (Model.FindSchoolPerformanceLink is not null)
{
<p class="govuk-body">
<a class="govuk-link" rel="noreferrer noopener" target="_blank" href="@Model.FindSchoolPerformanceLink">Find school college and performance data in England</a>
</p>
<p class="govuk-body">
<a class="govuk-link" rel="noreferrer noopener" target="_blank" href="@Model.FindSchoolPerformanceLink">Find school college and performance data in England</a>
</p>
}
</dd>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class TrustDetailsModel(
public string? GetInformationAboutSchoolsLink { get; set; }
public string? FinancialBenchmarkingInsightsToolLink { get; set; }
public string? FindSchoolPerformanceLink { get; set; }
public string SharepointLink { get; set; } = string.Empty;

public override async Task<IActionResult> OnGetAsync()
{
Expand All @@ -33,6 +34,7 @@ public override async Task<IActionResult> OnGetAsync()
FindSchoolPerformanceLink =
otherServicesLinkBuilder.FindSchoolPerformanceDataListingLink(TrustOverview.Uid, TrustOverview.Type,
TrustOverview.SingleAcademyTrustAcademyUrn);
SharepointLink = otherServicesLinkBuilder.SharepointFolderLink(TrustOverview.GroupId);

return Page();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe("Testing the components of the Governance page", () => {
const trustsWithNoGovernanceData = [
{
typeOfTrust: "single academy trust with no governance data",
uid: 17737
uid: 4009
},
{
typeOfTrust: "multi academy trust with no governance data",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,16 @@ public void FindSchoolPerformanceDataListingLink_should_be_null_if_trust_is_sing
_sut.FindSchoolPerformanceDataListingLink("1234", TrustType.SingleAcademyTrust, null);
result.Should().BeNull();
}

[Theory]
[InlineData("TR02345", "https://educationgovuk.sharepoint.com/_layouts/15/sharepoint.aspx?oobRefiners=%7B%22FileType%22%3A%5B%22other%22%5D%7D&q=TR02345&v=%2Fsearch")]
[InlineData("", "https://educationgovuk.sharepoint.com/_layouts/15/sharepoint.aspx?oobRefiners=%7B%22FileType%22%3A%5B%22other%22%5D%7D&q=&v=%2Fsearch")]
public void SharepointFolderLink_should_return_url_containing_GroupId(string trn, string expected)
{
var result =
_sut.SharepointFolderLink(trn);

result.Should()
.Be(expected);
}
}

0 comments on commit a17bbf6

Please sign in to comment.