Skip to content

Commit

Permalink
Refactoring/1090 upgrade jscookie webjars (#1091)
Browse files Browse the repository at this point in the history
* wicket-bootstrap#1090 Upgraded JS Cookie library from 1.3.1 to 3.0.5

* wicket-bootstrap#1090 Removed jquery.cookie.js

(cherry picked from commit 22d2334)
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
  • Loading branch information
mcr-paulanand authored and martin-g committed Jun 6, 2024
1 parent e5a8df3 commit a1f5ed2
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 15 deletions.
8 changes: 8 additions & 0 deletions bootstrap-extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
<font-awesome.version>6.5.2</font-awesome.version>
<momentjs.version>2.29.4</momentjs.version>
<bootstrap-select.version>1.14.0-beta3</bootstrap-select.version>
<tempusdominus4.version>5.39.0</tempusdominus4.version>
<tempusdominus.version>6.7.11</tempusdominus.version>
<js-cookie.version>3.0.5</js-cookie.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -70,6 +72,12 @@
<version>${bootstrap-select.version}</version>
</dependency>

<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>js-cookie</artifactId>
<version>${js-cookie.version}</version>
</dependency>

<dependency>
<groupId>org.webjars</groupId>
<artifactId>font-awesome</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
package de.agilecoders.wicket.extensions.markup.html.bootstrap.references;

import org.apache.wicket.resource.JQueryPluginResourceReference;
import de.agilecoders.wicket.webjars.request.resource.WebjarsJavaScriptResourceReference;
import org.apache.wicket.Application;
import org.apache.wicket.markup.head.HeaderItem;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
import org.apache.wicket.request.resource.ResourceReference;
import org.apache.wicket.resource.JQueryResourceReference;

import java.util.List;

/**
* A JavaScript resource reference that contributes the jquery.cookie.js.
*/
public class JQueryCookieJsReference extends JQueryPluginResourceReference {
public class JQueryCookieJsReference extends WebjarsJavaScriptResourceReference {

public static final JQueryCookieJsReference INSTANCE = new JQueryCookieJsReference();

public JQueryCookieJsReference() {
super(JQueryCookieJsReference.class, "js/jquery.cookie.js");
super("js-cookie/current/dist/js.cookie.min.js");
}

@Override
public List<HeaderItem> getDependencies()
{
final ResourceReference backingLibraryReference;
if (Application.exists())
{
backingLibraryReference = Application.get()
.getJavaScriptLibrarySettings()
.getJQueryReference();
}
else
{
backingLibraryReference = JQueryResourceReference.getV3();
}
List<HeaderItem> dependencies = super.getDependencies();
dependencies.add(JavaScriptHeaderItem.forReference(backingLibraryReference));
return dependencies;
}
}

This file was deleted.

0 comments on commit a1f5ed2

Please sign in to comment.