Skip to content

Commit

Permalink
Export: add context menu and batch operation
Browse files Browse the repository at this point in the history
  • Loading branch information
falkodev committed Jul 28, 2023
1 parent 16edf70 commit 9415b9e
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div align="center">
<img src="https://raw.githubusercontent.com/apostrophecms/apostrophe/main/logo.svg" alt="ApostropheCMS logo" width="80" height="80">

<h1>Apostrophe Module Template</h1>
<h1>Apostrophe Import Export Module</h1>
<p>
<a aria-label="Apostrophe logo" href="https://v3.docs.apostrophecms.org">
<img src="https://img.shields.io/badge/MADE%20FOR%20Apostrophe%203-000000.svg?style=for-the-badge&logo=Apostrophe&labelColor=6516dd">
Expand Down
4 changes: 4 additions & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"export": "Export",
"exporting": "Exporting"
}
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ module.exports = {
bundle: {
directory: 'modules',
modules: getBundleModuleNames()
}
},

options: {
name: '@apostrophecms/import-export',
i18n: {
ns: 'aposImportExport',
browser: true
},

Check failure on line 15 in index.js

View workflow job for this annotation

GitHub Actions / build (16, 4.4)

Unexpected trailing comma

Check failure on line 15 in index.js

View workflow job for this annotation

GitHub Actions / build (18, 5.0)

Unexpected trailing comma

Check failure on line 15 in index.js

View workflow job for this annotation

GitHub Actions / build (20, 5.0)

Unexpected trailing comma

Check failure on line 15 in index.js

View workflow job for this annotation

GitHub Actions / build (16, 6.0)

Unexpected trailing comma

Check failure on line 15 in index.js

View workflow job for this annotation

GitHub Actions / build (18, 4.4)

Unexpected trailing comma

Check failure on line 15 in index.js

View workflow job for this annotation

GitHub Actions / build (20, 6.0)

Unexpected trailing comma
},

Check failure on line 16 in index.js

View workflow job for this annotation

GitHub Actions / build (16, 4.4)

Unexpected trailing comma

Check failure on line 16 in index.js

View workflow job for this annotation

GitHub Actions / build (18, 5.0)

Unexpected trailing comma

Check failure on line 16 in index.js

View workflow job for this annotation

GitHub Actions / build (20, 5.0)

Unexpected trailing comma

Check failure on line 16 in index.js

View workflow job for this annotation

GitHub Actions / build (16, 6.0)

Unexpected trailing comma

Check failure on line 16 in index.js

View workflow job for this annotation

GitHub Actions / build (18, 4.4)

Unexpected trailing comma

Check failure on line 16 in index.js

View workflow job for this annotation

GitHub Actions / build (20, 6.0)

Unexpected trailing comma
};

function getBundleModuleNames() {
Expand Down
16 changes: 16 additions & 0 deletions modules/@apostrophecms/import-export-doc-type/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
improve: '@apostrophecms/doc-type',

init(self) {
if (self.options.export === false) {
return;
}

self.apos.doc.addContextOperation(self.__meta.name, {
action: 'export',
context: 'update',
label: 'aposImportExport:export',
modal: 'AposExportPiecesModal',

Check failure on line 13 in modules/@apostrophecms/import-export-doc-type/index.js

View workflow job for this annotation

GitHub Actions / build (16, 4.4)

Unexpected trailing comma

Check failure on line 13 in modules/@apostrophecms/import-export-doc-type/index.js

View workflow job for this annotation

GitHub Actions / build (18, 5.0)

Unexpected trailing comma

Check failure on line 13 in modules/@apostrophecms/import-export-doc-type/index.js

View workflow job for this annotation

GitHub Actions / build (20, 5.0)

Unexpected trailing comma

Check failure on line 13 in modules/@apostrophecms/import-export-doc-type/index.js

View workflow job for this annotation

GitHub Actions / build (16, 6.0)

Unexpected trailing comma

Check failure on line 13 in modules/@apostrophecms/import-export-doc-type/index.js

View workflow job for this annotation

GitHub Actions / build (18, 4.4)

Unexpected trailing comma

Check failure on line 13 in modules/@apostrophecms/import-export-doc-type/index.js

View workflow job for this annotation

GitHub Actions / build (20, 6.0)

Unexpected trailing comma
});
},

Check failure on line 15 in modules/@apostrophecms/import-export-doc-type/index.js

View workflow job for this annotation

GitHub Actions / build (16, 4.4)

Unexpected trailing comma

Check failure on line 15 in modules/@apostrophecms/import-export-doc-type/index.js

View workflow job for this annotation

GitHub Actions / build (18, 5.0)

Unexpected trailing comma

Check failure on line 15 in modules/@apostrophecms/import-export-doc-type/index.js

View workflow job for this annotation

GitHub Actions / build (20, 5.0)

Unexpected trailing comma

Check failure on line 15 in modules/@apostrophecms/import-export-doc-type/index.js

View workflow job for this annotation

GitHub Actions / build (16, 6.0)

Unexpected trailing comma

Check failure on line 15 in modules/@apostrophecms/import-export-doc-type/index.js

View workflow job for this annotation

GitHub Actions / build (18, 4.4)

Unexpected trailing comma

Check failure on line 15 in modules/@apostrophecms/import-export-doc-type/index.js

View workflow job for this annotation

GitHub Actions / build (20, 6.0)

Unexpected trailing comma
}

