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

[Draft] Temporary fix for Yibei's schema -- issues with Radio button component #321

Closed
wants to merge 4 commits into from
Closed
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
27 changes: 27 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use Node.js version 12 as the base image
FROM node:12-alpine

# Set the working directory in the container
WORKDIR /app

# Install Python and build tools
RUN apk add --update --no-cache python2 g++ make

# Copy package.json and package-lock.json for installing dependencies
COPY package*.json ./

# Install project dependencies
RUN npm install

# Copy the rest of your app's source code from your host to your image filesystem.
COPY . .

# Vue CLI serves on port 8080 by default, expose that port
EXPOSE 8080

# Command to run the app using npm
CMD ["npm", "run", "serve"]

# to run locally:
# docker build -f Dockerfile.dev -t yourapp .
# docker run -v $(pwd):/app -p 8080:8080 --rm yourapp
4 changes: 3 additions & 1 deletion src/components/InputSelector/InputSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
:constraints="valueConstraints"
:selected_language="selected_language"
:reprotermsUrl="reprotermsUrl"
:init="init" v-on:valueChanged="sendData"/>
:init="init"
v-on:valueChanged="sendData"
/>
</div>

<div v-else-if="inputType === 'audioCheck'">
Expand Down
6 changes: 3 additions & 3 deletions src/components/Inputs/WebRadio/Radio.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default {
}
return {
text, // ESLint object-shorthand
value: v['http://schema.repronim.org/value'][0]['@value'],
value: v['http://schema.repronim.org/value'][0]['@value'] ? v['http://schema.repronim.org/value'][0]['@value'] : text, // Fallback to 'text' in case schema.repronim value isn't found
image: v['http://schema.org/image'] ? v['http://schema.org/image'][0]['@value'] : null,
};
});
Expand Down Expand Up @@ -154,8 +154,8 @@ export default {
e.preventDefault();
this.$emit('valueChanged', this.checkboxSelected);
},
sendData(val) {
this.$emit('valueChanged', val);
sendData() {
this.$emit('valueChanged', this.selected);
},
onSelectImage(d) {
this.selected = d.id;
Expand Down
6 changes: 4 additions & 2 deletions src/components/Survey/Survey.vue
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,11 @@
},
setResponse(val, index, mp_progress=100) {
const itemUrl = this.context[index]['@id'];
console.log(itemUrl)
let exportVal = val;
let usedList = [];
let isAboutUrl = itemUrl;
if (val.constructor === Object && !val.hasOwnProperty('unitCode')) { // to find sub-activities; condition might need to be changed
if (val?.constructor === Object && !val?.hasOwnProperty('unitCode')) { // to find sub-activities; condition might need to be changed
const sectionItemKey = Object.keys(val)[0];
const sectionItemValue = Object.values(val)[0];
exportVal = sectionItemValue;
Expand Down Expand Up @@ -320,7 +321,8 @@
this.$emit('saveScores', this.srcUrl, this.scores);
}
}
this.updateProgress(mp_progress);
// TODO: Evaluate -- this was broken for Radio Button input
this.updateProgress();
},
setScore(scoreObj, index) {
this.$emit('saveScores', this.context[index]['@id'], scoreObj);
Expand Down
30 changes: 20 additions & 10 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
// module.exports = {
// githubSrc: 'https://raw.githubusercontent.com/ReproNim/demo-protocol/master/DemoProtocol/DemoProtocol_schema',
// startButton: {
// "en": 'Join',
// "es": 'Participar'
// },
// assetsPublicPath: '/reproschema-ui/',
// backendServer: null,
// consent: true,
// showHelp: true,
// contact: '[email protected]',
// emailSubject: 'Help with Covid19 study'
// };

// Yibei's config
module.exports = {
githubSrc: 'https://raw.githubusercontent.com/ReproNim/demo-protocol/master/DemoProtocol/DemoProtocol_schema',
startButton: {
"en": 'Join',
"es": 'Participar'
},
/* eslint-disable */
githubSrc: 'https://raw.githubusercontent.com/repronim/nimh-minimal/main/nimh_minimal/nimh_minimal_schema',
banner: 'NIMH data collection',
startButton: 'Start',
assetsPublicPath: '/reproschema-ui/',
backendServer: null,
consent: true,
showHelp: true,
contact: '[email protected]',
emailSubject: 'Help with Covid19 study'
backendServer: null
};
Loading