koco-content-management
koco content management
is a component used to create listing and editing pages for content management systems (CMS). It is an opinionated component based on the koco generator.
Table of contents
- Installation
- Creating a content listing page
- Creating a content editing page
- Registering Content Pages
Installation
bower install koco-content-management --save
Creating a content listing page
About content listing page
//TODO
Setup
Activator for content listing page (optional)
You can use the default activator
(see koco-router activator contract for more information) by first adding this to your require.config.js
file
paths: ... 'content-list-page-base-activator': 'bower_components/koco-content-management/src/listing/content-list-page-base-activator' ...
and then creating an activator
that inherits from the content-list-page-base-activator
;
Base ViewModel for content listing page
paths: ... 'content-list-page-base-viewmodel': 'bower_components/koco-content-management/src/listing/content-list-page-base-viewmodel' ...
- Create a
shareable
viewmodel that is different than the main viewmodel-ui.js
(theshareable
viewmodel will be joined with the main viewmodel after the activation process). Thisshareable
viewmodel shouldextend
(see jQuery extend for more information) thebase viewmodel
(content-list-page-base-viewmodel
) like this:
my-list-page-viewmodel.js
-->
;
- Create the main viewmodel for your content listing page. The main viewmodel will receive the
shareable
viewmodel as thecontext
argument:
my-list-page-ui.js
-->
;
Creating a content editing page
About content editing page
//TODO
Setup of content editing page
Activator for content editing page (optional)
You can use the default activator
(see koco-router activator contract for more information) by first adding this to your require.config.js
file
paths: ... 'content-edit-page-base-activator': 'bower_components/koco-content-management/src/listing/content-edit-page-base-activator' ...
and then creating an activator
that inherits from the content-edit-page-base-activator
;
Base ViewModel for content editing page
paths: ... 'content-edit-page-base-viewmodel': 'bower_components/koco-content-management/src/editing/content-edit-page-base-viewmodel' ...
- Create a
shareable
viewmodel that is different than the main viewmodel-ui.js
(theshareable
viewmodel will be joined with the main viewmodel after the activation process). Thisshareable
viewmodel shouldextend
(see jQuery extend for more information) thebase viewmodel
(content-edit-page-base-viewmodel
) like this:
my-edit-page-viewmodel.js
-->
;
- Create the main viewmodel for your content editing page. The main viewmodel will receive the
shareable
viewmodel as thecontext
argument:
my-edit-page-ui.js
-->
;
Registering Content Pages
The content management comes with a utility function that works well with koco and can be used this way:
// require.config.jspaths: ... 'content-management': 'bower_components/koco-content-management/src/content-management' ...
// components.js;