Skip to content

Commit efe3c43

Browse files
authored
Merge branch '5.x' into ui-Displaying-Elements-Based-on-User-Permissions
2 parents 8a56ac6 + 8a9e169 commit efe3c43

File tree

24 files changed

+2087
-47
lines changed

24 files changed

+2087
-47
lines changed

.all-contributorsrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,24 @@
4141
"contributions": [
4242
"doc"
4343
]
44+
},
45+
{
46+
"login": "sumbria",
47+
"name": "Balbinder Sumbria",
48+
"avatar_url": "https://avatars.githubusercontent.com/u/6416992?v=4",
49+
"profile": "https://incodit.com",
50+
"contributions": [
51+
"doc"
52+
]
53+
},
54+
{
55+
"login": "Hugo-Prossaird",
56+
"name": "Hugo-Prossaird",
57+
"avatar_url": "https://avatars.githubusercontent.com/u/176997845?v=4",
58+
"profile": "https://github.com/Hugo-Prossaird",
59+
"contributions": [
60+
"doc"
61+
]
4462
}
4563
],
4664
"contributorsPerLine": 7,

.github/holopin.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
organization: mautic
2+
holobytes:
3+
- evolvingStickerId: cm1ti4x4c57560cjq2styaitm
4+
icon: avocado
5+
alias: hacktoberfest-2024

.github/styles/config/vocabularies/Mautic/accept.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ AJAX
22
allowlist
33
Amazon SES
44
Ameling
5+
ascenders
56
autoloader
67
Autoloader
78
autowire
@@ -25,6 +26,7 @@ CloudAMQP
2526
Codeception
2627
Codecov
2728
Company(ies)
29+
Composability
2830
Composer
2931
Config
3032
config
@@ -48,8 +50,6 @@ Firewalls
4850
firewalls
4951
Focus Item
5052
Focus Items
51-
Forms
52-
forms
5353
Froala
5454
Froogaloop
5555
gcm
@@ -71,6 +71,8 @@ HubSpot
7171
IDP
7272
IMAP
7373
infographics
74+
Initialisms
75+
initialisms
7476
ISO
7577
JavaScript
7678
Joomla
@@ -109,6 +111,8 @@ Plugin
109111
Plugins
110112
post
111113
POST
114+
ProTip
115+
ProTips
112116
PUT
113117
PyCharm
114118
Rackspace
@@ -138,7 +142,6 @@ Themes
138142
timeframe
139143
Todo
140144
tooltip
141-
Tooltip
142145
Transifex
143146
Translator
144147
TRUE

.gitpod.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ vscode:
1111
- [email protected] # See https://github.com/mautic/user-documentation/pull/334#issuecomment-2405922370 before upgrading. - errata-ai.vale-server
1212
- eamodio.gitlens
1313
- trond-snekvik.simple-rst
14+
15+
ports:
16+
- port: 3000

