Skip to content

Commit 535f5ca

Browse files
authored
[5.0] Media manager list view parity (#42119)
Signed-off-by: Dimitris Grammatikogiannis <[email protected]>
1 parent b17a550 commit 535f5ca

File tree

2 files changed

+47
-0
lines changed
  • administrator/components/com_media/resources/scripts/components/browser/table
  • build/media_source/com_media/scss/components

2 files changed

+47
-0
lines changed

administrator/components/com_media/resources/scripts/components/browser/table/row.vue

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@
66
@click="onClick"
77
>
88
<td
9+
v-if="item.mime_type === 'image/svg+xml' && getURL()"
10+
>
11+
<img
12+
:src="getURL()"
13+
:width="item.width"
14+
:height="item.height"
15+
alt=""
16+
style="width:100%;height:auto"
17+
@load="setSize"
18+
>
19+
</td>
20+
<td
21+
v-else
922
class="type"
1023
:data-type="item.extension"
1124
/>
@@ -31,6 +44,7 @@
3144
</template>
3245

3346
<script>
47+
import api from '../../../app/Api.es6';
3448
import * as types from '../../../store/mutation-types.es6';
3549
import navigable from '../../../mixins/navigable.es6';
3650
@@ -67,6 +81,30 @@ export default {
6781
},
6882
6983
methods: {
84+
getURL() {
85+
if (!this.item.thumb_path) {
86+
return '';
87+
}
88+
89+
return this.item.thumb_path.split(Joomla.getOptions('system.paths').rootFull).length > 1
90+
? `${this.item.thumb_path}?${this.item.modified_date ? new Date(this.item.modified_date).valueOf() : api.mediaVersion}`
91+
: `${this.item.thumb_path}`;
92+
},
93+
width() {
94+
return this.item.naturalWidth ? this.item.naturalWidth : 300;
95+
},
96+
height() {
97+
return this.item.naturalHeight ? this.item.naturalHeight : 150;
98+
},
99+
setSize(event) {
100+
if (this.item.mime_type === 'image/svg+xml') {
101+
const image = event.target;
102+
// Update the item properties
103+
this.$store.dispatch('updateItemProperties', { item: this.item, width: image.naturalWidth ? image.naturalWidth : 300, height: image.naturalHeight ? image.naturalHeight : 150 });
104+
// @TODO Remove the fallback size (300x150) when https://bugzilla.mozilla.org/show_bug.cgi?id=1328124 is fixed
105+
// Also https://github.com/whatwg/html/issues/3510
106+
}
107+
},
70108
/* Handle the on row double click event */
71109
onDblClick() {
72110
if (this.isDir) {

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,15 @@
374374
visibility: hidden;
375375
}
376376
}
377+
378+
.selected {
379+
background-color: $table-item-icon-bg-selected;
380+
381+
> td,
382+
> th {
383+
background-color: $table-item-icon-bg-selected;
384+
}
385+
}
377386
}
378387

379388
.action-toggle {

0 commit comments

Comments
 (0)