Minimales theme für login
parent
375e5eff65
commit
d632003bbc
|
|
@ -29,7 +29,6 @@ import org.eclipse.krazo.engine.ViewEngineBase;
|
||||||
import org.eclipse.krazo.engine.ViewEngineConfig;
|
import org.eclipse.krazo.engine.ViewEngineConfig;
|
||||||
import org.libreccm.theming.ThemeInfo;
|
import org.libreccm.theming.ThemeInfo;
|
||||||
import org.libreccm.theming.ThemeProvider;
|
import org.libreccm.theming.ThemeProvider;
|
||||||
import org.libreccm.theming.freemarker.FreemarkerThemeProcessor;
|
|
||||||
import org.libreccm.theming.utils.L10NUtils;
|
import org.libreccm.theming.utils.L10NUtils;
|
||||||
import org.libreccm.theming.utils.SettingsUtils;
|
import org.libreccm.theming.utils.SettingsUtils;
|
||||||
import org.libreccm.theming.utils.TextUtils;
|
import org.libreccm.theming.utils.TextUtils;
|
||||||
|
|
@ -291,7 +290,6 @@ public class FreemarkerViewEngine extends ViewEngineBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object exec(final List arguments) throws TemplateModelException {
|
public Object exec(final List arguments) throws TemplateModelException {
|
||||||
|
|
||||||
if (arguments.isEmpty()) {
|
if (arguments.isEmpty()) {
|
||||||
throw new TemplateModelException("No string to localize.");
|
throw new TemplateModelException("No string to localize.");
|
||||||
}
|
}
|
||||||
|
|
@ -318,7 +316,6 @@ public class FreemarkerViewEngine extends ViewEngineBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object exec(final List arguments) throws TemplateModelException {
|
public Object exec(final List arguments) throws TemplateModelException {
|
||||||
|
|
||||||
if (arguments.size() == 2) {
|
if (arguments.size() == 2) {
|
||||||
final String text = ((TemplateScalarModel) arguments.get(0))
|
final String text = ((TemplateScalarModel) arguments.get(0))
|
||||||
.getAsString();
|
.getAsString();
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
@ -53,25 +54,31 @@ import javax.json.JsonObject;
|
||||||
import javax.json.JsonReader;
|
import javax.json.JsonReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of {@link ThemeProvider} for serves themes stored in the
|
* Implementation of {@link ThemeProvider} for serves themes stored in the
|
||||||
* classpath.
|
* classpath.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class StaticThemeProvider implements ThemeProvider {
|
public class StaticThemeProvider implements ThemeProvider {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(
|
private static final Logger LOGGER = LogManager.getLogger(
|
||||||
StaticThemeProvider.class);
|
StaticThemeProvider.class);
|
||||||
|
|
||||||
private static final String THEMES_DIR = "/themes";
|
private static final String THEMES_DIR = "/themes";
|
||||||
|
|
||||||
private static final String THEMES_PACKAGE = "themes";
|
private static final String THEMES_PACKAGE = "themes";
|
||||||
|
|
||||||
private static final String THEME_MANIFEST_JSON_PATH = THEMES_DIR
|
private static final String THEME_MANIFEST_JSON_PATH = THEMES_DIR
|
||||||
+ "/%s/theme.json";
|
+ "/%s/theme.json";
|
||||||
|
|
||||||
private static final String THEME_MANIFEST_XML_PATH = THEMES_DIR
|
private static final String THEME_MANIFEST_XML_PATH = THEMES_DIR
|
||||||
+ "/%s/theme.xml";
|
+ "/%s/theme.xml";
|
||||||
|
|
||||||
private static final String THEME_MANIFEST_JSON = "theme.json";
|
private static final String THEME_MANIFEST_JSON = "theme.json";
|
||||||
|
|
||||||
private static final String THEME_MANIFEST_XML = "theme.xml";
|
private static final String THEME_MANIFEST_XML = "theme.xml";
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
@ -84,7 +91,7 @@ public class StaticThemeProvider implements ThemeProvider {
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "StaticThemeProvider";
|
return "StaticThemeProvider";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ThemeInfo> getThemes() {
|
public List<ThemeInfo> getThemes() {
|
||||||
|
|
||||||
|
|
@ -472,18 +479,26 @@ public class StaticThemeProvider implements ThemeProvider {
|
||||||
|
|
||||||
final String fileName = path.get(0);
|
final String fileName = path.get(0);
|
||||||
|
|
||||||
final Optional<JsonObject> fileData = currentDirectory
|
final Optional<JsonObject> fileDataResult = currentDirectory
|
||||||
.stream()
|
.stream()
|
||||||
.map(value -> (JsonObject) value)
|
.map(value -> (JsonObject) value)
|
||||||
.filter(value -> filterFileData(value, fileName))
|
.filter(value -> filterFileData(value, fileName))
|
||||||
.findAny();
|
.findAny();
|
||||||
if (path.size() == 1) {
|
if (path.size() == 1) {
|
||||||
return fileData;
|
return fileDataResult;
|
||||||
} else {
|
} else {
|
||||||
|
final JsonObject fileData = fileDataResult
|
||||||
if (fileData.get().getBoolean("isDirectory")) {
|
.orElseThrow(
|
||||||
return findFile(path.subList(1, path.size()),
|
() -> new NoSuchElementException(
|
||||||
fileData.get().getJsonArray("files"));
|
String.format(
|
||||||
|
"File %s not found.", path
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if (fileData.getBoolean("isDirectory")) {
|
||||||
|
return findFile(
|
||||||
|
path.subList(1, path.size()), fileData.getJsonArray("files")
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
|
|
@ -1,30 +1,28 @@
|
||||||
<!DOCTYPE html>
|
<#import "../main.html.ftl" as main>
|
||||||
<html>
|
|
||||||
<head>
|
<@main.ccm_main>
|
||||||
<title>Category page</title>
|
<h1>${LoginMessages['login.title']}</h1>
|
||||||
<link rel="stylesheet" href="${themeUrl}/style.css" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<main>
|
|
||||||
<h1>${LoginMessages['login.title']}</h1>
|
|
||||||
<#if (loginFailed)>
|
<#if (loginFailed)>
|
||||||
<div class="alert-error">
|
<div class="alert-error">
|
||||||
${LoginMessages['login.errors.failed']}
|
${LoginMessages['login.errors.failed']}
|
||||||
</div>
|
</div>
|
||||||
</#if>
|
</#if>
|
||||||
<form action="${mvc.uri('LoginController#processLogin')}"
|
<form action="${mvc.uri('LoginController#processLogin')}"
|
||||||
|
class="login"
|
||||||
method="post">
|
method="post">
|
||||||
<label for="login">${LoginMessages['login.screenname.label']}</label>
|
<div class="form-row">
|
||||||
<input id="login" name="login" required="true" type="text" />
|
<label for="login">${LoginMessages['login.screenname.label']}</label>
|
||||||
|
<input id="login" name="login" required="true" type="text" />
|
||||||
<label for="password">
|
</div>
|
||||||
${LoginMessages['login.password.label']}
|
<div class="form-row">
|
||||||
</label>
|
<label for="password">
|
||||||
<input id="password"
|
${LoginMessages['login.password.label']}
|
||||||
name="password"
|
</label>
|
||||||
required="true"
|
<input id="password"
|
||||||
type="password" />
|
name="password"
|
||||||
|
required="true"
|
||||||
|
type="password" />
|
||||||
|
</div>
|
||||||
<input type="hidden"
|
<input type="hidden"
|
||||||
name="returnUrl"
|
name="returnUrl"
|
||||||
value="${returnUrl}" />
|
value="${returnUrl}" />
|
||||||
|
|
@ -33,7 +31,4 @@
|
||||||
${LoginMessages['login.submit']}
|
${LoginMessages['login.submit']}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</main>
|
</@main.ccm_main>
|
||||||
<#include "../footer.html.ftl">
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Category page</title>
|
||||||
|
<link rel="stylesheet" href="${themeUrl}/style.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<main>
|
||||||
|
<h1>${LoginMessages['login.title']}</h1>
|
||||||
|
<#if (loginFailed)>
|
||||||
|
<div class="alert-error">
|
||||||
|
${LoginMessages['login.errors.failed']}
|
||||||
|
</div>
|
||||||
|
</#if>
|
||||||
|
<form action="${mvc.uri('LoginController#processLogin')}"
|
||||||
|
method="post">
|
||||||
|
<label for="login">${LoginMessages['login.screenname.label']}</label>
|
||||||
|
<input id="login" name="login" required="true" type="text" />
|
||||||
|
|
||||||
|
<label for="password">
|
||||||
|
${LoginMessages['login.password.label']}
|
||||||
|
</label>
|
||||||
|
<input id="password"
|
||||||
|
name="password"
|
||||||
|
required="true"
|
||||||
|
type="password" />
|
||||||
|
|
||||||
|
<input type="hidden"
|
||||||
|
name="returnUrl"
|
||||||
|
value="${returnUrl}" />
|
||||||
|
|
||||||
|
<button type="submit">
|
||||||
|
${LoginMessages['login.submit']}
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</main>
|
||||||
|
<#include "../footer.html.ftl">
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<#macro ccm_main scripts=[]>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Category page</title>
|
||||||
|
<link rel="stylesheet" href="${themeUrl}/style.css" />
|
||||||
|
<#list scripts as script>
|
||||||
|
<script src="${themeUrl}/${script}" />
|
||||||
|
</#list>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<a href="https://www.libreccm.org">
|
||||||
|
<img alt="LibreCCM Logo"
|
||||||
|
src="${themeUrl}/images/libreccm.png" />
|
||||||
|
</a>
|
||||||
|
</header>
|
||||||
|
<main>
|
||||||
|
<#nested>
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<p>LibreCCM basic theme. The customize create your own theme.</p>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
</#macro>
|
||||||
|
|
@ -5,106 +5,69 @@
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.news {
|
header {
|
||||||
|
padding: 1em 2em;
|
||||||
background-color: #000;
|
|
||||||
|
|
||||||
margin: 0 auto 3em auto;
|
|
||||||
|
|
||||||
width: 100vw;
|
|
||||||
|
|
||||||
padding: 3em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.news li {
|
header img {
|
||||||
|
display: block;
|
||||||
display: flex;
|
|
||||||
|
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
|
|
||||||
max-width: 50em;
|
width: 20vw;
|
||||||
|
max-width: 1020px;
|
||||||
|
max-height: 566px;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.news li img {
|
main {
|
||||||
max-height: 20em;
|
max-width: 55em;
|
||||||
|
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
|
||||||
|
padding: 2em 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.news li span {
|
main h1 {
|
||||||
|
text-align: center;
|
||||||
color: #fff;
|
|
||||||
|
|
||||||
flex: 1;
|
|
||||||
|
|
||||||
font-size: 2rem;
|
|
||||||
|
|
||||||
padding-left: 1em;
|
|
||||||
padding-right: 1em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main div.boxes {
|
main form.login {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
margin: 3em auto 3em auto;
|
margin-top: 1em;
|
||||||
|
|
||||||
max-width: 80em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main div.boxes div {
|
main form.login .form-row {
|
||||||
position: relative;
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
flex: 1;
|
flex-direction: column;
|
||||||
|
|
||||||
margin: 0 3em;
|
margin-bottom: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
main div.boxes div p img {
|
main form.login button[type=submit] {
|
||||||
width: 100%;
|
display: block;
|
||||||
}
|
|
||||||
|
margin-top: 0.75em;
|
||||||
main div.boxes div a {
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
|
||||||
|
padding: 0.25em;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
background-color: #000;
|
background-color: #71ac52;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
|
||||||
|
padding: 3em 1em;
|
||||||
|
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer ul {
|
footer p {
|
||||||
|
text-align: center;
|
||||||
list-style: none;
|
}
|
||||||
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
|
|
||||||
max-width: 80em;
|
|
||||||
|
|
||||||
padding-top: 4em;
|
|
||||||
padding-bottom: 4em;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer ul li {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer ul li:not(:first-child) {
|
|
||||||
margin-left: 4em;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer ul li a:link {
|
|
||||||
|
|
||||||
color: #fff;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer ul li a:focus, footer ul li a:hover {
|
|
||||||
|
|
||||||
color: #fff;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,5 +1,16 @@
|
||||||
{
|
{
|
||||||
"files": [
|
"files": [
|
||||||
|
{
|
||||||
|
"name": "images",
|
||||||
|
"isDirectory": true,
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"name": "libreccm.png",
|
||||||
|
"isDirectory": false,
|
||||||
|
"mimeType": "image/png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "login",
|
"name": "login",
|
||||||
"isDirectory": true,
|
"isDirectory": true,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue