Skip to content
Merged
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
7 changes: 7 additions & 0 deletions example.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
// Available properties
// --------------------------------------------------

// course.json
"_vanilla": {
"_favIcon": {
"_src": ""
}
},

// contentObjects.json
"_vanilla": {
"_backgroundImage": {
Expand Down
11 changes: 11 additions & 0 deletions js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ class Theme extends Backbone.Controller {

onDataReady() {
$('html').addClass(Adapt.course.get('_courseStyle'));
this.addFavIcon();
}

addFavIcon() {
const theme = Adapt.course.get('_vanilla');
if (!theme._favIcon._src) return;
const $linkStandard = $(`<link rel="icon" href="${theme._favIcon._src}" size="192x192" />`);
const $linkApple = $(`<link rel="apple-touch-icon" href="${theme._favIcon._src}" />`);
$('head')
.append($linkStandard)
.append($linkApple);
}

onPostRender(view) {
Expand Down
25 changes: 24 additions & 1 deletion properties.schema
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,30 @@
"type": "object"
},
"course": {
"type": "object"
"type": "object",
"properties": {
"_vanilla": {
"type": "object",
"required": false,
"properties": {
"_favIcon": {
"type": "object",
"required": false,
"legend": "FavIcon",
"properties": {
"_src": {
"type": "string",
"required": false,
"default": "",
"inputType": "Asset:image",
"validators": [],
"help": "Select a favicon to improve user experience and enforce brand consistency. This will be displayed in places like your browser's address bar, page tabs and bookmarks menu. Usually, a favicon is 16 x 16 pixels in size and stored in the GIF, PNG, or ICO file format."
}
}
}
}
}
}
},
"contentobject": {
"type": "object",
Expand Down
39 changes: 39 additions & 0 deletions schema/course.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$anchor": "vanilla-course",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"$patch": {
"source": {
"$ref": "course"
},
"with": {
"properties": {
"_vanilla": {
"type": "object",
"title": "Theme",
"default": {},
"properties": {
"_favIcon": {
"type": "object",
"default": {},
"title": "Favicon",
"properties": {
"_src": {
"type": "string",
"isObjectId": true,
"title": "Image",
"description": "Select a favicon to improve user experience and enforce brand consistency. This will be displayed in places like your browser's address bar, page tabs and bookmarks menu. Usually, a favicon is 16 x 16 pixels in size and stored in the GIF, PNG, or ICO file format.",
"default": "",
"_backboneForms": {
"type": "Asset",
"media": "image"
}
}
}
}
}
}
}
}
}
}