Skip to content
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

[Backport stable-16.10.x] XWIKI-22485: Livedata option dropdown has no grouping semantics #3705

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,18 @@
.divider {
.nav-divider(@dropdown-divider-bg);
}

// Dividers within the dropdown with an improved semantic representation
li:has(> ul) + li:has(> ul) {
border-top: solid 1px @dropdown-divider-bg;
padding-top: ((@line-height-computed / 2) - 1);
}
li:has(> ul):has(+ li > ul) {
margin-bottom: ((@line-height-computed / 2) - 1);
}

// Links within the dropdown menu
> li > a {
// Links within the dropdown menu and submenus
> li > a, > li > ul > li > a {
display: block;
padding: 3px 20px;
clear: both;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@ function initWrapper() {

// Since the <li> elements does not have distinguishing attributes, we look for the layout items by looking at the
// elements located after the second separator (class dropdown-header).
// The lis passed here are both group lis and item lis. Group lis contain a title and their own item lis.
function findSecondDropdownHeaderIndex(lis) {
var dropdownHeadersCptr = 0;
var liIdx = 0;
for (; liIdx < lis.length; liIdx++) {
const li = lis.at(liIdx);
if (li.classes().includes('dropdown-header')) {
if (li.findAll('.dropdown-header').length > 0) {
dropdownHeadersCptr++;
}
if (dropdownHeadersCptr >= 2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,46 +47,50 @@
<ul class="dropdown-menu dropdown-menu-right">

<!-- Actions -->
<li class="dropdown-header">{{ $t('livedata.dropdownMenu.actions') }}</li>

<li>
<!-- Refresh -->
<a href="#" @click.prevent="logic.updateEntries()" class="livedata-action-refresh">
<XWikiIcon :icon-descriptor="{name: 'repeat'}" />
{{ $t('livedata.action.refresh') }}
</a>
<span class="dropdown-header">{{ $t('livedata.dropdownMenu.actions') }}</span>
<ul>
<li>
<!-- Refresh -->
<a href="#" @click.prevent="logic.updateEntries()" class="livedata-action-refresh">
<XWikiIcon :icon-descriptor="{name: 'repeat'}" />
{{ $t('livedata.action.refresh') }}
</a>
</li>
</ul>
</li>


<!-- Layouts -->
<li role="separator" class="divider"></li>

<li class="dropdown-header">{{ $t('livedata.dropdownMenu.layouts') }}</li>

<!-- Layout options -->
<li
v-for="layout in data.meta.layouts"
:key="layout.id"
:class="{
'disabled': isCurrentLayout(layout.id),
}"
>
<a href="#" @click.prevent="changeLayout(layout.id)">
<XWikiIcon :icon-descriptor="layout.icon"></XWikiIcon>
{{ layout.name }}
</a>
<li>
<span class="dropdown-header">{{ $t('livedata.dropdownMenu.layouts') }}</span>
<ul>
<!-- Layout options -->
<li
v-for="layout in data.meta.layouts"
:key="layout.id"
:class="{
'disabled': isCurrentLayout(layout.id),
}"
>
<a href="#" @click.prevent="changeLayout(layout.id)">
<XWikiIcon :icon-descriptor="layout.icon"></XWikiIcon>
{{ layout.name }}
</a>
</li>
</ul>
</li>

<!-- Panels -->
<li role="separator" class="divider"></li>

<li class="dropdown-header">{{ $t('livedata.dropdownMenu.panels') }}</li>

<li v-for="panel in logic.panels" :key="panel.id">
<a href="#" @click.prevent="logic.uniqueArrayToggle(logic.openedPanels, panel.id)">
<XWikiIcon :icon-descriptor="{name: panel.icon}"/>
{{ panel.name }}
</a>
<li>
<span class="dropdown-header">{{ $t('livedata.dropdownMenu.panels') }}</span>
<ul>
<li v-for="panel in logic.panels" :key="panel.id">
<a href="#" @click.prevent="logic.uniqueArrayToggle(logic.openedPanels, panel.id)">
<XWikiIcon :icon-descriptor="{name: panel.icon}"/>
{{ panel.name }}
</a>
</li>
</ul>
</li>

</ul>
Expand Down Expand Up @@ -130,7 +134,7 @@ export default {
<style>

.livedata-dropdown-menu {
// Similar to .flat-buttons()
/* Similar to .flat-buttons() */
.btn-default {
background-color: @breadcrumb-bg;
background-image: none;
Expand All @@ -143,6 +147,12 @@ export default {
.btn-default:hover, .btn-default:active, .btn-default:focus, .open .dropdown-toggle {
border-color: darken(@dropdown-divider-bg, 10%);
}

/* Style each section of the dropdown */
ul.dropdown-menu > li > ul {
list-style: none;
padding-left: 0;
}
}

.livedata-dropdown-menu .btn-default span {
Expand Down