.well-known/funding-manifest-urls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://github.com/mautic/mautic/blob/5.x/funding.json

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![Documentation Status][RTD badge URL]][RTD URL]
22
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
3-
[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)
3+
[![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors-)
44
<!-- ALL-CONTRIBUTORS-BADGE:END -->
55

66
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/mautic/developer-documentation-new)
@@ -124,6 +124,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
124124
<td align="center" valign="top" width="14.28%"><a href="https://github.com/shinde-rahul"><img src="https://avatars.githubusercontent.com/u/1046788?v=4?s=100" width="100px;" alt="Rahul Shinde"/><br /><sub><b>Rahul Shinde</b></sub></a><br /><a href="https://github.com/mautic/developer-documentation-new/commits?author=shinde-rahul" title="Documentation">📖</a></td>
125125
<td align="center" valign="top" width="14.28%"><a href="https://dennisameling.com"><img src="https://avatars.githubusercontent.com/u/17739158?v=4?s=100" width="100px;" alt="Dennis Ameling"/><br /><sub><b>Dennis Ameling</b></sub></a><br /><a href="https://github.com/mautic/developer-documentation-new/commits?author=dennisameling" title="Documentation">📖</a> <a href="https://github.com/mautic/developer-documentation-new/pulls?q=is%3Apr+reviewed-by%3Adennisameling" title="Reviewed Pull Requests">👀</a></td>
126126
<td align="center" valign="top" width="14.28%"><a href="http://ifeoluwafavour.hashnode.dev"><img src="https://avatars.githubusercontent.com/u/64481442?v=4?s=100" width="100px;" alt="Ife"/><br /><sub><b>Ife</b></sub></a><br /><a href="https://github.com/mautic/developer-documentation-new/commits?author=ifeoluwafavour" title="Documentation">📖</a></td>
127+
<td align="center" valign="top" width="14.28%"><a href="https://incodit.com"><img src="https://avatars.githubusercontent.com/u/6416992?v=4?s=100" width="100px;" alt="Balbinder Sumbria"/><br /><sub><b>Balbinder Sumbria</b></sub></a><br /><a href="https://github.com/mautic/developer-documentation-new/commits?author=sumbria" title="Documentation">📖</a></td>
128+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Hugo-Prossaird"><img src="https://avatars.githubusercontent.com/u/176997845?v=4?s=100" width="100px;" alt="Hugo-Prossaird"/><br /><sub><b>Hugo-Prossaird</b></sub></a><br /><a href="https://github.com/mautic/developer-documentation-new/commits?author=Hugo-Prossaird" title="Documentation">📖</a></td>
127129
</tr>
128130
</tbody>
129131
</table>

docs/design/accordion.rst

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
Accordion component
2+
###################
3+
4+
Introduction
5+
************
6+
7+
The Accordion Component allows developers to create collapsible sections within their Mautic templates. This Component is useful for organizing content into expandable and collapsible panels, enhancing the User experience by making large amounts of content more manageable.
8+
9+
10+
Template structure
11+
******************
12+
13+
The ``accordion.html.twig`` template defines this accordion component. The template employs a list structure ``<ul>`` where each item ``<li>`` represents an accordion panel. Each panel consists of a heading and a collapsible content section.
14+
15+
Key features
16+
============
17+
18+
- Clicking on the heading expands or collapses each accordion item.
19+
- The component includes ARIA attributes to improve accessibility.
20+
- You can customize the content of each accordion panel using Twig variables.
21+
22+
Applying the accordion component
23+
================================
24+
25+
To use the accordion component, include it in your template and pass the necessary data.
26+
27+
Define the content you want to include in the accordion. For example, if you want to include a group of UTM tags fields, you can define the content as follows:
28+
29+
.. code-block:: twig
30+
31+
{% set utmTagsContent %}
32+
{% for i, utmTag in form.utmTags %}
33+
{{ form_row(utmTag) }}
34+
{% endfor %}
35+
{% endset %}
36+
37+
.. vale off
38+
39+
.. note::
40+
For instance, you can loop over Form fields or any other data to generate the content dynamically.
41+
42+
.. vale on
43+
44+
Include the ``accordion.html.twig`` template in your main template and pass an array of items. Each item should have:
45+
46+
- ``id``: a unique identifier.
47+
- ``title``: the title of the accordion item.
48+
- ``padding_inline``: optional boolean to control padding within the content. Defaults to true if not defined.
49+
- ``content``: the content displays when the item expands.
50+
51+
Example:
52+
53+
.. code-block:: twig
54+
55+
{% include '@MauticCore/Helper/accordion.html.twig' with {
56+
'items': [
57+
{
58+
'id': 'UTM',
59+
'title': 'mautic.email.utm_tags',
60+
'padding_inline': false,
61+
'content': utmTagsContent,
62+
}
63+
]
64+
} %}
65+
66+
While defining a ``set`` block separately isn't strictly necessary, it can be helpful to ensure that operations relying on Twig functions keep working correctly. The ``set`` block allows you to predefine complex content or operations, making your template cleaner and more maintainable.
67+
68+
Example without the ``set`` block
69+
---------------------------------
70+
71+
If your content is simple, you can directly include it within the ``items`` array without using a ``set`` block. Here's an example:
72+
73+
.. code-block:: twig
74+
75+
{% include '@MauticCore/Helper/accordion.html.twig' with {
76+
'items': [
77+
{
78+
'id': 'Example',
79+
'title': 'Example Title',
80+
'padding_inline': true,
81+
'content': '<p>This is a simple content example.</p>',
82+
}
83+
]
84+
} %}
85+
86+
This flexibility allows you to choose the best approach based on each case.
87+
88+
Automatic CSS handling
89+
======================
90+
91+
When using the Component, all necessary CSS styles are automatically handled for you. This means that the Component comes pre-styled with classes such as ``accordion-heading``, ``accordion-wrapper``, and ``accordion-content``, ensuring a consistent and visually appealing appearance out of the box.
92+
93+
- The Component includes predefined CSS classes that manage the layout, spacing, and interactive elements of the accordion.
94+
- You don't need to add any extra CSS to make the accordion function and look visually appealing.
95+
- It uses the existing Bootstrap function for collapsing panels.
96+
- Avoid overriding these classes in your own CSS.
97+
98+
The design of the accordion makes it easy to implement, with all essential CSS styles already in place. This allows you to focus on integrating and using the component without worrying about additional styling.
99+
100+
Complete example
101+
================
102+
103+
Here is a complete example that demonstrates how to use the accordion Component in a Mautic template:
104+
105+
.. code-block:: twig
106+
107+
{% set utmTagsContent %}
108+
{% for i, utmTag in form.utmTags %}
109+
{{ form_row(utmTag) }}
110+
{% endfor %}
111+
{% endset %}
112+
113+
{% include '@MauticCore/Helper/accordion.html.twig' with {
114+
'items': [
115+
{
116+
'id': 'UTM',
117+
'title': 'mautic.email.utm_tags',
118+
'padding_inline': false,
119+
'content': utmTagsContent,
120+
}
121+
]
122+
} %}
123+
124+
For more complex structures, with dozens of accordion items, you might prefer to copy the structure and build something unique, but the best approach would be to place each content under a set block.

