github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/examples/gno.land/r/demo/boards/z_0_filetest.gno (about)

     1  // PKGPATH: gno.land/r/boards_test
     2  package boards_test
     3  
     4  // SEND: 200000000ugnot
     5  
     6  import (
     7  	"gno.land/r/demo/boards"
     8  	"gno.land/r/demo/users"
     9  )
    10  
    11  var bid boards.BoardID
    12  
    13  func init() {
    14  	users.Register("", "gnouser", "my profile")
    15  
    16  	bid = boards.CreateBoard("test_board")
    17  	boards.CreateThread(bid, "First Post (title)", "Body of the first post. (body)")
    18  	pid := boards.CreateThread(bid, "Second Post (title)", "Body of the second post. (body)")
    19  	boards.CreateReply(bid, pid, pid, "Reply of the second post")
    20  }
    21  
    22  func main() {
    23  	println(boards.Render("test_board"))
    24  }
    25  
    26  // Output:
    27  // \[[post](/r/demo/boards?help&__func=CreateThread&bid=1&body.type=textarea)]
    28  //
    29  // ----------------------------------------
    30  // ## [First Post (title)](/r/demo/boards:test_board/1)
    31  //
    32  // Body of the first post. (body)
    33  // \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm UTC](/r/demo/boards:test_board/1) \[[x](/r/demo/boards?help&__func=DeletePost&bid=1&threadid=1&postid=1)] (0 replies) (0 reposts)
    34  //
    35  // ----------------------------------------
    36  // ## [Second Post (title)](/r/demo/boards:test_board/2)
    37  //
    38  // Body of the second post. (body)
    39  // \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm UTC](/r/demo/boards:test_board/2) \[[x](/r/demo/boards?help&__func=DeletePost&bid=1&threadid=2&postid=2)] (1 replies) (0 reposts)