Adaptive course authoring platform.
- Node.js (>= 10.17.0)
- npm (>= 6.11.0)
- PostgreSQL (>= 9.6)
- Node.js & npm: https://nodejs.org/en/download/
- PostgreSQL: https://www.postgresql.org/download/
- Clone this repo
- Run
npm install
in the repo directory - Create a database in PostgreSQL
- Application is configured via environment variables contained in a file named
.env
. Use the.env.example
file as a template:cp .env.example .env
and enter configuration details. - Initialize database by running
npm run db migrate
- Enable default repository schema by setting env variable
ENABLE_DEFAULT_SCHEMA=1
or define a custom one (more details below). - You can create admin user by running
npm run add:admin <email> <password>
- App branding is configured via values set in a file named
.brandrc
(or.brandrc.js
). Use the.brandrc.example
file as a template:cp .brandrc.example .brandrc
and enter configuration details (Optional).
- Server:
npm run dev:server
- Client (webpack dev server):
npm run dev:client
- Bundle client by issuing
npm run build
npm run start
Repository structure can be altered using tailor configuration file. Recognized configuration filenames are (sorted by priority):
tailor.config.js
.tailorrc.js
.tailorrc
.tailorrc.json
Use the tailor.config.js.example
file as a template:
$ cp tailor.config.js.example tailor.config.js
and enter the configuration details. By default, the configuration file is
searched inside the current working directory. If a custom location or a custom
name is needed, it can be provided through the --config
flag passed to target
npm script:
$ npm run dev:client -- --config=path/to/custom/tailor/config.js
alternatively TAILOR_CONFIG
environment variable can be used:
$ TAILOR_CONFIG=path/to/custom/tailor/config.js npm run dev:server
Content repository structures are defined using the following properties:
An array of Schema objects.
- id
String
- Schema identifier. - name
String
- Schema display name. - meta
Array<Metadata>
- An array of objects defining repository metadata. - structure
Array<ActivityConfig>
- An array of objects which define schema structure. - contentContainers
Array<ContentContainer>
- Array of content container configs. - elementMeta
Array<ElementMetaConfig>
- An array of objects defining content element metadata.
Configuration for schema structure nodes (activities). Contains the following properties:
- type
String
- Const for marking activity type. - rootLevel
Boolean
- Used to define first level (root) activity types - subLevels
Array<String>
- An array of sub-types. - label
String
- Display label. - color
String
- Display color in hexadecimal notation. - contentContainers
Array<String>
- Array of content container types that define which content containers can be added. - hasExams
Boolean
- Activity allows adding exam activities to it. - exams
Object
- Configuration for activity exams. - relationships
Array<ActivityRelationship>
- Defines what relationships this activity has to other activities. - meta
Array<Metadata>
- An array of objects defining activity metadata.
Defines the structure of the activity relationship field.
- type
String
- Defines the name of the relationship. The relationship will be published under this value. - label
String
- Display label. - placeholder
String
- Display label for the select picker. - multiple
Boolean
- Defines if the relationship can have multiple associations chosen. True by default. - searchable
Boolean
- Defines if the list of activities can be searched. True by default. - allowEmpty
Boolean
- Defines if the member list can be empty. True by default. - allowCircularLinks
Boolean
- Defines if a member of the relationship instance can set the owner of that instance as a member of its own instance of that relationship. Example, activity X sets activity Y as its prerequisite. IfallowCircualLinks
is set to true then activity Y can set activity X as its prerequisite. False by default. - allowInsideLineage
Boolean
- Defines if an ancestor or a descendant can be a member of the relationship. False by default. - allowedTypes
Array<String>
- Defines activity types that can be associated in a relationship.
Defines the structure of the activity metadata field.
- key
String
- Unique key for the field. - type
String
- Type of the input component used on the client. - label
String
- Display label. - placeholder
String
- Input component placeholder. - validate
MetadataValidator
- Validator object. - defaultValue
*
- Default field value.
Defines validation rules on an activity metadata field.
- rules
Object
- Contains the following properties: - max
Number
- Maximum character count. - required
Boolean
- Defines if the field is required.
An array of ContentContainer objects.
Configuration for content containers. Contains the following properties:
- type
String
-const-cased
string for markingContentContainer
type. - templateId
String
-const-cased
string that defines which customContentContainer
is used to display this container. Needs to match thetemplateId
property of the desired customContentContainer
. If not specified the defaultContentContainer
is used to display this container. - label
String
- String used for referencingContentContainer
on the UI. - multiple
Boolean
- Defines if there can be multiple instances of theContentContainer
inside a singleActivity
. False by default. - types
Array<String>
- An array of possible content element types that can exist inside aContentContainer
. If not specified all types of elements are allowed. - displayHeading
Boolean
- Defines if a heading is displayed on top of theContentContainer
. False by default. - layout
Boolean
- Defines if elements inside aContentContainer
instance can be placed two in a row. True by default. - config
Object
- DefinesContentContainer
specific properties. - required
Boolean
- Defines if an instance of theContentContainer
is created if non exist. True by default. - publishedAs
String
- Defines the name of the file under which the container will be published. Defaults tocontainer
. The name of the structure component used is thekebab-cased
version of thetype
property. (example: ABC_DEF -> abc-def)
Defines the structure of an content element metadata.
- type
String
- Type of content element (example: "IMAGE", "HTML"). - inputs
Array<ElementMeta>
- Defines what meta fields content element has. - relationships
Array<ElementRelationship>
- Defines what relationship metadata content element has (relationships with content elements from the same or other activities in the repository).
Defines the structure of an content element relationship field.
- key
String
- Defines the name of the relationship. The relationship will be published under this value. - label
String
- Display label. - placeholder
String
- Label for relationship add button and modal title. - multiple
Boolean
- Defines if the relationship can have multiple associations chosen. True by default. - allowedTypes
Array<String>
- Defines to what type of content elements given content element can have relationship with (example:['VIDEO']
).
Defines what meta fields content element has.
- key
String
- Unique key for the field. - type
String
- Type of the input component used on the client. - label
String
- Display label. - description
String
- Description of meta field. - options
Array<Object>
- Options for certain types of input component. For example, for select component, options would be:"type": "SELECT" "options": [{ "label": "First", "value": "first" }, { "label": "Second", "value": "second" }]
A string template that will be interpolated on the client using two route
params, repositoryId
and activityId
, into a preview URL for each activity.
Example:
https://my.url.com/#/repository/{repositoryId}/activity/{activityId}/preview
Tailor supports creation of custom content elements and custom containers. These extensions can have unique content and structure that the default content elements and containers do not support. The template for creating custom content elements can be found here while the template for creating custom containers can be found here.
- copy (or git clone) extension files in
extensions/content-<elements or containers>/<my-extension-name>
- create index.js file in
extensions/content-<elements or containers>
directory - in the file from the previous step add
module.exports = ['my-extension-name'];
Note that module.exports
is an array and you can add as many extensions and just include their folder names in this array to include all of them.
After installation, the extension is ready for use and should be listed in tailor.config.js
file.