-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: APP-475 add language subfolders and custom new doc options (#73)
* feat: add language subfolders and custom new doc options * chore: lint * fix: newDocumentOptions filter * fix: uniqueDocuments filtering
- Loading branch information
Showing
5 changed files
with
94 additions
and
184 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
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,7 @@ | ||
export function filterSpanish(docType) { | ||
return `_type == "${docType}" && language == "es"` | ||
} | ||
|
||
export function filterEnglish(docType) { | ||
return `_type == "${docType}" && (!defined(language) || language == "en")` | ||
} |
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,23 @@ | ||
import { filterSpanish, filterEnglish } from './filterLanguage'; | ||
|
||
// Show English and Spanish subfolders for document types with many instances | ||
export default function manyDocumentListItem(S, title, docType) { | ||
return S.listItem() | ||
.title(title) | ||
.child( | ||
S.list() | ||
.title(title) | ||
.items([ | ||
S.listItem() | ||
.title('English') | ||
.schemaType(docType) | ||
.child(S.documentTypeList(docType).title(`${title} (EN)`) | ||
.filter(filterEnglish(docType))), | ||
S.listItem() | ||
.title('Spanish') | ||
.schemaType(docType) | ||
.child(S.documentTypeList(docType).title(`${title} (SP)`) | ||
.filter(filterSpanish(docType))) | ||
]), | ||
); | ||
} |