You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by vl...@apache.org on 2022/06/18 21:51:16 UTC

[tapestry-5] branch TAP5-2686 created (now dd51ea976)

This is an automated email from the ASF dual-hosted git repository.

vlamp pushed a change to branch TAP5-2686
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git


      at dd51ea976 TAP5-2686: Fix for the 404 error.

This branch includes the following new commits:

     new dd51ea976 TAP5-2686: Fix for the 404 error.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[tapestry-5] 01/01: TAP5-2686: Fix for the 404 error.

Posted by vl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vlamp pushed a commit to branch TAP5-2686
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git

commit dd51ea9767a95355257e4e892756a73fbf108453
Author: Volker Lamp <vl...@apache.org>
AuthorDate: Sat Jun 18 23:48:59 2022 +0200

    TAP5-2686: Fix for the 404 error.
    
    However, popovers won't work with the bundled Bootstrap until TAP5-2733
    has been done.
---
 .../apache/tapestry5/modules/JavaScriptModule.java   |  2 +-
 .../tapestry5/integration/app7/PopoverTest.groovy    | 20 ++++++++++++++++++++
 .../tapestry5/integration/app7/pages/Popover.java    | 16 ++++++++++++++++
 .../integration/app7/services/AppModule.java         | 11 +++++++++++
 .../test/resources/META-INF/modules/app/Popover.js   |  5 +++++
 .../tapestry5/integration/app7/pages/Index.tml       |  3 +++
 .../tapestry5/integration/app7/pages/Popover.tml     |  6 ++++++
 7 files changed, 62 insertions(+), 1 deletion(-)

diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/modules/JavaScriptModule.java b/tapestry-core/src/main/java/org/apache/tapestry5/modules/JavaScriptModule.java
index 63dfc5fcc..cbf5b8cd3 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/modules/JavaScriptModule.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/modules/JavaScriptModule.java
@@ -446,7 +446,7 @@ public class JavaScriptModule
                     bootstrapUtil.forFile("popper.js")));
             
             for (String name : new String[]{"alert", "button", "carousel", "collapse", "dropdown", "modal",
-                    "scrollspy", "tab", "tooltip"})
+                    "popover", "scrollspy", "tab", "tooltip"})
             {
                 Resource lib = bootstrapUtil.forFile(name + ".js");
                 if (lib.exists())
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app7/PopoverTest.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app7/PopoverTest.groovy
new file mode 100644
index 000000000..0ec4379e8
--- /dev/null
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app7/PopoverTest.groovy
@@ -0,0 +1,20 @@
+package org.apache.tapestry5.integration.app7
+
+import org.apache.tapestry5.integration.GroovyTapestryCoreTestCase
+import org.apache.tapestry5.test.TapestryTestConfiguration
+import org.testng.annotations.Test
+
+@TapestryTestConfiguration(webAppFolder = "src/test/app7")
+class PopoverTest extends GroovyTapestryCoreTestCase
+{
+	
+	/** TAP5-2686 */
+	@Test
+	void popover_js_accessible()
+	{
+		open "/modules.gz/bootstrap/popover.js"
+		waitForPageToLoad()
+		assertTextPresent("Bootstrap popover.js v4.3.1 (https://getbootstrap.com/)")
+	}
+
+}
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app7/pages/Popover.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app7/pages/Popover.java
new file mode 100644
index 000000000..8a87ca6e0
--- /dev/null
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app7/pages/Popover.java
@@ -0,0 +1,16 @@
+package org.apache.tapestry5.integration.app7.pages;
+
+import org.apache.tapestry5.annotations.Environmental;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
+
+public class Popover {
+
+	@Environmental
+	JavaScriptSupport jsSupport;
+	
+	void afterRender() {
+		jsSupport.require("app/Popover");
+	}
+
+	
+}
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app7/services/AppModule.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app7/services/AppModule.java
index 9d8c36c5b..aebaea91c 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app7/services/AppModule.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app7/services/AppModule.java
@@ -1,9 +1,20 @@
 package org.apache.tapestry5.integration.app7.services;
 
+import org.apache.tapestry5.SymbolConstants;
+import org.apache.tapestry5.commons.MappedConfiguration;
+import org.apache.tapestry5.ioc.annotations.Contribute;
 import org.apache.tapestry5.ioc.annotations.ImportModule;
+import org.apache.tapestry5.ioc.services.ApplicationDefaults;
+import org.apache.tapestry5.ioc.services.SymbolProvider;
 import org.apache.tapestry5.modules.Bootstrap4Module;
 
 @ImportModule(Bootstrap4Module.class)
 public class AppModule {
 
+	@Contribute(SymbolProvider.class)
+	@ApplicationDefaults
+	public static void configureTapestry(MappedConfiguration<String, Object> conf) {
+		conf.add(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER, "jquery");
+	}
+
 }
diff --git a/tapestry-core/src/test/resources/META-INF/modules/app/Popover.js b/tapestry-core/src/test/resources/META-INF/modules/app/Popover.js
new file mode 100644
index 000000000..732d28b92
--- /dev/null
+++ b/tapestry-core/src/test/resources/META-INF/modules/app/Popover.js
@@ -0,0 +1,5 @@
+require(['bootstrap/popover'], () => {
+	// Popovers are opt-in for performance reasons, so you must initialize them yourself.
+	// https://getbootstrap.com/docs/4.3/components/popovers/#example-enable-popovers-everywhere
+    $('[data-toggle="popover"]').popover()
+})
\ No newline at end of file
diff --git a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app7/pages/Index.tml b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app7/pages/Index.tml
index b3d222e45..39540137d 100644
--- a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app7/pages/Index.tml
+++ b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app7/pages/Index.tml
@@ -7,6 +7,9 @@
 		<li>
 			<t:pagelink t:page="Forms">Forms</t:pagelink>
 		</li>
+		<li>
+			<t:pagelink t:page="Popover">Popover</t:pagelink>
+		</li>
 	</ul>
 
 </div> 
\ No newline at end of file
diff --git a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app7/pages/Popover.tml b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app7/pages/Popover.tml
new file mode 100644
index 000000000..e92031b52
--- /dev/null
+++ b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app7/pages/Popover.tml
@@ -0,0 +1,6 @@
+<div t:type="layout" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd"
+	xmlns:p="tapestry:parameter" t:pageTitle="literal:Popover">
+
+	<button type="button" class="btn btn-lg btn-danger" data-toggle="popover" title="Popover title" data-content="And here is some amazing content. It is very engaging. Right?">Click to toggle popover</button>
+
+</div> 
\ No newline at end of file