Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix save as template #4233

Merged
merged 2 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ They keep the focus on elements inside modals and give it back to their parent m
* Add `update-doc-fields` event to call `AposDocEditor.updateDocFields` method
* Add schema field `hidden` property to always hide a field
* Hide empty schema tabs in `AposDocEditor` when all fields are hidden due to `if` conditions
* Respect `_aposEditorModal` property of a document if present, otherwise fall back to the usual way
of determining which component to use. This is a powerful addition to
custom editor components for piece and page types.
* The front end UI now respects the `_aposEditorModal` and `_aposAutopublish`
properties of a document if present, and otherwise falls back to module
configuration. This is a powerful addition to custom editor components
for piece and page types, allowing "virtual piece types" on the back end that
deal with many content types to give better hints to the UI.
* Respect the `_aposAutopublish` property of a document if present, otherwise
fall back to module configuration.

* For convenience in custom editor components, pass the new prop `type`, the original type of the document being copied or edited.
* For better results in custom editor components, pass the prop `copyOfId`, which implies
the custom editor should fetch the original itself by its means of choice.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ export default {
},
canRedo() {
return this.undone.length > 0;
},
autopublish() {
return this.context.autopublish ?? this.moduleOptions.autopublish;
}
},
watch: {
Expand Down Expand Up @@ -715,7 +718,7 @@ export default {
},
async getPublished() {
const moduleOptions = window.apos.modules[this.context.type];
const manuallyPublished = moduleOptions.localized && !moduleOptions.autopublish;
const manuallyPublished = moduleOptions.localized && !this.autopublish;
if (manuallyPublished && this.context.lastPublishedAt) {
const action = window.apos.modules[this.context.type].action;
const doc = await apos.http.get(`${action}/${this.context._id}`, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,10 @@
);
},
manuallyPublished() {
return this.moduleOptions.localized && !this.moduleOptions.autopublish;
return this.moduleOptions.localized && !this.autopublish;
},
autopublish() {
return this.context._aposAutopublish ?? this.moduleOptions.autopublish;
},
isModified() {
if (!this.current) {
Expand Down Expand Up @@ -433,8 +436,8 @@
...operation.props
});
function docProps(doc) {
return Object.fromEntries(Object.entries(operation.docProps || {}).map(([key, value]) => {

Check warning on line 439 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (16, 4.4)

A space is required after '['

Check warning on line 439 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (16, 4.4)

A space is required before ']'

Check warning on line 439 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (16, 5)

A space is required after '['

Check warning on line 439 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (16, 5)

A space is required before ']'

Check warning on line 439 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (16, 6)

A space is required after '['

Check warning on line 439 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (16, 6)

A space is required before ']'

Check warning on line 439 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (18, 4.4)

A space is required after '['

Check warning on line 439 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (18, 4.4)

A space is required before ']'

Check warning on line 439 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (18, 5)

A space is required after '['

Check warning on line 439 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (18, 5)

A space is required before ']'

Check warning on line 439 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (18, 6)

A space is required after '['

Check warning on line 439 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (18, 6)

A space is required before ']'
return [key, doc[value]];

Check warning on line 440 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (16, 4.4)

A space is required after '['

Check warning on line 440 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (16, 4.4)

A space is required before ']'

Check warning on line 440 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (16, 5)

A space is required after '['

Check warning on line 440 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (16, 5)

A space is required before ']'

Check warning on line 440 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (16, 6)

A space is required after '['

Check warning on line 440 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (16, 6)

A space is required before ']'

Check warning on line 440 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (18, 4.4)

A space is required after '['

Check warning on line 440 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (18, 4.4)

A space is required before ']'

Check warning on line 440 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (18, 5)

A space is required after '['

Check warning on line 440 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (18, 5)

A space is required before ']'

Check warning on line 440 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (18, 6)

A space is required after '['

Check warning on line 440 in modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue

View workflow job for this annotation

GitHub Actions / build (18, 6)

A space is required before ']'
}));
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,7 @@ import AposCellMixin from 'Modules/@apostrophecms/ui/mixins/AposCellMixin';

export default {
name: 'AposCellLabels',
mixins: [ AposCellMixin ],
computed: {
manuallyPublished() {
const module = apos.modules[this.item.type];
return module.localized && !module.autopublish;
}
}
mixins: [ AposCellMixin ]
};
</script>

Expand Down
9 changes: 9 additions & 0 deletions modules/@apostrophecms/ui/ui/apos/mixins/AposCellMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ export default {
computed: {
item() {
return this.published || this.draft;
},
moduleOptions() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These make more sense here

return apos.modules[this.item.type];
},
manuallyPublished() {
return this.moduleOptions.localized && !this.autopublish;
},
autopublish() {
return this.item._aposAutopublish ?? this.moduleOptions.autopublish;
}
}
};
Loading