Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_ui_home_00_filetest.gno

1.61 Kb · 49 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v1/filetests/z_ui_home_00_filetest
 2
 3// Render default realm view.
 4// Default realm view must render the list of listed boards.
 5package z_ui_home_00_filetest
 6
 7import (
 8	"testing"
 9
10	boards2 "gno.land/r/gnoland/boards2/v1"
11)
12
13const owner address = "g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh"
14
15func init(cur realm) {
16	testing.SetRealm(testing.NewUserRealm(owner))
17
18	// Create board "AAA" with a single thread
19	boardID := boards2.CreateBoard(cross(cur), "AAA", true, false)
20	boards2.CreateThread(cross(cur), boardID, "Foo", "Bar")
21
22	// Create 2 more boards
23	boards2.CreateBoard(cross(cur), "BBB", true, false)
24	boards2.CreateBoard(cross(cur), "CCC", true, false)
25	boards2.CreateBoard(cross(cur), "DDD", false, false) // <-- Unlisted board
26}
27
28func main() {
29	println(boards2.Render(""))
30}
31
32// Output:
33// # Boards
34// [Create Board](/r/gnoland/boards2/v1:create-board) • [List Admin Users](/r/gnoland/boards2/v1:admin-users) • [Help](/r/gnoland/boards2/v1:help)
35//
36// ---
37// Sort by: [newest first](/r/gnoland/boards2/v1:?order=desc)
38//
39// ###### [AAA](/r/gnoland/boards2/v1:AAA)
40// Created by [g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh](/u/g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh) on 2009-02-13 11:31pm UTC, #1
41// **1 threads**
42//
43// ###### [BBB](/r/gnoland/boards2/v1:BBB)
44// Created by [g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh](/u/g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh) on 2009-02-13 11:31pm UTC, #2
45// **0 threads**
46//
47// ###### [CCC](/r/gnoland/boards2/v1:CCC)
48// Created by [g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh](/u/g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh) on 2009-02-13 11:31pm UTC, #3
49// **0 threads**