Skip to content

Commit c887128

Browse files
committed
Show all evidence links on submissions page
1 parent 7b2334d commit c887128

File tree

5 files changed

+67
-30
lines changed

5 files changed

+67
-30
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<template>
2+
<div style="white-space: initial">
3+
<a v-for="(link, i) in currentValue" @click.stop="openLink(link.main)"
4+
><v-icon small
5+
>{{ isVideoUrl(link.main) ? 'mdi-video' : 'mdi-image' }}
6+
</v-icon></a
7+
>
8+
</div>
9+
</template>
10+
11+
<script>
12+
import columnMixin from '~/mixins/column'
13+
import { openLink } from '~/services/base'
14+
import { isVideoUrl } from '~/services/common'
15+
16+
export default {
17+
mixins: [columnMixin],
18+
19+
methods: {
20+
openLink,
21+
isVideoUrl,
22+
},
23+
computed: {},
24+
}
25+
</script>
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
<template>
2-
<div>
3-
<a
4-
v-if="currentValue.firstImageLink"
5-
@click.stop="openLink(currentValue.firstImageLink)"
6-
><v-icon small>mdi-image</v-icon></a
7-
>
8-
<a
9-
v-if="currentValue.firstVideoLink"
10-
@click.stop="openLink(currentValue.firstVideoLink)"
11-
><v-icon small>mdi-video</v-icon></a
12-
>
13-
</div>
14-
</template>
15-
16-
<script>
17-
import columnMixin from '~/mixins/column'
18-
import { openLink } from '~/services/base'
19-
20-
export default {
21-
mixins: [columnMixin],
22-
23-
methods: {
24-
openLink,
25-
},
26-
computed: {},
27-
}
28-
</script>
1+
<template>
2+
<div>
3+
<a
4+
v-if="currentValue.firstImageLink"
5+
@click.stop="openLink(currentValue.firstImageLink)"
6+
><v-icon small>mdi-image</v-icon></a
7+
>
8+
<a
9+
v-if="currentValue.firstVideoLink"
10+
@click.stop="openLink(currentValue.firstVideoLink)"
11+
><v-icon small>mdi-video</v-icon></a
12+
>
13+
</div>
14+
</template>
15+
16+
<script>
17+
import columnMixin from '~/mixins/column'
18+
import { openLink } from '~/services/base'
19+
20+
export default {
21+
mixins: [columnMixin],
22+
23+
methods: {
24+
openLink,
25+
},
26+
computed: {},
27+
}
28+
</script>

frontend/models/base/submission.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import AdminEditSubmissionInterface from '~/components/interface/crud/special/ad
1111
import CrudSubmissionInterface from '~/components/interface/crud/special/crudSubmissionInterface.vue'
1212
import UrlColumn from '~/components/table/urlColumn.vue'
1313
import EvidenceColumn from '~/components/table/special/evidenceColumn.vue'
14+
import AllEvidenceColumn from '~/components/table/special/allEvidenceColumn.vue'
1415
import RankingColumn from '~/components/table/special/rankingColumn.vue'
1516
import ReignColumn from '~/components/table/special/reignColumn.vue'
1617
import ParticipantsColumn from '~/components/table/special/participantsColumn.vue'
@@ -187,6 +188,11 @@ export const Submission = <RecordInfo<'submission'>>{
187188
fields: ['firstImageLink', 'firstVideoLink'],
188189
component: EvidenceColumn,
189190
},
191+
allEvidenceLinks: {
192+
text: 'Evidence',
193+
fields: ['externalLinks'],
194+
component: AllEvidenceColumn,
195+
},
190196
score: {
191197
text: 'Result',
192198
component: ResultColumn,

frontend/models/public/submission.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ export const PublicSubmission = {
4747
align: 'right',
4848
},
4949
{
50-
field: 'mainEvidenceLinks',
51-
width: '50px',
50+
field: 'allEvidenceLinks',
51+
width: '90px',
5252
},
5353
{
5454
field: 'happenedOn',

frontend/services/common.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,9 @@ export function generateEventText(
197197
export function isValidEvidenceLink(link: string) {
198198
return link.match(/youtu\.be|youtube\.com|streamable\.com|imgur\.com/)
199199
}
200+
201+
export function isVideoUrl(url: string) {
202+
return url.match(
203+
/(\.(gif|mp4)$)|(youtu\.be|youtube\.com|streamable\.com|gfycat\.com)/
204+
)
205+
}

0 commit comments

Comments
 (0)