-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved the class module in ./scripts/modules/ to ./server/src/modules/;
Updated path to modules in group-new.js Create modules doc Created translations dir in docs for language-specific translations.
- Loading branch information
1 parent
9b00e97
commit 091251d
Showing
10 changed files
with
167 additions
and
44 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
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,42 @@ | ||
# Tangy Modules | ||
|
||
Modules provide two functions: | ||
- forms added to the client when a new group is created | ||
- data transformation for reporting | ||
|
||
Steps to add a module | ||
- Forms that need to be copied over to the client should be placed in server/src/modules/moduleName. | ||
- Modify the code in server/src/routes/group-new | ||
- Add new functionality to the client Angular code, if needed. | ||
|
||
To modify the data transformation for reports, add an index.js file to your modules directory and follow this code example | ||
to implement the flatFormReponse hook: | ||
|
||
``` | ||
const DB = require('../../db.js') | ||
const log = require('tangy-log').log | ||
const clog = require('tangy-log').clog | ||
module.exports = { | ||
hooks: { | ||
flatFormReponse: function(data) { | ||
return new Promise((resolve, reject) => { | ||
debugger; | ||
let formResponse = data.formResponse | ||
let flatFormResponse = data.flatFormResponse | ||
if (formResponse.metadata && formResponse.metadata.studentRegistrationDoc && formResponse.metadata.studentRegistrationDoc.classId) { | ||
let studentRegistrationDoc = formResponse.metadata.studentRegistrationDoc | ||
flatFormResponse[`sr_classId`] = studentRegistrationDoc.classId; | ||
flatFormResponse[`sr_student_name`] = studentRegistrationDoc.student_name; | ||
flatFormResponse[`sr_student_id`] = studentRegistrationDoc.id; | ||
flatFormResponse[`sr_age`] = studentRegistrationDoc.age; | ||
flatFormResponse[`sr_gender`] = studentRegistrationDoc.gender; | ||
} | ||
resolve({flatFormResponse, formResponse}) | ||
}) | ||
} | ||
} | ||
} | ||
``` | ||
|
||
This code will be automatically run when the TangyModules (server/src/modules/index.js) is run |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
File renamed without changes.
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,105 @@ | ||
{ | ||
"Accuracy": "Accuracy:", | ||
"Accuracy Level:": "Accuracy Level:", | ||
"An update is available. Be sure to first sync your data before installing the update. If you have not done this, click `Cancel`. If you are ready to install the update, click `Yes`": "An update is available. Be sure to first sync your data before installing the update. If you have not done this, click `Cancel`. If you are ready to install the update, click `Yes`", | ||
"Applying Updates...": "Applying Updates...", | ||
"Are you sure you want to start a form response?": "Are you sure you want to start a form response?", | ||
"Are you sure you would like to exit the form?": "Are you sure you would like to exit the form?", | ||
"Check for Update": "Check for Update", | ||
"Checking For Updates...": "Checking For Updates...", | ||
"Click a Picture": "Click a Picture", | ||
"Click the play button to get started.": "Click the play button to get started.", | ||
"Confirm New Password": "Confirm New Password", | ||
"Confirm Password": "Confirm Password", | ||
"Could Not Create User": "Could Not Create User", | ||
"Could Not Load List Of Forms": "Could Not Load List Of Forms", | ||
"Create Form": "Create Form", | ||
"Date and Time": "Date and Time", | ||
"Docs Not Uploaded": "Docs Not Uploaded", | ||
"Docs Uploaded": "Docs Uploaded", | ||
"Download CSV": "Download CSV", | ||
"EXPORT DATA FOR ALL USERS": "EXPORT DATA FOR ALL USERS", | ||
"Edit Item": "Edit Item", | ||
"Enter your response to above question here": "Enter your response to above question here", | ||
"Export Data": "Export Data", | ||
"File Stored At": "File Stored At", | ||
"Filter": "Filter", | ||
"Form Name": "Form Name", | ||
"Form Title": "Form Title", | ||
"Item Listing": "Item Listing", | ||
"Item Not Found": "Item Not Found", | ||
"LAST ATTEMPTED": "LAST ATTEMPTED", | ||
"LOGIN": "LOGIN", | ||
"Last Successful Sync Timestamp": "Last Successful Sync Timestamp", | ||
"Last attempted cannot be before an item marked.": "Last attempted cannot be before an item marked.", | ||
"Latitude": "Latitude:", | ||
"Loading": "Loading...", | ||
"Login Unsuccesful": "Login Unsuccesful", | ||
"Logout": "Logout", | ||
"Longitude": "Longitude:", | ||
"MARK": "MARK", | ||
"Manage Profile": "Manage Profile", | ||
"Meters": "Meters", | ||
"My Forms": "My Forms", | ||
"New Form": "New Form", | ||
"New Item": "New Item", | ||
"New Password": "New Password", | ||
"No Data for": "No Data for", | ||
"No Forms Currently Defined": "No Forms Currently Defined", | ||
"No Update": "No Update", | ||
"Observations": "Observations", | ||
"Open": "Open", | ||
"Password": "Password", | ||
"Password Reset Unsuccesful": "Password Reset Unsuccesful", | ||
"Percentage Complete": "Percentage Complete", | ||
"RECOVER ACCOUNT": "RECOVER ACCOUNT", | ||
"REGISTER": "REGISTER", | ||
"RESET": "RESET", | ||
"RESET PASSWORD": "RESET PASSWORD", | ||
"Reports": "Reports", | ||
"Response": "response", | ||
"START": "START", | ||
"STOP": "STOP", | ||
"SYNC DATA FOR ALL USERS": "SYNC DATA FOR ALL USERS", | ||
"Save": "Save", | ||
"Save before switching or your changes will be deleted.": "Save before switching or your changes will be deleted.", | ||
"School": "School", | ||
"Searching...": "Searching...", | ||
"Select Form Name": "Select Form Name", | ||
"Select one or more": "Select one or more", | ||
"Select only One": "Select only One", | ||
"Select your Username": "Select your Username", | ||
"Switch Editor": "Switch Editor", | ||
"Sync": "Sync", | ||
"Sync Successful": "Sync Successful", | ||
"Sync Unsuccessful. Please Retry": "Sync Unsuccessful. Please Retry", | ||
"Syncing Status By User": "", | ||
"Syncing Status Summary": "Syncing Status Summary", | ||
"Tangerine": "Tangerine", | ||
"Tap any boxes that were incorrect during the test.": "Tap any boxes that were incorrect during the test.", | ||
"Tap items to mark them incorrect.": "Tap items to mark them incorrect.", | ||
"Tap the item last attempted.": "Tap the item last attempted.", | ||
"Tips": "Tips", | ||
"Total Docs Uploaded": "Total Docs Uploaded", | ||
"Total Docs not Uploaded": "Total Docs not Uploaded", | ||
"Total Percentage Complete": "Total Percentage Complete", | ||
"Total Updates Applied": "Total Updates Applied", | ||
"Try moving outside with a clear view of the sky": "Try moving outside with a clear view of the sky", | ||
"Try standing away from trees or buildings": "Try standing away from trees or buildings", | ||
"Try standing next to a window": "Try standing next to a window", | ||
"Update App": "Update App", | ||
"Update is Running. Please Wait ...": "Update is Running. Please Wait ...", | ||
"Username": "Username", | ||
"Username Available": "Username Available", | ||
"Username Unavailable": "Username Unavailable", | ||
"Visits": "Visits", | ||
"Write Failed": "Write Failed", | ||
"You may not mark an item incorrect that is beyond the last item attempted.": "You may not mark an item incorrect that is beyond the last item attempted.", | ||
"You may proceed.": "You may proceed.", | ||
"Item Title": "Item Title", | ||
"✓ Yay! You are up to date.": "✓ Yay! You are up to date.", | ||
"open": "open", | ||
"close": "close", | ||
"save": "save", | ||
"submit": "submit" | ||
} |
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