Skip to content

Commit

Permalink
Merge pull request #593 from cabinetoffice/EHD-1043-manage-organisati…
Browse files Browse the repository at this point in the history
…ons-page--part-2

EHD-1043: Manage Organisations page: Re-wire links to point at new page
  • Loading branch information
jamesgriff authored Oct 11, 2024
2 parents 637078e + 3f60a4a commit b7e24d5
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 22 deletions.
2 changes: 1 addition & 1 deletion GenderPayGap.WebUI/Controllers/CompareController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public IActionResult CompareEmployers(string command, int year = 0)
switch (command.ToLower())
{
case "employer":
return RedirectToAction(nameof(ViewingController.Employer), "Viewing", new {employerIdentifier = args});
return RedirectToAction("ViewEmployerPage", "Redirect", new {employerIdentifier = args});
case "report":
return RedirectToAction(nameof(ViewingController.Report), "Viewing", new {employerIdentifier = args, year});
}
Expand Down
9 changes: 9 additions & 0 deletions GenderPayGap.WebUI/Controllers/RedirectController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using GenderPayGap.WebUI.Classes;
using GenderPayGap.WebUI.Helpers;
using Microsoft.AspNetCore.Mvc;

namespace GenderPayGap.WebUI.Controllers
Expand Down Expand Up @@ -98,5 +99,13 @@ public IActionResult GuidancePdfRedirects()
return Redirect("https://www.gov.uk/government/publications/gender-pay-gap-reporting-guidance-for-employers/closing-your-gender-pay-gap");
}

[HttpGet("/Employer/{employerIdentifier}")]
public IActionResult ViewEmployerPage(string employerIdentifier, int? page = 1)
{
long organisationId = ControllerHelper.DeObfuscateOrganisationIdOrThrow404(employerIdentifier);

return RedirectToAction("Employer", "ViewReports", new {organisationId});
}

}
}
19 changes: 1 addition & 18 deletions GenderPayGap.WebUI/Controllers/ViewingController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
Expand Down Expand Up @@ -119,23 +119,6 @@ public IActionResult SuggestEmployerNameJs(string search)

#endregion

#region Employer details

[HttpGet("~/Employer/{employerIdentifier}")]
public IActionResult Employer(string employerIdentifier, int? page = 1)
{
if (string.IsNullOrWhiteSpace(employerIdentifier))
{
return new HttpBadRequestResult("Missing employer identifier");
}

long organisationId = ControllerHelper.DeObfuscateOrganisationIdOrThrow404(employerIdentifier);

return RedirectToAction("Employer", "ViewReports", new {organisationId});
}

#endregion

#region Reports

[HttpGet("~/EmployerReport/{employerIdentifier}/{year}")]
Expand Down
2 changes: 1 addition & 1 deletion GenderPayGap.WebUI/Views/Admin/ViewOrganisation.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</h1>

<p class="govuk-body">
<a href="@Url.Action("Employer", "Viewing", new {employerIdentifier = Model.Organisation.GetEncryptedId()})"
<a href="@Url.Action("Employer", "ViewReports", new {organisationId = Model.Organisation.OrganisationId})"
class="govuk-link">
'@(Model.Organisation.OrganisationName)' on viewing service
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<partial name="~/Views/Compare/ComparisonBasket.cshtml" model="ViewBag.BasketViewModel"/>
<div class="grid-row">
<div class="column-full">
<a class="link-back" href="@(Url.Action("Employer", new {employerIdentifier}))">View all reports for this employer</a>
<a class="link-back" href="@Url.Action("Employer", "ViewReports", new {organisationId = Model.Organisation.OrganisationId})">View all reports for this employer</a>
<h1 class="heading-large">
<div id="OrganisationName">
@Model.Organisation.OrganisationName
Expand Down
3 changes: 2 additions & 1 deletion GenderPayGap.WebUI/Views/Viewing/Finder/Parts/Results.cshtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@using GenderPayGap.Core.Models
@using GenderPayGap.Core.Classes
@model GenderPayGap.WebUI.Models.Search.SearchViewModel

<ul id="SearchResults" class="results">
Expand All @@ -9,7 +10,7 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h2>
@Html.ActionLink(employer.Name, "Employer", "Viewing", new {employerIdentifier = employer.OrganisationIdEncrypted}, new {data_name = "ViewLink", data_id = employer.OrganisationIdEncrypted, data_loadtestid = employer.Name})
@Html.ActionLink(employer.Name, "Employer", "ViewReports", new {organisationId = Obfuscator.DeObfuscate(employer.OrganisationIdEncrypted)}, new {data_name = "ViewLink", data_id = employer.OrganisationIdEncrypted, data_loadtestid = employer.Name})
</h2>
@if (string.IsNullOrWhiteSpace(employer.PreviousName) == false)
{
Expand Down

0 comments on commit b7e24d5

Please sign in to comment.