Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6642,12 +6642,6 @@ parameters:
count: 1
path: src/lib/Form/DataTransformer/DateIntervalTransformer.php

-
message: '#^Method Ibexa\\AdminUi\\Form\\DataTransformer\\DateIntervalTransformer\:\:transform\(\) has Symfony\\Component\\Form\\Exception\\TransformationFailedException in PHPDoc @throws tag but it''s not thrown\.$#'
identifier: throws.unusedType
count: 1
path: src/lib/Form/DataTransformer/DateIntervalTransformer.php

-
message: '#^Method Ibexa\\AdminUi\\Form\\DataTransformer\\DateIntervalTransformer\:\:transform\(\) has parameter \$value with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -6876,12 +6870,6 @@ parameters:
count: 1
path: src/lib/Form/DataTransformer/LanguageTransformer.php

-
message: '#^Method Ibexa\\AdminUi\\Form\\DataTransformer\\LanguageTransformer\:\:transform\(\) has Symfony\\Component\\Form\\Exception\\TransformationFailedException in PHPDoc @throws tag but it''s not thrown\.$#'
identifier: throws.unusedType
count: 1
path: src/lib/Form/DataTransformer/LanguageTransformer.php

-
message: '#^Class Ibexa\\AdminUi\\Form\\DataTransformer\\LocationTransformer implements generic interface Symfony\\Component\\Form\\DataTransformerInterface but does not specify its types\: T, R$#'
identifier: missingType.generics
Expand Down Expand Up @@ -7104,12 +7092,6 @@ parameters:
count: 1
path: src/lib/Form/DataTransformer/UserTransformer.php

-
message: '#^Method Ibexa\\AdminUi\\Form\\DataTransformer\\UserTransformer\:\:transform\(\) has Symfony\\Component\\Form\\Exception\\TransformationFailedException in PHPDoc @throws tag but it''s not thrown\.$#'
identifier: throws.unusedType
count: 1
path: src/lib/Form/DataTransformer/UserTransformer.php

-
message: '#^Call to function is_array\(\) with array will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { controlZIndex } from './helpers/modal.helper';

