MiniDigger/Hangar

View on GitHub
ore/app/views/users/admin/activity.scala.html

Summary

Maintainability
Test Coverage
@import java.sql.Timestamp
@import java.time.Instant

@import controllers.sugar.Requests.OreRequest
@import ore.models.project.{Flag, Project}
@import ore.models.user.User
@import ore.OreConfig
@import util.StringFormatterUtils._
@import models.querymodels.{FlagActivity, ReviewActivity}
@(username: String, activities: Seq[Either[FlagActivity, ReviewActivity]])(implicit messages: Messages, request: OreRequest[_], config: OreConfig, flash: Flash)

@layout.base(messages("activity.title") + username) {

    <div class="row">
        <div class="col-md-12  header-flags">
            <div class="clearfix">
                <h1 class="pull-left">@messages("activity.title") <i>@username</i></h1>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h4 class="panel-title pull-left">@messages("activity.title")</h4>
                    <div class="clearfix"></div>
                </div>
                <table class="table table-condensed setting-no-border table-review-log">
                    <tbody>
                        @if(activities.isEmpty) {
                            <tr><td>No activities founds</td></tr>
                        }
                        @activities.map {
                            case Right(review) => {
                                <tr>
                                    <td>Review approved</td>
                                    <td>@prettifyDateAndTime(review.endedAt.getOrElse(Instant.EPOCH)))</td>
                                    <td>for:
                                        <a href="@controllers.routes.Reviews.showReviews(review.project.ownerName, review.project.slug, review.id.toString)">
                                            @review.project.ownerName / @review.project.slug
                                        </a>
                                    </td>
                                </tr>
                            }
                            case Left(flag) => {
                                <tr>
                                    <td>Flag resolved</td>
                                    <td>@prettifyDateAndTime(flag.resolvedAt.getOrElse(Instant.EPOCH)))</td>
                                    <td>for:
                                        <a href="@controllers.project.routes.Projects.show(flag.project.ownerName, flag.project.slug)">
                                            @flag.project.ownerName / @flag.project.slug
                                        </a>
                                    </td>
                                </tr>
                            }
                        }
                    </tbody>
                </table>
            </div>
        </div>
    </div>
}