Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,6 @@ onMounted(async () => {
}
if (versions.value.length) {
selectVersion(versions.value[0]);
} else {
evaluateConditions(props.doc);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,16 +299,16 @@ function matches(row) {
return changeGroups.matchesFilter(row, filter.value);
}

// What an empty list says: a restore and a first version are baselines,
// while a version compared with the one before it and left with nothing
// ended where that one did
// What an empty list says: a restore is a baseline, a first version has
// nothing before it, and a version compared with the one before it and left
// with nothing ended where that one did
const emptyMessage = computed(() => {
if (props.version?.restoredFrom) {
return 'apostrophe:versionRestoredBaseline';
}
return props.compared
? 'apostrophe:versionUnchanged'
: 'apostrophe:versionNoChanges';
: 'apostrophe:versionFirst';
});

const shownRows = computed(() => props.rows.filter(matches));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
* The tabs of the versions modal: the read-only schema of the document's
* type, grouped as the document editor groups it, with the conditional
* fields evaluated against the version shown. A tab none of whose fields
* renders is not visible.
* renders is not visible, and there are no tabs until a version is shown.
*
* @param {object} options
* @param {import('vue').Ref<object>} options.moduleOptions
Expand All @@ -22,7 +22,7 @@ import {
* @param {object} options.doc
* The document the modal opened for
* @param {import('vue').Ref<{ data: object }>} options.docFields
* The version shown
* The version shown, `data` empty until one is
*/
export function useDocVersionTabs({
moduleOptions, unsupported, doc, docFields
Expand Down Expand Up @@ -51,11 +51,10 @@ export function useDocVersionTabs({
);
}

// With no version to show, the tabs follow the live document
function evaluateConditions(data = docFields.value.data) {
function evaluateConditions() {
conditionalFields.value = getConditionalFields(
schema.value,
data,
docFields.value.data,
externalConditionsResults.value
);
}
Expand Down Expand Up @@ -93,7 +92,7 @@ export function useDocVersionTabs({
}

const versionTabs = computed(() => {
if (unsupported.value) {
if (unsupported.value || !docFields.value.data.type) {
return [];
}
const tabs = Object.entries(groups.value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@
"versionFailDocPermsMessage": "Insufficient permissions.",
"versionFailVersionLoadMessage": "Failed to load the requested Document Version.",
"versionFailVersionRestoreMessage": "Unable to restore the requested Document Version.",
"versionFirst": "This is the first recorded version. There is no earlier version to compare it with.",
"versionFilterChanges": "Filter changes",
"versionFilterShowing": "Filter changes, showing {{ count }} edit",
"versionFilterShowing_plural": "Filter changes, showing {{ count }} edits",
Expand Down Expand Up @@ -826,7 +827,6 @@
"versionNavPosition": "{{ current }} of {{ total }}",
"versionNavPrevious": "Previous",
"versionNavShow": "Show in the document",
"versionNoChanges": "No changes recorded for this version.",
"versionNoChangesMatch": "No changes match these filters.",
"versionOpensNewTab": "Opens in a new tab",
"versionOrderChanged": "Order changed",
Expand Down
Loading