Cody CMS
Fork me on GitHub

Add new Content type

Different from adding custom content. Here we create a new content type in Cody. Adding it permanently in the official Cody sources will be subject to revision and approval.

1a) in cody/views/content-type.js add a block that allows the webmaster to pick you new content type. Don't forget the icon file.

1b) If needed add a new "kind".png file to cody/static/incons (here H.png)

2) in cody/views/cms/pages-ajax.js add a block that allows the webmaster to fill in the parameters (if any) 

3) add to cody/models/Content.js a new "render" function and add it to the dispatcher.

Content.prototype.renderShare = function(controller) { 
var url = this.data.replace("[page]", controller.context.page.getURL(this.language));
if (url === "") url = controller.context.page.getURL(this.language);
if (url.indexOf("http") < 0) { url = "http://" + url; }
return '<a href="#" onclick="' +
'window.open(' +
' \'https://www.facebook.com/sharer/sharer.php?u=\'+encodeURIComponent(location.href), ' +
' \'facebook-share-dialog\', \'width=626,height=436\'); ' +
'return false;">Share on Facebook</a>';
};