json-object-editor
Version:
JOE the Json Object Editor | Platform Edition
74 lines (70 loc) • 3.53 kB
JavaScript
var schema ={
title: '${name}',
info:"Manage pieces of content you will re-use throughout your site, like a blog post.",
menuicon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="-9 -9 44 44"><path d="M18.9 0.2C18.6 0.1 18.1 0.4 17.8 0.8L13.1 7.4C10.4 6.6 7.3 7.3 5.2 9.4L16.6 20.8C18.7 18.6 19.4 15.5 18.6 12.8L18.6 12.8 25.2 8.3C25.8 7.8 26 7.2 25.6 6.8L19.3 0.4C19.2 0.3 19.1 0.2 18.9 0.2zM18.9 3.2L20.7 4.9 16.2 9 15.2 8 18.9 3.2zM13 9.3C13.2 9.3 13.3 9.3 13.3 9.3L14.3 10.3C14.3 10.3 13.6 10.4 11.6 12.4L9.8 10.6C11.3 9.5 12.5 9.3 13 9.3zM8.6 14.8L0.2 25.8 11.2 17.3 8.6 14.8z"></path></svg>',
// Curated summary for agents
summary:{
description:'Reusable content post with rich text, bullets, files, and tags.',
purpose:'Posts represent blog/news content to be rendered on site pages. They can be tagged and associated to a site, with a post_date for sorting.',
labelField:'name',
defaultSort:{ field:'post_date', dir:'desc' },
searchableFields:['name','info','_id'],
allowedSorts:['post_date','joeUpdated','created','name'],
relationships:{
outbound:[
{ field:'site', targetSchema:'site', cardinality:'one' },
{ field:'tags', targetSchema:'tag', cardinality:'many' }
],
inbound:{ graphRef:'server/relationships.graph.json' }
},
joeManagedFields:['created','joeUpdated'],
fields:[
{ name:'_id', type:'string', required:true },
{ name:'itemtype', type:'string', required:true, const:'post' },
{ name:'name', type:'string', required:true },
{ name:'info', type:'string' },
{ name:'content_type', type:'string' },
{ name:'content', type:'string' },
{ name:'bullets', type:'objectList' },
{ name:'files', type:'string', isArray:true },
{ name:'site', type:'string', isReference:true, targetSchema:'site' },
{ name:'post_date', type:'string', format:'date' },
{ name:'tags', type:'string', isArray:true, isReference:true, targetSchema:'tag' },
{ name:'joeUpdated', type:'string', format:'date-time', required:true },
{ name:'created', type:'string', format:'date-time', required:true }
]
},
fields:function(){
var f = [
'name',
'info',
{section_start:'Content'},
'content_type',
{extend:'content',specs:{type:function(item){
return item.content_type || 'wysiwyg';
}}},
{section_end:'Content'},
{name:'bullets',type:'objectList',properties:['message'],hideHeadings:true},
{section_start:'files',collapsed:function(item){
return !(item.files && item.files.length);
}},
{name:'files',type:'uploader',allowmultiple:true, height:'300px',comment:'drag files here to upload', onConfirm:_joe.SERVER.Plugins.awsFileUpload},
{section_end:'files'},
'_id','created','itemtype',
{sidebar_start:'right'},
{section_start:'Adv'},
'site',
{name:'post_date',type:'date'},
'tags',
{section_end:'Adv'},
{sidebar_end:'right'}
]
return f;
},
idprop: '_id',
listView:{
title: '<joe-title>${name}</joe-title><joe-subtitle>${date}</joe-subtitle>',
listWindowTitle: 'Posts'
}
};
module.exports = schema;