UNPKG

apostrophe

Version:

The Apostrophe Content Management System.

95 lines (92 loc) 2.57 kB
// A subclass of `apostrophe-pieces`, `apostrophe-images` establishes a library // of uploaded images in formats suitable for use on the web. // // Together with [apostrophe-images-widgets](/reference/modules/apostrophe-images-widgets), // this module provides a simple way to add downloadable PDFs and the like to // a website, and to manage a library of them for reuse. // // Each `apostrophe-image` doc has an `attachment` schema field, implemented // by the [apostrophe-attachments](/reference/modules/apostrophe-attachments) module. module.exports = { extend: 'apostrophe-pieces', name: 'apostrophe-image', slugPrefix: 'image-', label: 'Image', alias: 'images', perPage: 20, manageViews: ['grid', 'list'], insertViaUpload: true, // Means not included in public sitewide search. -Tom searchable: false, beforeConstruct: function(self, options) { options.addFields = [ { type: 'attachment', name: 'attachment', label: 'Image File', fileGroup: 'images', required: true }, { type: 'string', name: 'description', label: 'Description', textarea: true }, { type: 'string', name: 'credit', label: 'Credit' }, { type: 'url', name: 'creditUrl', label: 'Credit URL' }, { name: 'camera', label: 'Camera Model', type: 'string' }, { name: 'captureDate', label: 'Capture Date', type: 'string' } ].concat(options.addFields || []); options.arrangeFields = [ { name: 'basics', label: 'Basics', fields: [ 'attachment', 'title', 'slug', 'published', 'tags' ] }, { name: 'info', label: 'Info', fields: [ 'description', 'credit', 'creditUrl', 'camera', 'captureDate' ] } ].concat(options.arrangeFields || []); }, construct: function(self, options) { self.pushAsset('script', 'chooser', { when: 'user' }); self.pushAsset('script', 'relationship-editor', { when: 'user' }); self.pushAsset('script', 'manager-modal', { when: 'user' }); self.pushAsset('script', 'editor-modal', { when: 'user' }); self.pushAsset('script', 'focal-point-editor', { when: 'user' }); self.pushAsset('stylesheet', 'user', { when: 'user' }); require('./lib/api.js')(self, options); self.enableHelpers(); } };