-
Notifications
You must be signed in to change notification settings - Fork 49
docs: Document tableheader.html.twig helper and its new tooltip parameter #594
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
Draft
promptless-for-oss
wants to merge
1
commit into
mautic:7.2
Choose a base branch
from
Promptless:promptless/dev-tableheader-tooltip-16517
base: 7.2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -160,7 +160,7 @@ themes | |
| Themes | ||
| timeframe | ||
| Todo | ||
| tooltip | ||
| tooltips? | ||
| Transifex | ||
| Translator | ||
| TRUE | ||
|
|
||
This file contains hidden or 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,40 @@ | ||
| Table header template | ||
| ##################### | ||
|
|
||
| Introduction | ||
| ************ | ||
|
|
||
| The ``tableheader.html.twig`` template renders the ``<th>`` header cells for Mautic's list views. It handles the bulk-select checkbox column, plain non-sortable columns, and sortable or filterable columns, wiring up the sort links, per-column filter inputs, and session-persisted sort state for you. Include it once per column when you build a list table, rather than writing the header markup by hand. | ||
|
|
||
| Adding a header tooltip | ||
| *********************** | ||
|
|
||
| Pass an optional ``tooltip`` key to show a tooltip when a User hovers over a column header. The tooltip works on plain non-sortable columns and on sortable or filterable columns, as well as the bulk-select checkbox column, which already supported it. | ||
|
|
||
| .. code-block:: twig | ||
|
|
||
| {{ include('@MauticCore/Helper/tableheader.html.twig', { | ||
| text: 'mautic.lead.list.header', | ||
| tooltip: 'mautic.lead.list.header.tooltip', | ||
| sessionVar: 'contact', | ||
| orderBy: 'l.name', | ||
| }) }} | ||
|
|
||
| Mautic passes ``tooltip`` through the ``trans`` filter, so you can supply either a translation key or a literal string. Reload the list view and hover over the column header to see the tooltip. | ||
|
|
||
| Columns that don't pass ``tooltip`` render as before, with no tooltip markup, so existing list views stay unaffected until you opt in. | ||
|
|
||
| You don't need any JavaScript setup. Mautic initializes tooltips globally for any element carrying ``data-toggle="tooltip"``, so emitting the attribute is enough for the tooltip to appear. Mautic escapes the value you pass with the ``html_attr`` filter before rendering it into the ``data-original-title`` attribute. | ||
|
|
||
| Common parameters | ||
| ***************** | ||
|
|
||
| Configure the header by passing keys when you include the template. The most commonly used keys are: | ||
|
|
||
| * ``text``: the column label. Passed through the ``trans`` filter, so it accepts a translation key or a literal string. | ||
| * ``tooltip``: optional tooltip text shown on hover. Passed through the ``trans`` filter. | ||
| * ``sessionVar``: the session namespace for the list. When set, the header renders as a sortable or filterable column, and Mautic persists the sort and filter state under this key. | ||
| * ``orderBy``: the field to sort by. When set, the label becomes a clickable sort link; when omitted, it renders as a static label. | ||
| * ``class``: extra CSS class or classes to add to the ``<th>`` element. | ||
| * ``filterBy``: the field to filter by. When set, the header renders a per-column filter input. | ||
| * ``target``: the CSS selector for the table container that receives the sort and filter updates. Defaults to ``.page-list``. | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documented the new optional
tooltipkey added totableheader.html.twigin this PR, which extendsdata-toggle="tooltip"support from the bulk-selectcheckallcolumn to plain non-sortable and sortable/filterable columns. The example usage and the|trans+html_attrescaping behavior come directly from the PR's template diff and description.Source: mautic/mautic#16517