Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/dp 998 user management translations #1058

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ [ organisation ]
public static IEnumerable<object[]> TestCases()
{
yield return new object[] { $"/organisation/{OrganisationId}/users/user-summary", new[] { "Organisation has 2 users" } };
yield return new object[] { $"/organisation/{OrganisationId}/users/{PersonInviteGuid}/change-role?handler=personInvite", new[] { "Person invite Last name", "Select a role" } };
yield return new object[] { $"/organisation/{OrganisationId}/users/{PersonInviteGuid}/change-role?handler=personInvite", new[] { "Person invite Last name", "Select user role" } };
}

[Theory]
Expand Down
38 changes: 20 additions & 18 deletions Frontend/CO.CDP.OrganisationApp/Pages/Users/AddUser.cshtml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
@page "/organisation/{id}/users/add-user/{personId?}"
@model CO.CDP.OrganisationApp.Pages.Users.AddUserModel
@using CO.CDP.OrganisationApp.Constants
@using CO.CDP.Localization

@{
ViewData["Title"] = "Add a user";
ViewData["Title"] = StaticTextResource.Users_AddUser_Title;
var firstNameHasError = ((TagBuilder)Html.ValidationMessageFor(m => m.FirstName)).HasInnerHtml;
var lastNameHasError = ((TagBuilder)Html.ValidationMessageFor(m => m.LastName)).HasInnerHtml;
var emailHasError = ((TagBuilder)Html.ValidationMessageFor(m => m.Email)).HasInnerHtml;
Expand All @@ -16,7 +17,7 @@
}

@section BeforeContent {
<a href="/organisation/{@Model.Id}/users/user-summary" class="govuk-back-link">Back</a>
<a href="/organisation/{@Model.Id}/users/user-summary" class="govuk-back-link">@StaticTextResource.Global_Back</a>
}

<div class="govuk-grid-row">
Expand All @@ -30,13 +31,13 @@
<form class="form" method="post">
<div class="govuk-form-group @(firstNameHasError ? "govuk-form-group--error" : "")">
<label class="govuk-label" for="@nameof(Model.FirstName)">
First name
@StaticTextResource.Users_FirstName_Label
</label>

@if (firstNameHasError)
{
<p id="first-name-error" class="govuk-error-message">
<span class="govuk-visually-hidden">Error:</span>
<span class="govuk-visually-hidden">@StaticTextResource.Global_Error:</span>
@Html.ValidationMessageFor(m => m.FirstName)
</p>
}
Expand All @@ -47,13 +48,13 @@

<div class="govuk-form-group @(lastNameHasError ? "govuk-form-group--error" : "")">
<label class="govuk-label" for="@nameof(Model.LastName)">
Last name
@StaticTextResource.Users_LastName_Label
</label>

@if (lastNameHasError)
{
<p id="last-name-error" class="govuk-error-message">
<span class="govuk-visually-hidden">Error:</span>
<span class="govuk-visually-hidden">@StaticTextResource.Global_Error:</span>
@Html.ValidationMessageFor(m => m.LastName)
</p>
}
Expand All @@ -64,13 +65,13 @@

<div class="govuk-form-group @(emailHasError ? "govuk-form-group--error" : "")">
<label class="govuk-label" for="@nameof(Model.Email)">
Email address
@StaticTextResource.Users_EmailAddress_Label
</label>

@if (emailHasError)
{
<p id="email-error" class="govuk-error-message">
<span class="govuk-visually-hidden">Error:</span>
<span class="govuk-visually-hidden">@StaticTextResource.Global_Error:</span>
@Html.ValidationMessageFor(m => m.Email)
</p>
}
Expand All @@ -82,53 +83,54 @@
<div class="govuk-form-group @(roleHasError ? "govuk-form-group--error" : "")">
<fieldset class="govuk-fieldset" aria-describedby="role-hint @(roleHasError ? "role-error" : "")">
<legend class="govuk-fieldset__legend govuk-fieldset__legend--m">
Select user role
@StaticTextResource.Users_UserRole_Label
</legend>
@if (roleHasError)
{
<p id="role-error" class="govuk-error-message">
<span class="govuk-visually-hidden">Error:</span>
<span class="govuk-visually-hidden">@StaticTextResource.Global_Error:</span>
@Html.ValidationMessageFor(m => m.Role)
</p>
}
<div id="role-hint" class="govuk-hint">
Select the one that applies
@StaticTextResource.Users_UserRole_Hint
</div>
<div class="govuk-radios" data-module="govuk-radios">
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="@nameof(Model.Role)" name="role" type="radio" value="@OrganisationPersonScopes.Admin" aria-describedby="role-admin-hint" @IsSelected(Model.Role == OrganisationPersonScopes.Admin)>
<label class="govuk-label govuk-radios__label" for="@nameof(Model.Role)">
Admin
@StaticTextResource.Global_Admin
</label>
<div id="role-admin-hint" class="govuk-hint govuk-radios__hint">
Can do anything, including add, remove and edit users

@StaticTextResource.Users_UserRoleAdmin_Hint
</div>
</div>

