1 define(function(require) {
6 var Dialog = require('views/dialog/dialog'),
7 View = require('plugins/core/metadataEditor/view');
10 return function(ctx) {
12 name: 'showMetadataEditor',
14 doc: {type: 'context', name: 'document'}
18 label: gettext('Metadata'),
19 execute: function(callback, params) {
21 var dialog = Dialog.create({
22 title: gettext('Document Metadata'),
23 executeButtonText: gettext('Close'),
24 cssClass: 'metadataEditor',
27 view = new View(params.doc.root, ctx.config);
29 dialog.setContentView(view.dom);
30 dialog.on('execute', function(e) {
31 var cover_url = view.getMetadataByKey('relation.coverimage.url');
32 if (cover_url && !cover_url.match(/\.(png|jpg|jpeg|gif|tif|tiff)$/i)) {
33 window.alert(gettext('The cover needs to be an image file: jpg, png, gif. Use another URL or clear the cover field.'));
40 getState: function(params) {