Skip to content
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

Fix: Fixed schemas to add AAT support (fixes #12) #13

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"_isEnabled": true,
"title": "Definition",
"body": "{{{word}}}: {{{definition}}}",
"confirmText": "Close",
"_showIcon": true
}
```
Expand All @@ -24,7 +23,6 @@
"_isEnabled": true,
"title": "Definition",
"body": "{{{word}}}: {{{definition}}}",
"confirmText": "Close",
"_showIcon": true,
"_items": [
{
Expand Down Expand Up @@ -53,6 +51,6 @@
"definition": "Excellent word this one"
}
]
}
}
```

3 changes: 1 addition & 2 deletions example.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"_isEnabled": true,
"title": "Definition",
"body": "{{{word}}}: {{{definition}}}",
"confirmText": "Close",
"_showIcon": true,
"_items": [
{
Expand Down Expand Up @@ -32,4 +31,4 @@
"definition": "Excellent word this one"
}
]
}
}
5 changes: 0 additions & 5 deletions js/adapt-definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ class Definitions extends Backbone.Controller {
notify.popup({
title,
body: '<div no-definition="true">' + body + '</div>',
_prompts: [
{
promptText: this.model.get('confirmText') || 'Close'
}
],
_showIcon: this.model.get('_showIcon'),
_classes: 'is-extension is-definitions'
});
Expand Down
81 changes: 78 additions & 3 deletions properties.schema
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,90 @@
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema",
"id": "http://jsonschema.net",
"required": false,
"properties": {
"pluginLocations": {
"type": "object",
"required": true,
"properties": {
"config": {
"course": {
"type": "object",
"properties": {}
"properties": {
"_definitions": {
"type": "object",
"required": false,
"legend": "Definitions",
"properties": {
"_isEnabled": {
"type": "boolean",
"required": true,
"default": false,
"title": "Add definition links to course words",
"inputType": "Checkbox",
"validators": [],
"help": "Controls whether the Definitions extension is enabled or disabled."
},
"title": {
"type": "string",
"default": "Definition",
"required": true,
"title": "Title",
"inputType": "Text",
"validators": ["required"],
"help": "The title for the pop up which displays when a definitions link is selected.",
"translatable": true
},
"body": {
"type": "string",
"default": "{{{word}}}: {{{definition}}}",
"required": false,
"title": "Body",
"inputType": "Text",
"validators": [],
"help": "The body content for the pop up which displays when a definitions link is selected.",
"translatable": true
},
"_items": {
"type": "array",
"required": true,
"title": "Items",
"items": {
"type": "object",
"required": false,
"properties": {
"_words": {
"type": "array",
"required": false,
"title": "Words",
"items": {
"type": "string",
"required": false,
"default": "",
"title": "Word",
"inputType": "Text",
"validators": [],
"help": "The collection of word(s) to attach the associated definition to.",
"translatable": true
}
},
"definition": {
"type": "string",
"default": "",
"required": false,
"title": "Definition",
"inputType": "Text",
"validators": [],
"help": "The definition for the associated word(s).",
"translatable": true
}
}
}
}
}
}
}
}
}
}
}
}
}
74 changes: 74 additions & 0 deletions schema/course.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"$anchor": "definitions-course",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"$patch": {
"source": {
"$ref": "course"
},
"with": {
"properties": {
"_definitions": {
"type": "object",
"title": "Definitions",
"default": {},
"required": [
"title"
],
"properties": {
"_isEnabled": {
"type": "boolean",
"title": "Add definition links to course words",
"description": "Controls whether the Definitions extension is enabled or disabled.",
"default": false
},
"title": {
"type": "string",
"title": "Title",
"default": "Definition",
"description": "The title for the pop up which displays when a definitions link is selected.",
"_adapt": {
"translatable": true
}
},
"body": {
"type": "string",
"title": "Body",
"default": "{{{word}}}: {{{definition}}}",
"description": "The body content for the pop up which displays when a definitions link is selected.",
"_adapt": {
"translatable": true
}
},
"_items": {
"type": "array",
"title": "Items",
"items": {
"type": "object",
"properties": {
"_words": {
"type": "array",
"title": "Words",
"description": "The collection of word(s) to attach the associated definition to.",
"items": {
"type": "string"
}
},
"definition": {
"type": "string",
"title": "Definition",
"default": "",
"description": "The definition for the associated word(s).",
"_adapt": {
"translatable": true
}
}
}
}
}
}
}
}
}
}
}
Loading