Last active
November 13, 2018 10:52
-
-
Save pnmcosta/536963709b8615557c5cde50c2ec17eb to your computer and use it in GitHub Desktop.
Total.js CMS Admin Component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script total> | |
// register component in admin group | |
exports.group = 'admin'; | |
exports.install = function() { | |
// MODEL: /schemas/properties.js | |
ROUTE('GET #admin/api/properties/ *Property --> @query', ['&admin', 'id:properties']); | |
ROUTE('GET #admin/api/properties/{id}/ *Property --> @read', ['&admin', 'id:properties']); | |
}; | |
exports.uninstall = function() { | |
UNINSTALL('route', 'id:properties'); | |
}; | |
</script> | |
<script> | |
WAIT('common.nav', function() { | |
var item = { | |
role: 'Properties', | |
title: 'Properties', | |
url: '/admin/properties/', | |
value: 'properties', | |
icon: 'home' | |
}; | |
ROUTE(item.url, function() { | |
EMIT('page', item); | |
SET('common.page', item.value); | |
}); | |
// add to third position in nav | |
common.nav.splice(3, 0, item); | |
// append to roles | |
ENV('roles', ENV('roles') + ',Properties'); | |
}); | |
</script> | |
<div data-jc="part__common.page__if:properties;url:/admin/pages/properties.html;reload:properties/reload;cleaner:10"></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment