Skip to content

Commit 7d740f6

Browse files
authored
No tabs when not versions; better first version message (#5627)
1 parent 505089e commit 7d740f6

4 files changed

Lines changed: 10 additions & 13 deletions

File tree

‎packages/apostrophe/modules/@apostrophecms/document-versions/ui/apos/components/AposDocVersions.vue‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,6 @@ onMounted(async () => {
480480
}
481481
if (versions.value.length) {
482482
selectVersion(versions.value[0]);
483-
} else {
484-
evaluateConditions(props.doc);
485483
}
486484
});
487485

‎packages/apostrophe/modules/@apostrophecms/document-versions/ui/apos/components/AposDocVersionsChanges.vue‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,16 +299,16 @@ function matches(row) {
299299
return changeGroups.matchesFilter(row, filter.value);
300300
}
301301
302-
// What an empty list says: a restore and a first version are baselines,
303-
// while a version compared with the one before it and left with nothing
304-
// ended where that one did
302+
// What an empty list says: a restore is a baseline, a first version has
303+
// nothing before it, and a version compared with the one before it and left
304+
// with nothing ended where that one did
305305
const emptyMessage = computed(() => {
306306
if (props.version?.restoredFrom) {
307307
return 'apostrophe:versionRestoredBaseline';
308308
}
309309
return props.compared
310310
? 'apostrophe:versionUnchanged'
311-
: 'apostrophe:versionNoChanges';
311+
: 'apostrophe:versionFirst';
312312
});
313313
314314
const shownRows = computed(() => props.rows.filter(matches));

‎packages/apostrophe/modules/@apostrophecms/document-versions/ui/apos/composables/useDocVersionTabs.js‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
* The tabs of the versions modal: the read-only schema of the document's
1313
* type, grouped as the document editor groups it, with the conditional
1414
* fields evaluated against the version shown. A tab none of whose fields
15-
* renders is not visible.
15+
* renders is not visible, and there are no tabs until a version is shown.
1616
*
1717
* @param {object} options
1818
* @param {import('vue').Ref<object>} options.moduleOptions
@@ -22,7 +22,7 @@ import {
2222
* @param {object} options.doc
2323
* The document the modal opened for
2424
* @param {import('vue').Ref<{ data: object }>} options.docFields
25-
* The version shown
25+
* The version shown, `data` empty until one is
2626
*/
2727
export function useDocVersionTabs({
2828
moduleOptions, unsupported, doc, docFields
@@ -51,11 +51,10 @@ export function useDocVersionTabs({
5151
);
5252
}
5353

54-
// With no version to show, the tabs follow the live document
55-
function evaluateConditions(data = docFields.value.data) {
54+
function evaluateConditions() {
5655
conditionalFields.value = getConditionalFields(
5756
schema.value,
58-
data,
57+
docFields.value.data,
5958
externalConditionsResults.value
6059
);
6160
}
@@ -93,7 +92,7 @@ export function useDocVersionTabs({
9392
}
9493

9594
const versionTabs = computed(() => {
96-
if (unsupported.value) {
95+
if (unsupported.value || !docFields.value.data.type) {
9796
return [];
9897
}
9998
const tabs = Object.entries(groups.value)

‎packages/apostrophe/modules/@apostrophecms/i18n/i18n/en.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,7 @@
796796
"versionFailDocPermsMessage": "Insufficient permissions.",
797797
"versionFailVersionLoadMessage": "Failed to load the requested Document Version.",
798798
"versionFailVersionRestoreMessage": "Unable to restore the requested Document Version.",
799+
"versionFirst": "This is the first recorded version. There is no earlier version to compare it with.",
799800
"versionFilterChanges": "Filter changes",
800801
"versionFilterShowing": "Filter changes, showing {{ count }} edit",
801802
"versionFilterShowing_plural": "Filter changes, showing {{ count }} edits",
@@ -826,7 +827,6 @@
826827
"versionNavPosition": "{{ current }} of {{ total }}",
827828
"versionNavPrevious": "Previous",
828829
"versionNavShow": "Show in the document",
829-
"versionNoChanges": "No changes recorded for this version.",
830830
"versionNoChangesMatch": "No changes match these filters.",
831831
"versionOpensNewTab": "Opens in a new tab",
832832
"versionOrderChanged": "Order changed",

0 commit comments

Comments
 (0)