Skip to content

Commit 485f3de

Browse files
committed
Refacotr & style fixes
1 parent 083c326 commit 485f3de

File tree

9 files changed

+46
-45
lines changed

9 files changed

+46
-45
lines changed

src/bundle/Resources/encore/ibexa.js.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,5 +258,5 @@ module.exports = (Encore) => {
258258
path.resolve(__dirname, '../public/js/scripts/core/sidebar.collapse.js'),
259259
path.resolve(__dirname, '../public/js/scripts/admin.notifications.list.js'),
260260
path.resolve(__dirname, '../public/js/scripts/admin.notifications.filters.js'),
261-
])
261+
]);
262262
};

src/bundle/Resources/public/js/scripts/admin.notifications.filters.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(function (global, doc) {
2-
const searchForm = doc.querySelector('.ibexa-al-list-search-form');
2+
const searchForm = doc.querySelector('.ibexa-list-search-form');
33
const filtersContainerNode = doc.querySelector('.ibexa-list-filters');
44
const applyFiltersBtn = filtersContainerNode.querySelector('.ibexa-btn--apply');
55
const clearFiltersBtn = filtersContainerNode.querySelector('.ibexa-btn--clear');
@@ -49,9 +49,7 @@
4949
const checkboxes = filterNode.querySelectorAll(
5050
'.ibexa-list-filters__item-content .ibexa-input--checkbox:not([name="dropdown-checkbox"])',
5151
);
52-
const picker = filterNode.querySelector(
53-
'.ibexa-input--date',
54-
);
52+
const picker = filterNode.querySelector('.ibexa-input--date');
5553
picker?.addEventListener('change', filterChange, false);
5654
sourceSelect?.addEventListener('change', filterChange, false);
5755
checkboxes.forEach((checkbox) => {

src/bundle/Resources/public/js/scripts/admin.notifications.list.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,10 @@
5858
.then(getJsonFromResponse)
5959
.catch(() => ibexa.helpers.notification.showErrorNotification(errorMessage));
6060
};
61-
const getBulkOperations = (notificationIds) => notificationIds.reduce((total, notificationId) => {
61+
const getBulkOperations = (notificationIds) =>
62+
notificationIds.reduce((total, notificationId) => {
6263
const markAsReadLink = Routing.generate('ibexa.notifications.mark_as_read', { notificationId });
63-
64+
6465
total[markAsReadLink] = {
6566
uri: markAsReadLink,
6667
method: 'GET',
@@ -69,9 +70,9 @@
6970
Accept: 'application/vnd.ibexa.api.ContentType+json',
7071
'X-Requested-With': 'XMLHttpRequest',
7172
},
72-
credentials: 'same-origin'
73+
credentials: 'same-origin',
7374
};
74-
75+
7576
return total;
7677
}, {});
7778

@@ -106,8 +107,7 @@
106107
notificationRow.querySelectorAll('.ibexa-notification-view-all__notice-dot').forEach((noticeDot) => {
107108
noticeDot.setAttribute('data-is-read', (!isRead).toString());
108109
});
109-
notificationRow.querySelector('.ibexa-notification-view-all__read').innerHTML =
110-
statusText;
110+
notificationRow.querySelector('.ibexa-notification-view-all__read').innerHTML = statusText;
111111

112112
return;
113113
}
@@ -155,25 +155,27 @@
155155
markAllAsReadBtn.addEventListener('click', markAllAsRead, false);
156156
markAsReadBtn.addEventListener('click', markSelectedAsRead, false);
157157

158-
159158
const toggleActionButtonState = () => {
160159
const checkedNotifications = checkboxes.filter((el) => el.checked);
161160
const isAnythingSelected = checkedNotifications.length > 0;
162-
const unreadLabel = Translator.trans(/* @Desc("Unread") */ 'notification.unread',{},'ibexa_notifications');
161+
const unreadLabel = Translator.trans(/* @Desc("Unread") */ 'notification.unread', {}, 'ibexa_notifications');
163162

164163
deleteBtn.disabled = !isAnythingSelected;
165-
markAsReadBtn.disabled = !isAnythingSelected || !checkedNotifications.every((checkbox) =>
166-
checkbox.closest('.ibexa-table__row').querySelector('.ibexa-notification-view-all__read').innerText === unreadLabel
167-
);
164+
markAsReadBtn.disabled =
165+
!isAnythingSelected ||
166+
!checkedNotifications.every(
167+
(checkbox) =>
168+
checkbox.closest('.ibexa-table__row').querySelector('.ibexa-notification-view-all__read').innerText === unreadLabel,
169+
);
168170
};
169171
const handleCheckboxChange = (checkbox) => {
170172
const checkboxFormId = checkbox.dataset?.formRemoveId;
171173
const formRemoveCheckbox = doc.getElementById(checkboxFormId);
172174
if (formRemoveCheckbox) {
173175
formRemoveCheckbox.checked = checkbox.checked;
174176
}
175-
toggleActionButtonState();
177+
toggleActionButtonState();
176178
};
177-
179+
178180
checkboxes.forEach((checkbox) => checkbox.addEventListener('change', () => handleCheckboxChange(checkbox), false));
179181
})(window, window.document, window.ibexa, window.Translator, window.Routing);

src/bundle/Resources/public/js/scripts/admin.notifications.modal.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@
9696
if (notificationsCount < 10) {
9797
panel.querySelector('.ibexa-notifications-modal__count').textContent = `(${notificationsCount})`;
9898
}
99-
10099
};
101100
const updatePendingNotificationsView = (notificationsInfo) => {
102101
const noticeDot = doc.querySelector('.ibexa-header-user-menu__notice-dot');

src/bundle/Resources/public/js/scripts/core/sidebar.collapse.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
(function (global, doc) {
2-
const sidebar = doc.querySelector('.ibexa-notification-list__filters-wrapper');
2+
const sidebar = doc.querySelector('.ibexa-list-filters__sidebar');
33
const toggleBtn = sidebar.querySelector('.ibexa-list-filters__expand-btn');
44
const toggleCollapseIcon = toggleBtn.querySelector('.ibexa-list-filters__collapse-icon');
55
const toggleExpandIcon = toggleBtn.querySelector('.ibexa-list-filters__expand-icon');
66

77
const toggleSidebar = () => {
88
const isExpanded = toggleBtn.getAttribute('aria-expanded') === 'true';
9-
10-
sidebar.classList.toggle('ibexa-notification-list__filters-wrapper--collapsed', !isExpanded);
9+
10+
sidebar.classList.toggle('ibexa-list-filters__sidebar--collapsed', isExpanded);
1111
toggleBtn.setAttribute('aria-expanded', (!isExpanded).toString());
12-
toggleExpandIcon.toggleAttribute('hidden', isExpanded);
13-
toggleCollapseIcon.toggleAttribute('hidden', !isExpanded);
12+
toggleExpandIcon.toggleAttribute('hidden', !isExpanded);
13+
toggleCollapseIcon.toggleAttribute('hidden', isExpanded);
1414
};
1515

1616
toggleBtn.addEventListener('click', toggleSidebar, false);

src/bundle/Resources/public/scss/_list-filters.scss

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
.ibexa-list-filters {
22
$self: &;
3-
3+
44
overflow: hidden;
55

66
&__header {
77
display: flex;
88
align-items: center;
99
justify-content: space-between;
10-
padding: calculateRem(11px) calculateRem(16px);
10+
padding: calculateRem(11px) calculateRem(12px);
1111
min-width: calculateRem(275px);
1212
}
1313

@@ -17,6 +17,18 @@
1717
font-weight: 600;
1818
}
1919

20+
&__sidebar {
21+
&--collapsed {
22+
width: calculateRem(68px);
23+
margin-right: 0;
24+
25+
.ibexa-list-filters__header > *:not(.ibexa-list-filters__expand-btn),
26+
.ibexa-list-filters__items {
27+
display: none;
28+
}
29+
}
30+
}
31+
2032
.accordion-item {
2133
background: transparent;
2234

src/bundle/Resources/public/scss/_notifications-modal.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
font-size: $ibexa-text-font-size-small;
8080
color: $ibexa-color-light-700;
8181
}
82-
82+
8383
&__notice-dot {
8484
width: calculateRem(8px);
8585
height: calculateRem(8px);
@@ -218,10 +218,10 @@
218218
width: calculateRem(6px);
219219
height: calculateRem(6px);
220220
}
221-
&[data-is-read="true"] {
221+
&[data-is-read='true'] {
222222
background: $ibexa-color-dark-300;
223223
}
224-
&[data-is-read="false"] {
224+
&[data-is-read='false'] {
225225
background: $ibexa-color-danger;
226226
}
227227
}

src/bundle/Resources/public/scss/_notifications.scss

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@
3636

3737
.ibexa-table-header {
3838
padding: calculateRem(8px) 0;
39-
&__headline{
40-
font-size: $ibexa-text-font-size-extra-large;
39+
&__headline {
40+
font-size: $ibexa-text-font-size-extra-large;
4141
}
4242
}
43-
43+
4444
&__mark-all-read {
4545
display: flex;
4646
justify-content: flex-end;
@@ -58,23 +58,13 @@
5858
border: calculateRem(1px) solid $ibexa-color-light;
5959
background-color: $ibexa-color-white;
6060
transition: width 0.3s ease;
61-
62-
&--collapsed {
63-
width: calculateRem(64px);
64-
margin-right: 0;
65-
66-
.ibexa-list-filters__header > *:not(.ibexa-list-filters__expand-btn),
67-
.ibexa-list-filters__items {
68-
display: none;
69-
}
70-
}
7161
}
7262

7363
&__table-btns {
7464
font-size: $ibexa-text-font-size-medium;
7565
}
76-
66+
7767
&__hidden-btn {
7868
display: none;
7969
}
80-
}
70+
}

src/bundle/Resources/views/themes/admin/account/notifications/list_all.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
</div>
9393
{% endif %}
9494
</section>
95-
<div class="ibexa-notification-list__filters-wrapper">
95+
<div class="ibexa-notification-list__filters-wrapper ibexa-list-filters__sidebar">
9696
{% include '@ibexadesign/account/notifications/filters.html.twig' %}
9797
</div>
9898
</div>

0 commit comments

Comments
 (0)