Skip to content

Commit

Permalink
Merge branch 'release/0.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
YaaL committed Jul 31, 2020
2 parents 0143e6f + 940a974 commit 5b55f83
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "assessment-uploader",
"version": "0.5.0",
"version": "0.6.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --mode develop",
Expand Down
21 changes: 19 additions & 2 deletions src/components/Form/FileUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export default {
file: '',
isReplacing: false,
isUploading: false,
acceptableExtensions: ['docx', 'doc', 'odf'],
};
},
computed: {
Expand Down Expand Up @@ -121,22 +122,38 @@ export default {
},
generateFileName(originalName) {
const parts = originalName.split('.');
if( parts.length === 1 || ( parts[0] === '' && parts.length === 2 )) {
if ( parts.length === 1 || ( parts[0] === '' && parts.length === 2 )) {
return this.name;
}
return [this.name, parts.pop()].join('.');
},
validFileExtension(originalName){
const parts = originalName.split('.');
if (parts.length < 2){
return false;
}
if (this.acceptableExtensions.includes(parts.pop())){
return true;
}
return false;
},
resetFile() {
this.$refs.file = null;
this.isUploading = false;
},
async upload(file) {
// @todo return more useful error messages
if (!file) {
this.setError('File upload failed, please try again');
return false;
}
if (!this.validFileExtension(file.name)) {
this.setError(`Invalid file type. Choose from: ${this.acceptableExtensions}`);
return false;
}
this.isUploading = true;
Expand Down
9 changes: 9 additions & 0 deletions src/components/LoadingMessage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,19 @@
</template>

<script>
import { auth } from '@/firebase';
export default {
props: {
loadFailed: Boolean,
},
watch: {
loadFailed: function(newVal) {
if(newVal == true){
// If we fail to load, log the user out
auth().signOut();
}
},
},
};
</script>

Expand Down
9 changes: 6 additions & 3 deletions src/views/Assessment/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
<div class="govuk-grid-row">
<form @submit.prevent="save">
<div class="govuk-grid-column-two-thirds">
<BackLink />
<router-link
class="govuk-back-link"
to="/assessments"
>
View All Assessments
</router-link>

<h1 class="govuk-heading-l">
Upload Independent Assessment
Expand Down Expand Up @@ -86,15 +91,13 @@
</div>
</template>
<script>
import BackLink from '@/components/BackLink';
import Form from '@/components/Form/Form';
import ErrorSummary from '@/components/Form/ErrorSummary';
import DownloadLink from '@/components/DownloadLink';
import FileUpload from '@/components/Form/FileUpload';
export default {
components: {
BackLink,
ErrorSummary,
DownloadLink,
FileUpload,
Expand Down
9 changes: 6 additions & 3 deletions src/views/Assessment/View.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<template>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<BackLink />
<router-link
class="govuk-back-link"
to="/assessments"
>
View All Assessments
</router-link>

<h1 class="govuk-heading-l">
Review Assessment
Expand Down Expand Up @@ -71,12 +76,10 @@
<script>
import { mapState } from 'vuex';
import BackLink from '@/components/BackLink';
import DownloadLink from '@/components/DownloadLink';
export default {
components: {
BackLink,
DownloadLink,
},
computed: {
Expand Down
2 changes: 1 addition & 1 deletion src/views/SignIn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default {
async created() {
if (this.$route.query.email && this.$route.query.ref) {
// we have email and ref querystring parameters so try to sign in automatically
const email = this.$route.query.email;
const email = this.$route.query.email.replace(/ /g, '+'); // Quick fix for #28 `+` being stripped from emails in IA links
const ref = this.$route.query.ref;
const returnUrl = `${window.location.protocol}//${window.location.host}/sign-in`;
const response = await functions.httpsCallable('generateSignInWithEmailLink')({ ref: ref, email: email, returnUrl: returnUrl });
Expand Down

0 comments on commit 5b55f83

Please sign in to comment.