mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
docs/Design/Page/Public.md is the design; it describes only what is different
about this page and links back to docs/Design/Page/Table.md for everything shared,
which is that page's own rule.
WHAT IT WAS. /public rendered `boardList` - the All Boards page - with its query
swapped for `{ permission: 'public' }`. That brought the whole of All Boards with
it: the Starred / Templates / Remaining menu counting the user's OWN boards beside
a grid that was not, the workspaces tree, the org and team filters,
Multi-Selection with its archive and duplicate actions, the sort popup, board
dragging, and an "Add board" tile that made a private board from a page about
public ones. Multi-Selection offered to archive boards the visitor has no rights
to at all.
WHAT IT IS. Only the table. Two columns - board title and board description - ten
rows a page, paged and counted on the server. No left menu, no create, no
selection, no drag, and nothing on the page changes anything: a row's only action
is to open its board.
It supplies a rowTemplate rather than a text-cell column spec, because a row is a
LINK and carries its board's colour class and background image - so a board is
recognised here the way it is on All Boards (#5157) - and a text cell can express
neither. Read-only is about what the page can CHANGE: the row template renders one
anchor and no control.
WHAT A PAGE COSTS. Six fields for ten boards, not ten board documents: title and
description for the columns, slug for the link, color and backgroundImageURL for
the row. `members` is deliberately absent - it is the largest field on a busy
board and this page shows no avatars. The selector is built on the SERVER and
takes nothing from the client: public, not archived, a real board rather than a
template container, and not an internal ^Subtasks^ board. A search goes in as its
own $and term rather than replacing the title clause, or it would drop that last
exclusion.
Not carried over from the tile: member avatars, the per-list card counts, and the
spent-time clock. What a visitor needs of a board they do not belong to is what it
is called and what it is for; the rest is the inside of a board they have not
opened, and each costs a query the page would otherwise not make - the clock in
particular answers by looking for cards, which this page does not publish, so it
would read false for every board on every instance.
client/lib/reportPages.js now declares the DDP-only page-index collection, because
`new Mongo.Collection(name)` throws if the name is taken and it was declared
inside adminReports.js - so the second page to need it could not have one. The
guard in tests/adminPageRows.test.cjs that pinned that declaration is updated with
the reason: what it protects (declared once, from the shared constant, never a
typed string) is unchanged, it just lives in a different file.
tests/publicBoardsPage.test.cjs pins the route, that none of the All Boards chrome
is on the page, that a row carries no control, the two columns and one cell each,
that the labels are translation keys that exist, that paging is ten a page on the
server and the rows drawn are the ids the server named, exactly which six fields
the publication sends, that the selector is server-built and survives a search,
the row colouring, the shared collection, that the files are registered in the
bundle, and that every path the design doc names exists.
Thanks to xet7 !
27 lines
1.4 KiB
JavaScript
27 lines
1.4 KiB
JavaScript
import { Mongo } from 'meteor/mongo';
|
|
import { REPORT_PAGE_COLLECTION } from '/models/lib/reportPageIndex';
|
|
|
|
// The page index the paginated publications send (models/lib/reportPageIndex.js):
|
|
// one document per report, holding the ids of the page the SERVER chose, in the
|
|
// order it sorted them.
|
|
//
|
|
// Client-only — there is no `report_pages` collection on the server, the
|
|
// publications just address documents to that name over DDP — and declared HERE,
|
|
// once, because `new Mongo.Collection(name)` throws if the name is taken. It used
|
|
// to live inside adminReports.js, so the second page to need it (/public) could
|
|
// not have one.
|
|
export const ReportPages = new Mongo.Collection(REPORT_PAGE_COLLECTION);
|
|
|
|
// The documents of the page the server named, in the order it sorted them.
|
|
//
|
|
// A plain `collection.find()` shows whatever minimongo holds, which is right only
|
|
// for a collection nothing else fills. Boards and Cards are not those: every board
|
|
// the user has opened is in minimongo, so a page that read the collection drew
|
|
// rows from other pages while its pager - counted on the server - said "1 / 1".
|
|
export function reportPageDocs(collection, reportId, docsByIds) {
|
|
const index = ReportPages.findOne(reportId);
|
|
const ids = (index && index.ids) || [];
|
|
if (!ids.length) return [];
|
|
return docsByIds(ids, collection.find({ _id: { $in: ids } }).fetch());
|
|
}
|