<div class="govuk-radios__item">
<input class="govuk-radios__input" id="@nameof(Model.Role)-1" name="role" type="radio" value="@OrganisationPersonScopes.Editor" aria-describedby="role-editor-hint" @IsSelected(Model.Role == OrganisationPersonScopes.Editor)>
<label class="govuk-label govuk-radios__label" for="@nameof(Model.Role)-1">
Editor
@StaticTextResource.Global_Editor
</label>
<div id="role-editor-hint" class="govuk-hint govuk-radios__hint">
Can view, add and edit organisation information, view supplier information and create API keys
@StaticTextResource.Users_UserRoleEditor_Hint
</div>
</div>

<div class="govuk-radios__item">
<input class="govuk-radios__input" id="@nameof(Model.Role)-2" name="role" type="radio" value="@OrganisationPersonScopes.Viewer" aria-describedby="role-viewer-hint" @IsSelected(Model.Role == OrganisationPersonScopes.Viewer)>
<label class="govuk-label govuk-radios__label" for="@nameof(Model.Role)-2">
Viewer
@StaticTextResource.Global_Viewer
</label>
<div id="role-viewer-hint" class="govuk-hint govuk-radios__hint">
Can view organisation and supplier information
@StaticTextResource.Users_UserRoleViewer_Hint
</div>
</div>
</div>
</fieldset>
</div>

<govuk-button class="govuk-!-margin-top-6">Continue</govuk-button>
<govuk-button class="govuk-!-margin-top-6">@StaticTextResource.Global_Continue</govuk-button>
</form>
</div>
</div>
23 changes: 12 additions & 11 deletions Frontend/CO.CDP.OrganisationApp/Pages/Users/ChangeUserRole.cshtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@page "/organisation/{id}/users/{itemId}/change-role"
@model CO.CDP.OrganisationApp.Pages.Users.ChangeUserRoleModel
@using CO.CDP.OrganisationApp.Constants
@using CO.CDP.Localization

@{
ViewData["Title"] = Model.UserFullName;
Expand All @@ -13,7 +14,7 @@
}

@section BeforeContent {
<a href="/organisation/{@Model.Id}/users/user-summary" class="govuk-back-link">Back</a>
<a href="/organisation/{@Model.Id}/users/user-summary" class="govuk-back-link">@StaticTextResource.Global_Back</a>
}

<div class="govuk-grid-row">
Expand All @@ -28,53 +29,53 @@
<div class="govuk-form-group @(roleHasError ? "govuk-form-group--error" : "")">
<fieldset class="govuk-fieldset" aria-describedby="role-hint @(roleHasError ? "role-error" : "")">
<legend class="govuk-fieldset__legend govuk-fieldset__legend--m">
Select a role
@StaticTextResource.Users_UserRole_Label
</legend>
@if (roleHasError)
{
<p id="role-error" class="govuk-error-message">
<span class="govuk-visually-hidden">Error:</span>
<span class="govuk-visually-hidden">@StaticTextResource.Global_Error:</span>
@Html.ValidationMessageFor(m => m.Role)
</p>
}
<div id="role-hint" class="govuk-hint">
Select the one that applies
@StaticTextResource.Users_UserRole_Hint
</div>
<div class="govuk-radios" data-module="govuk-radios">
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="@nameof(Model.Role)" name="role" type="radio" value="@OrganisationPersonScopes.Admin" aria-describedby="role-admin-hint" @IsSelected(Model.Role == OrganisationPersonScopes.Admin)>
<label class="govuk-label govuk-radios__label" for="@nameof(Model.Role)">
Admin
@StaticTextResource.Global_Admin
</label>
<div id="role-editor-hint" class="govuk-hint govuk-radios__hint">
Can do anything, including add, remove and edit users
@StaticTextResource.Users_UserRoleAdmin_Hint
</div>
</div>

<div class="govuk-radios__item">
<input class="govuk-radios__input" id="@nameof(Model.Role)-1" name="role" type="radio" value="@OrganisationPersonScopes.Editor" aria-describedby="role-editor-hint" @IsSelected(Model.Role == OrganisationPersonScopes.Editor)>
<label class="govuk-label govuk-radios__label" for="@nameof(Model.Role)-1">
Editor
@StaticTextResource.Global_Editor
</label>
<div id="role-editor-hint" class="govuk-hint govuk-radios__hint">
Can view, add and edit organisation information, view supplier information and create API keys
@StaticTextResource.Users_UserRoleEditor_Hint
</div>
</div>

<div class="govuk-radios__item">
<input class="govuk-radios__input" id="@nameof(Model.Role)-2" name="role" type="radio" value="@OrganisationPersonScopes.Viewer" aria-describedby="role-viewer-hint" @IsSelected(Model.Role == OrganisationPersonScopes.Viewer)>
<label class="govuk-label govuk-radios__label" for="@nameof(Model.Role)-2">
Viewer
@StaticTextResource.Global_Viewer
</label>
<div id="role-viewer-hint" class="govuk-hint govuk-radios__hint">
Can view organisation and supplier information
@StaticTextResource.Users_UserRoleViewer_Hint
</div>
</div>
</div>
</fieldset>
</div>

