Skip to content

Commit

Permalink
Release Posters 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jowerner committed May 29, 2024
2 parents 442dd99 + d8b5719 commit 38f8921
Show file tree
Hide file tree
Showing 56 changed files with 1,208 additions and 782 deletions.
47 changes: 35 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.xceptance</groupId>
<artifactId>posters-demo-store</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
<packaging>jar</packaging>

<name>Posters Demo Store</name>
Expand Down Expand Up @@ -57,6 +57,7 @@
<java.version>17</java.version>
<ninja.version>6.9.0</ninja.version>
<copyright>Copyright (c) ${project.inceptionYear}-2024 ${project.organization.name}</copyright>
<ebean-maven-plugin.version>12.9.3</ebean-maven-plugin.version>
<posters.mainClass>util.standalone.PostersMain</posters.mainClass>
</properties>

Expand All @@ -71,9 +72,9 @@
</configuration>
</plugin>
<plugin>
<groupId>org.avaje</groupId>
<artifactId>ebean-maven-enhancement-plugin</artifactId>
<version>2.8.1</version>
<groupId>io.ebean</groupId>
<artifactId>ebean-maven-plugin</artifactId>
<version>${ebean-maven-plugin.version}</version>
<executions>
<execution>
<id>main</id>
Expand All @@ -82,10 +83,8 @@
<goal>enhance</goal>
</goals>
<configuration>
<packages>models, models_backoffice</packages>
<packages>models, models_backoffice</packages>
<transformArgs>debug=1</transformArgs>
<!-- workaround against bug in ebean:
https://groups.google.com/forum/?fromgroups#!topic/ebean/w2Q6PSeXKAk%5B1-25%5D -->
<classSource>${project.build.outputDirectory}</classSource>
<classDestination>${project.build.outputDirectory}</classDestination>
</configuration>
Expand Down Expand Up @@ -163,6 +162,8 @@

<pluginManagement>
<plugins>
<!-- Taken Directly from:
http://stackoverflow.com/questions/11996507/how-do-i-enable-ebean-enhancement-in-maven -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
Expand All @@ -172,16 +173,16 @@
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.avaje</groupId>
<artifactId>
ebean-maven-enhancement-plugin</artifactId>
<versionRange>[2.7.7,)</versionRange>
<groupId>io.ebean</groupId>
<artifactId>ebean-maven-plugin</artifactId>
<versionRange>[${ebean-maven-plugin.version},)</versionRange>
<goals>
<goal>enhance</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnConfiguration>true</runOnConfiguration>
<runOnIncremental>true</runOnIncremental>
</execute>
</action>
Expand Down Expand Up @@ -231,7 +232,12 @@
<dependency>
<groupId>org.ninjaframework</groupId>
<artifactId>ninja-ebean-module</artifactId>
<version>1.4.0</version>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.2.224</version>
</dependency>
<dependency>
<groupId>org.mindrot</groupId>
Expand All @@ -243,6 +249,23 @@
<artifactId>jul-to-slf4j</artifactId>
<version>1.7.26</version>
</dependency>
<!-- JAXB required by Ebean DDL Generator -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.2</version>
</dependency>

<!-- Test Dependencies -->
<dependency>
<groupId>org.ninjaframework</groupId>
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/assets/css/posters.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
.dropdown-menu-c{
top: 100%;
left: auto;
margin-top: var(--bs-dropdown-spacer);
}

.body-wrapper {
max-width: 992px;
margin-left: auto;
Expand Down Expand Up @@ -28,7 +34,7 @@

#headerCartOverview {
margin: 0;
paddin: 10px 15px;
padding: 10px 15px;
}

#headerCartOverview:hover {
Expand Down Expand Up @@ -84,10 +90,6 @@
border-bottom: 2px solid #e7e7e7;
}

#cartOverviewTable tbody tr, #checkoutOverviewTable tbody tr {

}

