Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Show content as accordions in element information modal
The element information modal displays both field information for the current record and its references. The more fields there are in a table and the more content the specific record contains, the more the reference sections disappear from view. The three sections are now displayed as accordions to enable the user to decide for themselves which sections are relevant to them. In addition, the display of non-existent records in the reference sections has been adjusted and information about the paths/storage locations has been removed, as these can already be viewed in the record's editing mask. Resolves: #102469 Releases: main Change-Id: Ia4ba85921d7be2ab30477e8248d4fb8734f6eaaf Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81873 Tested-by: Garvin Hicking <gh@faktor-e.de> Tested-by: core-ci <typo3@b13.com> Tested-by: Jasmina Ließmann <minapokhalo+typo3@gmail.com> Reviewed-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Jasmina Ließmann <minapokhalo+typo3@gmail.com> Tested-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Garvin Hicking <gh@faktor-e.de>
- Loading branch information
Showing
7 changed files
with
284 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
import DocumentService from '@typo3/core/document-service'; | ||
import RegularEvent from '@typo3/core/event/regular-event'; | ||
import Icons from '@typo3/backend/icons'; | ||
|
||
/** | ||
* Module: @typo3/backend/element-information | ||
* @exports @typo3/backend/element-information | ||
*/ | ||
class ElementInformation { | ||
constructor() { | ||
DocumentService.ready().then((): void => { | ||
document.querySelectorAll('div[data-persist-collapse-state]').forEach((element: HTMLElement): void => { | ||
const isCollapsed: boolean = !element.classList.contains('show'); | ||
const collapseTrigger: HTMLElement = document.querySelector('.t3js-toggle-table[data-bs-target="#' + element.id + '"]'); | ||
if (collapseTrigger !== null) { | ||
collapseTrigger.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true'); | ||
collapseTrigger.classList.toggle('collapsed', isCollapsed); | ||
const collapseIcon: HTMLElement = collapseTrigger.querySelector('.t3js-icon'); | ||
if (collapseIcon !== null) { | ||
this.replaceIcon(isCollapsed, collapseIcon) | ||
} | ||
} | ||
}) | ||
|
||
new RegularEvent('show.bs.collapse', this.toggleCollapseIcon.bind(this)).bindTo(document); | ||
new RegularEvent('hide.bs.collapse', this.toggleCollapseIcon.bind(this)).bindTo(document); | ||
}); | ||
} | ||
|
||
private toggleCollapseIcon(e: Event): void { | ||
const collapseIcon: HTMLElement = document.querySelector('.t3js-toggle-table[data-bs-target="#' + (e.target as HTMLElement).id + '"] .t3js-icon'); | ||
if (collapseIcon !== null) { | ||
this.replaceIcon(e.type === 'hide.bs.collapse', collapseIcon) | ||
} | ||
} | ||
|
||
private replaceIcon(isCollapsed: boolean, collapseIcon: HTMLElement): void { | ||
Icons | ||
.getIcon((isCollapsed ? 'actions-view-list-expand' : 'actions-view-list-collapse'), Icons.sizes.small) | ||
.then((icon: string): void => { | ||
collapseIcon.replaceWith(document.createRange().createContextualFragment(icon)); | ||
}); | ||
} | ||
} | ||
|
||
export default new ElementInformation(); |
282 changes: 188 additions & 94 deletions
282
typo3/sysext/backend/Resources/Private/Templates/ContentElement/ElementInformation.html
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
typo3/sysext/backend/Resources/Public/JavaScript/element-information.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters