.. index:: ! Styling .. _styling: ======= Styling ======= The academic extensions render their frontend markup without a look of its own. Every element carries a class that says what it is, the classes follow the same system in every extension, and the extensions ship no stylesheet for them. The look is the job of the site package of a project. This chapter describes that system once for all academic extensions. The chapter :guilabel:`Styling` of each extension shows how the markup of its plugins is built up, see :ref:`styling-extensions`. .. contents:: :local: :depth: 2 .. _styling-shipped: What the extensions ship ======================== * **Markup and classes.** The templates, partials and layouts below :file:`Resources/Private/` of each extension. Their classes are described below. * **Behaviour.** The JavaScript modules that make a list filter in place, open a dialog of the study plan or run the profile editor. They find their elements by `data-*` attributes, with two exceptions, and each extension can switch its scripts off per site, see :ref:`styling-scripts`. * **No styling.** No extension ships a stylesheet for its markup. The stylesheets an extension loads are those of a library one of its scripts needs to work, the map library of the partner map, and they are loaded and switched off together with that script. The one other case is the standalone set `fgtclb/academic-persons-standalone` of :guilabel:`EXT:academic_persons`, an opt-in page object for an installation without a site package of its own, which loads the stylesheet and the script of Bootstrap 5 from jsDelivr. It renders a plain Bootstrap page around the plugins and does not style their markup. A project that installs an academic extension and adds no styles of its own sees the markup as its theme styles plain HTML: headings, lists, links, form fields and images, laid out by the grid classes the markup keeps (:ref:`styling-kept-classes`). .. _styling-class-system: The class system ================ An element carries up to three kinds of class: #. The **outermost element** of a plugin or page names the extension and the plugin, `academic--`. #. **Speaking classes** with the prefix `ace-` name what an element is, the same in every extension. #. A few **classes of Bootstrap and TYPO3** are kept on purpose, because a TYPO3 site styles them already. .. _styling-outermost-element: The outermost element --------------------- Every plugin renders one outermost element with a class of the pattern `academic--`, every page of a page type of an extension one with `academic--page`: .. code-block:: html
…
…
A few outermost classes do not follow the pattern exactly: * The partnerships list and teaser of :guilabel:`EXT:academic_partners`, `academic-partnerships-list` and `academic-partnerships-teaser`, name the partnerships rather than the extension. * The profile editor of :guilabel:`EXT:academic_persons_edit` is `academic-persons-profile-editing`. Its profile list carries two classes, `academic-persons-edit academic-persons-profile-editing-list`. * The study plan is a content element without plugins and carries `academic-study-plan`. The outermost class is the only class that tells the extensions and their plugins apart, and it is therefore the scope of every rule of a project stylesheet, see :ref:`styling-project`. The outermost element of each plugin is listed in the chapter :guilabel:`Styling` of its extension. A plugin leaves its width to the layout of its content element and carries no `container`. A page of a page type, a program, partner or project page, renders the main content of the site layout and carries `container` next to its class. .. _styling-speaking-classes: Speaking classes ---------------- A speaking class names the thing an element is, not the look it has in a theme: `ace-item` is one record of a list, whatever extension renders it, and `ace-label` the label of a value, whether it sits in a card, a table or a form. `ace` stands for academic extensions. An element carries the general class first and a more specific one next to it where there is one: the attributes of an item are an `ace-list ace-attributes` of `ace-list-item ace-attribute` entries, a filter is an `ace-filter ace-field ace-select-wrap`. A stylesheet that styles every list of a plugin selects `ace-list`, one that styles only the attributes selects `ace-attributes`. .. list-table:: :header-rows: 1 :widths: 22 38 40 * - Family - Classes - Meaning * - Content - `ace-content`, `ace-section`, `ace-hero` - The content of a plugin below the header of its content element, or of a part of it below its own head, a section with a title of its own, and the head of a page with its title and media. * - Items - `ace-itemlist`, `ace-item`, `ace-item-content`, `ace-empty` - A list of records, one record, an :html:`
` or a table row, the text of a record next to its image, and the message of a list without records. * - Lists - `ace-list`, `ace-list-item` - Any list, and one entry of it, also the parts of a value that has several, the addresses of a contact for example. * - Attributes - `ace-attributes`, `ace-attribute`, `ace-label`, `ace-value`, `ace-icon` - The properties of a record, one property, its label, its value and the icon in front of it. * - Headings - `ace-header`, `ace-title`, `ace-subtitle`, `ace-name` - The head of an element, mostly the :html:`
` around a heading, the heading or title of a record, a section or a dialog, the subtitle below it, and a name of a person. * - Links - `ace-link` - A link that is not a button: the link back to a list, the link of an active filter, the link that resets the filters. * - Actions - `ace-actions`, `ace-controls` - The group of buttons or controls of an element. * - Dialogs - `ace-dialog`, `ace-close` - A :html:``, and the button that closes it or a message. * - Forms - `ace-form`, `ace-field`, `ace--wrap`, `ace-label`, `ace-required`, `ace-control`, `ace-`, `ace-help`, `ace-field-errors`, `ace-field-error`, `ace-errors` - A form, one field with its label, the required mark, the control and its type, the help text and the messages of a field that failed validation, and the message above a form with such a field. See :ref:`styling-markup-form`. * - Filters - `ace-filters`, `ace-filter`, `ace-more`, `ace-toggle` - The filter and sorting bar of a list, one filter, the :html:`
` element that holds the filters beyond the visible ones, and its :html:``. * - Active filters - `ace-active-filters`, `ace-active-filter` - The list of the filters a visitor applied, next to `ace-list`, and one of them, next to `ace-list-item`. Each holds an `ace-link` that removes it, with an `ace-icon`. * - Count and status - `ace-count`, `ace-status` - A number, the number of results of a list for example, and the live region a script announces a changed result in. The live region is `visually-hidden` as well. * - Pagination - `f3-widget-paginator` - The pages of a list, see :ref:`styling-kept-classes`. * - State - `ace-state` - The state of a record shown as text, with the state as a second class, `ace-state active` for a running project for example. * - Contact - `ace-contact`, `ace-role` - A block of contact data, and the role of a contact person. * - Media - `ace-image`, `ace-picture`, `ace-figure`, `ace-caption`, `ace-description`, `ace-copyright`, `ace-map` - An image, the :html:`` around its sources, the :html:`
` of an image with a caption, the caption with its description and copyright, and a map. See :ref:`styling-markup-image`. * - Tables - `ace-table`, `ace-item`, `ace-label`, `ace-value` - A table view, its rows and its header and data cells. An extension with markup of its own adds a family with the same prefix, the semesters and modules of the study plan, `ace-semester` and `ace-module`, for example. Those are described in the chapter of that extension. .. _styling-states: States ------ A state an element is in is a class without prefix, or an HTML attribute: .. list-table:: :header-rows: 1 :widths: 25 75 * - State - Meaning * - `active` - The current entry of a navigation or pagination. * - `disabled` - An entry of a navigation or pagination that cannot be followed. * - `invalid` - A form field, and its wrapper, that failed validation, with `aria-invalid="true"` on the field. The profile editor of :guilabel:`EXT:academic_persons_edit` names this state `is-invalid`, the name of Bootstrap, see its chapter. * - :html:`open` - The attribute of an open :html:`
` or :html:``. * - :html:`hidden` - The attribute of an element a script shows when it is needed. A state a script sets is named in the chapter of the extension the script belongs to. .. _styling-kept-classes: Classes of Bootstrap and TYPO3 kept on purpose ---------------------------------------------- The markup keeps a few classes it did not invent. They belong to systems a TYPO3 site provides already, either through Bootstrap, which the most used site packages build on, or through TYPO3 itself. A project with such a theme gets layout, buttons and accessible hiding without a line of its own. The markup uses no other class of Bootstrap: no cards, no spacing or display utilities, no form classes. The one exception is the flash message of the job list, the job detail and the job form of :guilabel:`EXT:academic_jobs`, the confirmation after a submitted job among them. It is rendered by TYPO3 itself, as a :html:`
    ` of :html:`
  • ` entries, with the alert classes of Bootstrap. .. list-table:: :header-rows: 1 :widths: 30 70 * - Classes - Why they are kept * - `container` - The content width of a page of a page type. A plugin carries none, its width is the one of its content element layout. * - `row`, `col-*` - The grid of the item lists, the filter bars, the forms and the columns of a detail view. A responsive grid is layout, not look, and every Bootstrap theme provides it. * - `btn`, `btn-*` - The buttons of a form and links that act as a button, the application link of a program for example, with the button group `btn-group` and the close button `btn-close` of the profile editor. A theme styles its buttons through these classes, so the buttons of the plugins look like those of the site. Where the plugin has to tell its button from others, a speaking class stands next to them. * - `visually-hidden` - Text that a screen reader reads and a visitor does not see, the live region of a list for example. Hiding it is accessibility, not look, and must work on every site. * - `f3-widget-paginator`, `page-item`, `page-link` - The list of pages of a pagination is an `f3-widget-paginator`, the name the pagination of TYPO3 uses. The paginations of the job and partner lists name their entries `page-item` and `page-link`, as Bootstrap does. The pagination of the profile list names them `ace-list-item` and `ace-link` and its :html:`