cnil-2023: add forms counter in current forms & current drafs cell title (#82813)
gitea/publik-base-theme/pipeline/head This commit looks good Details

This commit is contained in:
Thomas Jund 2023-11-06 17:51:59 +01:00 committed by Thomas Jund
parent 2dacb17e11
commit 04038faeed
2 changed files with 44 additions and 20 deletions

View File

@ -314,27 +314,39 @@ div.cell.foldable > div > h2:first-child {
.wcs-current-drafts-cell,
.wcs-current-forms-cell {
@extend .bordered-links-list;
.list-of-forms {
.form-title {
flex-grow: 1;
font-family: $ff-serif;
.gru-content &.cell {
// Forms counter
.cell--title, h2:first-child {
display: flex;
.cnil-forms-counter {
flex-grow: 1;
text-align: right;
color: $font-color;
margin-left: .66em;
}
}
.form-number {
flex-grow: 0;
font-family: $ff-serif;
font-weight: normal;
opacity: 1;
color: $gray;
font-size: $font-size-small;
}
.form-digest {
color: $font-color;
}
.form-status {
font-family: $ff-serif;
font-size: $fz-small;
color: $blue;
@extend .bordered-links-list;
.list-of-forms {
.form-title {
flex-grow: 1;
font-family: $ff-serif;
}
.form-number {
flex-grow: 0;
font-family: $ff-serif;
font-weight: normal;
opacity: 1;
color: $gray;
font-size: $font-size-small;
}
.form-digest {
color: $font-color;
}
.form-status {
font-family: $ff-serif;
font-size: $fz-small;
color: $blue;
}
}
}
}

12
static/cnil-2023/extra.js Normal file
View File

@ -0,0 +1,12 @@
// Add forms counter after cell title
$(document).on('combo:cell-loaded', function(e, cell){
const cellType = ["wcs-current-forms-cell", "wcs-current-drafts-cell"]
if (cellType.some(className => cell.classList.contains(className))) {
const title = cell.querySelector("h2")
const nbForms = cell.querySelectorAll('.list-of-forms > ul > li').length
const nbTag = document.createElement('span')
nbTag.classList.add('cnil-forms-counter')
nbTag.innerText = nbForms
title.appendChild(nbTag)
}
})