Check failure on line 16 in modules/@apostrophecms/import-export-doc-type/index.js

View workflow job for this annotation

GitHub Actions / build (16, 4.4)

Missing semicolon

Check failure on line 16 in modules/@apostrophecms/import-export-doc-type/index.js

View workflow job for this annotation

GitHub Actions / build (18, 5.0)

Missing semicolon

Check failure on line 16 in modules/@apostrophecms/import-export-doc-type/index.js

View workflow job for this annotation

GitHub Actions / build (20, 5.0)

Missing semicolon

Check failure on line 16 in modules/@apostrophecms/import-export-doc-type/index.js

View workflow job for this annotation

GitHub Actions / build (16, 6.0)

Missing semicolon

Check failure on line 16 in modules/@apostrophecms/import-export-doc-type/index.js

View workflow job for this annotation

GitHub Actions / build (18, 4.4)

Missing semicolon

Check failure on line 16 in modules/@apostrophecms/import-export-doc-type/index.js

View workflow job for this annotation

GitHub Actions / build (20, 6.0)

Missing semicolon
29 changes: 29 additions & 0 deletions modules/@apostrophecms/import-export-piece-type/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = {
improve: '@apostrophecms/piece-type',

cascades: ['batchOperations'],

Check warning on line 4 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (16, 4.4)

A space is required after '['

Check warning on line 4 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (16, 4.4)

A space is required before ']'

Check warning on line 4 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (18, 5.0)

A space is required after '['

Check warning on line 4 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (18, 5.0)

A space is required before ']'

Check warning on line 4 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (20, 5.0)

A space is required after '['

Check warning on line 4 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (20, 5.0)

A space is required before ']'

Check warning on line 4 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (16, 6.0)

A space is required after '['

Check warning on line 4 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (16, 6.0)

A space is required before ']'

Check warning on line 4 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (18, 4.4)

A space is required after '['

Check warning on line 4 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (18, 4.4)

A space is required before ']'

Check warning on line 4 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (20, 6.0)

A space is required after '['

Check warning on line 4 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (20, 6.0)

A space is required before ']'

batchOperations(self) {
if (self.options.export === false) {
return;
}

return {
add: {
export: {
label: 'aposImportExport:export',
messages: {
progress: 'aposImportExport:exporting'
},
modal: 'AposExportPiecesModal',

Check failure on line 18 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (16, 4.4)

Unexpected trailing comma

Check failure on line 18 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (18, 5.0)

Unexpected trailing comma

Check failure on line 18 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (20, 5.0)

Unexpected trailing comma

Check failure on line 18 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (16, 6.0)

Unexpected trailing comma

Check failure on line 18 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (18, 4.4)

Unexpected trailing comma

Check failure on line 18 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (20, 6.0)

Unexpected trailing comma
}
},
group: {
more: {
icon: 'dots-vertical-icon',
operations: [ 'export' ]
}
}
}

Check failure on line 27 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (16, 4.4)

Missing semicolon

Check failure on line 27 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (18, 5.0)

Missing semicolon

Check failure on line 27 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (20, 5.0)

Missing semicolon

Check failure on line 27 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (16, 6.0)

Missing semicolon

Check failure on line 27 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (18, 4.4)

Missing semicolon

Check failure on line 27 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (20, 6.0)

Missing semicolon
},

Check failure on line 28 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (16, 4.4)

Unexpected trailing comma

Check failure on line 28 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (18, 5.0)

Unexpected trailing comma

Check failure on line 28 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (20, 5.0)

Unexpected trailing comma

Check failure on line 28 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (16, 6.0)

Unexpected trailing comma

Check failure on line 28 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (18, 4.4)

Unexpected trailing comma

Check failure on line 28 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (20, 6.0)

Unexpected trailing comma
}

Check failure on line 29 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (16, 4.4)

Missing semicolon

Check failure on line 29 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (18, 5.0)

Missing semicolon

Check failure on line 29 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (20, 5.0)

Missing semicolon

Check failure on line 29 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (16, 6.0)

Missing semicolon

Check failure on line 29 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (18, 4.4)

Missing semicolon

Check failure on line 29 in modules/@apostrophecms/import-export-piece-type/index.js

View workflow job for this annotation

GitHub Actions / build (20, 6.0)

Missing semicolon

0 comments on commit 9415b9e

Please sign in to comment.