(function (global, doc, ibexa, Translator, Routing) {
let currentPageLink = null;
let getNotificationsStatusErrorShowed = false;
let lastFailedCountFetchNotificationNode = null;
let selectedNotificationId = null;
const SELECTOR_MODAL_ITEM = '.ibexa-notifications-modal__item';
const SELECTOR_MODAL_RESULTS = '.ibexa-notifications-modal__results .ibexa-scrollable-wrapper';
const SELECTOR_MODAL_TITLE = '.ibexa-side-panel__header';
Expand Down Expand Up @@ -214,9 +217,8 @@

currentTarget.textContent.trim() === markAsReadLabel ? markAsRead({ currentTarget }) : markAsUnread({ currentTarget });
};
const deleteNotification = ({ currentTarget }) => {
const { notificationId } = currentTarget.dataset;
const deleteLink = Routing.generate('ibexa.notifications.delete', { notificationId });
const deleteNotification = () => {
const deleteLink = Routing.generate('ibexa.notifications.delete', { notificationId: selectedNotificationId });
const message = Translator.trans(
/* @Desc("Cannot delete notification") */ 'notifications.modal.message.error.delete',
{},
Expand All @@ -227,11 +229,10 @@
.then(getJsonFromResponse)
.then((response) => {
if (response.status === 'success') {
const notification = doc.querySelector(`.ibexa-notifications-modal__item[data-notification-id="${notificationId}"]`);
const menuBranch = currentTarget.closest('.ibexa-multilevel-popup-menu__branch');
const menuInstance = ibexa.helpers.objectInstances.getInstance(menuBranch.menuInstanceElement);
const notification = doc.querySelector(
`.ibexa-notifications-modal__item[data-notification-id="${selectedNotificationId}"]`,
);

menuInstance.closeMenu();
notification.remove();
getNotificationsStatus();
} else {
Expand All @@ -245,15 +246,26 @@
const attachActionsListeners = () => {
const attachListener = (node, callback) => node.addEventListener('click', callback, false);
const markAsButtons = doc.querySelectorAll('.ibexa-notifications-modal--mark-as');
const deleteButtons = doc.querySelectorAll('.ibexa-notifications-modal--delete');
const deleteButtons = doc.querySelectorAll('.ibexa-notifications-open-modal-button');
const confirmDeleteButton = doc.querySelector('.ibexa-notifications-modal--delete--confirm');
Comment on lines +249 to +250
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick - naming convention

Suggested change
const deleteButtons = doc.querySelectorAll('.ibexa-notifications-open-modal-button');
const confirmDeleteButton = doc.querySelector('.ibexa-notifications-modal--delete--confirm');
const deleteBtns = doc.querySelectorAll('.ibexa-notifications-open-modal-button');
const confirmDeleteBtn = doc.querySelector('.ibexa-notifications-modal--delete--confirm');

const setNotificationId = ({ currentTarget }) => {
const deleteModal = doc.querySelector('.modal-backdrop.show.fade');
controlZIndex(deleteModal, '199');
Copy link
Contributor Author

@RopRaptor RopRaptor Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not very satisfied with this solution.
I had to move the modal-backdrop back in the z-index because it was covering the entire container.

Opened for suggestions


selectedNotificationId = currentTarget.dataset.notificationId;
};

markAsButtons.forEach((markAsButton) => {
attachListener(markAsButton, handleMarkAsAction);
});

deleteButtons.forEach((deleteButton) => {
attachListener(deleteButton, deleteNotification);
attachListener(deleteButton, setNotificationId);
});

if (confirmDeleteButton) {
confirmDeleteButton.addEventListener('click', deleteNotification);
}
};
const showNotificationPage = (pageHtml) => {
const modalResults = panel.querySelector(SELECTOR_MODAL_RESULTS);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const controlZIndex = (container) => {
const controlZIndex = (container, ZIndexValue) => {
const initialZIndex = container.style.zIndex;
container.style.zIndex = ZIndexValue;

container.addEventListener('show.bs.modal', () => {
container.style.zIndex = 'initial';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@
<target state="new">Mark as unread</target>
<note>key: notification.mark_as_unread</note>
</trans-unit>
<trans-unit id="1b5f287ab1b01d5f0402378d633e8924aad59c98" resname="notification.modal.delete.confirm_message">
<source>Are you sure you want to delete this notification?</source>
<target state="new">Are you sure you want to delete this notification?</target>
<note>key: notification.modal.delete.confirm_message</note>
</trans-unit>
<trans-unit id="5b03625b8de51d296ad7f4bc980e631c964185d8" resname="notification.no_longer_available">
<source>The Content item is no longer available</source>
<target state="new">The Content item is no longer available</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@

{% set popup_items = popup_items|merge([{
label: 'notification.delete'|trans|desc('Delete'),
action_attr: { class: 'ibexa-notifications-modal--delete', 'data-notification-id': notification.id },
action_attr: {
class: 'ibexa-notifications-open-modal-button',
'data-notification-id': notification.id,
'data-bs-toggle': 'modal',
'data-bs-target': '#delete-notification-modal', }
}]) %}

{% embed '@ibexadesign/ui/component/table/table_body_row.html.twig' with {
Expand Down Expand Up @@ -103,3 +107,14 @@
{% endembed %}
{% endblock %}
{% endembed %}

{% embed '@ibexadesign/ui/modal/delete_confirmation.html.twig' with {
id: 'delete-notification-modal',
message: 'notification.modal.delete.confirm_message'|trans|desc('Are you sure you want to delete this notification?'),
} %}
{% block confirm_button %}
<button class="btn ibexa-btn ibexa-btn--primary ibexa-notifications-modal--delete--confirm" data-bs-dismiss="modal">
{{ 'modal.delete'|trans|desc('Delete') }}
</button>
{% endblock %}
{% endembed %}
Loading