Skip to content

Commit

Permalink
Fix: Adds AAT v1 schemas (fixes: #63)
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-replin authored Feb 14, 2023
1 parent f0d8762 commit fbc2507
Show file tree
Hide file tree
Showing 9 changed files with 348 additions and 10 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ If the number of `_previewWords` cannot be found then use `x` number of characte
## Item Attributes
The attributes listed below are used in *contentObject.json*, *articles.json*, *blocks.json* and *components.json* to configure **Search Items**, and are properly formatted as JSON in [*example.json*](https://github.com/cgkineo/adapt-search/blob/master/example.json).

### \_search (object):
### \_search (object):
Container object for the `keywords` setting

### \title (string):
### title (string):
Alternative title for search result.

#### keywords (array):
### keywords (array):
A list of search keywords/phrases to be associated with the contentObject/article/block/component. Each item in the array must be a string.
**NOTE**: Keywords are exported with the `grunt translate:export` command. When localising content, use a process that ensures translated keywords are found in the actual translated course content.

Expand All @@ -63,8 +63,9 @@ A list of search keywords/phrases to be associated with the contentObject/articl
No known limitations.

----------------------------
<a href="https://community.adaptlearning.org/" target="_blank"><img src="https://github.com/adaptlearning/documentation/blob/master/04_wiki_assets/plug-ins/images/adapt-logo-mrgn-lft.jpg" alt="adapt learning logo" align="right"></a>
**Author / maintainer:** Kineo and community with [contributors](https://github.com/cgkineo/adapt-search/graphs/contributors)
**Accessibility support:** WAI AA
**RTL support:** No
**Cross-platform coverage:** Chrome, Chrome for Android, Firefox (ESR + latest version), Edge, IE11, Safari 14 for macOS/iOS/iPadOS, Opera

**Framework versions:** 5.8+<a href="https://community.adaptlearning.org/" target="_blank"><img src="https://github.com/adaptlearning/documentation/blob/master/04_wiki_assets/plug-ins/images/adapt-logo-mrgn-lft.jpg" alt="adapt learning logo" align="right"></a><br>
**Author / maintainer:** Kineo and community with [contributors](https://github.com/cgkineo/adapt-search/graphs/contributors)<br>
**Accessibility support:** WAI AA<br>
**RTL support:** No<br>
**Cross-platform coverage:** Chrome, Chrome for Android, Firefox (ESR + latest version), Edge, IE11, Safari 14 for macOS/iOS/iPadOS, Opera<br>
2 changes: 1 addition & 1 deletion js/SearchObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class SearchObject {
const searchConfig = Adapt.course.get('_search');
Object.assign(this, searchConfig, {
query: searchPhrase,
searchResults: searchResults,
searchResults,
isAwaitingResults: (searchPhrase.length !== 0 && !shouldSearch),
isBlank: (searchPhrase.length === 0)
});
Expand Down
1 change: 0 additions & 1 deletion js/replaceAccents.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export const flattedAccentedCharacters = accentedCharacterMap.reduce((flattedAcc
return flattedAccentedCharacters;
}, {});


export default function replaceAccents(str) {
const accentReplacer = function(chr) {
return flattedAccentedCharacters[chr] || chr;
Expand Down
8 changes: 8 additions & 0 deletions properties.schema
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"default": "",
"required": false,
"title": "Alternative title",
"help": "Alternative title for the search result",
"inputType": "Text",
"validators": [],
"translatable": true
Expand All @@ -41,6 +42,7 @@
"default": "",
"required": false,
"title": "Keywords",
"help": "You may enter search words here that are associated with this page but may not appear on this page.",
"inputType": "Text",
"validators": [],
"translatable": true
Expand Down Expand Up @@ -71,6 +73,7 @@
"default": "",
"required": false,
"title": "Alternative title",
"help": "Alternative title for the search result",
"inputType": "Text",
"validators": [],
"translatable": true
Expand All @@ -80,6 +83,7 @@
"default": "",
"required": false,
"title": "Keywords",
"help": "You may enter search words here that are associated with this article but may not appear on this article.",
"inputType": "Text",
"validators": [],
"translatable": true
Expand Down Expand Up @@ -110,6 +114,7 @@
"default": "",
"required": false,
"title": "Alternative title",
"help": "Alternative title for the search result",
"inputType": "Text",
"validators": [],
"translatable": true
Expand All @@ -119,6 +124,7 @@
"default": "",
"required": false,
"title": "Keywords",
"help": "You may enter search words here that are associated with this block but may not appear on this block.",
"inputType": "Text",
"validators": [],
"translatable": true
Expand Down Expand Up @@ -149,6 +155,7 @@
"default": "",
"required": false,
"title": "Alternative title",
"help": "Alternative title for the search result",
"inputType": "Text",
"validators": [],
"translatable": true
Expand All @@ -158,6 +165,7 @@
"default": "",
"required": false,
"title": "Keywords",
"help": "You may enter search words here that are associated with this component but may not appear on this component.",
"inputType": "Text",
"validators": [],
"translatable": true
Expand Down
44 changes: 44 additions & 0 deletions schema/article.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$anchor": "search-article",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"$patch": {
"source": {
"$ref": "article"
},
"with": {
"properties": {
"_search": {
"type": "object",
"title": "Search",
"default": {},
"properties": {
"_isEnabled": {
"type": "boolean",
"title": "Enable search",
"default": true
},
"title": {
"type": "string",
"title": "Alternative title",
"description": "Alternative title for the search result",
"default": "",
"_adapt": {
"translatable": true
}
},
"keywords": {
"type": "string",
"title": "Keywords",
"description": "You may enter search words here that are associated with this article but may not visually appear within this article.",
"default": "",
"_adapt": {
"translatable": true
}
}
}
}
}
}
}
}
44 changes: 44 additions & 0 deletions schema/block.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$anchor": "search-block",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"$patch": {
"source": {
"$ref": "block"
},
"with": {
"properties": {
"_search": {
"type": "object",
"title": "Search",
"default": {},
"properties": {
"_isEnabled": {
"type": "boolean",
"title": "Enable search",
"default": true
},
"title": {
"type": "string",
"title": "Alternative title",
"description": "Alternative title for the search result",
"default": "",
"_adapt": {
"translatable": true
}
},
"keywords": {
"type": "string",
"title": "Keywords",
"description": "You may enter search words here that are associated with this block but may not visually appear within this block.",
"default": "",
"_adapt": {
"translatable": true
}
}
}
}
}
}
}
}
44 changes: 44 additions & 0 deletions schema/component.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$anchor": "search-component",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"$patch": {
"source": {
"$ref": "component"
},
"with": {
"properties": {
"_search": {
"type": "object",
"title": "Search",
"default": {},
"properties": {
"_isEnabled": {
"type": "boolean",
"title": "Enable search",
"default": true
},
"title": {
"type": "string",
"title": "Alternative title",
"description": "Alternative title for the search result",
"default": "",
"_adapt": {
"translatable": true
}
},
"keywords": {
"type": "string",
"title": "Keywords",
"description": "You may enter search words here that are associated with this component but may not visually appear within this component.",
"default": "",
"_adapt": {
"translatable": true
}
}
}
}
}
}
}
}
44 changes: 44 additions & 0 deletions schema/contentobject.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$anchor": "search-contentobject",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"$patch": {
"source": {
"$ref": "contentobject"
},
"with": {
"properties": {
"_search": {
"type": "object",
"title": "Search",
"default": {},
"properties": {
"_isEnabled": {
"type": "boolean",
"title": "Enable search",
"default": true
},
"title": {
"type": "string",
"title": "Alternative title",
"description": "Alternative title for the search result",
"default": "",
"_adapt": {
"translatable": true
}
},
"keywords": {
"type": "string",
"title": "Keywords",
"description": "You may enter search words here that are associated with this page but may not appear on this page.",
"default": "",
"_adapt": {
"translatable": true
}
}
}
}
}
}
}
}
Loading

0 comments on commit fbc2507

Please sign in to comment.