Skip to content

Custom Modules

Kelly Chu edited this page Aug 18, 2015 · 2 revisions

Custom Modules allows you to extend the CMS by adding your own sections and custom views. To add a custom module you can modify the config.json property: public.customModules with the following:

{
  "private": {
    ...
  },
  "public": {
    ...
    "customModules": [{
      "name" : "dashboard.Dashboard.Home",
      "files" : ["/javascripts/heatmap.min.js", "/cms/modules/Home.js", "/cms/modules/Home.css"]
    },{
      "name" : "dashboard.Dashboard.Setup",
      "files" : ["/cms/modules/Setup.js", "/cms/modules/Setup.css"]
    },{
      "name" : "dashboard.Dashboard.RealTime",
      "files" : ["/cms/modules/RealTime.js", "/cms/modules/RealTime.css"]
    }],
    "nav": [
      {
        "label": "Dashboard",
        "path": "dashboard",
        "icon": "fa-dashboard",
        "url": "/cms/portal/home"
      },
      ...
    ]
  }
}

The above example shows 3 modules that were added. Each file reference gets included into the index HTML. Also, notice the nav array property containing a link to the custom module.

To create pages in the CMS You can use AngularJS state provider as follows:

angular.module('dashboard.Dashboard.Home', [
  'dashboard.services.GeneralModel',
  'dashboard.Config',
  'ui.router'
])
  .config(function config($stateProvider) {
    $stateProvider
      .state('portal.home', {
        url: '/home',
        templateUrl: '/cms/modules/Home.html',
        data: {
          pageTitle: 'Dashboard Home Page'
        }
      })
    ;
  })
  .controller('HomeCtrl', function HomeCtrl($scope, $state, $cookies, $location, Config, GeneralModelService) {
  
});

Clone this wiki locally