Skip to content

Commit

Permalink
Merge pull request #227 from jac-uk/downloads
Browse files Browse the repository at this point in the history
Downloads
  • Loading branch information
warrensearle authored Jan 23, 2020
2 parents 16c79a8 + 69c0b93 commit f53c83b
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 11 deletions.
13 changes: 9 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
class="govuk-main-wrapper"
>
<header class="header">
<!-- HEADER SECTION -->
<!-- HEADER SECTION -->
<div>
<div>
<div>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds organisation__margin-bottom">
<div class="gem-c-organisation-logo brand--ministry-of-justice">
Expand All @@ -30,8 +30,13 @@
>
Sign Out
</button>
<button style="background-color: #753880;" target="_blank" class="govuk-button" onclick="location.href='https://apply.judicialappointments.digital/vacancies';">
Vacancies
<button
style="background-color: #753880;"
target="_blank"
class="govuk-button"
onclick="location.href='https://apply.judicialappointments.digital/vacancies';"
>
Vacancies
</button>
<br>
<span
Expand Down
14 changes: 12 additions & 2 deletions src/components/DownloadLink.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<a
class="govuk-link"
class="govuk-link govuk-body-m"
:class="{'download-visited' : visited }"
href="javascript:void(0)"
@click.prevent="download(fileName)"
>
{{ fileName }}
{{ linkText }}
</a>
</template>

Expand All @@ -24,12 +24,22 @@ export default {
type: String,
default: '',
},
title: {
required: false,
type: String,
default: '',
},
},
data () {
return {
visited: false,
};
},
computed: {
linkText() {
return this.title ? this.title : this.fileName;
},
},
methods: {
download(fileName) {
this.visited = true;
Expand Down
10 changes: 6 additions & 4 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import CKEditor from '@ckeditor/ckeditor5-vue';
import * as Sentry from '@sentry/browser';
import * as Integrations from '@sentry/integrations';

Sentry.init({
dsn: 'https://ab99abfef6294bc5b564e635d7b7cb4b@sentry.io/1792541',
integrations: [new Integrations.Vue({ Vue, attachProps: true })],
});
if (process.env.NODE_ENV !== 'development') {
Sentry.init({
dsn: 'https://ab99abfef6294bc5b564e635d7b7cb4b@sentry.io/1792541',
integrations: [new Integrations.Vue({ Vue, attachProps: true })],
});
}

Vue.config.productionTip = false;
Vue.use( CKEditor );
Expand Down
2 changes: 1 addition & 1 deletion src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ const router = new Router({
],
},
{
path: 'applications-full',
path: '/applications-full',
component: ApplicationsFull,
name: 'exercise-applications-full',
meta: {
Expand Down
17 changes: 17 additions & 0 deletions src/views/Exercises/Show/Downloads.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<DownloadLink
:file-name="exercise.uploadedCandidateAssessmentFormTemplate"
:exercise-id="exerciseId"
:title="downloadNameGenerator"
/>
</dd>
</div>
Expand Down Expand Up @@ -94,6 +95,22 @@ export default {
exerciseId() {
return this.$store.getters['exerciseDocument/id'];
},
downloadNameGenerator() {
let outcome = null;
if (this.exercise.assessmentOptions == 'statement-of-suitability-with-competencies') {
outcome = 'statement-of-suitability-with-competencies';
} else if (
this.exercise.assessmentOptions == 'statement-of-suitability-with-skills-and-abilities' ||
this.exercise.assessmentOptions == 'statement-of-suitability-with-skills-and-abilities-and-cv'
) {
outcome = 'statement-of-suitability-with-skills-and-abilities';
}
let fileName = this.exercise.uploadedCandidateAssessmentFormTemplate;
if (fileName) {
outcome = outcome + '.' + fileName.split('.').pop();
}
return outcome;
},
},
};
</script>
Expand Down

0 comments on commit f53c83b

Please sign in to comment.