<govuk-button class="govuk-!-margin-top-6">Continue</govuk-button>
<govuk-button class="govuk-!-margin-top-6">@StaticTextResource.Global_Continue</govuk-button>
</form>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
@page "/organisation/{id}/users/check-answers"
@using CO.CDP.OrganisationApp.Constants
@using CO.CDP.Localization

@model CO.CDP.OrganisationApp.Pages.Users.UserCheckAnswersModel

@{
ViewData["Title"] = "Check your answers";
ViewData["Title"] = StaticTextResource.Users_CheckYourAnswers_Title;
var scopes = Model.PersonInviteStateData?.Scopes ?? new List<string>();
var filteredScopes = scopes.Where(scope => !string.Equals(scope, OrganisationPersonScopes.Responder));
var scopesCsvString = string.Join(", ", filteredScopes);
}

@section BeforeContent {
<a href="/organisation/@Model.Id/users/add-user" class="govuk-back-link">Back</a>
<a href="/organisation/@Model.Id/users/add-user" class="govuk-back-link">@StaticTextResource.Global_Back</a>
}

<div class="govuk-grid-row">
Expand All @@ -24,21 +25,21 @@

<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
First name
@StaticTextResource.Users_FirstName_Label
</dt>
<dd class="govuk-summary-list__value">
@Model.PersonInviteStateData?.FirstName
</dd>
<dd class="govuk-summary-list__actions">
<a class="govuk-link" href="/organisation/@Model.Id/users/add-user?frm-chk-answer">
Change
@StaticTextResource.Global_Change
</a>
</dd>
</div>

<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
Last name
@StaticTextResource.Users_LastName_Label
</dt>
<dd class="govuk-summary-list__value">
@Model.PersonInviteStateData?.LastName
Expand All @@ -48,7 +49,7 @@

<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
Email address
@StaticTextResource.Users_EmailAddress_Label
</dt>
<dd class="govuk-summary-list__value">
@Model.PersonInviteStateData?.Email
Expand All @@ -58,7 +59,7 @@

<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
User role
@StaticTextResource.Users_UserRole_Label
</dt>
<dd class="govuk-summary-list__value">
@scopesCsvString
Expand All @@ -67,7 +68,7 @@
</div>
</dl>

<govuk-button class="govuk-!-margin-top-9">Send email</govuk-button>
<govuk-button class="govuk-!-margin-top-9">@StaticTextResource.Users_SendEmail_Button</govuk-button>
</form>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
@page "/organisation/{id}/users/{userId}/remove"
@using CO.CDP.Localization
@model CO.CDP.OrganisationApp.Pages.Users.UserRemoveConfirmationModel
@{
ViewData["Title"] = $"Are you sure you want to remove {Model.UserFullName}?";
ViewData["Title"] = string.Format(StaticTextResource.User_RemoveConfirmation_Title, Model.UserFullName);

var hasError = ((TagBuilder)Html.ValidationMessageFor(m => m.ConfirmRemove)).HasInnerHtml;;
}

@section BeforeContent {
<a href="/organisation/@Model.Id/users/user-summary" class="govuk-back-link">Back</a>
<a href="/organisation/@Model.Id/users/user-summary" class="govuk-back-link">@StaticTextResource.Global_Back</a>
}

<div class="govuk-grid-row">
Expand All @@ -17,7 +19,7 @@
<div class="govuk-form-group @(hasError ? "govuk-form-group--error" : "")" @(hasError ? Html.Raw(@"aria-describedby=""confirm-remove-error""") : "")>
<legend class="govuk-fieldset__legend govuk-fieldset__legend--l">
<h1 class="govuk-fieldset__heading">
Are you sure you want to remove <br/>[@Model.UserFullName]?
@(string.Format(StaticTextResource.User_RemoveConfirmation_Header, Model.UserFullName))
</h1>
</legend>

Expand All @@ -26,7 +28,7 @@
@if (hasError)
{
<p id="confirm-remove-error" class="govuk-error-message">
<span class="govuk-visually-hidden">Error:</span>
<span class="govuk-visually-hidden">@StaticTextResource.Global_Error:</span>
@Html.ValidationMessageFor(m => m.ConfirmRemove)
</p>
}
Expand All @@ -35,19 +37,19 @@
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="conditional-YES" name="ConfirmRemove" type="radio"
value="true" @(Model.ConfirmRemove == true ? "checked" : "")>
<label class="govuk-label govuk-radios__label" for="conditional-YES">Yes</label>
<label class="govuk-label govuk-radios__label" for="conditional-YES">@StaticTextResource.Global_Yes</label>
</div>
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="conditional-NO" name="ConfirmRemove" type="radio"
value="false" @(Model.ConfirmRemove == false ? "checked" : "")>
<label class="govuk-label govuk-radios__label" for="conditional-NO">No</label>
<label class="govuk-label govuk-radios__label" for="conditional-NO">@StaticTextResource.Global_No</label>
</div>
</div>
</div>
</fieldset>

<govuk-button class="govuk-!-margin-top-6">
Continue
@StaticTextResource.Global_Continue
</govuk-button>
</form>
</div>
Expand Down
Loading
Loading