Skip to content

Commit

Permalink
fix vale
Browse files Browse the repository at this point in the history
  • Loading branch information
favour-chibueze committed Aug 7, 2024
1 parent d5df5a5 commit 6a58604
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions docs/design/notifications.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ Accessibility
- Notifications should be accessible and not rely solely on color to convey status, as this can be problematic for Users with color blindness, so use additional HTML attributes according to the notification type.
- Toast notifications with interactive content shouldn't automatically disappear to remain WCAG 2.1 compliant.

Check warning on line 42 in docs/design/notifications.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Acronyms] Spell out 'WCAG', if it's unfamiliar to the audience. Raw Output: {"message": "[Google.Acronyms] Spell out 'WCAG', if it's unfamiliar to the audience.", "location": {"path": "docs/design/notifications.rst", "range": {"start": {"line": 42, "column": 92}}}, "severity": "INFO"}

Using notification components
.. vale off
Using notification Components
=============================

.. vale on
Standard notifications with icons
---------------------------------

Expand Down Expand Up @@ -86,11 +90,11 @@ This creates a more substantial notification block with a heading and paragraph,
Notifications for the notifications panel
=========================================

Notifications under the panel are managed through the ``NotificationModel`` class, which is defined in ``NotificationModel.php``.
The ``NotificationModel`` class in ``NotificationModel.php`` manages notifications under the panel.

.. note::

The notification template is defined in ``notification.html.twig``.
The system defines the notification template in ``notification.html.twig``.

Creating a notification
-----------------------
Expand Down Expand Up @@ -122,19 +126,19 @@ Parameters:
- ``$message`` (string): the main content of the notification.

Check warning on line 127 in docs/design/notifications.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Parens] Use parentheses judiciously. Raw Output: {"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "docs/design/notifications.rst", "range": {"start": {"line": 127, "column": 16}}}, "severity": "INFO"}
- ``$type`` (string|null): identifies the source and style of the notification (optional).

Check warning on line 128 in docs/design/notifications.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Parens] Use parentheses judiciously. Raw Output: {"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "docs/design/notifications.rst", "range": {"start": {"line": 128, "column": 13}}}, "severity": "INFO"}
- ``$isRead`` (boolean): indicates if the notification has been read (default: true).
- ``$isRead`` (boolean): indicates if the system has marked the notification as read (default: true).
- ``$header`` (string|null): the header text for the notification (required).

Check warning on line 130 in docs/design/notifications.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Parens] Use parentheses judiciously. Raw Output: {"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "docs/design/notifications.rst", "range": {"start": {"line": 130, "column": 15}}}, "severity": "INFO"}
- ``$iconClass`` (string|null): CSS class for the notification icon (for example, 'ri-eye-line').

Check warning on line 131 in docs/design/notifications.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Parens] Use parentheses judiciously. Raw Output: {"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "docs/design/notifications.rst", "range": {"start": {"line": 131, "column": 18}}}, "severity": "INFO"}

Check warning on line 131 in docs/design/notifications.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Colons] ': C' should be in lowercase. Raw Output: {"message": "[Google.Colons] ': C' should be in lowercase.", "location": {"path": "docs/design/notifications.rst", "range": {"start": {"line": 131, "column": 31}}}, "severity": "WARNING"}
- ``$datetime`` (\\DateTime|null): creation date of the notification.

Check warning on line 132 in docs/design/notifications.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Parens] Use parentheses judiciously. Raw Output: {"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "docs/design/notifications.rst", "range": {"start": {"line": 132, "column": 1}}}, "severity": "INFO"}
- ``$user`` (User|null): User object associated with the notification (defaults to current user).
- ``$user`` (User|null): the User object associated with the notification defaults to the current User.

Check warning on line 133 in docs/design/notifications.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Parens] Use parentheses judiciously. Raw Output: {"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "docs/design/notifications.rst", "range": {"start": {"line": 133, "column": 13}}}, "severity": "INFO"}
- ``$deduplicateValue`` (string|null): used to prevent duplicate notifications within a specified timeframe.

Check warning on line 134 in docs/design/notifications.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Parens] Use parentheses judiciously. Raw Output: {"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "docs/design/notifications.rst", "range": {"start": {"line": 134, "column": 25}}}, "severity": "INFO"}
- ``$deduplicateDateTimeFrom`` (\\DateTime|null): customizes the ``deduplication timeframe``.

.. vale on
.. note::

The header should only contain the translation string; Twig will handle the translation.
The header should only contain the translation string; Twig handles the translation.


Notification types
Expand All @@ -154,7 +158,7 @@ The ``$type`` parameter determines the visual style of the notification:
Example usage
-------------

Here's an example of how to create a notification when a Contact export is scheduled:
Here's how to create a notification when you schedule a Contact export:

.. code-block:: php
Expand All @@ -175,8 +179,8 @@ Here's an example of how to create a notification when a Contact export is sched
);
}
This use case showcases how the NotificationModel can be integrated into event-driven processes within Mautic.
This use case shows how to integrate the NotificationModel into event-driven processes within Mautic.
This example calls the ``addNotification`` method with specific parameters tailored to the Contact export scenario. The Translator service handles the ``$message`` parameter to generate a localized message. This approach includes the User's Email address in the notification message. The system uses the translation key ``mautic.lead.export.being.prepared`` with the parameter ``%user_email%``, replacing it with the actual Email of the User who scheduled the export. This method allows for dynamic content insertion into the translated string.
If the User's Email wasn't necessary in the message, a normal translation string could have been used without parameter replacement.
If the User's Email weren't needed in the message, the system could have used a normal translation string without parameter replacement.

The other parameters in the ``addNotification`` call are equally important. The system styles the notification as an informational alert using the ``info`` type, which is appropriate for a status update on a scheduled task. The false value for ``$isRead`` ensures that the notification appears as unread, drawing the User's attention to this new information. The header, like the message, uses a translation key ``mautic.lead.export.being.prepared.header`` to maintain language consistency. Null values for the icon class and ``datetime`` mean that the system will use default values for these optional parameters. Finally, by passing the $user object, the notification is specifically associated with the user who initiated the export, ensuring it appears in their personal notification panel.
The other parameters in the ``addNotification`` call are equally important. The system styles the notification as an informational alert using the ``info`` type, which is appropriate for a status update on a scheduled task. The false value for ``$isRead`` ensures that the notification appears as unread, drawing the User's attention to this new information. The header, like the message, uses a translation key ``mautic.lead.export.being.prepared.header`` to maintain language consistency. Null values for the icon class and ``datetime`` mean that the system uses default values for these optional parameters. Finally, by passing the ``$user`` object, the notification is specifically associated with the user who initiated the export, ensuring it appears in their personal notification panel.

0 comments on commit 6a58604

Please sign in to comment.