-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Use NPM SimpleSchema rather than Meteor #3331
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
0b390ed
Use NPM SimpleSchema rather than Meteor
aldeed 49dd908
WIP Latest changes
aldeed b6a52ad
Fix apps dashboard display issue
aldeed 8946110
Fix form generation issue
aldeed 982f9c1
Fix more simpl-schema bugs
aldeed 4407bb6
Fix tests
aldeed 8eb329b
Remove link
aldeed f5f2150
Address some of @zenweasel PR review
aldeed 9338d34
Fix settings forms validation
aldeed 3d52a34
Update method-update AutoForm methods
aldeed 7617203
Fix address validation errors
aldeed 35d1688
Clean up shop/createShop method
aldeed 51b20a8
Merge branch 'master' into aldeed-npm-simple-schema
aldeed 274ada3
Fix shop settings form submit errors
aldeed 19da09e
Fix shippo errors during checkout
aldeed e8b1ffe
Merge branch 'master' into aldeed-npm-simple-schema
aldeed 4194592
fix: Correct schema validation for search settings form
aldeed 2952116
Merge branch 'master' into aldeed-npm-simple-schema
aldeed 441869e
fix: Authnet id/key should not have min characters
aldeed 6fb403a
fix: Fix some shipping schema issues
aldeed 146c240
fix: Add migration for invalid shipmentMethod
aldeed 6b0f931
Merge branch 'master' into aldeed-npm-simple-schema
aldeed 4ca56d0
Merge branch 'release-1.8.0' into aldeed-npm-simple-schema
aldeed 3bb3308
Merge branch 'master' into aldeed-npm-simple-schema
aldeed 0a1863f
chore: Switch to collection2 pkg
aldeed 7ccbe9c
Merge branch 'master' into aldeed-npm-simple-schema
aldeed 35d98ba
tests: Fix test so that the real error is seen rather than timeout
aldeed 91b3a66
fix: Use latest schema-index to avoid loading collection2 twice
aldeed dcb5926
Merge branch 'release-1.9.0' into aldeed-npm-simple-schema
aldeed ba46dd2
chore: Resolve lint issues
aldeed File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -48,9 +48,9 @@ [email protected] | |
|
||
# Community Packages | ||
alanning:roles | ||
aldeed:autoform | ||
aldeed:collection2 | ||
aldeed:schema-index | ||
aldeed:autoform@6.2.0 | ||
aldeed:collection2@3.0.0 | ||
aldeed:schema-index@3.0.0 | ||
aldeed:template-extension | ||
bozhao:accounts-instagram | ||
cfs:filesystem | ||
|
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 |
---|---|---|
|
@@ -5,12 +5,9 @@ [email protected] | |
[email protected] | ||
[email protected] | ||
alanning:[email protected] | ||
aldeed:[email protected] | ||
aldeed:[email protected] | ||
aldeed:[email protected] | ||
aldeed:[email protected] | ||
aldeed:[email protected] | ||
aldeed:[email protected] | ||
aldeed:[email protected] | ||
aldeed:[email protected] | ||
aldeed:[email protected] | ||
aldeed:[email protected] | ||
[email protected] | ||
[email protected] | ||
|
@@ -90,7 +87,6 @@ [email protected] | |
[email protected] | ||
matb33:[email protected] | ||
mdg:[email protected] | ||
mdg:[email protected] | ||
[email protected] | ||
[email protected] | ||
meteorhacks:[email protected] | ||
|
@@ -147,6 +143,7 @@ [email protected] | |
[email protected] | ||
[email protected] | ||
[email protected] | ||
tmeasday:[email protected] | ||
tmeasday:[email protected] | ||
[email protected] | ||
[email protected] | ||
|
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
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import i18next from "i18next"; | ||
import { values } from "lodash"; | ||
import SimpleSchema from "simpl-schema"; | ||
import { Meteor } from "meteor/meteor"; | ||
import { Tracker } from "meteor/tracker"; | ||
import { SimpleSchema } from "meteor/aldeed:simple-schema"; | ||
import { Reaction } from "/client/api"; | ||
|
||
/** | ||
|
@@ -39,25 +40,22 @@ export function getBrowserLanguage() { | |
* @return {Object} return schema label object | ||
*/ | ||
export function getLabelsFor(schema, name) { | ||
const titleCaseName = name.charAt(0).toLowerCase() + name.slice(1); | ||
const labels = {}; | ||
// loop through all the rendered form fields and generate i18n keys | ||
for (const fieldName of schema._schemaKeys) { | ||
const i18nKey = `${name.charAt(0).toLowerCase() + name.slice(1)}.${ | ||
fieldName | ||
.split(".$").join("")}`; | ||
Object.keys(schema.mergedSchema()).forEach((fieldName) => { | ||
const i18nKey = `${titleCaseName}.${fieldName.split(".$").join("")}`; | ||
// translate autoform label | ||
const t = i18next.t(i18nKey); | ||
if (new RegExp("string").test(t) !== true && t !== i18nKey) { | ||
if (t) { | ||
labels[fieldName] = t; | ||
} | ||
if (t && new RegExp("string").test(t) !== true && t !== i18nKey) { | ||
labels[fieldName] = t; | ||
} | ||
} | ||
}); | ||
return labels; | ||
} | ||
|
||
/** | ||
* @name getMessagesFor | ||
* @name getValidationErrorMessages | ||
* @method | ||
* @memberof i18n | ||
* @summary Get i18n messages for autoform messages. Currently using a globalMessage namespace only. | ||
|
@@ -67,17 +65,15 @@ export function getLabelsFor(schema, name) { | |
* @todo Implement messaging hierarchy from simple-schema | ||
* @return {Object} returns i18n translated message for schema labels | ||
*/ | ||
export function getMessagesFor() { | ||
export function getValidationErrorMessages() { | ||
const messages = {}; | ||
for (const message in SimpleSchema._globalMessages) { | ||
if ({}.hasOwnProperty.call(SimpleSchema._globalMessages, message)) { | ||
const i18nKey = `globalMessages.${message}`; | ||
const t = i18next.t(i18nKey); | ||
if (new RegExp("string").test(t) !== true && t !== i18nKey) { | ||
messages[message] = t; | ||
} | ||
values(SimpleSchema.ErrorTypes).forEach((errorType) => { | ||
const i18nKey = `globalMessages.${errorType}`; | ||
const message = i18next.t(i18nKey); | ||
if (new RegExp("string").test(message) !== true && message !== i18nKey) { | ||
messages[errorType] = message; | ||
} | ||
} | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just tweaked for the changed SS API |
||
return messages; | ||
} | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was checking the schema to see if it should be an array, but it actually makes more sense to just check if the value is an array.