FlagReason values

This commit is contained in:
Jake Potrebic 2020-09-14 12:27:47 -07:00
parent 86240f98ed
commit c501281625
No known key found for this signature in database
GPG Key ID: 7C58557EC9C421F8
3 changed files with 10 additions and 6 deletions

View File

@ -23,4 +23,10 @@ public enum FlagReason {
public String getTitle() {
return title;
}
private static final FlagReason[] VALUES = values();
public static FlagReason[] getValues() {
return VALUES;
}
}

View File

@ -1,12 +1,11 @@
package io.papermc.hangar.service.project;
import io.papermc.hangar.db.dao.FlagDao;
import io.papermc.hangar.model.viewhelpers.ProjectFlag;
import io.papermc.hangar.db.dao.HangarDao;
import io.papermc.hangar.db.model.ProjectFlagsTable;
import io.papermc.hangar.model.FlagReason;
import io.papermc.hangar.model.viewhelpers.ProjectFlag;
import io.papermc.hangar.service.HangarService;
import io.papermc.hangar.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -17,12 +16,10 @@ import java.util.stream.Collectors;
@Service
public class FlagService extends HangarService {
private final UserService userService;
private final HangarDao<FlagDao> flagDao;
@Autowired
public FlagService(UserService userService, HangarDao<FlagDao> flagDao) {
this.userService = userService;
public FlagService(HangarDao<FlagDao> flagDao) {
this.flagDao = flagDao;
}

View File

@ -8,6 +8,7 @@ Base template for Project overview.
<#assign Visibility=@helper["io.papermc.hangar.model.Visibility"]>
<#assign Permission=@helper["io.papermc.hangar.model.Permission"]>
<#assign FlagReason=@helper["io.papermc.hangar.model.FlagReason"]>
<#-- @ftlvariable name="FlagReason" type="io.papermc.hangar.model.FlagReason" -->
<#macro view p sp active noButtons=false additionalScripts="" additionalStyling="">
<#-- @ftlvariable name="p" type="io.papermc.hangar.model.viewhelpers.ProjectData" -->
<#-- @ftlvariable name="sp" type="io.papermc.hangar.model.viewhelpers.ScopedProjectData" -->
@ -133,7 +134,7 @@ Base template for Project overview.
<@csrf.formField />
<div class="modal-body">
<ul class="list-group list-flags">
<#list FlagReason.values() as reason>
<#list FlagReason.getValues() as reason>
<#-- @ftlvariable name="reason" type="io.papermc.hangar.model.FlagReason" -->
<li class="list-group-item">
<span>${reason.title}</span>