mirror of https://github.com/xwiki-labs/cryptpad
created list in user menu dropdown
This commit is contained in:
parent
b10ec96e05
commit
dbc9cca1ff
|
@ -77,6 +77,63 @@
|
|||
display: block;
|
||||
}
|
||||
|
||||
li:not([class]) {
|
||||
& > a, & > span {
|
||||
color: @cp_dropdown-fg;
|
||||
border-radius: @variables_radius;
|
||||
padding: 5px;
|
||||
text-decoration: none;
|
||||
display: flex;
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
float: none;
|
||||
text-align: left;
|
||||
line-height: 1em;
|
||||
align-items: center;
|
||||
|
||||
&:not(.fa) {
|
||||
font: @dropdown_font;
|
||||
}
|
||||
&.fa, &.cptools {
|
||||
font-size: 18px;
|
||||
&::before {
|
||||
width: 40px;
|
||||
margin-left: -10px;
|
||||
text-align: center;
|
||||
}
|
||||
* {
|
||||
font: @dropdown_font;
|
||||
}
|
||||
}
|
||||
|
||||
.fa, .cptools {
|
||||
width: 20px;
|
||||
text-align: center;
|
||||
margin-right: 5px !important;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: @cp_dropdown-bg-hover;
|
||||
color: @cp_dropdown-fg;
|
||||
}
|
||||
|
||||
&.cp-dropdown-element-active {
|
||||
background-color: @cp_dropdown-bg-active;
|
||||
color: @cp_dropdown-fg;
|
||||
}
|
||||
|
||||
&.cp-app-hidden {
|
||||
display: none;
|
||||
}
|
||||
&.cp-app-disabled {
|
||||
cursor: not-allowed !important;
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
& > a, & > span {
|
||||
color: @cp_dropdown-fg;
|
||||
border-radius: @variables_radius;
|
||||
|
|
|
@ -1539,6 +1539,16 @@ define([
|
|||
if (typeof(item) === 'string') {
|
||||
$el[0].appendChild(document.createTextNode(item));
|
||||
}
|
||||
if (typeof item === 'object') {
|
||||
// case where item is an object, eg: an <a> tag
|
||||
var $subElement = $(h(item.tag, item.attributes || {}));
|
||||
if (typeof item.content === 'string') {
|
||||
$subElement.text(item.content);
|
||||
} else if (item.content instanceof Element) {
|
||||
$subElement.append(item.content);
|
||||
}
|
||||
$el.append($subElement);
|
||||
}
|
||||
});
|
||||
// array of elements or text nodes
|
||||
}
|
||||
|
@ -2102,9 +2112,18 @@ define([
|
|||
return true;
|
||||
};
|
||||
});
|
||||
var liOptions = options.map(function (option) {
|
||||
if (option.tag === 'hr' || option.tag === 'li') {
|
||||
return option;
|
||||
}
|
||||
return {
|
||||
tag: 'li',
|
||||
content: [option]
|
||||
};
|
||||
});
|
||||
var dropdownConfigUser = {
|
||||
buttonContent: $userButton[0],
|
||||
options: options, // Entries displayed in the menu
|
||||
options: liOptions, // Entries displayed in the menu
|
||||
left: true, // Open to the left of the button
|
||||
container: config.$initBlock, // optional
|
||||
feedback: "USER_ADMIN",
|
||||
|
|
Loading…
Reference in New Issue