#cartOverviewTable ul, #checkoutOverviewTable ul {
padding-top: 20px;
padding-bottom: 20px;
Expand Down Expand Up @@ -277,7 +279,6 @@ ul.nav li.dropdown:hover ul.dropdown-menu {
header {
background-color: #f8f8f8;
border-bottom: 1px solid #d3d7cf;
margin-bottom: ;
}
footer {
border-top: 1px solid #d3d7cf;
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/assets/css/style_reworked.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@
font-size: 1.8rem;
}

@media(max-width: 400px) {
.navbar-brand {
font-size: 7vw;
}
}

#user-menu {
width: 250px;
padding: 15px 20px;
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/assets/files/customer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<name>Doe</name>
<firstName>John</firstName>
<shippingAddress>
<delName>John Doe</delName>
<delName>Doe</delName>
<delFirstName>John</delFirstName>
<delCompany>John Doe Inc.</delCompany>
<delAddressLine>5-7 John Doe street</delAddressLine>
<delCity>New York</delCity>
Expand All @@ -15,7 +16,8 @@
<delZip>12345</delZip>
</shippingAddress>
<billingAddress>
<billName>John Doe</billName>
<billName>Doe</billName>
<billFirstName>John</billFirstName>
<billCompany>John Doe Inc.</billCompany>
<billAddressLine>5-7 John Doe street</billAddressLine>
<billCity>New York</billCity>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/assets/files/products.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
</product>
<product>
<name>Blue Morpho Butterfly</name>
<shortDescription>A beutiful blue and black butterfly on a leaf.</shortDescription>
<shortDescription>A beautiful blue and black butterfly on a leaf.</shortDescription>
<longDescription>Butterflies are the perfect insects to get some colorful spring vibes into your house. The blue morpho butterfly is also ranking among the world's largest butterflies and is known for its numerous eye spots that camouflage it during flight.</longDescription>
<imageURL>
<small>/assets/img/products/flora_and_fauna/animals/blue-morpho-butterfly/blue-morpho-butterfly-small.webp</small>
Expand Down Expand Up @@ -1448,7 +1448,7 @@
<shortDescription>A fantastic skycolor change!</shortDescription>
<longDescription>The bright glitter in the center beautifully highlights the sky and delivers this spectacular color change effect. Picture composition at its best. Memo: there's also no use asking about our new year's resolutions. We don't have any. </longDescription>
<imageURL>
<small>/assets/img/products/panoramas/fireworks/new years-fireworks-III/new-years-fireworks-III-small.webp</small>
<small>/assets/img/products/panoramas/fireworks/new-years-fireworks-III/new-years-fireworks-III-small.webp</small>
<medium>/assets/img/products/panoramas/fireworks/new-years-fireworks-III/new-years-fireworks-III-medium.webp</medium>
<large>/assets/img/products/panoramas/fireworks/new-years-fireworks-III/new-years-fireworks-III-large.webp</large>
<original>/assets/img/products/panoramas/fireworks/new-years-fireworks-III/new-years-fireworks-III-original.webp</original>
Expand Down
24 changes: 18 additions & 6 deletions src/main/java/assets/js/poster.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,22 @@ function updateProductOverview(data) {
// Iterate over the products in the data and append the updated content
data.products.forEach(function(product) {
var productCard = document.createElement('div');
var productURI = encodeURI(product.name);
productCard.classList.add("card");
productCard.classList.add("product-tile");
productCard.innerHTML = [
`
<picture id="pagination-picture-${product.id}">
<source media="(max-width: 399px)" srcset="${CONTEXT_PATH}${product.smallImageURL}">
<source media="(max-width: 799px)" srcset="${CONTEXT_PATH}${product.mediumImageURL}">
<source media="(max-width: 1999px)" srcset="${CONTEXT_PATH}${product.largeImageURL}">
<img class="card-img-top" src="${CONTEXT_PATH}${product.originalImageURL}" alt="picture of ${product.name}" >
</picture>
<a href="${CONTEXT_PATH}/productDetail/${productURI}?productId=${product.id}">
<img
srcset="${CONTEXT_PATH}${product.smallImageURL} 400w,
${CONTEXT_PATH}${product.mediumImageURL} 800w,
${CONTEXT_PATH}${product.largeImageURL} 2000w"
sizes="262px"
src="${CONTEXT_PATH}${product.originalImageURL}"
alt="picture of ${product.name}"
class="card-img-top"
id="pagination-picture-${product.id}">
</a>
<div class="card-body">
<h5 class="card-title">${product.name}</h5>
<p class="card-text product-tile-text">${product.descriptionOverview}</p>
Expand Down Expand Up @@ -150,6 +156,12 @@ function postersSetup() {
// dismiss button
e.target.querySelector("#button-close").addEventListener('click', () => {
e.target.querySelector(`:scope ${'.modal-body'}`).innerHTML = '';
e.target.querySelector('.modal-footer').innerHTML += '';
});
// modal close button (clone of the above since it should work the same)
e.target.querySelector(".btn-close").addEventListener('click', () => {
e.target.querySelector(`:scope ${'.modal-body'}`).innerHTML = '';
e.target.querySelector('.modal-footer').innerHTML += '';
});
//Bodycontent of popup
e.target.querySelector(`:scope ${'.modal-body'}`).appendChild(prodInfo);
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/assets/js/posterMiniCart.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ function addToCart(productId, finish, size) {
function addToMiniCart(productId, finish, size) {
document.getElementById('mini-cart-menu').style.display = "block";
document.querySelector(".notifications-loader").innerHTML = ['<img src="' + CONTEXT_PATH + '/assets/img/loader.gif">'];
var liId = "productId" + productId + finish + size.width + "x" + size.height;
var width = size.match(/\d+/g)[0];
var height = size.match(/\d+/g)[1];
var liId = "product-id-" + productId + '-' + finish + '-' + width + "x" + height;
var url = CONTEXT_PATH + '/addToCartSlider' + '?productId=' + productId + '&finish=' + finish + '&size=' + size;
const xhr = new XMLHttpRequest();

Expand Down Expand Up @@ -87,6 +89,8 @@ function addToMiniCart(productId, finish, size) {
window.setTimeout(function(){
document.querySelector(".top-menu #header-cart-overview").classList.remove('show');
document.querySelector(".top-menu #mini-cart-menu").classList.remove('show');
document.querySelector(".top-menu #mini-cart-menu").removeAttribute('style');
document.querySelector(".top-menu #mini-cart-menu").style.left='auto';
}, 1500);
} else {
sendAlert("failed to update mini cart", "alert-danger");
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/conf/Scheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import models.Cart;
import models.CartProduct;
import models.Order;
import ninja.scheduler.Schedule;

import com.google.inject.Singleton;
Expand Down Expand Up @@ -67,4 +68,14 @@ public void deleteUnusedCart()
}
}
}

/**
* Deletes pending orders, that have been existing for more than a day inside the database. Will be triggered every 24 hours.
*/
@Schedule(delay = 86400, timeUnit = TimeUnit.SECONDS)
public void deletePendingOrder() {

Order.deleteOldPendingOrders();
}

}
4 changes: 2 additions & 2 deletions src/main/java/conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ application.unitLength = in
## ------------------------------

# we use a embedded ebeans in regular config
ebean.datasource.databaseUrl = jdbc:h2:db/posters;DB_CLOSE_DELAY=-1;AUTO_SERVER=TRUE
ebean.datasource.databaseUrl = jdbc:h2:./db/posters;DB_CLOSE_DELAY=-1;AUTO_SERVER=TRUE

# in memory db when testing:
%test.ebean.datasource.databaseUrl = jdbc:h2:mem:tests;DB_CLOSE_DELAY=-1
Expand Down Expand Up @@ -118,7 +118,7 @@ ebean.datasource.heartbeatsql = select 1

application.name = demo poster store

application.version = 2.2.0
application.version = 2.3.0

application.cookie.prefix = NINJA

Expand Down
Loading

0 comments on commit 38f8921

Please sign in to comment.