diff --git a/cap-notebook/demoapp/app/common.cds b/cap-notebook/demoapp/app/common.cds index 5f590992..c9120dfe 100644 --- a/cap-notebook/demoapp/app/common.cds +++ b/cap-notebook/demoapp/app/common.cds @@ -95,6 +95,72 @@ annotate Attachments with @Common: {SideEffects #ContentChanged: { TargetEntities : [Books.attachments] }}{}; +annotate my.Books.references with @UI: { + HeaderInfo: { + $Type : 'UI.HeaderInfoType', + TypeName : '{i18n>Attachment}', + TypeNamePlural: '{i18n>Attachments}', + }, + LineItem : [ + {Value: fileName, @HTML5.CssDefaults: {width: '20%'}}, + {Value: content, @HTML5.CssDefaults: {width: '20%'}}, + {Value: createdAt, @HTML5.CssDefaults: {width: '20%'}}, + {Value: createdBy, @HTML5.CssDefaults: {width: '20%'}}, + {Value: note, @HTML5.CssDefaults: {width: '20%'}}, + + { + $Type : 'UI.DataFieldForAction', + Label : 'Copy Attachments', + Action: 'AdminService.copyAttachments', + } + ] +} { + note @(title: '{i18n>Note}'); + fileName @(title: '{i18n>Filename}'); + modifiedAt @(odata.etag: null); + content + @Core.ContentDisposition: { Filename: fileName } + @(title: '{i18n>Attachment}'); + folderId @UI.Hidden; + repositoryId @UI.Hidden ; + objectId @UI.Hidden ; + mimeType @UI.Hidden; + status @UI.Hidden; +} + +annotate my.Books.footnotes with @UI: { + HeaderInfo: { + $Type : 'UI.HeaderInfoType', + TypeName : '{i18n>Attachment}', + TypeNamePlural: '{i18n>Attachments}', + }, + LineItem : [ + {Value: fileName, @HTML5.CssDefaults: {width: '20%'}}, + {Value: content, @HTML5.CssDefaults: {width: '20%'}}, + {Value: createdAt, @HTML5.CssDefaults: {width: '20%'}}, + {Value: createdBy, @HTML5.CssDefaults: {width: '20%'}}, + {Value: note, @HTML5.CssDefaults: {width: '20%'}}, + + { + $Type : 'UI.DataFieldForAction', + Label : 'Copy Attachments', + Action: 'AdminService.copyAttachments', + } + ] +} { + note @(title: '{i18n>Note}'); + fileName @(title: '{i18n>Filename}'); + modifiedAt @(odata.etag: null); + content + @Core.ContentDisposition: { Filename: fileName } + @(title: '{i18n>Attachment}'); + folderId @UI.Hidden; + repositoryId @UI.Hidden ; + objectId @UI.Hidden ; + mimeType @UI.Hidden; + status @UI.Hidden; +} + //////////////////////////////////////////////////////////////////////////// // // Books Elements diff --git a/cap-notebook/demoapp/srv/admin-service.cds b/cap-notebook/demoapp/srv/admin-service.cds index 7247b2ca..d5d3b7ee 100644 --- a/cap-notebook/demoapp/srv/admin-service.cds +++ b/cap-notebook/demoapp/srv/admin-service.cds @@ -8,4 +8,14 @@ service AdminService @(requires: ['admin','system-user']) { @(Common.SideEffects : {TargetEntities: ['']},) action copyAttachments(in:many $self,up__ID:String,objectIds:String); } + entity Books.references as projection on my.Books.references + actions { + @(Common.SideEffects : {TargetEntities: ['']},) + action copyAttachments(in:many $self,up__ID:String,objectIds:String); + } + entity Books.footnotes as projection on my.Books.footnotes + actions { + @(Common.SideEffects : {TargetEntities: ['']},) + action copyAttachments(in:many $self,up__ID:String,objectIds:String); + } }