Message Boards
Opening a modal using "plus" button from clay:management-toolbar taglib
Rui António, modified 3 Years ago.
Opening a modal using "plus" button from clay:management-toolbar taglib
New Member Posts: 5 Join Date: 1/20/20 Recent Posts
Hi all,
I'm building a custom admin panel module in Liferay 7.2.1 GA2 release. My view.jsp has a clay:management-toolbar taglib and now I need to build the action for the "plus" button. I want to open a modal when it's clicked, like the "plus" button of Site Builder -> Navigation Menus
I looked into this file /modules/apps/site-navigation/site-navigation-admin-web/src/main/resources/META-INF/resources/view.jsp from liferay source code to understand how it's done.
Right now, I have a class that extends com.liferay.frontend.taglib.clay.servlet.taglib.display.context.SearchContainerManagementToolbarDisplayContext, already overrided getCreationMenu() method to have this "plus" button, copied ManagementToolbarDefaultEventHandler.es.js from site-navigation-admin-web into my admin panel module and also included the following taglib to call it:
Missing dependency ':ERROR:Missing version constraints for anonymous-questions-admin-panel$frontend-js-web in package.json of anonymous-questions-admin-panel@1.0.0' of 'anonymous-questions-admin-panel@1.0.0/js/ManagementToolbarDefaultEventHandler.es'
In my module I have created this package.json:
Is it how this event handler should be implemented ? How can I solve my problem with this frontend-js-web dependeny ?
I'm building a custom admin panel module in Liferay 7.2.1 GA2 release. My view.jsp has a clay:management-toolbar taglib and now I need to build the action for the "plus" button. I want to open a modal when it's clicked, like the "plus" button of Site Builder -> Navigation Menus
I looked into this file /modules/apps/site-navigation/site-navigation-admin-web/src/main/resources/META-INF/resources/view.jsp from liferay source code to understand how it's done.
Right now, I have a class that extends com.liferay.frontend.taglib.clay.servlet.taglib.display.context.SearchContainerManagementToolbarDisplayContext, already overrided getCreationMenu() method to have this "plus" button, copied ManagementToolbarDefaultEventHandler.es.js from site-navigation-admin-web into my admin panel module and also included the following taglib to call it:
<liferay-frontend:component componentId="<%= channelsAdminManagementToolbarDisplayContext.getDefaultEventHandler() %>" module="js/ManagementToolbarDefaultEventHandler.es" />
This module is deployed successfully, but when I try to open the page it throws this js error:Missing dependency ':ERROR:Missing version constraints for anonymous-questions-admin-panel$frontend-js-web in package.json of anonymous-questions-admin-panel@1.0.0' of 'anonymous-questions-admin-panel@1.0.0/js/ManagementToolbarDefaultEventHandler.es'
In my module I have created this package.json:
{
"dependencies": {
"metal-dom": "2.16.8",
"metal-drag-drop": "3.3.1",
"metal-position": "2.1.2",
"metal-state": "2.16.8"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.4",
"@babel/preset-env": "^7.9.6",
"liferay-npm-bundler": "^2.18.5"
},
"main": "js/ManagementToolbarDefaultEventHandler.es.j",
"name": "anonymous-questions-admin-panel",
"private": true,
"scripts": {
"build": "babel --source-maps -d build/resources/main/META-INF/resources src/main/resources/META-INF/resources && liferay-npm-bundler"
},
"version": "1.0.0"
}
I already tried to include "frontend-js-web": "*" dependency into package.json as it is in package.json from site-navigation-admin-web module, but it doesn't solve my problem. Is it how this event handler should be implemented ? How can I solve my problem with this frontend-js-web dependeny ?