Cheers for that. I am happy that it is working, and no worries about using leptonx.createContextMenuWithin
.
I more was talking about where I ended up having to call it from, the event handler issues, and the change I made to pass document.querySelector('#lpx-toolbar')
instead of using the 'notification-bar' id - was just checking whether I had gone the right way with these.
Anyway it is working so I will close. Thanks again for that.
Sorry I didn't reply earlier - took me a while to get back to it and also took me a while to get it working. I did get it working, but had to make a few changes:
leptonx.createContextMenuWithin(document.querySelector('#lpx-toolbar'), 'notification-bar');
This all became a little messier than the suggested solution, so if you have a better way to achieve this, or an answer to why it didn't work using your first solution, please let me know.
Thanks!
ABP Framework version: v8.3.4
Hi
My project is using the LeptonX theme (commercial) with a side menu. I am wanting to add a button to the toolbar that toggles a context menu/pane, in a similar way to how the User and Settings buttons work. This will be for Notifications, and will pretty much look and operate like the Notification icon in the LeptonX theme demo (see screenshot).
I can add a link to the toolbar easily enough. Then, digging into the theme code, I can see that the User and Settings links are implemented with a custom attribute called 'data-lpx-ctx-toggle', and the context menu has 'data-lpx-context-menu'. JavaScript selects on these attributes, and registers event handlers so that clicking on the link shows the pop-up. I have done the same sort of thing, but no event handler gets registered for it. I am therefore assuming the 'user-context-menu' and 'settings-context-menu' are coded into the JavaScript? If this is the case, is there an accepted way to add a custom context menu like this? Or, if not the case and the JavaScript is generic in adding using these attributes, is there a way to get this to work just using these attributes?
Prototype code:
<ul class="lpx-nav-menu">
<li class="outer-menu-item" id="notificationItem">
<a href="#" class="lpx-menu-item-link active-menu-item" data-lpx-ctx-toggle="notification-context-menu">
<span class="lpx-menu-item-icon">
@* <small class="menu-item-badge">2</small> *@
<i class="lpx-icon action-icon bi bi-bell-fill" aria-hidden="true"></i>
</span>
</a>
</li>
</ul>
<div class="lpx-context-menu" data-lpx-context-menu="notification-context-menu">
<ul class="lpx-nav-menu-notification">
<li class="outer-menu-item">
<a class="lpx-menu-item-link lpx-menu-item">
<span class="lpx-menu-item-icon">
<i class="lpx-icon outer-icon bi bi-bell-fill" aria-hidden="true"></i>
</span>
<span class="lpx-menu-item-text">Notifications
@* <span class="lpx-badge">2 NEW</span> *@
</span>
<span data-lpx-close="settings-context-menu">
<i class="lpx-icon bi bi-x outer-icon dd-icon" aria-hidden="true"></i>
</span>
</a>
</li>
</ul>
<div class="lpx-button-container">
<button class="lpx-button">See All Notifications</button>
</div>
</div>
LeptonX Demo Example:
Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
If you're creating a bug/problem report, please include followings:
Hi
We are currently evaluating ABP Commercial with the intention to purchase the Business license at the end of the trial if all goes well (really positive about it so far - it will save me a lot of time as the only developper in my organisation). We have some questions regarding whether ABP will be able to support requirements we have for the application we are building. Hoping you can provide some guidance on these.
Thanks! Matt