From 8c2ad7271443fbc7156554147df4245a75b05c59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Grabowski?= Date: Tue, 25 Jan 2022 14:16:46 +0100 Subject: [PATCH 1/3] IBX-1476: Disable Select All checkbox when all the checkboxes in the table row are disabled --- .../views/themes/admin/account/bookmarks/list.html.twig | 1 + .../views/themes/admin/content/draft/draft_list.html.twig | 1 + .../views/themes/admin/content/tab/locations/tab.html.twig | 1 + .../views/themes/admin/content/tab/translations/tab.html.twig | 1 + .../themes/admin/content/tab/url/custom_urls_table.html.twig | 1 + .../admin/content_type/content_type_group/list.html.twig | 1 + .../Resources/views/themes/admin/content_type/list.html.twig | 1 + .../Resources/views/themes/admin/language/list.html.twig | 1 + .../Resources/views/themes/admin/object_state/list.html.twig | 1 + .../admin/object_state/object_state_group/list.html.twig | 1 + .../Resources/views/themes/admin/section/list.html.twig | 1 + src/bundle/Resources/views/themes/admin/trash/list.html.twig | 1 + .../themes/admin/ui/field_type/edit/relation_base.html.twig | 4 +++- .../Resources/views/themes/admin/url_wildcard/list.html.twig | 1 + .../Resources/views/themes/admin/user/policy/list.html.twig | 1 + .../Resources/views/themes/admin/user/role/list.html.twig | 1 + .../views/themes/admin/user/role_assignment/list.html.twig | 1 + 17 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/bundle/Resources/views/themes/admin/account/bookmarks/list.html.twig b/src/bundle/Resources/views/themes/admin/account/bookmarks/list.html.twig index 2ddf49c038..a13c547337 100644 --- a/src/bundle/Resources/views/themes/admin/account/bookmarks/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/account/bookmarks/list.html.twig @@ -82,6 +82,7 @@ }) }} {% include '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'bookmark.table.header'|trans|desc('Bookmarks') ~ ' (' ~ pager.count ~ ')', + class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { has_icon: true }, diff --git a/src/bundle/Resources/views/themes/admin/content/draft/draft_list.html.twig b/src/bundle/Resources/views/themes/admin/content/draft/draft_list.html.twig index 50e971a5f1..7ecb2f28c0 100644 --- a/src/bundle/Resources/views/themes/admin/content/draft/draft_list.html.twig +++ b/src/bundle/Resources/views/themes/admin/content/draft/draft_list.html.twig @@ -117,6 +117,7 @@ }) }} {% include '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'drafts.table.header'|trans|desc('Drafts') ~ ' (' ~ pager.count ~ ')', + class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { has_icon: true }, diff --git a/src/bundle/Resources/views/themes/admin/content/tab/locations/tab.html.twig b/src/bundle/Resources/views/themes/admin/content/tab/locations/tab.html.twig index 4c48929bc7..4f0248cbfc 100644 --- a/src/bundle/Resources/views/themes/admin/content/tab/locations/tab.html.twig +++ b/src/bundle/Resources/views/themes/admin/content/tab/locations/tab.html.twig @@ -92,6 +92,7 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'tab.locations.content_locations'|trans|desc('Content Locations'), + class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { content: 'tab.locations.path'|trans|desc('Path'), diff --git a/src/bundle/Resources/views/themes/admin/content/tab/translations/tab.html.twig b/src/bundle/Resources/views/themes/admin/content/tab/translations/tab.html.twig index 384b85e980..1e8320a13f 100644 --- a/src/bundle/Resources/views/themes/admin/content/tab/translations/tab.html.twig +++ b/src/bundle/Resources/views/themes/admin/content/tab/translations/tab.html.twig @@ -65,6 +65,7 @@ {% include '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'tab.translations.translation_manger'|trans|desc('Translation manager'), + class: 'ibexa-table--has-bulk-checkbox', head_cols, body_rows, actions: tab.table_header_tools(form_translation_remove, can_translate), diff --git a/src/bundle/Resources/views/themes/admin/content/tab/url/custom_urls_table.html.twig b/src/bundle/Resources/views/themes/admin/content/tab/url/custom_urls_table.html.twig index d99f2c3a6e..2c5b763c06 100644 --- a/src/bundle/Resources/views/themes/admin/content/tab/url/custom_urls_table.html.twig +++ b/src/bundle/Resources/views/themes/admin/content/tab/url/custom_urls_table.html.twig @@ -42,6 +42,7 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'tab.urls.custom_url_aliases'|trans({'%contentName%' : ibexa_content_name(content)})|desc('Custom URL aliases for %contentName%'), + class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { content: 'tab.urls.url'|trans|desc('URL') }, diff --git a/src/bundle/Resources/views/themes/admin/content_type/content_type_group/list.html.twig b/src/bundle/Resources/views/themes/admin/content_type/content_type_group/list.html.twig index bd73149729..4cfc4b92d7 100644 --- a/src/bundle/Resources/views/themes/admin/content_type/content_type_group/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/content_type/content_type_group/list.html.twig @@ -109,6 +109,7 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'content_type_group.view.list.title'|trans|desc('Content Type groups'), + class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { content: 'content_type_group.view.list.column.identifier'|trans|desc('Name') }, diff --git a/src/bundle/Resources/views/themes/admin/content_type/list.html.twig b/src/bundle/Resources/views/themes/admin/content_type/list.html.twig index f5dcdea66f..1f4d4315d0 100644 --- a/src/bundle/Resources/views/themes/admin/content_type/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/content_type/list.html.twig @@ -71,6 +71,7 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'content_type.view.list.title'|trans({ '%identifier%': content_type_group.identifier })|desc('Content Types in \'%identifier%\''), + class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { has_icon: true }, diff --git a/src/bundle/Resources/views/themes/admin/language/list.html.twig b/src/bundle/Resources/views/themes/admin/language/list.html.twig index 06a6ffd015..87f06a0069 100644 --- a/src/bundle/Resources/views/themes/admin/language/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/language/list.html.twig @@ -117,6 +117,7 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'language.list'|trans|desc('Languages'), + class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { content: 'language.name'|trans|desc('Name') }, diff --git a/src/bundle/Resources/views/themes/admin/object_state/list.html.twig b/src/bundle/Resources/views/themes/admin/object_state/list.html.twig index c21e98011c..f9d317a6ea 100644 --- a/src/bundle/Resources/views/themes/admin/object_state/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/object_state/list.html.twig @@ -60,6 +60,7 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'object_state.view.list.title'|trans({'%count%': object_states|length})|desc('Object states (%count%)'), + class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { content: 'object_state.name'|trans|desc('Object state name') }, diff --git a/src/bundle/Resources/views/themes/admin/object_state/object_state_group/list.html.twig b/src/bundle/Resources/views/themes/admin/object_state/object_state_group/list.html.twig index 3e678885e0..063244f7da 100644 --- a/src/bundle/Resources/views/themes/admin/object_state/object_state_group/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/object_state/object_state_group/list.html.twig @@ -103,6 +103,7 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'object_state_group.view.list.title'|trans|desc('Object state groups'), + class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { content: 'object_state_group.name'|trans|desc('Object state group name') }, diff --git a/src/bundle/Resources/views/themes/admin/section/list.html.twig b/src/bundle/Resources/views/themes/admin/section/list.html.twig index a98bf3f333..1f05f41f97 100644 --- a/src/bundle/Resources/views/themes/admin/section/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/section/list.html.twig @@ -119,6 +119,7 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'section.list.title'|trans|desc('Sections'), + class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { content: 'section.name'|trans|desc('Name') }, diff --git a/src/bundle/Resources/views/themes/admin/trash/list.html.twig b/src/bundle/Resources/views/themes/admin/trash/list.html.twig index 2e9c5a8756..77ea8a1189 100644 --- a/src/bundle/Resources/views/themes/admin/trash/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/trash/list.html.twig @@ -222,6 +222,7 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'trash.table.header'|trans|desc('Trash'), + class: 'ibexa-table--has-bulk-checkbox', head_cols, body_rows, empty_table_info_text: 'trash.empty'|trans|desc('Trash is empty. Content you send to Trash will show up here.'), diff --git a/src/bundle/Resources/views/themes/admin/ui/field_type/edit/relation_base.html.twig b/src/bundle/Resources/views/themes/admin/ui/field_type/edit/relation_base.html.twig index faf83cb7ca..8f89d9f15f 100644 --- a/src/bundle/Resources/views/themes/admin/ui/field_type/edit/relation_base.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/field_type/edit/relation_base.html.twig @@ -165,11 +165,13 @@ {% endfor %} {% set head_cols = [] %} + {% set table_class = 'ibexa-table--not-striped' %} {% if limit != 1 %} {% set head_cols = head_cols|merge([ { has_checkbox: true }, ]) %} + {% set table_class = table_class ~ ' ibexa-table--has-bulk-checkbox' %} {% endif %} {% set head_cols = head_cols|merge([ @@ -191,7 +193,7 @@ attr: { hidden: not has_relations, }, - class: 'ibexa-table--not-striped', + class: table_class, show_head_cols_if_empty: true, body_rows, table_body_class: 'ibexa-relations__list', diff --git a/src/bundle/Resources/views/themes/admin/url_wildcard/list.html.twig b/src/bundle/Resources/views/themes/admin/url_wildcard/list.html.twig index f0a863d010..d3dbbed85f 100644 --- a/src/bundle/Resources/views/themes/admin/url_wildcard/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/url_wildcard/list.html.twig @@ -73,6 +73,7 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'url_wildcard.list.title'|trans|desc('URL wildcards'), + class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { content: 'url_wildcard.label.alias'|trans|desc('URL alias wildcard') }, diff --git a/src/bundle/Resources/views/themes/admin/user/policy/list.html.twig b/src/bundle/Resources/views/themes/admin/user/policy/list.html.twig index 114bd1264f..d16389358c 100644 --- a/src/bundle/Resources/views/themes/admin/user/policy/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/user/policy/list.html.twig @@ -73,6 +73,7 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'policy.view.list.title.count'|trans({'%count%': role.policies|length})|desc('Policies (%count%)'), + class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { content: 'policy.view.list.panel.policies.column.module'|trans|desc('Module') }, diff --git a/src/bundle/Resources/views/themes/admin/user/role/list.html.twig b/src/bundle/Resources/views/themes/admin/user/role/list.html.twig index d9a24e464b..475c5c9070 100644 --- a/src/bundle/Resources/views/themes/admin/user/role/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/user/role/list.html.twig @@ -111,6 +111,7 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'role.view.list.title'|trans|desc('Roles'), + class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { content: 'role.view.list.column.name'|trans|desc('Name') }, diff --git a/src/bundle/Resources/views/themes/admin/user/role_assignment/list.html.twig b/src/bundle/Resources/views/themes/admin/user/role_assignment/list.html.twig index 14b877e55d..64e46a71e1 100644 --- a/src/bundle/Resources/views/themes/admin/user/role_assignment/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/user/role_assignment/list.html.twig @@ -49,6 +49,7 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'role_assignment.view.list.header'|trans|desc('Users and Groups'), + class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { content: 'role_assignment.view.list.panel.assignments.column.user_group'|trans|desc('User/Group') }, From a45c0e1c149330e8d0ce05cabd354022826e65d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Grabowski?= Date: Wed, 26 Jan 2022 11:17:34 +0100 Subject: [PATCH 2/3] change from class bulk to checkbox bulk --- .../Resources/public/js/scripts/admin.table.js | 16 ++++++++++++++-- .../admin/account/bookmarks/list.html.twig | 1 - .../admin/content/draft/draft_list.html.twig | 1 - .../admin/content/tab/locations/tab.html.twig | 1 - .../admin/content/tab/translations/tab.html.twig | 1 - .../content/tab/url/custom_urls_table.html.twig | 5 ++++- .../content_type_group/list.html.twig | 1 - .../themes/admin/content_type/list.html.twig | 1 - .../views/themes/admin/language/list.html.twig | 1 - .../themes/admin/object_state/list.html.twig | 1 - .../object_state_group/list.html.twig | 1 - .../views/themes/admin/section/list.html.twig | 1 - .../views/themes/admin/trash/list.html.twig | 1 - .../ui/component/table/table_head_cell.html.twig | 5 ++++- .../ui/component/table/table_head_row.html.twig | 1 + .../ui/field_type/edit/relation_base.html.twig | 4 +--- .../themes/admin/url_wildcard/list.html.twig | 1 - .../themes/admin/user/policy/list.html.twig | 1 - .../views/themes/admin/user/role/list.html.twig | 1 - .../admin/user/role_assignment/list.html.twig | 1 - .../table-view/table.view.component.js | 4 ++-- 21 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/bundle/Resources/public/js/scripts/admin.table.js b/src/bundle/Resources/public/js/scripts/admin.table.js index 3ed8cedc17..a49c7eb5f3 100644 --- a/src/bundle/Resources/public/js/scripts/admin.table.js +++ b/src/bundle/Resources/public/js/scripts/admin.table.js @@ -1,5 +1,5 @@ (function(global, doc, $, ibexa) { - const tablesWithBulkCheckbox = doc.querySelectorAll('.ibexa-table.ibexa-table--has-bulk-checkbox'); + const ibexaTables = doc.querySelectorAll('.ibexa-table'); const setMainCheckboxState = (mainCheckbox, subCheckboxes, event) => { const isFromJS = event?.detail?.isFromJS ?? false; @@ -52,6 +52,12 @@ const checkboxesChangeListeners = new Map(); headCellsWithCheckboxes.forEach((headCellsWithCheckbox) => { + const hasBulkCheckbox = !!headCellsWithCheckbox.querySelector('.ibexa-table__header-cell-checkbox:not(.ibexa-table__header-cell-checkbox--custom-init)'); + + if (!hasBulkCheckbox) { + return; + } + const mainCheckboxIndex = [...headCells].indexOf(headCellsWithCheckbox); const mainCheckbox = headCellsWithCheckbox.querySelector('.ibexa-input--checkbox'); const subCheckboxes = tableBody.querySelectorAll( @@ -90,7 +96,13 @@ tablesCheckboxesChangeListeners.delete(table); }; - tablesWithBulkCheckbox.forEach((table) => { + ibexaTables.forEach((table) => { + const tableHasBulkCheckbox = !!table.querySelector('.ibexa-table__header-cell-checkbox:not(.ibexa-table__header-cell-checkbox--custom-init)'); + + if (!tableHasBulkCheckbox) { + return; + } + addTableCheckboxesListeners(table); table.addEventListener( diff --git a/src/bundle/Resources/views/themes/admin/account/bookmarks/list.html.twig b/src/bundle/Resources/views/themes/admin/account/bookmarks/list.html.twig index a13c547337..2ddf49c038 100644 --- a/src/bundle/Resources/views/themes/admin/account/bookmarks/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/account/bookmarks/list.html.twig @@ -82,7 +82,6 @@ }) }} {% include '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'bookmark.table.header'|trans|desc('Bookmarks') ~ ' (' ~ pager.count ~ ')', - class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { has_icon: true }, diff --git a/src/bundle/Resources/views/themes/admin/content/draft/draft_list.html.twig b/src/bundle/Resources/views/themes/admin/content/draft/draft_list.html.twig index 7ecb2f28c0..50e971a5f1 100644 --- a/src/bundle/Resources/views/themes/admin/content/draft/draft_list.html.twig +++ b/src/bundle/Resources/views/themes/admin/content/draft/draft_list.html.twig @@ -117,7 +117,6 @@ }) }} {% include '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'drafts.table.header'|trans|desc('Drafts') ~ ' (' ~ pager.count ~ ')', - class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { has_icon: true }, diff --git a/src/bundle/Resources/views/themes/admin/content/tab/locations/tab.html.twig b/src/bundle/Resources/views/themes/admin/content/tab/locations/tab.html.twig index 4f0248cbfc..4c48929bc7 100644 --- a/src/bundle/Resources/views/themes/admin/content/tab/locations/tab.html.twig +++ b/src/bundle/Resources/views/themes/admin/content/tab/locations/tab.html.twig @@ -92,7 +92,6 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'tab.locations.content_locations'|trans|desc('Content Locations'), - class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { content: 'tab.locations.path'|trans|desc('Path'), diff --git a/src/bundle/Resources/views/themes/admin/content/tab/translations/tab.html.twig b/src/bundle/Resources/views/themes/admin/content/tab/translations/tab.html.twig index 1e8320a13f..384b85e980 100644 --- a/src/bundle/Resources/views/themes/admin/content/tab/translations/tab.html.twig +++ b/src/bundle/Resources/views/themes/admin/content/tab/translations/tab.html.twig @@ -65,7 +65,6 @@ {% include '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'tab.translations.translation_manger'|trans|desc('Translation manager'), - class: 'ibexa-table--has-bulk-checkbox', head_cols, body_rows, actions: tab.table_header_tools(form_translation_remove, can_translate), diff --git a/src/bundle/Resources/views/themes/admin/content/tab/url/custom_urls_table.html.twig b/src/bundle/Resources/views/themes/admin/content/tab/url/custom_urls_table.html.twig index 2c5b763c06..368ba99bb9 100644 --- a/src/bundle/Resources/views/themes/admin/content/tab/url/custom_urls_table.html.twig +++ b/src/bundle/Resources/views/themes/admin/content/tab/url/custom_urls_table.html.twig @@ -5,16 +5,20 @@ {% if custom_urls_pager.currentPageResults is not empty %} {% for custom_url in custom_urls_pager.currentPageResults %} {% set body_row_cols = [] %} + {% set has_checkbox = false %} {% set col_raw %} {% if can_edit_custom_url %} {{ form_widget(form_custom_url_remove.url_aliases[custom_url.id]) }} + + {% set has_checkbox = true %} {% else %} {% do form_custom_url_remove.url_aliases.setRendered %} {% endif %} {% endset %} {% set body_row_cols = body_row_cols|merge([{ content: col_raw, + has_checkbox, raw: true, }]) %} @@ -42,7 +46,6 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'tab.urls.custom_url_aliases'|trans({'%contentName%' : ibexa_content_name(content)})|desc('Custom URL aliases for %contentName%'), - class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { content: 'tab.urls.url'|trans|desc('URL') }, diff --git a/src/bundle/Resources/views/themes/admin/content_type/content_type_group/list.html.twig b/src/bundle/Resources/views/themes/admin/content_type/content_type_group/list.html.twig index 4cfc4b92d7..bd73149729 100644 --- a/src/bundle/Resources/views/themes/admin/content_type/content_type_group/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/content_type/content_type_group/list.html.twig @@ -109,7 +109,6 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'content_type_group.view.list.title'|trans|desc('Content Type groups'), - class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { content: 'content_type_group.view.list.column.identifier'|trans|desc('Name') }, diff --git a/src/bundle/Resources/views/themes/admin/content_type/list.html.twig b/src/bundle/Resources/views/themes/admin/content_type/list.html.twig index 1f4d4315d0..f5dcdea66f 100644 --- a/src/bundle/Resources/views/themes/admin/content_type/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/content_type/list.html.twig @@ -71,7 +71,6 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'content_type.view.list.title'|trans({ '%identifier%': content_type_group.identifier })|desc('Content Types in \'%identifier%\''), - class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { has_icon: true }, diff --git a/src/bundle/Resources/views/themes/admin/language/list.html.twig b/src/bundle/Resources/views/themes/admin/language/list.html.twig index 87f06a0069..06a6ffd015 100644 --- a/src/bundle/Resources/views/themes/admin/language/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/language/list.html.twig @@ -117,7 +117,6 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'language.list'|trans|desc('Languages'), - class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { content: 'language.name'|trans|desc('Name') }, diff --git a/src/bundle/Resources/views/themes/admin/object_state/list.html.twig b/src/bundle/Resources/views/themes/admin/object_state/list.html.twig index f9d317a6ea..c21e98011c 100644 --- a/src/bundle/Resources/views/themes/admin/object_state/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/object_state/list.html.twig @@ -60,7 +60,6 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'object_state.view.list.title'|trans({'%count%': object_states|length})|desc('Object states (%count%)'), - class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { content: 'object_state.name'|trans|desc('Object state name') }, diff --git a/src/bundle/Resources/views/themes/admin/object_state/object_state_group/list.html.twig b/src/bundle/Resources/views/themes/admin/object_state/object_state_group/list.html.twig index 063244f7da..3e678885e0 100644 --- a/src/bundle/Resources/views/themes/admin/object_state/object_state_group/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/object_state/object_state_group/list.html.twig @@ -103,7 +103,6 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'object_state_group.view.list.title'|trans|desc('Object state groups'), - class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { content: 'object_state_group.name'|trans|desc('Object state group name') }, diff --git a/src/bundle/Resources/views/themes/admin/section/list.html.twig b/src/bundle/Resources/views/themes/admin/section/list.html.twig index 1f05f41f97..a98bf3f333 100644 --- a/src/bundle/Resources/views/themes/admin/section/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/section/list.html.twig @@ -119,7 +119,6 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'section.list.title'|trans|desc('Sections'), - class: 'ibexa-table--has-bulk-checkbox', head_cols: [ { has_checkbox: true }, { content: 'section.name'|trans|desc('Name') }, diff --git a/src/bundle/Resources/views/themes/admin/trash/list.html.twig b/src/bundle/Resources/views/themes/admin/trash/list.html.twig index 77ea8a1189..2e9c5a8756 100644 --- a/src/bundle/Resources/views/themes/admin/trash/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/trash/list.html.twig @@ -222,7 +222,6 @@ {% embed '@ibexadesign/ui/component/table/table.html.twig' with { headline: 'trash.table.header'|trans|desc('Trash'), - class: 'ibexa-table--has-bulk-checkbox', head_cols, body_rows, empty_table_info_text: 'trash.empty'|trans|desc('Trash is empty. Content you send to Trash will show up here.'), diff --git a/src/bundle/Resources/views/themes/admin/ui/component/table/table_head_cell.html.twig b/src/bundle/Resources/views/themes/admin/ui/component/table/table_head_cell.html.twig index f7efbb275a..e221fdb69e 100644 --- a/src/bundle/Resources/views/themes/admin/ui/component/table/table_head_cell.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/component/table/table_head_cell.html.twig @@ -11,7 +11,10 @@ > {%- block content -%} {%- if has_checkbox|default(false) -%} - + {%- endif -%} {this.renderBasicColumnsHeader()} @@ -303,7 +303,7 @@ export default class TableViewComponent extends Component { return (
- +
{this.renderHead()} {renderedItems}
From b375d98968ca61a6c49e8a1a23dec967e29d016e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Grabowski?= Date: Wed, 26 Jan 2022 14:41:21 +0100 Subject: [PATCH 3/3] change vars names --- .../Resources/public/js/scripts/admin.table.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bundle/Resources/public/js/scripts/admin.table.js b/src/bundle/Resources/public/js/scripts/admin.table.js index a49c7eb5f3..171253eeba 100644 --- a/src/bundle/Resources/public/js/scripts/admin.table.js +++ b/src/bundle/Resources/public/js/scripts/admin.table.js @@ -48,18 +48,18 @@ const addTableCheckboxesListeners = (table) => { const tableBody = table.querySelector('.ibexa-table__body'); const headCells = table.querySelectorAll('.ibexa-table__header-cell'); - const headCellsWithCheckboxes = table.querySelectorAll('.ibexa-table__header-cell--checkbox'); + const headCellsWithCheckbox = table.querySelectorAll('.ibexa-table__header-cell--checkbox'); const checkboxesChangeListeners = new Map(); - headCellsWithCheckboxes.forEach((headCellsWithCheckbox) => { - const hasBulkCheckbox = !!headCellsWithCheckbox.querySelector('.ibexa-table__header-cell-checkbox:not(.ibexa-table__header-cell-checkbox--custom-init)'); + headCellsWithCheckbox.forEach((headCellWithCheckbox) => { + const isCustomInit = !!headCellWithCheckbox.querySelector('.ibexa-table__header-cell-checkbox.ibexa-table__header-cell-checkbox--custom-init'); - if (!hasBulkCheckbox) { + if (isCustomInit) { return; } - const mainCheckboxIndex = [...headCells].indexOf(headCellsWithCheckbox); - const mainCheckbox = headCellsWithCheckbox.querySelector('.ibexa-input--checkbox'); + const mainCheckboxIndex = [...headCells].indexOf(headCellWithCheckbox); + const mainCheckbox = headCellWithCheckbox.querySelector('.ibexa-input--checkbox'); const subCheckboxes = tableBody.querySelectorAll( `.ibexa-table__cell--has-checkbox:nth-child(${mainCheckboxIndex + 1}) .ibexa-input--checkbox` );