Skip to content

Commit a207990

Browse files
TD-2371 Hide 'View more' link if displayed data rows is less than or equal to count 5 on report screens
1 parent b77a974 commit a207990

File tree

2 files changed

+94
-89
lines changed

2 files changed

+94
-89
lines changed
Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,52 @@
11
@using DigitalLearningSolutions.Web.ViewModels.Common
22
@model SelfAssessmentActivityTableViewModel
33
@{
4-
const int defaultNumOfRowsVisible = 5;
4+
const int defaultNumOfRowsVisible = 5;
55

6-
//These must match with the name in trackingSystem/reports.ts
7-
const string toggleableActivityButtonId = "js-toggle-row-button";
8-
const string toggleableActivityRowClass = "js-toggleable-activity-row";
6+
//These must match with the name in trackingSystem/reports.ts
7+
const string toggleableActivityButtonId = "js-toggle-row-button";
8+
const string toggleableActivityRowClass = "js-toggleable-activity-row";
99
}
1010

1111
<table role="table" class="nhsuk-table-responsive">
12-
<thead role="rowgroup" class="nhsuk-table__head">
13-
<tr role="row">
14-
<th role="columnheader" scope="col">
15-
Period
16-
</th>
17-
<th role="columnheader" scope="col">
18-
Enrolments
19-
</th>
20-
<th role="columnheader" scope="col">
21-
Completions
22-
</th>
23-
</tr>
24-
</thead>
25-
<tbody class="nhsuk-table__body">
26-
@foreach (var (activityRow, rowNumber) in Model.Rows.Select((row, index) => (row, index + 1)))
27-
{
28-
<tr role="row" class="nhsuk-table__row @(rowNumber > defaultNumOfRowsVisible ? toggleableActivityRowClass : string.Empty)">
29-
<td role="cell" class="nhsuk-table__cell">
30-
<span class="nhsuk-table-responsive__heading">Period </span>@activityRow.Period
31-
</td>
32-
<td role="cell" class="nhsuk-table__cell">
33-
<span class="nhsuk-table-responsive__heading">Enrolments </span>@activityRow.Enrolments
34-
</td>
35-
<td role="cell" class="nhsuk-table__cell">
36-
<span class="nhsuk-table-responsive__heading">Completions </span>@activityRow.Completions
37-
</td>
38-
</tr>
39-
}
40-
</tbody>
12+
<thead role="rowgroup" class="nhsuk-table__head">
13+
<tr role="row">
14+
<th role="columnheader" scope="col">
15+
Period
16+
</th>
17+
<th role="columnheader" scope="col">
18+
Enrolments
19+
</th>
20+
<th role="columnheader" scope="col">
21+
Completions
22+
</th>
23+
</tr>
24+
</thead>
25+
<tbody class="nhsuk-table__body">
26+
@foreach (var (activityRow, rowNumber) in Model.Rows.Select((row, index) => (row, index + 1)))
27+
{
28+
<tr role="row" class="nhsuk-table__row @(rowNumber > defaultNumOfRowsVisible ? toggleableActivityRowClass : string.Empty)">
29+
<td role="cell" class="nhsuk-table__cell">
30+
<span class="nhsuk-table-responsive__heading">Period </span>@activityRow.Period
31+
</td>
32+
<td role="cell" class="nhsuk-table__cell">
33+
<span class="nhsuk-table-responsive__heading">Enrolments </span>@activityRow.Enrolments
34+
</td>
35+
<td role="cell" class="nhsuk-table__cell">
36+
<span class="nhsuk-table-responsive__heading">Completions </span>@activityRow.Completions
37+
</td>
38+
</tr>
39+
}
40+
</tbody>
4141
</table>
42-
43-
<div class="nhsuk-u-margin-top-4">
44-
<a id="@(toggleableActivityButtonId)"
45-
role="button"
46-
class="nhsuk-u-margin-top-4 js-only-inline"
47-
href="#">
48-
View more
49-
</a>
50-
</div>
42+
@if (Model.Rows.Count() > defaultNumOfRowsVisible)
43+
{
44+
<div class="nhsuk-u-margin-top-4">
45+
<a id="@(toggleableActivityButtonId)"
46+
role="button"
47+
class="nhsuk-u-margin-top-4 js-only-inline"
48+
href="#">
49+
View more
50+
</a>
51+
</div>
52+
}
Lines changed: 50 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,59 @@
11
@using DigitalLearningSolutions.Web.ViewModels.Common
22
@model ActivityTableViewModel
33
@{
4-
const int defaultNumOfRowsVisible = 5;
4+
const int defaultNumOfRowsVisible = 5;
55

6-
//These must match with the name in trackingSystem/reports.ts
7-
const string toggleableActivityButtonId = "js-toggle-row-button";
8-
const string toggleableActivityRowClass = "js-toggleable-activity-row";
6+
//These must match with the name in trackingSystem/reports.ts
7+
const string toggleableActivityButtonId = "js-toggle-row-button";
8+
const string toggleableActivityRowClass = "js-toggleable-activity-row";
99
}
1010