docs/design/availability.rst

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
Depicting availability of interface elements
2+
############################################
3+
4+
The state of interface elements is a crucial aspect of user interface design, providing visual feedback and preventing interaction when certain actions aren't allowed.
5+
6+
Working with tabs
7+
*****************
8+
9+
Mautic uses the following CSS code to style tabs which aren't available for interaction:
10+
11+
.. code-block:: css
12+
13+
.nav-tabs.nav-tabs-contained > li.disabled {
14+
cursor: not-allowed;
15+
color: var(--text-disabled);
16+
}
17+
18+
.nav-tabs.nav-tabs-contained > li.disabled > a {
19+
background-color: var(--button-disabled);
20+
pointer-events: none;
21+
}
22+
23+
This CSS accomplishes the following:
24+
25+
* Sets the cursor to ``not-allowed`` for tabs which can't be interacted with, indicating that interaction is prohibited.
26+
* Changes the text color to a predefined inactive state color.
27+
* Modifies the background color of the tab to visually represent its inactive state.
28+
* Prevent click events on the tab using ``pointer-events: none``.
29+
30+
To dynamically deactivate tabs, use JavaScript to add or remove the ``disabled`` class. Here's an example function:
31+
32+
.. code-block:: javascript
33+
34+
Mautic.togglePermissionVisibility = function () {
35+
setTimeout(function () {
36+
if (mQuery('#role_isAdmin_0').prop('checked')) {
37+
mQuery('#permissions-tab').removeClass('disabled');
38+
} else {
39+
mQuery('#permissions-tab').addClass('disabled');
40+
}
41+
}, 10);
42+
};
43+
44+
This function:
45+
46+
* Checks the state of a checkbox - ``#role_isAdmin_0``.
47+
* Adds or removes the ``disabled`` class from the permissions tab based on the checkbox state.
48+
49+
To implement inactive states for tabs:
50+
51+
1. Assign unique IDs to your tab elements.
52+
2. Use JavaScript to toggle the ``disabled`` class on the appropriate ``<li>`` elements.
53+
54+
.. note::
55+
Always use inactive states instead of hiding elements.

0 commit comments

Comments
 (0)