MiniDigger/Hangar

View on GitHub
ore/app/views/projects/versions/unsafeDownload.scala.html

Summary

Maintainability
Test Coverage
@import controllers.sugar.Requests.OreRequest
@import ore.models.project.{Project, ReviewState, Version}
@import ore.OreConfig
@import ore.data.DownloadType
@import views.html.helper.CSRF
@(project: Project,
        target: Version,
        isTargetChannelNonReviewed: Boolean,
        downloadType: DownloadType)(implicit messages: Messages, request: OreRequest[_], config: OreConfig, flash: Flash)

@versionRoutes = @{ controllers.project.routes.Versions }

@layout.base(messages("version.download.confirm.title") + " " + messages("version.download.confirm.header", project.ownerName, project.name, target.name)) {

    <div class="row">
        <div class="col-md-6 col-md-offset-3">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="col-xs-12 col-sm-4 no-padding">
                        <h4 class="panel-title"><i class="fas fa-exclamation-triangle"></i>&ensp;@messages("general.warning")</h4>
                    </div>
                    <div class="col-xs-12 col-sm-8 no-padding">
                        <span class="pull-right">@messages("version.download.confirm.header", project.ownerName, project.name, target.name)</span>
                    </div>
                </div>
                <div class="panel-body">
                    <div class="alert alert-danger" style="margin-bottom: 10px">
                    @if(isTargetChannelNonReviewed || target.reviewState == ReviewState.Backlog) {
                        @messages("version.download.confirm.nonReviewedChannel")
                    } else {
                        @if(target.reviewState != ReviewState.PartiallyReviewed) {
                            @messages("version.download.confirm.reviewedChannel")
                        } else {
                            @messages("version.download.confirmPartial.reviewedChannel")
                        }
                    }
                    </div>
                    <p>
                        @messages("general.disclaimer"):
                        <span class="text-italic">@messages("version.download.confirm.disclaimer")</span>
                    </p>

                    <div class="row">
                        <div class="col-xs-12 col-sm-6 mb-3-sm">
                            <button class="btn btn-success link-go-back">
                            @messages("project.back")
                            </button>
                        </div>

                        <div class="col-xs-12 col-sm-6">
                            <form action="@versionRoutes.confirmDownload(project.ownerName, project.slug, target.name, Some(downloadType.value), None, Some("dummy"))" method="post" id="form-download">
                                @CSRF.formField

                                <button type="submit" form="form-download" class="btn btn-danger pull-right-sm">
                                @messages("version.download.confirm.download")
                                </button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

}