-
-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to extend user drop down view? #733
Comments
Try something like this in JavaScript addEventListener('rl-view-model.create', e => {
if ('SystemDropDown' === e.detail.viewModelTemplateID) {
let view = e.detail;
view.customClick = () => {
alert('customClick');
};
document
.getElementById('SystemDropDown')
.content
.querySelector('menu')
.append(Element.fromHTML(`<li role="presentation">
<a href="#" tabindex="-1" data-bind="click: customClick" data-icon="⏻" data-i18n="GLOBAL/TEST"></a>
</li>`));
}
}); This code modifies the original I'm also using this method for other extensions like the Different approach is the Nextcloud plugin that add features to the messages list, message view and the composer dialog for integrations with Nextcloud. |
@the-djmaze Amazing 🎉 . This works as expected. |
It would also be interesting to allow ordering of items in the drop down |
I was able to achieve required positioning with this document.getElementById('SystemDropDown')
.content
.querySelector('menu')
.children[4]
.insertAdjacentElement("afterEnd", Element.fromHTML(`<li role="presentation">
<a href="#" tabindex="-1" data-icon="⏻" data-i18n="GLOBAL/TEST"></a>
</li>`)); |
Better to find Or even more advanced: querySelector(`menu .dividerbar + li`).after( Element.fromHTML() ); |
Hi @the-djmaze added this to the developer documentation inside the wiki: https://github.com/the-djmaze/snappymail/wiki/Developer-Documentation#modify-the-ui-of-snappymail-at-runtime . |
Well, that would be the best :) |
👍 . Would you like that I make a comment on the issues that have been ported to the documentation to remove the "documentation" flag or do we leave everything as it is? |
Is your feature request related to a problem? Please describe.
currently it is not possible to extend drop down view of user. This adds limited functionality for plugin developers to add new features to drop down menu
Describe the solution you'd like
Something similar like
addSettingsViewModel
would be interesting to have for drop downDescribe alternatives you've considered
Overwrite
snappymail/v/0.0.0/app/templates/Views/User/SystemDropDown.html
with custom changesAdditional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: