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.libreccm.theming.ThemeInfo;
|
||||
import org.libreccm.theming.ThemeProvider;
|
||||
import org.libreccm.theming.freemarker.FreemarkerThemeProcessor;
|
||||
import org.libreccm.theming.utils.L10NUtils;
|
||||
import org.libreccm.theming.utils.SettingsUtils;
|
||||
import org.libreccm.theming.utils.TextUtils;
|
||||
|
|
@ -291,7 +290,6 @@ public class FreemarkerViewEngine extends ViewEngineBase {
|
|||
|
||||
@Override
|
||||
public Object exec(final List arguments) throws TemplateModelException {
|
||||
|
||||
if (arguments.isEmpty()) {
|
||||
throw new TemplateModelException("No string to localize.");
|
||||
}
|
||||
|
|
@ -318,7 +316,6 @@ public class FreemarkerViewEngine extends ViewEngineBase {
|
|||
|
||||
@Override
|
||||
public Object exec(final List arguments) throws TemplateModelException {
|
||||
|
||||
if (arguments.size() == 2) {
|
||||
final String text = ((TemplateScalarModel) arguments.get(0))
|
||||
.getAsString();
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
|
@ -62,16 +63,22 @@ import javax.json.JsonReader;
|
|||
public class StaticThemeProvider implements ThemeProvider {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger(
|
||||
StaticThemeProvider.class);
|
||||
|
||||
private static final String THEMES_DIR = "/themes";
|
||||
|
||||
private static final String THEMES_PACKAGE = "themes";
|
||||
|
||||
private static final String THEME_MANIFEST_JSON_PATH = THEMES_DIR
|
||||
+ "/%s/theme.json";
|
||||
|
||||
private static final String THEME_MANIFEST_XML_PATH = THEMES_DIR
|
||||
+ "/%s/theme.xml";
|
||||
|
||||
private static final String THEME_MANIFEST_JSON = "theme.json";
|
||||
|
||||
private static final String THEME_MANIFEST_XML = "theme.xml";
|
||||
|
||||
@Inject
|
||||
|
|
@ -472,18 +479,26 @@ public class StaticThemeProvider implements ThemeProvider {
|
|||
|
||||
final String fileName = path.get(0);
|
||||
|
||||
final Optional<JsonObject> fileData = currentDirectory
|
||||
final Optional<JsonObject> fileDataResult = currentDirectory
|
||||
.stream()
|
||||
.map(value -> (JsonObject) value)
|
||||
.filter(value -> filterFileData(value, fileName))
|
||||
.findAny();
|
||||
if (path.size() == 1) {
|
||||
return fileData;
|
||||
return fileDataResult;
|
||||
} else {
|
||||
|
||||
if (fileData.get().getBoolean("isDirectory")) {
|
||||
return findFile(path.subList(1, path.size()),
|
||||
fileData.get().getJsonArray("files"));
|
||||
final JsonObject fileData = fileDataResult
|
||||
.orElseThrow(
|
||||
() -> new NoSuchElementException(
|
||||
String.format(
|
||||
"File %s not found.", path
|
||||
)
|
||||
)
|
||||
);
|
||||
if (fileData.getBoolean("isDirectory")) {
|
||||
return findFile(
|
||||
path.subList(1, path.size()), fileData.getJsonArray("files")
|
||||
);
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
|
|
@ -1,11 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Category page</title>
|
||||
<link rel="stylesheet" href="${themeUrl}/style.css" />
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<#import "../main.html.ftl" as main>
|
||||
|
||||
<@main.ccm_main>
|
||||
<h1>${LoginMessages['login.title']}</h1>
|
||||
<#if (loginFailed)>
|
||||
<div class="alert-error">
|
||||
|
|
@ -13,10 +8,13 @@
|
|||
</div>
|
||||
</#if>
|
||||
<form action="${mvc.uri('LoginController#processLogin')}"
|
||||
class="login"
|
||||
method="post">
|
||||
<div class="form-row">
|
||||
<label for="login">${LoginMessages['login.screenname.label']}</label>
|
||||
<input id="login" name="login" required="true" type="text" />
|
||||
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="password">
|
||||
${LoginMessages['login.password.label']}
|
||||
</label>
|
||||
|
|
@ -24,7 +22,7 @@
|
|||
name="password"
|
||||
required="true"
|
||||
type="password" />
|
||||
|
||||
</div>
|
||||
<input type="hidden"
|
||||
name="returnUrl"
|
||||
value="${returnUrl}" />
|
||||
|
|
@ -33,7 +31,4 @@
|
|||
${LoginMessages['login.submit']}
|
||||
</button>
|
||||
</form>
|
||||
</main>
|
||||
<#include "../footer.html.ftl">
|
||||
</body>
|
||||
</html>
|
||||
</@main.ccm_main>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
ul.news {
|
||||
|
||||
background-color: #000;
|
||||
|
||||
margin: 0 auto 3em auto;
|
||||
|
||||
width: 100vw;
|
||||
|
||||
padding: 3em;
|
||||
header {
|
||||
padding: 1em 2em;
|
||||
}
|
||||
|
||||
ul.news li {
|
||||
|
||||
display: flex;
|
||||
header img {
|
||||
display: block;
|
||||
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
|
||||
max-width: 50em;
|
||||
|
||||
width: 20vw;
|
||||
max-width: 1020px;
|
||||
max-height: 566px;
|
||||
}
|
||||
|
||||
ul.news li img {
|
||||
max-height: 20em;
|
||||
main {
|
||||
max-width: 55em;
|
||||
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
|
||||
padding: 2em 1em;
|
||||
}
|
||||
|
||||
ul.news li span {
|
||||
|
||||
color: #fff;
|
||||
|
||||
flex: 1;
|
||||
|
||||
font-size: 2rem;
|
||||
|
||||
padding-left: 1em;
|
||||
padding-right: 1em;
|
||||
main h1 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
main div.boxes {
|
||||
main form.login {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
|
||||
margin: 3em auto 3em auto;
|
||||
|
||||
max-width: 80em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
main div.boxes div {
|
||||
position: relative;
|
||||
main form.login .form-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
|
||||
flex: 1;
|
||||
|
||||
margin: 0 3em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
main div.boxes div p img {
|
||||
width: 100%;
|
||||
}
|
||||
main form.login button[type=submit] {
|
||||
display: block;
|
||||
|
||||
main div.boxes div a {
|
||||
margin-top: 0.75em;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
|
||||
padding: 0.25em;
|
||||
}
|
||||
|
||||
footer {
|
||||
background-color: #000;
|
||||
background-color: #71ac52;
|
||||
color: #fff;
|
||||
|
||||
padding: 3em 1em;
|
||||
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
footer ul {
|
||||
|
||||
list-style: none;
|
||||
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
|
||||
max-width: 80em;
|
||||
|
||||
padding-top: 4em;
|
||||
padding-bottom: 4em;
|
||||
footer p {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
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": [
|
||||
{
|
||||
"name": "images",
|
||||
"isDirectory": true,
|
||||
"files": [
|
||||
{
|
||||
"name": "libreccm.png",
|
||||
"isDirectory": false,
|
||||
"mimeType": "image/png"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "login",
|
||||
"isDirectory": true,
|
||||
|
|
|
|||
Loading…
Reference in New Issue