Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/257 access candidate uploads #272

Merged
merged 2 commits into from
Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions src/components/DownloadLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ export default {
type: String,
default: '',
},
userId: {
required: false,
type: String,
default: null,
},
title: {
required: false,
type: String,
Expand All @@ -39,23 +44,22 @@ export default {
linkText() {
return this.title ? this.title : this.fileName;
},
savePath() {
let savePath = '';
if (this.exerciseId) {
savePath += `exercise/${this.exerciseId}/`;
}
if (this.userId) {
savePath += `user/${this.userId}/`;
}
return savePath;
},
},
methods: {
download(fileName) {
this.visited = true;
// Create a reference to the file we want to download
const fileSavePath = `exercise/${this.exerciseId}/${fileName}`;

// Get a reference to the storage service, which is used to create references in your storage bucket
const storage = firebase.storage();

// Create a storage reference from our storage service
const storageRef = storage.ref();

// Create a reference with an initial file path and name
const fileNameRef = storageRef.child(fileSavePath);

// Get the download URL
const storageRef = firebase.storage().ref();
const fileNameRef = storageRef.child(this.savePath + fileName);
fileNameRef.getDownloadURL().then((url) => {
// open url in another window
window.open(url);
Expand Down
32 changes: 30 additions & 2 deletions src/views/Exercises/Show/Application.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,42 @@
Application
</h1>
<JsonRenderer :value="application" />
<div class="govuk-column-full">
<DownloadLink
v-if="application && application.uploadedCV"
:exercise-id="application.exerciseId"
:user-id="application.userId"
title="Uploaded CV"
:file-name="application.uploadedCV"
class="govuk-!-margin-right-3"
/>
<DownloadLink
v-if="application && application.uploadedSelfAssessment"
:exercise-id="application.exerciseId"
:user-id="application.userId"
title="Uploaded Self Assessment"
:file-name="application.uploadedSelfAssessment"
class="govuk-!-margin-right-3"
/>
<DownloadLink
v-if="application && application.uploadedSuitabilityStatement"
:exercise-id="application.exerciseId"
:user-id="application.userId"
title="Uploaded Suitability Statement"
:file-name="application.uploadedSuitabilityStatement"
class="govuk-!-margin-right-3"
/>
</div>
<button
v-if="isApplied"
class="govuk-button govuk-!-margin-right-3"
class="govuk-button govuk-!-margin-right-3 govuk-!-margin-top-3"
@click="unlock"
>
Unlock
</button>
<button
v-else
class="govuk-button govuk-!-margin-right-3"
class="govuk-button govuk-!-margin-right-3 govuk-!-margin-top-3"
@click="submitApplication"
>
Mark as applied
Expand All @@ -25,11 +51,13 @@
<script>
import BackLink from '@/components/BackLink';
import JsonRenderer from '@/components/JsonRenderer';
import DownloadLink from '@/components/DownloadLink';

export default {
components: {
BackLink,
JsonRenderer,
DownloadLink,
},
computed: {
exercise() {
Expand Down