Skip to content

Commit c03c21d

Browse files
committed
Style changes: made sure that props aren't in array form and that the blocks inside the export default block are in the same order across different Vue.js files.
1 parent b69da21 commit c03c21d

File tree

35 files changed

+19573
-544
lines changed

35 files changed

+19573
-544
lines changed

package-lock.json

Lines changed: 387 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"i18n:report": "vue-cli-service i18n:report --src './src/**/*.?(js|vue)' --locales './src/locales/**/*.json'"
1212
},
1313
"dependencies": {
14+
"@adapttive/vue-markdown": "^4.0.2",
1415
"axios": "^1.7.4",
1516
"bootstrap-vue": "^2.23.1",
1617
"bowser": "^2.11.0",
@@ -23,7 +24,6 @@
2324
"msr": "^1.3.4",
2425
"vue": "^2.7.16",
2526
"vue-i18n": "^8.28.2",
26-
"@adapttive/vue-markdown": "^4.0.2",
2727
"vue-multiselect": "^2.1.9",
2828
"vue-router": "^3.6.5",
2929
"vue-slider-component": "^3.2.24",
@@ -33,6 +33,7 @@
3333
"vuex": "^3.6.2"
3434
},
3535
"devDependencies": {
36+
"@babel/eslint-parser": "^7.24.1",
3637
"@intlify/vue-i18n-loader": "^3.3.0",
3738
"@vue/cli-plugin-babel": "^5.0.8",
3839
"@vue/cli-plugin-e2e-cypress": "^5.0.8",
@@ -42,9 +43,9 @@
4243
"@vue/cli-plugin-vuex": "~5.0.8",
4344
"@vue/cli-service": "^5.0.8",
4445
"@vue/test-utils": "^1.0.3",
45-
"@babel/eslint-parser": "^7.24.1",
46-
"eslint": "^7.32.0",
46+
"@vue/vue2-jest": "^27.0.0",
4747
"cypress": "^13.7.2",
48+
"eslint": "^7.32.0",
4849
"eslint-plugin-vue": "^7.20.0",
4950
"vue-cli-plugin-i18n": "^2.3.2",
5051
"vue-template-compiler": "^2.7.16"

src/App.vue

Lines changed: 75 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -552,81 +552,6 @@ export default {
552552
});
553553
},
554554
},
555-
watch: {
556-
$route() {
557-
if (this.$route.params.id !== undefined) {
558-
this.$store.dispatch('setActivityIndex', this.$route.params.id);
559-
}
560-
},
561-
visibilityConditions: {
562-
handler(newC) {
563-
if (!_.isEmpty(newC)) {
564-
this.setVisbility();
565-
}
566-
},
567-
deep: true,
568-
},
569-
},
570-
created() {
571-
const url = this.$route.query.url;
572-
if (url) {
573-
this.protocolUrl = url;
574-
}
575-
this.$store.dispatch('getBaseSchema', url).then(() => this.getPrefLabel());
576-
// this.$store.dispatch('getBaseSchema', url);
577-
},
578-
mounted() {
579-
new EmailDecoder('[data-email]');
580-
this.clientSpecs = JSON.stringify(Bowser.parse(window.navigator.userAgent));
581-
this.browserType = Bowser.parse(window.navigator.userAgent).browser.name;
582-
if (config.checkMediaPermission) {
583-
this.checkPermission();
584-
}
585-
if (this.$route.query.lang) {
586-
this.selected_language = this.$route.query.lang;
587-
i18n.locale = this.selected_language;
588-
} else this.selected_language = 'en';
589-
590-
if (this.$route.query.uid) {
591-
// console.log(407, this.$route.query.uid);
592-
this.$store.dispatch('saveParticipantId', this.$route.query.uid);
593-
} else if (config.generateRandomUid) {
594-
this.$store.dispatch('saveParticipantId', uuidv4());
595-
}
596-
if (this.$route.params.id) {
597-
this.$store.dispatch('setActivityIndex', this.$route.params.id);
598-
}
599-
axios.get('https://raw.githubusercontent.com/ReproNim/reproschema-library/master/resources/languages.json').then((resp) => {
600-
this.langMap = resp.data;
601-
});
602-
this.$store.dispatch('setParticipantUUID', uuidv4()); // set participant UUID for the current user
603-
if (this.$route.query.expiry_time) {
604-
this.$store.dispatch('setExpiryMinutes', this.$route.query.expiry_time);
605-
}
606-
if (this.$route.query.auth_token) {
607-
this.$store.dispatch('setAuthToken', this.$route.query.auth_token);
608-
}
609-
if (!_.isEmpty(this.$route.query)) {
610-
this.$store.dispatch('setQueryParameters', this.$route.query);
611-
}
612-
613-
// const formData = new FormData();
614-
// const TOKEN = this.$store.getters.getAuthToken;
615-
// if (TOKEN) {
616-
// formData.append('file', null);
617-
// formData.append('auth_token', `${TOKEN}`);
618-
// axios.post(`${config.backendServer}/submit`, formData, {
619-
// 'Content-Type': 'multipart/form-data',
620-
// }).then((res) => {
621-
// // console.log('SUCCESS!!', res.status);
622-
// })
623-
// .catch((e) => {
624-
// if (e.response.status === 403) {
625-
// this.invalidToken = true;
626-
// }
627-
// });
628-
// }
629-
},
630555
computed: {
631556
accessDeniedPath() {
632557
let path = require('./assets/403-Access-Forbidden-HTML-Template.gif');
@@ -817,6 +742,81 @@ export default {
817742
return this.$store.getters.getParticipantId;
818743
},
819744
},
745+
mounted() {
746+
new EmailDecoder('[data-email]');
747+
this.clientSpecs = JSON.stringify(Bowser.parse(window.navigator.userAgent));
748+
this.browserType = Bowser.parse(window.navigator.userAgent).browser.name;
749+
if (config.checkMediaPermission) {
750+
this.checkPermission();
751+
}
752+
if (this.$route.query.lang) {
753+
this.selected_language = this.$route.query.lang;
754+
i18n.locale = this.selected_language;
755+
} else this.selected_language = 'en';
756+
757+
if (this.$route.query.uid) {
758+
// console.log(407, this.$route.query.uid);
759+
this.$store.dispatch('saveParticipantId', this.$route.query.uid);
760+
} else if (config.generateRandomUid) {
761+
this.$store.dispatch('saveParticipantId', uuidv4());
762+
}
763+
if (this.$route.params.id) {
764+
this.$store.dispatch('setActivityIndex', this.$route.params.id);
765+
}
766+
axios.get('https://raw.githubusercontent.com/ReproNim/reproschema-library/master/resources/languages.json').then((resp) => {
767+
this.langMap = resp.data;
768+
});
769+
this.$store.dispatch('setParticipantUUID', uuidv4()); // set participant UUID for the current user
770+
if (this.$route.query.expiry_time) {
771+
this.$store.dispatch('setExpiryMinutes', this.$route.query.expiry_time);
772+
}
773+
if (this.$route.query.auth_token) {
774+
this.$store.dispatch('setAuthToken', this.$route.query.auth_token);
775+
}
776+
if (!_.isEmpty(this.$route.query)) {
777+
this.$store.dispatch('setQueryParameters', this.$route.query);
778+
}
779+
780+
// const formData = new FormData();
781+
// const TOKEN = this.$store.getters.getAuthToken;
782+
// if (TOKEN) {
783+
// formData.append('file', null);
784+
// formData.append('auth_token', `${TOKEN}`);
785+
// axios.post(`${config.backendServer}/submit`, formData, {
786+
// 'Content-Type': 'multipart/form-data',
787+
// }).then((res) => {
788+
// // console.log('SUCCESS!!', res.status);
789+
// })
790+
// .catch((e) => {
791+
// if (e.response.status === 403) {
792+
// this.invalidToken = true;
793+
// }
794+
// });
795+
// }
796+
},
797+
watch: {
798+
$route() {
799+
if (this.$route.params.id !== undefined) {
800+
this.$store.dispatch('setActivityIndex', this.$route.params.id);
801+
}
802+
},
803+
visibilityConditions: {
804+
handler(newC) {
805+
if (!_.isEmpty(newC)) {
806+
this.setVisbility();
807+
}
808+
},
809+
deep: true,
810+
},
811+
},
812+
created() {
813+
const url = this.$route.query.url;
814+
if (url) {
815+
this.protocolUrl = url;
816+
}
817+
this.$store.dispatch('getBaseSchema', url).then(() => this.getPrefLabel());
818+
// this.$store.dispatch('getBaseSchema', url);
819+
}
820820
};
821821
</script>
822822

@@ -943,5 +943,3 @@ export default {
943943
944944
945945
</style>
946-
947-

src/components/InputSelector/InputSelector.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
:constraints="valueConstraints"
154154
:selected_language="selected_language"
155155
:init="init" v-on:valueChanged="sendData"/>
156-
</div>
156+
</div>
157157

158158
<!-- If type is date -->
159159
<div v-else-if="inputType === 'date' || inputType === 'year'">

src/components/Inputs/AudioCheck/AudioCheck.vue

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,6 @@ export default {
9191
hasError: false,
9292
};
9393
},
94-
computed: {
95-
recordingTime() {
96-
return this.constraints['http://schema.org/maxValue'][0]['@value'];
97-
},
98-
},
9994
methods: {
10095
record() {
10196
this.isRecording = true;
@@ -197,11 +192,9 @@ export default {
197192
// this.$dialog.alert(notification, options);
198193
},
199194
},
200-
watch: {
201-
init() {
202-
if (this.init === 'skip' || this.init === 'dontKnow') {
203-
this.hasRecording = false;
204-
}
195+
computed: {
196+
recordingTime() {
197+
return this.constraints['http://schema.org/maxValue'][0]['@value'];
205198
},
206199
},
207200
mounted() {
@@ -266,5 +259,12 @@ export default {
266259
// console.log(259, 'Getusermedia API is not supported on this browser');
267260
}
268261
},
262+
watch: {
263+
init() {
264+
if (this.init === 'skip' || this.init === 'dontKnow') {
265+
this.hasRecording = false;
266+
}
267+
},
268+
},
269269
};
270270
</script>

src/components/Inputs/DocumentUpload/DocumentUpload.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
1111
export default {
1212
name: 'DocumentUpload',
13-
props: ['constraints', 'init'],
13+
props: {
14+
'constraints': {},
15+
'init': {}
16+
},
1417
data() {
1518
return {
1619
selectedFile: null,

src/components/Inputs/EmailInput/EmailInput.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@
2020
<script>
2121
export default {
2222
name: 'EmailInput',
23-
props: ['constraints', 'init'],
23+
props: {
24+
'constraints': {},
25+
'init': {}
26+
},
27+
data() {
28+
return {
29+
input: null,
30+
};
31+
},
2432
methods: {
2533
onSubmit(e) {
2634
e.preventDefault();
@@ -40,11 +48,6 @@ export default {
4048
return this.isValid(this.input);
4149
},
4250
},
43-
data() {
44-
return {
45-
input: null,
46-
};
47-
},
4851
mounted() {
4952
if (this.init) {
5053
this.input = this.init;

src/components/Inputs/MultiTextInput/MultiTextInput.vue

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,17 @@
3131
<script>
3232
export default {
3333
name: 'TextInput',
34-
props: ['constraints', 'init'],
34+
props: {
35+
'constraints': {},
36+
'init': {}
37+
},
38+
data() {
39+
return {
40+
input1: '',
41+
input2: '',
42+
input3: '',
43+
};
44+
},
3545
methods: {
3646
onSubmit(e) {
3747
e.preventDefault();
@@ -42,13 +52,6 @@ export default {
4252
this.$emit('valueChanged', name);
4353
},
4454
},
45-
data() {
46-
return {
47-
input1: '',
48-
input2: '',
49-
input3: '',
50-
};
51-
},
5255
mounted() {
5356
if (this.init) {
5457
this.input1 = this.init.first_name;

src/components/Inputs/ParticipantId/ParticipantId.vue

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,23 @@ import { v4 as uuidv4 } from 'uuid';
1818
1919
export default {
2020
name: 'ParticipantId',
21-
props: ['constraints', 'init'],
22-
methods: {
23-
onSubmit(e) {
24-
e.preventDefault();
25-
// console.log(25, 'submit', this.input);
26-
this.$emit('valueChanged', this.input);
27-
},
21+
props: {
22+
'constraints': {},
23+
'init': {}
2824
},
2925
data() {
3026
return {
3127
input: '',
3228
p_uuid: '',
3329
};
3430
},
31+
methods: {
32+
onSubmit(e) {
33+
e.preventDefault();
34+
// console.log(25, 'submit', this.input);
35+
this.$emit('valueChanged', this.input);
36+
},
37+
},
3538
computed: {
3639
getPId() {
3740
return this.$store.getters.getParticipantId;

src/components/Inputs/RangeInput/RangeInput.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ import 'vue-multiselect/dist/vue-multiselect.min.css';
6767
6868
export default {
6969
name: 'RangeInput',
70-
props: ['constraints', 'init'],
70+
props: {
71+
'constraints': {},
72+
'init': {}
73+
},
7174
components: {
7275
Multiselect,
7376
},
@@ -97,7 +100,7 @@ export default {
97100
const num = parseFloat(this.input);
98101
if (isNaN(num)) {
99102
return false;
100-
}
103+
}
101104
return Number.isFinite(num);
102105
},
103106
isValidRange() {
@@ -107,7 +110,7 @@ export default {
107110
if (num2 > num1) {
108111
return true;
109112
} return false;
110-
},
113+
},
111114
selectedLanguageLabel(unit) {
112115
const activeUnitOption = _.filter(unit['http://www.w3.org/2004/02/skos/core#prefLabel'], u => u['@language'] === this.selected_language);
113116
if (!Array.isArray(activeUnitOption) || !activeUnitOption.length) {

0 commit comments

Comments
 (0)