Constructor
new CMS(view)
Parameters:
| Name | Type | Description | 
|---|---|---|
| view | Window | 
- Source:
Members
collections :Object.<string, FileCollection>
Name-grouped list of collection objects for all resource types defined
Type:
- Object.<string, FileCollection>
- Source:
config :Config
Configuration handler for the CMS
Type:
- Config
- Source:
currentPage :TemplateObject|string|null
The renderable object of the currently viewing page or a string with the error
Type:
- TemplateObject | string | null
- Source:
currentPagePath :string
The URL path of the current page (window.location.pathname)
Type:
- string
- Source:
extras :Object.<string, {status: string, onload: Array.<function()>, onerror: Array.<function()>}>
Dictionary of all extras and their load events
Type:
- Object.<string, {status: string, onload: Array.<function()>, onerror: Array.<function()>}>
- Source:
log :Log
Reference to the logger for external scripts to tap into easily
Type:
- Log
- Source:
ready :boolean
Internally set to true when the CMS is ready
Type:
- boolean
- Source:
view :Window
Top-level View object, (usually just the Window object)
Type:
- Window
- Source:
Methods
fetchLayout(layout, data) → {Promise.<string>}
Pass-thru convenience function for external scripts to utilize the template engine
Parameters:
| Name | Type | Description | 
|---|---|---|
| layout | string | |
| data | Object | 
- Source:
Returns:
- Type
- Promise.<string>
getCollection(name) → {FileCollection|null}
Get the given collection by name or NULL if it does not exist
Parameters:
| Name | Type | Description | 
|---|---|---|
| name | string | 
- Source:
Returns:
- Type
- FileCollection | null
getCollectionClone(name) → {FileCollection|null}
Get a clone of the given collection by its name, or NULL if it does not exist
Parameters:
| Name | Type | Description | 
|---|---|---|
| name | string | 
- Source:
Returns:
- Type
- FileCollection | null
getPathsFromURL(path) → {Array.<string>}
Retrieve the current path URL broken down into individual pieces
Parameters:
| Name | Type | Description | 
|---|---|---|
| path | string | null | Path to parse, or current location by default | 
- Source:
Returns:
The segments of the URL broken down by directory
- Type
- Array.<string>
historyPushState(url)
PUSH the window location, useful for most interactions where the user may click 'back'
This is the normal "go to URL" method for the CMS.
Parameters:
| Name | Type | Description | 
|---|---|---|
| url | string | 
- Source:
historyReplaceState(url)
REPLACE the window location, ONLY really useful on initial pageload
Use historyPushState instead for most interactions where the user may click 'back'
Parameters:
| Name | Type | Description | 
|---|---|---|
| url | string | URL to replace | 
- Source:
init()
Init
Initializes the application based on the configuration. Sets up config object, hash change event listener for router, and loads the content.
- Source:
(async) initFileCollections() → {Promise}
Initialize file collections
- Source:
Returns:
- Type
- Promise
isExtraLoaded(extra) → {boolean}
Check if the requested extra is loaded
Parameters:
| Name | Type | Description | 
|---|---|---|
| extra | string | 
- Source:
Returns:
- Type
- boolean
listenerLinkClick(e)
Handle processing links clicked, will re-route to the history for applicable links.
Parameters:
| Name | Type | Description | 
|---|---|---|
| e | MouseEvent | Click event from user | 
- Source:
load(optionsopt)
Set the options for the CMS and initialize the system
Parameters:
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
| options | Object | <optional> | {} | List of config options | 
- Source:
(async) loadExtra(extra, optionsopt) → {Promise.<string>}
Load an extra / plugin, optionally with plugin configuration options
Parameters:
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
| extra | string | Plugin name to load | ||
| options | Object | null | <optional> | null | Configuration options for the plugin | 
- Source:
Returns:
Resolves with the plugin name if loaded successfully
- Type
- Promise.<string>
renderLayout(layout, data) → {Promise}
Renders a layout with the set data
Parameters:
| Name | Type | Description | 
|---|---|---|
| layout | string | Base filename of layout to render | 
| data | TemplateObject | Data passed to template. | 
- Source:
Returns:
Returns rendered HTML on success or the error message on error
- Type
- Promise
route()
Primary method handling the loading of pages and content within the CMS
- Source:
search(type, search)
Search method for file collections.
Parameters:
| Name | Type | Description | 
|---|---|---|
| type | string | Type of file collection. | 
| search | string | Search query. | 
- Source:
sort(type, sort)
Sort method for file collections.
Parameters:
| Name | Type | Description | 
|---|---|---|
| type | string | Type of file collection. | 
| sort | function | Sorting function. | 
- Source: