(core) Polish doc tutorials

Summary:
The GristDocTutorial table is now always visible to users with edit
access to the trunk, and the Share menu is now available within
tutorial forks, making it easier for editors to replace the original
tutorial trunk with changes made in the fork, and for viewers to export
their copy of the tutorial.

Also, changes to the GristDocTutorial table are now immediately reflected
in the tutorial popup.

Test Plan: Browser tests.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D3930
This commit is contained in:
George Gevoian
2023-06-22 09:31:29 -04:00
parent e09e8f7160
commit 25b71c4e57
5 changed files with 130 additions and 39 deletions

View File

@@ -26,6 +26,7 @@ import MetaTableModel from 'app/client/models/MetaTableModel';
import * as rowset from 'app/client/models/rowset';
import {TableData} from 'app/client/models/TableData';
import {isHiddenTable, isSummaryTable} from 'app/common/isHiddenTable';
import {canEdit} from 'app/common/roles';
import {RowFilterFunc} from 'app/common/RowFilterFunc';
import {schema, SchemaTypes} from 'app/common/schema';
import {UIRowId} from 'app/common/UIRowId';
@@ -44,7 +45,7 @@ import {createViewSectionRec, ViewSectionRec} from 'app/client/models/entities/V
import {CellRec, createCellRec} from 'app/client/models/entities/CellRec';
import {RefListValue} from 'app/common/gristTypes';
import {decodeObject} from 'app/plugin/objtypes';
import { toKo } from 'grainjs';
import {toKo} from 'grainjs';
// Re-export all the entity types available. The recommended usage is like this:
// import {ColumnRec, ViewFieldRec} from 'app/client/models/DocModel';
@@ -166,7 +167,12 @@ export class DocModel {
// is initialized once on page load. If set, then the tour page (if any) will be visible.
public showDocTourTable: boolean = (urlState().state.get().docPage === 'GristDocTour');
public showDocTutorialTable: boolean = !this._docPageModel.isTutorialFork.get();
// Whether the GristDocTutorial table should be shown. Initialized once on page load.
public showDocTutorialTable: boolean =
// We skip subscribing to the observables below since they normally shouldn't change during
// this object's lifetime. If that changes, this should be made into a computed observable.
!this._docPageModel.isTutorialFork.get() ||
canEdit(this._docPageModel.currentDoc.get()?.trunkAccess ?? null);
// List of all the metadata tables.
private _metaTables: Array<MetaTableModel<any>>;

View File

@@ -14,7 +14,7 @@ export function createPageRec(this: PageRec, docModel: DocModel): void {
// Page is hidden when any of this is true:
// - It has an empty name (or no name at all)
// - It is GristDocTour (unless user wants to see it)
// - It is GristDocTutorial (and the document is a tutorial fork)
// - It is GristDocTutorial (unless user should see it)
// - It is a page generated for a hidden table TODO: Follow up - don't create
// pages for hidden tables.
// This is used currently only the left panel, to hide pages from the user.