A few more lines

This commit is contained in:
KennyTV 2020-07-16 21:18:24 +02:00
parent 0eac074b3a
commit a3c9f8dbc8
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
12 changed files with 56 additions and 56 deletions

View File

@ -3,7 +3,7 @@
@(call: Call, message: String, id: String = "modal-download")(implicit messages: Messages)
<div class="modal fade" id="@id" tabindex="-1" role="dialog"
<div class="modal fade" id="${id}" tabindex="-1" role="dialog"
aria-labelledby="label-download">
<div class="modal-dialog" role="document">
<div class="modal-content">

View File

@ -48,7 +48,7 @@
<select class="form-control select-parent">
<option selected value="-1">&lt;none&gt;</option>
@rootPages.filter(_.name != Page.homeName).map { page =>
<option value="@page.id" data-slug="@page.slug">@page.name</option>
<option value="${page.id}" data-slug="${page.slug}">${page.name}</option>
}
</select>
</div>

View File

@ -2,6 +2,7 @@
<#import "*/utils/hangar.ftlh" as hangar />
<#import "*/projects/view.ftlh" as projectView />
<#import "*/users/memberList.ftlh" as memberList />
<#import "*/utils/editor.ftlh" as editor />
<#--
Documentation page within Project overview.
@ -51,15 +52,15 @@ Documentation page within Project overview.
<div class="col-md-9">
<div class="row">
<div class="col-md-12">
@editor(
saveCall = routes.Pages.save(p.project.ownerName, p.project.slug, page.fullSlug(parentPage)),
deleteCall = routes.Pages.delete(p.project.ownerName, p.project.slug, page.fullSlug(parentPage)),
deletable = !page.isHome,
enabled = canEditPages,
raw = page.contents,
cooked = page.html(Some(p.project)),
subject = "Page",
extraFormValue = page.name)
<@editor.editor
saveCall=routes.getRouteUrl("pages.save", p.project.ownerName, p.project.slug, page.fullSlug(parentPage))
deleteCall=routes.getRouteUrl("pages.delete", p.project.ownerName, p.project.slug, page.fullSlug(parentPage))
deletable=!page.isHome
enabled=canEditPages
raw=page.contents
cooked=page.html(p.project)
subject="Page"
extraFormValue=page.name />
</div>
</div>
</div>

View File

@ -2,6 +2,7 @@
<#import "*/utils/hangar.ftlh" as hangar />
<#import "*/utils/form.ftlh" as form>
<#import "*/utils/csrf.ftlh" as csrf>
<#import "*/projects/view.ftlh" as projects />
@import controllers.sugar.Requests.OreRequest
@import models.viewhelper.{ProjectData, ScopedProjectData}
@ -34,7 +35,7 @@
</script>
</#assign>
@projects.view(p, sp, "#settings", additionalScripts = scripts) {
<@projects.view p=p sp=sp active="#settings" =additionalScripts=scriptsVar>
<div class="row">
<div class="col-md-8">
@ -296,4 +297,4 @@
</div>
</div>
}
</@projects.view>

View File

@ -5,6 +5,7 @@
<#import "*/utils/csrf.ftlh" as csrf>
<#import "*/projects/channels/helper/modalManage.ftlh" as modalManage />
<#import "*/projects/helper/alertFile.ftlh" as alertFile />
<#import "*/utils/editor.ftlh" as editor />
@import controllers.sugar.Requests.OreRequest
@import models.querymodels.ViewTag
@ -139,13 +140,13 @@
<h3><@spring.message "version.releaseBulletin" /></h3>
<p><@spring.message "version.releaseBulletin.info" /></p>
@editor(
savable = false,
enabled = true,
raw = version.description!"",
cancellable = false,
targetForm = "form-publish"
)
<@editor.editor
savable=false
enabled=true
raw=version.description!""
cancellable=false
targetForm="form-publish"
/>
</div>
</div>
<script @CSPNonce.attr>$(function () { $('.btn-edit').click() });</script>

View File

@ -3,6 +3,7 @@
<#import "*/utils/form.ftlh" as form>
<#import "*/utils/csrf.ftlh" as csrf>
<#import "*/projects/view.ftlh" as projects />
<#import "*/utils/editor.ftlh" as editor />
@import controllers.sugar.Requests.OreRequest
@import models.viewhelper.{ScopedProjectData, VersionData}
@ -165,15 +166,13 @@
</div>
</#if>
<div class="col-md-12">
@editor(
saveCall = versionRoutes.saveDescription(
v.p.project.ownerName, v.p.project.slug, v.v.versionString
),
enabled = sp.perms(Permission.EditPage),
raw = v.v.description!"",
cooked = v.v.obj.render,
subject = "Version"
)
<@editor.editor
saveCall=routes.getRouteUrl("versions.saveDescription", v.p.project.ownerName, v.p.project.slug, v.v.versionString)
enabled=sp.perms(Permission.EditPage)
raw=v.v.description!""
cooked=v.v.obj.render
subject="Version"
/>
</div>
</div>
</div>

View File

@ -32,7 +32,7 @@
<div class="col-md-12">
<ul class="list-group list-flags-admin">
@flags.map { flag =>
<li data-flag-id="@flag.flagId" class="list-group-item">
<li data-flag-id="${flag.flagId}" class="list-group-item">
<div class="row">
<div class="col-xs-12 col-md-1" style="width: 40px;">
<a href="${routes.getRouteUrl("users.showProjects", flag.reporter)}">

View File

@ -18,22 +18,22 @@
@orgRoles = @{Role.organizationRoles.filter(r => r.isAssignable || r == Role.OrganizationOwner)}
@projectRoles = @{Role.projectRoles.filter(r => r.isAssignable || r == Role.ProjectOwner)}
@panel(title: String, size: Int = 12)(content: Html) = {
<div class="col-md-@size">
<#macro panel title size=12>
<div class="col-md-${size}">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">@title</h4>
<h4 class="panel-title">${title}</h4>
</div>
@content
<#nested />
</div>
</div>
}
</#macro>
@roleTable[T, M <: UserRoleModel[M]](keyName: String, tableType: String, withOwner: Boolean, roles: Set[(T, Model[M], String)], roleTypes: IndexedSeq[Role])(showKey: (T, M) => Html) = {
<table class="table role-table">
<tr><th>${keyName}</th><#if withOwner><th>Owner</th></#if><th>Role</th><th>Accepted</th></tr>
@roles.map { case (t, role, owner) =>
<tr data-role-type="@tableType" data-role-id="@role.id">
<tr data-role-type="@tableType" data-role-id="${role.id}">
<td>@showKey(t, role)</td>
<#if withOwner>
<td><a href="${routes.getRouteUrl("userAdmin", owner)}">${owner}</a></td>
@ -65,7 +65,7 @@
<div class="row">
<div class="col-md-12">
<h1>@prefix<a href="${routes.getRouteUrl("users.showProjects", user.user.name)}">${user.user.name}</a></h1>
<h1>${prefix}<a href="${routes.getRouteUrl("users.showProjects", user.user.name)}">${user.user.name}</a></h1>
</div>
</div>
@ -74,46 +74,46 @@
<div class="row">
<#if !user.isOrga>
@panel("Organizations") {
<@panel "Organizations">
@roleTable[Model[Organization], OrganizationUserRole]("Organization", "orgRole", withOwner = true, user.orgas.map(t => (t._1, t._3, t._4.name)).toSet, orgRoles) { (org, _) =>
<a href="${routes.getRouteUrl("userAdmin", org.name)}">
${org.name}
</a>
}
}
</@panel>
<#else>
@panel("Members") {
<@panel "Members">
@roleTable[Model[User], OrganizationUserRole]("User", "memberRole", withOwner = false, orga.members.map(t => (t._2, t._1, null)).toSet, orgRoles) { (user, _) =>
<a href="${routes.getRouteUrl("userAdmin", user.name)}">
${user.name}
</a>
}
}
</@panel>
</#if>
</div>
<#if !user.isOrga>
<div class="row">
@panel("Projects") {
<@panel "Projects">
@roleTable[Project, ProjectUserRole]("Project", "projectRole", withOwner = true, userProjectRoles.map(t => (t._1, t._2, t._1.ownerName)).toSet, projectRoles) { (project, _) =>
<a href="@controllers.project.routes.Projects.show(project.ownerName, project.slug)">
<a href="${routes.getRouteUrl("projects.show", project.ownerName, project.slug)}">
${project.name}
</a>
}
}
</@panel>
</div>
</#if>
</div>
@panel("Other Administration", size=3) {
<@panel title="Other Administration" size=3>
<div class="list-group">
<div class="list-group-item">
<a href="@config.security.api.url/admin/accounts/user/@user.user.id/change/">HangarAuth Profile</a>
<a href="${config.security.api.url}/admin/accounts/user/${user.user.id}/change/">HangarAuth Profile</a>
</div>
<div class="list-group-item">
<a href="https://papermc.io/forums/@user.user.name">Forum Profile</a>
<a href="https://papermc.io/forums${user.user.name}">Forum Profile</a>
</div>
</div>
}
</@panel>
</div>

View File

@ -51,7 +51,6 @@
</div>
<div class="modal-body"><@spring.message "project.removeMember.confirm" /></div>
<div class="modal-footer">
<#-- todo: removeCall, gotten from settings template -->
<@form.form action=removeCall method="POST" class="form-inline">
<@csrf.formField />
<input type="hidden" name="username" />
@ -76,15 +75,14 @@
<#if perms.has(Permission.ManageSubjectMembers)>
<div class="pull-right">
<#if !editable && settingsCall??>
<a href="@settingsCall"
<#if !editable && settingsCall?has_content>
<a href="${settingsCall}"
class="btn yellow btn-xs">
<i class="fas fa-pencil-alt"></i>
</a>
</#if>
<#if saveCall??>
<#-- todo: saveCall, gotten from settings template -->
<#if saveCall?has_content>
<@form.form action=saveCall method="POST" id="save">
<@csrf.formField />
<button class="btn-members-save btn btn-default btn-panel btn-xs" data-toggle="tooltip"

View File

@ -137,7 +137,7 @@
</span>
<br/>
<div class="invite-message invite-choice" style="Fdisplay: auto;">
<div class="invite-message invite-choice" style="display: auto;">
<p>
<@spring.messageArgs "notification.invite" subject.getClass.getSimpleName.toLowerCase />
<a href=${subject.url}>@subject.name</a>.

View File

@ -3,7 +3,7 @@
<#import "*/utils/form.ftlh" as form>
<#import "*/utils/csrf.ftlh" as csrf>
<#macro editor saveCall deleteCall="" savable=true deletable=false enabled=true raw="" cooked="" subject="" cancellable=true targetForm="" extraFormValue="">
<#macro editor saveCall="" deleteCall="" savable=true deletable=false enabled=true raw="" cooked="" subject="" cancellable=true targetForm="" extraFormValue="">
<#if enabled>
<!-- Edit -->
<button type="button" class="btn btn-sm btn-edit btn-page btn-default" title="<@spring.message "general.edit" />">

View File

@ -1,7 +1,7 @@
<#import "/spring.ftl" as spring />
<#import "*/utils/hangar.ftlh" as hangar />
<#macro prompt prompt id="", position="right">
<#macro prompt prompt id="" position="right">
<div class="prompt popover ${id} ${position}" data-prompt-id="${prompt.value}">
<div class="arrow"></div>
<h3 class="popover-title"><@spring.message prompt.titleId /></h3>