mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-11-21 01:21:54 +08:00
make some pages (including homepage!) actually render now
This commit is contained in:
parent
983a769871
commit
6a84b68980
11
STATUS.md
11
STATUS.md
@ -2,17 +2,20 @@
|
||||
|
||||
## stuff to do
|
||||
|
||||
* make sure the ported templates work
|
||||
* port all templates
|
||||
* enable user dropdown in templates
|
||||
* config stuff for templates
|
||||
* fix alerts
|
||||
* figure out messages
|
||||
* figure out database
|
||||
* figure out building of frontend
|
||||
* figure out internal api
|
||||
* implement external api
|
||||
* csrf stuff
|
||||
* dev server for frontend
|
||||
|
||||
### stuff that is done
|
||||
|
||||
* model external api
|
||||
* implement plugin file detection shit
|
||||
* kinda port templates
|
||||
* add frontend
|
||||
* kinda port templates (the first ones anyways)
|
||||
* add frontend (which actually builds)
|
||||
|
3
src/main/java/freemarker_implicit.ftl
Normal file
3
src/main/java/freemarker_implicit.ftl
Normal file
@ -0,0 +1,3 @@
|
||||
[#ftl]
|
||||
[#-- @implicitly included --]
|
||||
[#-- @ftlvariable name="rc" type="org.springframework.web.servlet.support.RequestContext" --]
|
@ -39,7 +39,8 @@ public class MvcConfig implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/assets/**")
|
||||
// TODO we kinda want this to be /assets, fix the spring.url macro maybe?
|
||||
registry.addResourceHandler("/**")
|
||||
.addResourceLocations("classpath:/public/")
|
||||
.setCacheControl(CacheControl.maxAge(1, TimeUnit.DAYS))
|
||||
.resourceChain(true)
|
||||
|
@ -0,0 +1,14 @@
|
||||
package me.minidigger.hangar.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
@Controller
|
||||
public class HomeController {
|
||||
|
||||
@GetMapping("/")
|
||||
public ModelAndView home() {
|
||||
return new ModelAndView("home");
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
# General #
|
||||
###########
|
||||
server.port=8080
|
||||
spring.freemarker.request-context-attribute=rc
|
||||
|
||||
############
|
||||
# DataBase #
|
||||
|
@ -419,6 +419,8 @@ visibility.notice.softDelete = Project deleted by {0}
|
||||
|
||||
routes.showHome = /
|
||||
routes.showFlags = /flags
|
||||
routes.swagger = /api
|
||||
routes.javaScriptRoutes = /javascriptRoutes
|
||||
routes.projects.showCreator = /new
|
||||
routes.org.showCreator = /organisations/new
|
||||
routes.users.showAuthors = /authors
|
||||
|
@ -6,6 +6,6 @@
|
||||
<div class="container-error container">
|
||||
<img src="<@spring.url "images/ore-dark.png" />" alt="Hangar logo"/>
|
||||
<h1 class="minor"><@spring.message "error.notFound.title" /></h1>
|
||||
<h3 class="minor"><@spring.messageArgs "error.notFound.message" requestHeader.uri /></h3>
|
||||
<h3 class="minor"><@spring.messageArgs "error.notFound.message" springMacroRequestContext.requestUri /></h3>
|
||||
</div>
|
||||
</@base.base>
|
||||
|
@ -1,41 +1,42 @@
|
||||
@*
|
||||
<#--
|
||||
The main entry point of Ore. This page displays a list of Projects that can be
|
||||
sorted according to different criteria.
|
||||
*@
|
||||
@import scala.util.Random
|
||||
|
||||
@import controllers.sugar.Requests.OreRequest
|
||||
@import ore.OreConfig
|
||||
@()(implicit messages: Messages, flash: Flash, request: OreRequest[_], config: OreConfig, assetsFinder: AssetsFinder)
|
||||
-->
|
||||
|
||||
<#import "/spring.ftl" as spring />
|
||||
<#import "../utils/hangar.ftlh" as hangar />
|
||||
<#import "*/utils/hangar.ftlh" as hangar />
|
||||
<#import "*/layout/base.ftlh" as base>
|
||||
|
||||
@randomSponsor = @{
|
||||
<#function randomSponsor>
|
||||
val logos = config.sponge.sponsors
|
||||
|
||||
val index = new Random().nextInt(logos.size)
|
||||
logos(index)
|
||||
}
|
||||
<#-- todo implement random sponsor stuff -->
|
||||
<#return { "link": "https://minidigger.me", "image": "https://avatars2.githubusercontent.com/u/2185527?s=400&v=4"}>
|
||||
</#function>
|
||||
|
||||
@scripts = {
|
||||
<#macro scripts>
|
||||
<script src="<@spring.url "build/home.js" />"></script>
|
||||
}
|
||||
</#macro>
|
||||
|
||||
@stylesheets = {
|
||||
<#macro stylesheets>
|
||||
<link rel="stylesheet" type="text/css" href="@routes.Assets.versioned("build/home.css")" />
|
||||
}
|
||||
</#macro>
|
||||
|
||||
@meta = {
|
||||
<#macro meta>
|
||||
<meta property="og:title" content="<@spring.message "general.appName" />">
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="@config.app.baseUrl">
|
||||
<meta property="og:image" content="<@spring.url "images/ore-dark.png" />" />
|
||||
<meta property="og:description" content="<@spring.message "general.description" />" />
|
||||
}
|
||||
|
||||
@layout.base(messages("general.title"), scripts, additionalMeta = meta, additionalStyling = stylesheets) {
|
||||
</#macro>
|
||||
|
||||
<#assign message><@spring.message "general.title" /></#assign>
|
||||
<#assign scriptsVar><@scripts /></#assign>
|
||||
<#assign stylesheetsVar><@stylesheets /></#assign>
|
||||
<#assign metaVar><@meta /></#assign>
|
||||
<@base.base title="${message}" additionalScripts=scriptsVar additionalMeta=metaVar additionalStyling=stylesheetsVar>
|
||||
<!-- Header -->
|
||||
<div class="index-header">
|
||||
<div class="row centered-content-row">
|
||||
@ -54,11 +55,10 @@ sorted according to different criteria.
|
||||
<div class="panel sponsor-panel">
|
||||
<span>Sponsored by</span>
|
||||
<div class="panel-body">
|
||||
@defining(randomSponsor) { sponsor =>
|
||||
<a href="@sponsor.link">
|
||||
<img class="logo" src="<@spring.urls sponsor.image />" alt="Sponsor" />
|
||||
<#assign sponsor=randomSponsor() />
|
||||
<a href="${sponsor.link}">
|
||||
<img class="logo" src="<@spring.url sponsor.image />" alt="Sponsor" />
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -66,4 +66,4 @@ sorted according to different criteria.
|
||||
</div>
|
||||
|
||||
<div id="home"></div>
|
||||
}
|
||||
</@base.base>
|
@ -64,7 +64,8 @@ showFooter: Boolean = true, noContainer: Boolean = false, additionalMeta: Html =
|
||||
<#nested>
|
||||
<#else>
|
||||
<div class="container<#if showHeader> site-header-margin</#if>">
|
||||
<#if config.ore.staging>
|
||||
<#assign var><@hangar.config "ore.staging" /></#assign>
|
||||
<#if var == "true">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="staging-warning"><@spring.message "general.stagingWarning" /></div>
|
||||
@ -101,7 +102,7 @@ showFooter: Boolean = true, noContainer: Boolean = false, additionalMeta: Html =
|
||||
<#-- </script>-->
|
||||
<#-- </#if>-->
|
||||
|
||||
<script type="text/javascript" src="${@routes.Application.javascriptRoutes}"></script>
|
||||
<script type="text/javascript" src="<@spring.message "routes.javaScriptRoutes"/>"></script>
|
||||
<script type="text/javascript" src="<@spring.url "build/vendors.js" />"></script>
|
||||
<script type="text/javascript" src="<@spring.url "build/font-awesome.js" />"></script>
|
||||
<script type="text/javascript" src="<@spring.url "build/commons.js" />"></script>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<div class="col-sm-2 col-xs-12">
|
||||
<h5>Hangar API</h5>
|
||||
<a class="btn dark"
|
||||
href="${@routes.Application.swagger()}"><@spring.message "general.api" /></a>
|
||||
href="<@spring.message "routes.swagger" />"><@spring.message "general.api" /></a>
|
||||
</div>
|
||||
<div class="col-sm-2 col-xs-12">
|
||||
<h5>Help Needed?</h5>
|
||||
@ -49,8 +49,10 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<#assign date = .now>
|
||||
<p>Copyright © <@spring.message "general.organization" />
|
||||
2016-${Calendar.getInstance().get(Calendar.YEAR)}</p>
|
||||
<#--noinspection FtlReferencesInspection-->
|
||||
2016-${date?string.yyyy}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -43,7 +43,7 @@
|
||||
</div>
|
||||
|
||||
<#-- Right navbar -->
|
||||
<#if authEnabled>
|
||||
<#if authEnabled && false> <#-- todo enable user header thingy -->
|
||||
<ul class="nav navbar-nav navbar-collapse collapse navbar-right">
|
||||
<#if request.headerData.currentUser??>
|
||||
<#assign cu=request.headerData.currentUser>
|
||||
|
@ -1,15 +1,18 @@
|
||||
<#macro alert alertType>
|
||||
<#if flash.get(alertType).isDefined || flash.get(s"$alertType-num").isDefined>
|
||||
<div class="alert alert-fade <@bootstrapNames type=alertType/> alert-dismissable"
|
||||
role="alert" style="display: none;">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="<@spring.message "general.close" />">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<#import "/spring.ftl" as spring />
|
||||
<#import "*/utils/hangar.ftlh" as hangar />
|
||||
|
||||
<@normalAlert />
|
||||
<@numAlert />
|
||||
</div>
|
||||
</#if>
|
||||
<#macro alert alertType>
|
||||
<#-- <#if flash.get(alertType).isDefined || flash.get(s"$alertType-num").isDefined>-->
|
||||
<#-- <div class="alert alert-fade <@bootstrapNames type=alertType/> alert-dismissable"-->
|
||||
<#-- role="alert" style="display: none;">-->
|
||||
<#-- <button type="button" class="close" data-dismiss="alert" aria-label="<@spring.message "general.close" />">-->
|
||||
<#-- <span aria-hidden="true">×</span>-->
|
||||
<#-- </button>-->
|
||||
|
||||
<#-- <@normalAlert />-->
|
||||
<#-- <@numAlert />-->
|
||||
<#-- </div>-->
|
||||
<#-- </#if>-->
|
||||
</#macro>
|
||||
|
||||
<#macro normalAlert>
|
||||
|
Loading…
Reference in New Issue
Block a user