riff-raff/app/views/auth/list.scala.html (48 lines of code) (raw):
@import conf.Config
@(config: Config, menu: Menu)(implicit request: Security.AuthenticatedRequest[AnyContent, com.gu.googleauth.UserIdentity], authList: Seq[controllers.AuthorisationRecord])
@import helper.CSRF
@main("Authorisation List", request) {
<h2>Authorisation List</h2>
<hr/>
<p><a class="btn btn-primary" href="@routes.Login.authForm"><i class="glyphicon glyphicon-plus glyphicon glyphicon-white"></i> Add authorisation</a></p>
<div class="content">
@if(authList.isEmpty) {
<div class="alert alert-warning"><strong>No authorisations.</strong></div>
} else {
<table class="table table-condensed">
<thead>
<tr>
<th>Date added</th>
<th>Authorised E-mail</th>
<th>Approver</th>
<th>Is a superuser?</th>
<th></th>
</tr>
</thead>
<tbody>
@authList.map { auth =>
<tr>
<td>@utils.DateFormats.Short.print(auth.approvedDate)</td>
<td>@auth.email</td>
<td><span class="label label-default">@auth.approvedBy</span></td>
<td>
@(if(auth.isSuperuser(config)) {
<span>
<i class="glyphicon glyphicon-ok"></i>
Yes
</span>
})
</td>
<td>
@helper.form(routes.Login.authDelete, Symbol("class") -> "modal-form") {
@CSRF.formField
<button class="btn btn-xs btn-danger" name="email" value="@auth.email"><i class="glyphicon glyphicon-trash glyphicon glyphicon-white"></i> Delete</button>
}
</td>
</tr>
}
</tbody>
</table>
}
</div>
}(config, menu)