You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Volker Lamp (Jira)" <ji...@apache.org> on 2022/06/17 17:13:00 UTC
[jira] [Commented] (TAP5-2686) require('bootstrap/popover') fails when using bootstrap 4
[ https://issues.apache.org/jira/browse/TAP5-2686?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17555708#comment-17555708 ]
Volker Lamp commented on TAP5-2686:
-----------------------------------
h4. Cause analysis
Even though {{popover.js}} is present (part of Bootstrap, see {{{}/tapestry-core/src/main/resources/META-INF/assets/tapestry5/bootstrap4/js/popover.js{}}}), it is not set up as a module (see {{{}JavaScriptModule.java:448{}}}), for no obvious reason, probably simply forgotten.
h4. Workaround
Users can add the missing module setup by contributing to {{ModuleManager}} like so:
{{@Contribute(ModuleManager.class)}}
{{public static void addPopover(MappedConfiguration<String, Object> config,}}
{{ @Path("${tapestry.asset.root}/bootstrap4/js/bootstrap-util.js")}}
{{ Resource bootstrapUtil)}}
{{ Resource popover = bootstrapUtil.forFile("popover.js");}}
{{ config.add}}
{{ (}}
{{ "bootstrap/popover", new JavaScriptModuleConfiguration(popover)}}
{{ .dependsOn("bootstrap/bootstrap-util")}}
{{ .dependsOn("bootstrap/popper")}}
{{ );}}
Unfortunately, this doesn't suffice to make popovers work due to a bug in the dependency definition (see {{popover.js:8:84}} - The '.js' in {{bootstrap/tooltip.js}} is wrong, it should simply say {{bootstrap/tooltip}}). The necessary change was made in Bootstrap 4.6.0. Users would have to add Bootstrap 4.6.+ to their project manually and configure Tapestry to use it (via the {{tapestry.bootstrap-root}} configuration symbol) instead of the built-in Bootstrap 4.3.1.
> require('bootstrap/popover') fails when using bootstrap 4
> ---------------------------------------------------------
>
> Key: TAP5-2686
> URL: https://issues.apache.org/jira/browse/TAP5-2686
> Project: Tapestry 5
> Issue Type: Bug
> Components: tapestry-core
> Affects Versions: 5.5.0, 5.6.0, 5.6.1, 5.6.2, 5.7.0, 5.6.3, 5.7.1, 5.7.2, 5.6.4, 5.7.3, 5.8.0, 5.8.1
> Reporter: Raigo Aljand
> Assignee: Volker Lamp
> Priority: Major
> Labels: bootstrap, javascript
>
> This code fails when using bootstrap 4:
> {code:java}
> require(['bootstrap/popover'], () => {
> console.log('success');
> })
> {code}
> The server returns a 404 error code when the browser requests for the bootstrap/popover module.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)