Skip to content

Commit 371ecd9

Browse files
authored
[4.0] Change the select all toggle to a checkbox in media manager (#34597)
* Change the select all toggle to a checkbox in media manager * More merge conflicts fixed * Correct border * Listen on click * CS * Only stop propagation * code style
1 parent f4fed7f commit 371ecd9

File tree

2 files changed

+32
-27
lines changed

2 files changed

+32
-27
lines changed

administrator/components/com_media/resources/scripts/components/toolbar/toolbar.vue

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,13 @@
99
class="media-loader"
1010
/>
1111
<div class="media-view-icons">
12-
<a
13-
href="#"
12+
<input
13+
ref="mediaToolbarSelectAll"
14+
type="checkbox"
1415
class="media-toolbar-icon media-toolbar-select-all"
1516
:aria-label="translate('COM_MEDIA_SELECT_ALL')"
16-
@click.stop.prevent="toggleSelectAll()"
17+
@click.stop="toggleSelectAll"
1718
>
18-
<span
19-
:class="toggleSelectAllBtnIcon"
20-
aria-hidden="true"
21-
/>
22-
</a>
2319
</div>
2420
<media-breadcrumb />
2521
<div
@@ -102,9 +98,6 @@ export default {
10298
toggleListViewBtnIcon() {
10399
return (this.isGridView) ? 'icon-list' : 'icon-th';
104100
},
105-
toggleSelectAllBtnIcon() {
106-
return (this.allItemsSelected) ? 'icon-check-square' : 'icon-square';
107-
},
108101
isLoading() {
109102
return this.$store.state.isLoading;
110103
},
@@ -119,6 +112,14 @@ export default {
119112
return (this.$store.getters.getSelectedDirectoryContents.length === this.$store.state.selectedItems.length);
120113
},
121114
},
115+
watch: {
116+
// eslint-disable-next-line
117+
'$store.state.selectedItems'() {
118+
if (!this.allItemsSelected) {
119+
this.$refs.mediaToolbarSelectAll.checked = false;
120+
}
121+
},
122+
},
122123
methods: {
123124
toggleInfoBar() {
124125
if (this.$store.state.showInfoBar) {

build/media_source/com_media/scss/components/_media-toolbar.scss

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,31 @@
55
padding: 0;
66
background-color: $toolbar-bg;
77
border-bottom: 1px solid $border-color;
8+
border-left: 1px solid $border-color;
89
border-radius: $border-radius $border-radius 0 0;
910
box-shadow: 0 -1px 0 0 $border-color;
1011
input {
1112
padding: .3rem .75rem;
1213
}
13-
}
14-
15-
.media-toolbar-icon {
16-
display: inline-block;
17-
width: $toolbar-icon-width;
18-
font-size: 1.3rem;
19-
line-height: $toolbar-height;
20-
color: var(--atum-bg-dark-60);
21-
text-align: center;
22-
background-color: transparent;
23-
border: 0;
24-
border-left: 1px solid $border-color;
25-
box-shadow: 1px 0 #fefefe inset;
26-
&:hover {
27-
background-color: $toolbar-icon-bg-hover;
28-
box-shadow: none;
14+
&-icon {
15+
display: inline-block;
16+
width: $toolbar-icon-width;
17+
font-size: 1.3rem;
18+
line-height: $toolbar-height;
19+
color: var(--atum-bg-dark-60);
20+
text-align: center;
21+
background-color: transparent;
22+
border: 0;
23+
border-left: 1px solid $border-color;
24+
box-shadow: 1px 0 #fefefe inset;
25+
&:hover {
26+
background-color: $toolbar-icon-bg-hover;
27+
box-shadow: none;
28+
}
29+
}
30+
&-select-all {
31+
width: 1rem;
32+
margin: 1rem;
2933
}
3034
}
3135

0 commit comments

Comments
 (0)