Skip to content

Commit f5701c0

Browse files
committed
Add some documenting comments about Pager, add tooltips
1 parent 81d8495 commit f5701c0

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

app/models/Pager.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
package models
22

3+
/**
4+
* A simple structure to assist in handling paging through a list of resources.
5+
* `prev` and `next` contain the ID of the previous and next resources (respectively).
6+
*
7+
* Currently this class is used for paging through files in a dataset, but could
8+
* be used to handle paging for any list of arbitrary UUIDs / resources in other contexts.
9+
*
10+
* See:
11+
* {@link views.files},
12+
* {@link controllers.Files#file}
13+
*
14+
* @param prev UUID of the previous resource in the list
15+
* @param next UUID of the next resource in the list
16+
*
17+
* @author lambert8
18+
*/
319
case class Pager(
420
prev: Option[models.UUID],
521
next: Option[models.UUID]

app/views/file.scala.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,10 @@
202202
<div class="col-sm-12 col-md-12 col-lg-12">
203203
@pager.prev match {
204204
case None => {
205-
<button class="btn btn-sm btn-link disabled" disabled="true" style="cursor:not-allowed;border-radius:15px;border-color:lightgray;"><i class="glyphicon glyphicon-chevron-left"></i> Prev</button>
205+
<button class="btn btn-sm btn-link disabled" title="This is the first file in this dataset" disabled="true" style="cursor:not-allowed;border-radius:15px;border-color:lightgray;"><i class="glyphicon glyphicon-chevron-left"></i> Prev</button>
206206
}
207207
case Some(prev) => {
208-
<a class="btn btn-sm btn-link" style="border-radius:15px;border-color:lightgray;" href="@routes.Files.file(prev, if(datasets.length > 0) {
208+
<a class="btn btn-sm btn-link" title="Previous file in this dataset" style="border-radius:15px;border-color:lightgray;" href="@routes.Files.file(prev, if(datasets.length > 0) {
209209
Some(datasets.head.id.stringify)
210210
} else {
211211
None
@@ -218,10 +218,10 @@
218218
}
219219
@pager.next match {
220220
case None => {
221-
<button class="btn btn-sm btn-link disabled" disabled="true" style="cursor:not-allowed;border-radius:15px;border-color:lightgray;">Next <i class="glyphicon glyphicon-chevron-right"></i></button>
221+
<button class="btn btn-sm btn-link disabled" title="This is the last file in this dataset" disabled="true" style="cursor:not-allowed;border-radius:15px;border-color:lightgray;">Next <i class="glyphicon glyphicon-chevron-right"></i></button>
222222
}
223223
case Some(next) => {
224-
<a class="btn btn-sm btn-link" style="border-radius:15px;border-color:lightgray;" href="@routes.Files.file(next, if(datasets.length > 0) {
224+
<a class="btn btn-sm btn-link" title="Next file in this dataset" style="border-radius:15px;border-color:lightgray;" href="@routes.Files.file(next, if(datasets.length > 0) {
225225
Some(datasets.head.id.stringify)
226226
} else {
227227
None

0 commit comments

Comments
 (0)