1111
<table role="table" class="nhsuk-table-responsive">
12-
<thead role="rowgroup" class="nhsuk-table__head">
13-
<tr role="row">
14-
<th role="columnheader" scope="col">
15-
Period
16-
</th>
17-
<th role="columnheader" scope="col">
18-
Registrations
19-
</th>
20-
<th role="columnheader" scope="col">
21-
Completions
22-
</th>
23-
<th role="columnheader" scope="col">
24-
Evaluations
25-
</th>
26-
</tr>
27-
</thead>
28-
<tbody class="nhsuk-table__body">
29-
@foreach (var (activityRow, rowNumber) in Model.Rows.Select((row, index) => (row, index + 1)))
30-
{
31-
<tr role="row" class="nhsuk-table__row @(rowNumber > defaultNumOfRowsVisible ? toggleableActivityRowClass : string.Empty)">
32-
<td role="cell" class="nhsuk-table__cell">
33-
<span class="nhsuk-table-responsive__heading">Period </span>@activityRow.Period
34-
</td>
35-
<td role="cell" class="nhsuk-table__cell">
36-
<span class="nhsuk-table-responsive__heading">Registrations </span>@activityRow.Registrations
37-
</td>
38-
<td role="cell" class="nhsuk-table__cell">
39-
<span class="nhsuk-table-responsive__heading">Completions </span>@activityRow.Completions
40-
</td>
41-
<td role="cell" class="nhsuk-table__cell">
42-
<span class="nhsuk-table-responsive__heading">Evaluations </span>@activityRow.Evaluations
43-
</td>
44-
</tr>
45-
}
46-
</tbody>
12+
<thead role="rowgroup" class="nhsuk-table__head">
13+
<tr role="row">
14+
<th role="columnheader" scope="col">
15+
Period
16+
</th>
17+
<th role="columnheader" scope="col">
18+
Registrations
19+
</th>
20+
<th role="columnheader" scope="col">
21+
Completions
22+
</th>
23+
<th role="columnheader" scope="col">
24+
Evaluations
25+
</th>
26+
</tr>
27+
</thead>
28+
<tbody class="nhsuk-table__body">
29+
@foreach (var (activityRow, rowNumber) in Model.Rows.Select((row, index) => (row, index + 1)))
30+
{
31+
<tr role="row" class="nhsuk-table__row @(rowNumber > defaultNumOfRowsVisible ? toggleableActivityRowClass : string.Empty)">
32+
<td role="cell" class="nhsuk-table__cell">
33+
<span class="nhsuk-table-responsive__heading">Period </span>@activityRow.Period
34+
</td>
35+
<td role="cell" class="nhsuk-table__cell">
36+
<span class="nhsuk-table-responsive__heading">Registrations </span>@activityRow.Registrations
37+
</td>
38+
<td role="cell" class="nhsuk-table__cell">
39+
<span class="nhsuk-table-responsive__heading">Completions </span>@activityRow.Completions
40+
</td>
41+
<td role="cell" class="nhsuk-table__cell">
42+
<span class="nhsuk-table-responsive__heading">Evaluations </span>@activityRow.Evaluations
43+
</td>
44+
</tr>
45+
}
46+
</tbody>
4747
</table>
4848

49-
<div class="nhsuk-u-margin-top-4">
50-
<a id="@(toggleableActivityButtonId)"
51-
role="button"
52-
class="nhsuk-u-margin-top-4 js-only-inline"
53-
href="#">
54-
View more
55-
</a>
56-
</div>
49+
@if (Model.Rows.Count() > defaultNumOfRowsVisible)
50+
{
51+
<div class="nhsuk-u-margin-top-4">
52+
<a id="@(toggleableActivityButtonId)"
53+
role="button"
54+
class="nhsuk-u-margin-top-4 js-only-inline"
55+
href="#">
56+
View more
57+
</a>
58+
</div>
59+
}

0 commit comments

Comments
 (0)