parent
348a2c635b
commit
28695756f0
|
|
@ -4,6 +4,7 @@ node
|
|||
node_modules
|
||||
runtime
|
||||
target
|
||||
.cache
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -107,7 +107,7 @@
|
|||
<goal>install-node-and-npm</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<nodeVersion>v8.11.4</nodeVersion>
|
||||
<nodeVersion>v12.18.3</nodeVersion>
|
||||
</configuration>
|
||||
</execution>
|
||||
<!-- <execution>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"name": "ccm-core",
|
||||
"version": "7.0.0",
|
||||
"description": "JavaScript stuff for ccm-core",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "npm-run-all build:*:*",
|
||||
"build:ccm-admin:js": "parcel build --out-dir target/generated-resources/org/libreccm/ui/admin src/main/typescript/ccm-admin/ccm-admin.ts",
|
||||
"build:ccm-admin:css": "sass src/main/scss/ccm-admin/ccm-admin.scss target/generated-resources/org/libreccm/ui/admin/ccm-admin.css"
|
||||
},
|
||||
"author": "Jens Pelzetter",
|
||||
"license": "LGPL-3.0-or-later",
|
||||
"devDependencies": {
|
||||
"npm-run-all": "^4.1.5",
|
||||
"parcel-bundler": "^1.12.4",
|
||||
"sass": "^1.26.10",
|
||||
"typescript": "^4.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"bootstrap": "^4.5.2",
|
||||
"jquery": "^3.5.1",
|
||||
"popper.js": "^1.16.1"
|
||||
}
|
||||
}
|
||||
|
|
@ -301,6 +301,9 @@
|
|||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>./target/generated-resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<testResources>
|
||||
|
|
@ -324,6 +327,40 @@
|
|||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.github.eirslett</groupId>
|
||||
<artifactId>frontend-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<installDirectory>../node</installDirectory>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>Install node.js and NPM</id>
|
||||
<goals>
|
||||
<goal>install-node-and-npm</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<nodeVersion>v12.18.3</nodeVersion>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm install</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>build</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<arguments>run build</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
|
|
@ -425,6 +462,7 @@
|
|||
<!--<additionalparam>-Xdoclint:none</additionalparam>-->
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jxr-plugin</artifactId>
|
||||
|
|
|
|||
|
|
@ -18,9 +18,15 @@
|
|||
*/
|
||||
package org.libreccm.ui.admin;
|
||||
|
||||
import org.apache.wicket.markup.head.CssHeaderItem;
|
||||
import org.apache.wicket.markup.head.IHeaderResponse;
|
||||
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
|
||||
import org.apache.wicket.markup.head.filter.HeaderResponseContainer;
|
||||
import org.apache.wicket.markup.html.WebPage;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.repeater.RepeatingView;
|
||||
import org.apache.wicket.request.resource.PackageResourceReference;
|
||||
import org.libreccm.ui.bootstrap.NavItem;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
|
@ -44,6 +50,12 @@ public class AdminPage extends WebPage {
|
|||
public AdminPage() {
|
||||
super();
|
||||
|
||||
add(
|
||||
new HeaderResponseContainer(
|
||||
"scripts-container", "scripts-container"
|
||||
)
|
||||
);
|
||||
|
||||
final List<AdminPageData> adminPagesData = adminPages
|
||||
.stream()
|
||||
.map(AdminPagesProvider::getAdminPagesData)
|
||||
|
|
@ -56,13 +68,31 @@ public class AdminPage extends WebPage {
|
|||
)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
final RepeatingView adminPagesView = new RepeatingView("adminPages");
|
||||
final RepeatingView adminPagesView = new RepeatingView("admin-pages");
|
||||
for (final AdminPageData adminPageData : adminPagesData) {
|
||||
adminPagesView.add(
|
||||
new Label(adminPagesView.newChildId(), adminPageData.getLabel())
|
||||
final NavItem navItem = new NavItem(
|
||||
adminPagesView.newChildId(),
|
||||
adminPageData.getLabel(),
|
||||
adminPageData.getPageClass()
|
||||
);
|
||||
navItem.setRenderBodyOnly(true);
|
||||
adminPagesView.add(navItem);
|
||||
}
|
||||
add(adminPagesView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderHead(final IHeaderResponse response) {
|
||||
response.render(
|
||||
CssHeaderItem.forReference(
|
||||
new PackageResourceReference(AdminPage.class, "ccm-admin.css")
|
||||
)
|
||||
);
|
||||
response.render(
|
||||
JavaScriptHeaderItem.forReference(
|
||||
new PackageResourceReference(AdminPage.class, "ccm-admin.js")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ package org.libreccm.ui.admin;
|
|||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.wicket.cdi.CdiConfiguration;
|
||||
import org.apache.wicket.markup.head.filter.JavaScriptFilteredIntoFooterHeaderResponse;
|
||||
import org.apache.wicket.markup.html.WebPage;
|
||||
import org.apache.wicket.protocol.http.WebApplication;
|
||||
import org.libreccm.l10n.GlobalizationHelper;
|
||||
|
|
@ -45,7 +46,6 @@ public class CcmAdmin extends WebApplication {
|
|||
@Inject
|
||||
private Instance<AdminPagesProvider> adminPages;
|
||||
|
||||
|
||||
@Override
|
||||
public Class<? extends WebPage> getHomePage() {
|
||||
return DashboardPage.class;
|
||||
|
|
@ -59,6 +59,14 @@ public class CcmAdmin extends WebApplication {
|
|||
final CdiConfiguration cdiConfiguration = new CdiConfiguration();
|
||||
cdiConfiguration.configure(this);
|
||||
|
||||
getCspSettings().blocking().disabled();
|
||||
getMarkupSettings().setStripWicketTags(true);
|
||||
|
||||
getHeaderResponseDecorators().add(
|
||||
response -> new JavaScriptFilteredIntoFooterHeaderResponse(
|
||||
response, "scripts-container"
|
||||
));
|
||||
|
||||
final Set<AdminPageData> adminPagesData = adminPages
|
||||
.stream()
|
||||
.map(AdminPagesProvider::getAdminPagesData)
|
||||
|
|
@ -86,5 +94,4 @@ public class CcmAdmin extends WebApplication {
|
|||
// mountPage("users-groups-roles/users", UsersPage.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (C) 2020 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.ui.bootstrap;
|
||||
|
||||
import org.apache.wicket.markup.html.WebPage;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.link.Link;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class NavItem extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@SuppressWarnings("OverridableMethodCallInConstructor")
|
||||
public NavItem(
|
||||
final String id,
|
||||
final String label,
|
||||
final Class<? extends WebPage> targetPage
|
||||
) {
|
||||
super(id);
|
||||
|
||||
final Link<Void> link = new Link<Void>("link") {
|
||||
|
||||
@Override
|
||||
public void onClick() {
|
||||
setResponsePage(targetPage);
|
||||
}
|
||||
|
||||
};
|
||||
link.add(new Label("link-label", label));
|
||||
add(link);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -5,12 +5,29 @@
|
|||
<title>LibreCCM Admin</title>
|
||||
</head>
|
||||
<body>
|
||||
<ul>
|
||||
<li wicket:id="adminPages">[adminPageName]</li>
|
||||
</ul>
|
||||
<div wicket:id="adminPanel">[admin panel]</div>
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-primary">
|
||||
<a class="navbar-brand" href="#">Navbar</a>
|
||||
<button
|
||||
class="navbar-toggler"
|
||||
type="button"
|
||||
data-toggle="collapse"
|
||||
data-target="#navbarSupportedContent"
|
||||
aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false"
|
||||
aria-label="Toggle navigation"
|
||||
>
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li class="nav-item" wicket:id="admin-pages"></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container">
|
||||
<div wicket:id="adminPanel">[admin panel]</div>
|
||||
</div>
|
||||
<wicket:container wicket:id="scripts-container"></wicket:container>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<li class="nav-item">
|
||||
<a
|
||||
class="nav-link"
|
||||
href="[targetpage]"
|
||||
wicket:id="link"
|
||||
>
|
||||
<span wicket:id="link-label">[Link Label]</span>
|
||||
</a>
|
||||
</li>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
@import "../../../../node_modules/bootstrap/scss/bootstrap";
|
||||
|
|
@ -0,0 +1 @@
|
|||
import "bootstrap";
|
||||
Loading…
Reference in New Issue