-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(medic/cht-core#6598): Command line to convert and upload trainin…
…g forms (#529) Adds `convert-training-forms`, `upload-training-forms` and `validate-training-forms` commands for training forms
- Loading branch information
1 parent
afb480a
commit fb700ef
Showing
16 changed files
with
434 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const convertForms = require('../lib/convert-forms').execute; | ||
const environment = require('../lib/environment'); | ||
const { TRAINING_FORMS_PATH } = require('../lib/project-paths'); | ||
|
||
const convertTrainingForms = (forms) => { | ||
return convertForms(environment.pathToProject, 'training', { | ||
enketo: true, | ||
forms: forms, | ||
}); | ||
}; | ||
|
||
module.exports = { | ||
requiresInstance: false, | ||
convertTrainingForms, | ||
TRAINING_FORMS_PATH, | ||
execute: () => convertTrainingForms(environment.extraArgs) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const environment = require('../lib/environment'); | ||
const uploadForms = require('../lib/upload-forms').execute; | ||
const { TRAINING_FORMS_PATH } = require('../lib/project-paths'); | ||
|
||
const uploadTrainingForms = (forms) => { | ||
return uploadForms(environment.pathToProject, 'training', { | ||
id_prefix: 'training:', | ||
forms: forms, | ||
}); | ||
}; | ||
|
||
module.exports = { | ||
requiresInstance: true, | ||
uploadTrainingForms, | ||
TRAINING_FORMS_PATH, | ||
execute: () => uploadTrainingForms(environment.extraArgs) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const validateForms = require('../lib/validate-forms'); | ||
const environment = require('../lib/environment'); | ||
|
||
const validateTrainingForms = (forms) => { | ||
return validateForms(environment.pathToProject, 'training', { forms }); | ||
}; | ||
|
||
module.exports = { | ||
requiresInstance: false, | ||
validateTrainingForms, | ||
execute: () => validateTrainingForms(environment.extraArgs) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
test/data/convert-training-forms/forms/training/expected/new_actions_training.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?xml version="1.0"?> | ||
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa" xmlns:orx="http://openrosa.org/xforms"> | ||
<h:head> | ||
<h:title>new_actions_training</h:title> | ||
<model> | ||
<itext> | ||
<translation lang="en"> | ||
<text id="/new_actions_training/action_icons/action_icons_note_1:label"> | ||
<value>The "New Action" icon at the bottom of your app has changed to a big blue plus icon.</value> | ||
</text> | ||
<text id="/new_actions_training/ending/ending_note_1:label"> | ||
<value>If you do not understand these changes, please contact your supervisor.</value> | ||
</text> | ||
<text id="/new_actions_training/ending/ending_note_2:label"> | ||
<value>When you're ready, go ahead and start using your app.</value> | ||
</text> | ||
<text id="/new_actions_training/intro/intro_note_1:label"> | ||
<value>There have been some changes to icons in your app. The next few screens will show you the difference.</value> | ||
</text> | ||
<text id="/new_actions_training/intro/intro_note_2:label"> | ||
<value>Read each screen carefully and tap "Next" if you understand. If you need extra support, please contact your supervisor.</value> | ||
</text> | ||
</translation> | ||
</itext> | ||
<instance> | ||
<new_actions_training id="new_actions_training" prefix="J1!new_actions_training!" delimiter="#" version="2023-01-18 04:35:53"> | ||
<intro tag="hidden"> | ||
<intro_note_1 tag="hidden"/> | ||
<intro_note_2 tag="hidden"/> | ||
</intro> | ||
<action_icons tag="hidden"> | ||
<action_icons_note_1 tag="hidden"/> | ||
</action_icons> | ||
<ending tag="hidden"> | ||
<ending_note_1 tag="hidden"/> | ||
<ending_note_2 tag="hidden"/> | ||
</ending> | ||
<meta tag="hidden"> | ||
<instanceID/> | ||
</meta> | ||
</new_actions_training> | ||
</instance> | ||
<bind nodeset="/new_actions_training/intro/intro_note_1" readonly="true()" type="string"/> | ||
<bind nodeset="/new_actions_training/intro/intro_note_2" readonly="true()" type="string"/> | ||
<bind nodeset="/new_actions_training/action_icons/action_icons_note_1" readonly="true()" type="string"/> | ||
<bind nodeset="/new_actions_training/ending/ending_note_1" readonly="true()" type="string"/> | ||
<bind nodeset="/new_actions_training/ending/ending_note_2" readonly="true()" type="string"/> | ||
<bind nodeset="/new_actions_training/meta/instanceID" type="string" readonly="true()" calculate="concat('uuid:', uuid())"/> | ||
</model> | ||
</h:head> | ||
<h:body class="pages"> | ||
<group appearance="field-list" ref="/new_actions_training/intro"> | ||
<input ref="/new_actions_training/intro/intro_note_1"> | ||
<label ref="jr:itext('/new_actions_training/intro/intro_note_1:label')"/> | ||
</input> | ||
<input ref="/new_actions_training/intro/intro_note_2"> | ||
<label ref="jr:itext('/new_actions_training/intro/intro_note_2:label')"/> | ||
</input> | ||
</group> | ||
<group appearance="field-list" ref="/new_actions_training/action_icons"> | ||
<input ref="/new_actions_training/action_icons/action_icons_note_1"> | ||
<label ref="jr:itext('/new_actions_training/action_icons/action_icons_note_1:label')"/> | ||
</input> | ||
</group> | ||
<group appearance="field-list" ref="/new_actions_training/ending"> | ||
<input ref="/new_actions_training/ending/ending_note_1"> | ||
<label ref="jr:itext('/new_actions_training/ending/ending_note_1:label')"/> | ||
</input> | ||
<input ref="/new_actions_training/ending/ending_note_2"> | ||
<label ref="jr:itext('/new_actions_training/ending/ending_note_2:label')"/> | ||
</input> | ||
</group> | ||
</h:body> | ||
</h:html> |
Binary file added
BIN
+35.3 KB
test/data/convert-training-forms/forms/training/new_actions_training.xlsx
Binary file not shown.
Empty file.
Empty file.
Oops, something went wrong.