2018-03-03 22:51:48 +00:00
|
|
|
{{#if media.length}}
|
|
|
|
<div class="compose-media-container" style="grid-template-columns: repeat({{media.length}}, 1fr);">
|
|
|
|
{{#each media as mediaItem, i}}
|
2018-03-02 05:21:49 +00:00
|
|
|
<div class="compose-media">
|
2018-03-03 22:51:48 +00:00
|
|
|
<img src="{{mediaItem.data.preview_url}}" alt="{{mediaItem.file.name}}"/>
|
2018-03-02 05:21:49 +00:00
|
|
|
<div class="compose-media-delete">
|
2018-03-03 05:55:04 +00:00
|
|
|
<button class="compose-media-delete-button"
|
2018-03-03 22:51:48 +00:00
|
|
|
data-a11y-dialog-hide aria-label="Delete {{mediaItem.file.name}}"
|
|
|
|
on:click="onDeleteMedia(i)" >
|
2018-03-02 05:21:49 +00:00
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<div class="compose-media-alt">
|
|
|
|
<input type="text"
|
|
|
|
placeholder="Description"
|
2018-03-03 22:51:48 +00:00
|
|
|
aria-label="Describe {{mediaItem.file.name}} for the visually impaired">
|
2018-03-02 05:21:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{/each}}
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
|
|
|
<style>
|
|
|
|
.compose-media-container {
|
|
|
|
grid-area: media;
|
|
|
|
display: grid;
|
|
|
|
grid-column-gap: 5px;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
margin-top: 10px;
|
|
|
|
background: var(--form-bg);
|
|
|
|
padding: 5px;
|
|
|
|
border-radius: 4px;
|
|
|
|
}
|
|
|
|
.compose-media {
|
|
|
|
height: 200px;
|
|
|
|
overflow: hidden;
|
|
|
|
flex-direction: column;
|
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
background: var(--main-bg);
|
|
|
|
}
|
|
|
|
.compose-media img {
|
|
|
|
object-fit: contain;
|
|
|
|
object-position: center center;
|
|
|
|
flex: 1;
|
|
|
|
height: 100%;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
.compose-media-alt {
|
|
|
|
z-index: 10;
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
|
|
|
.compose-media-alt input {
|
|
|
|
width: 100%;
|
|
|
|
font-size: 1.2em;
|
|
|
|
background: var(--alt-input-bg);
|
|
|
|
}
|
|
|
|
.compose-media-alt input:focus {
|
|
|
|
background: var(--main-bg);
|
|
|
|
}
|
|
|
|
.compose-media-delete {
|
|
|
|
position: absolute;
|
|
|
|
z-index: 10;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
left: 0;
|
|
|
|
display: flex;
|
|
|
|
justify-content: flex-end;
|
|
|
|
margin: 2px;
|
|
|
|
}
|
|
|
|
.compose-media-delete-button {
|
|
|
|
padding: 0 0 7px;
|
|
|
|
background: none;
|
|
|
|
border: none;
|
|
|
|
}
|
|
|
|
.compose-media-delete-button:hover {
|
|
|
|
background: var(--toast-border);
|
|
|
|
}
|
|
|
|
.compose-media-delete-button span {
|
|
|
|
padding: 0 10px 7px;
|
|
|
|
font-size: 32px;
|
|
|
|
color: var(--button-text);
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
import { store } from '../../_store/store'
|
2018-03-03 05:55:04 +00:00
|
|
|
import { deleteMedia } from '../../_actions/media'
|
2018-03-02 05:21:49 +00:00
|
|
|
|
|
|
|
export default {
|
2018-03-03 05:55:04 +00:00
|
|
|
store: () => store,
|
|
|
|
methods: {
|
|
|
|
onDeleteMedia(i) {
|
2018-03-03 18:11:32 +00:00
|
|
|
deleteMedia(this.get('realm'), i)
|
2018-03-03 05:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
2018-03-02 05:21:49 +00:00
|
|
|
}
|
|
|
|
</script>
|