Skip to content

Commit

Permalink
Export: add exclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
falkodev committed Jul 31, 2023
1 parent 9415b9e commit 0228905
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ module.exports = {
i18n: {
ns: 'aposImportExport',
browser: true
},
},
}
}
};

function getBundleModuleNames() {
Expand Down
24 changes: 18 additions & 6 deletions modules/@apostrophecms/import-export-doc-type/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
const excludedTypes = [];

module.exports = {
improve: '@apostrophecms/doc-type',

init(self) {
if (self.options.export === false) {
return;
excludedTypes.push({
type: {
$ne: self.__meta.name
}
});
}

self.apos.doc.addContextOperation(self.__meta.name, {
const criteria = {
action: 'export',
context: 'update',
label: 'aposImportExport:export',
modal: 'AposExportPiecesModal',
});
},
}
modal: 'AposExportPiecesModal'
};

if (excludedTypes.length) {
criteria.if = { $and: excludedTypes };
}

self.apos.doc.addContextOperation(self.__meta.name, criteria);
}
};
10 changes: 5 additions & 5 deletions modules/@apostrophecms/import-export-piece-type/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
improve: '@apostrophecms/piece-type',

cascades: ['batchOperations'],
cascades: [ 'batchOperations' ],

batchOperations(self) {
if (self.options.export === false) {
Expand All @@ -15,7 +15,7 @@ module.exports = {
messages: {
progress: 'aposImportExport:exporting'
},
modal: 'AposExportPiecesModal',
modal: 'AposExportPiecesModal'
}
},
group: {
Expand All @@ -24,6 +24,6 @@ module.exports = {
operations: [ 'export' ]
}
}
}
},
}
};
}
};

0 comments on commit 0228905

Please sign in to comment.