Skip to content

Instantly share code, notes, and snippets.

@dancgray
Last active March 30, 2016 09:44
Show Gist options
  • Save dancgray/95578add77cdfe6393a1 to your computer and use it in GitHub Desktop.
Save dancgray/95578add77cdfe6393a1 to your computer and use it in GitHub Desktop.

####What about extensions, menus, and themes

The attributes for extensions, menus, and themes can be placed in any of the course JSON files. Because of this the structure of the properties.schema file is different and has a pluginLocations element for each of the course JSON files. The extension, menu, and theme properties for each of these pluginLocations should be added as required by the plug-in.

An empty properties.shema file for an extension would be described like this:

{
  "type":"object",
  "$schema": "http://json-schema.org/draft-04/schema",
  "id": "http://jsonschema.net",
  "required":false,
  "globals": {
  },
  "properties":{
    "pluginLocations": {
      "type":"object",
      "required":true,
      "properties":{
        "config": {
          "type":"object"
        },
        "course": {
          "type":"object"
        },
        "contentobject": {
          "type":"object"
        },
        "article": {
          "type":"object"
        },
        "block": {
          "type":"object"
        },
        "component": {
          "type":"object"
        }
      }
    }
  }
}

A plugins properties would be specified within the corresponding location within pluginLocations. A plugins properties must be contained within an element specific for this plugin. The value for this is set in the _targetAttribute attribute of bower.json file. If your extensions _targetAttribute is "_tutor" you must contain your attributes within an object named "_tutor".

For example the Tutor extension has only one property isEnabled defined within config.json which in properties.schema would be described like this:

"config": {
  "type":"object",
  "properties":{
    "_tutor": {
      "legend" : "Tutor",
      "type":"object",
      "required":false,
      "properties": {
        "_isEnabled": {
          "type":"boolean",
          "required":true,
          "title": "Enabled",
          "inputType": { "type": "Boolean", "options": [false, true]},
        }
      }
    }
  }
}

Within the nested target attribute, properties for an extension are constructed in the same way as all other plugins.

Please note that currently the authoring tool only supports properties for extensions.

####Oh and don't forget bower.json

In addition to the properties.schema file a plug-in must have a correctly defined bower.json file. The bower.json file will contains properties that are specific to the plug-in and plug-in type.

All plug-in's should contain a displayName and description attribute that will be displayed in the authoring tool and will help identify your plug-in.

If a minimum framework version is defined in bower.json this will be used by the authoring tool to determine if the plugin is compatible with the installed framework version. The minimum framework version would be described like this:

"framework": "^2.0.0",

If a plug-in is an extension, menu or theme it must also define a _targetAttribute which is also used in the properties.schema as described above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment