Add a detail page
Give a plugin a second screen with its own address, such as the page of one item.
On this page
A plugin has one main screen, public/index.html. Each extra screen is another HTML file in public plus a route in index.js. The sample plugins use this for the page of one item.
1. Add the route
In the plugin index.js, list the screen in exports.routes:
exports.routes = [
{ url: '/orders/{id}/', html: 'detail' }
];urlis the address under/admin/.{id}is a part of the address that changes, here the ID of the item.htmlis the file name inpublic, without.html.
2. Add the screen
Create public/detail.html. Copy it from plugins/profiles/public/detail.html and adapt it. The sample reads the ID from the address and shows it:
exports.reload = function() {
var params = NAV.params;
exports.set('id', params[0]);
exports.refresh();
BREADCRUMB.add('@(Orders)', '../')('Detail', NAV.url);
};3. Link to it
On the main screen, open the detail page with REDIRECT. The sample does it when you select an item:
exports.detail = function(el) {
var id = ATTRD(el);
REDIRECT('/orders/{0}/'.format(id));
};Restart Pluginable. Select an item in the list: the address changes to /admin/orders/<id>/ and the breadcrumb shows Home > Orders > Detail.