Documentation
¶
Overview ¶
Package views holds the templ components and pages.
Index ¶
- Constants
- func AdminRoom(row AdminRoomRow) templ.Component
- func AdminRoomPath(id uint64) string
- func AdminRoomsPage(d AdminRoomsData) templ.Component
- func AdminTabs(current string) templ.Component
- func AdminUsersPage(d AdminUsersData) templ.Component
- func Attachments(atts []app.AttachmentView) templ.Component
- func AuditFilters(d AuditData) templ.Component
- func AuditPage(d AuditData) templ.Component
- func AuditPanel(d AuditData) templ.Component
- func BoardAddColumn(d BoardData) templ.Component
- func BoardColumns(d BoardData) templ.Component
- func BoardColumnsPath(roomID uint64) string
- func BoardEditor(d BoardData) templ.Component
- func BoardHeader(d BoardData) templ.Component
- func BoardMessage(message string) templ.Component
- func BoardNote(d BoardData) templ.Component
- func BoardPage(d BoardData) templ.Component
- func BoardPath(roomID uint64) string
- func BoardStreamPath(roomID uint64, version string) string
- func BoardVersion(b app.BoardView) string
- func CommentPath(rootID, id uint64) string
- func CommentsSection(d PostPageData) templ.Component
- func ConversationBeforePath(convID, before uint64) string
- func ConversationHeader(d ConversationData) templ.Component
- func ConversationList(items []app.ConversationSummary, viewerID uint64) templ.Component
- func ConversationMembers(d MembersPanelData) templ.Component
- func ConversationOlderPath(convID, before uint64) string
- func ConversationPage(d ConversationData) templ.Component
- func ConversationPath(id uint64) string
- func ConversationReplyPath(convID, msgID uint64) string
- func ConversationStreamPath(convID, newest, before uint64) string
- func ErrorPage(status int, message string) templ.Component
- func Feed(d FeedData) templ.Component
- func FeedMore(d FeedData) templ.Component
- func FeedPath(roomID, before uint64) string
- func FeedPosts(d FeedData) templ.Component
- func FilePath(a app.AttachmentView) string
- func FormPost(path string) string
- func FormPostConfirm(path, message string) string
- func Home(sb SidebarData) templ.Component
- func InviteSection(d InviteData) templ.Component
- func Layout(title string, sidebar templ.Component) templ.Component
- func LoginForm(d LoginData) templ.Component
- func LoginPage(d LoginData) templ.Component
- func MembersPanel(d RoomData) templ.Component
- func MessageActionPath(msgID uint64, action string) string
- func MessageAttachments(atts []app.AttachmentView) templ.Component
- func MessageComposer(d ComposerData) templ.Component
- func MessageComposerForm(d ComposerData) templ.Component
- func MessageContent(d MessageData) templ.Component
- func MessageContentID(id uint64) string
- func MessageCount(n int) templ.Component
- func MessageEdit(d MessageEditData) templ.Component
- func MessageElementID(id uint64) string
- func MessageFilePath(a app.AttachmentView) string
- func MessageItem(d MessageData) templ.Component
- func MessageItemEditing(d MessageEditData) templ.Component
- func MessageItems(items []MessageData) templ.Component
- func MessageQuote(q app.MessageQuote) templ.Component
- func MessageReactionPicker(d MessageReactionsData) templ.Component
- func MessageReactions(d MessageReactionsData) templ.Component
- func MessageReplySlot(q *app.MessageQuote, convID uint64) templ.Component
- func MessageSeen(id uint64, seen bool) templ.Component
- func MessagesOlder(convID uint64, hasOlder bool, before uint64) templ.Component
- func MessagesPage(d ConversationsData) templ.Component
- func NewConversationForm(d NewConversationData) templ.Component
- func NotificationCount(n int) templ.Component
- func NotificationElementID(id uint64) string
- func NotificationItem(n app.Notification) templ.Component
- func NotificationPath(n app.Notification) string
- func NotificationSentence(n app.Notification) string
- func NotificationsMessage(message string) templ.Component
- func NotificationsOlderPath(before uint64) string
- func NotificationsPage(d NotificationsData) templ.Component
- func NotificationsStreamPath(seen uint64, live bool) string
- func OlderPostsPath(roomID, before uint64) string
- func PostCard(d PostCardData) templ.Component
- func PostCommentsPath(id uint64) string
- func PostContent(d PostCardData) templ.Component
- func PostEdit(d PostEditData) templ.Component
- func PostEditor(d PostEditorData) templ.Component
- func PostPage(d PostPageData) templ.Component
- func PostPath(id uint64) string
- func PostPreview(d PostPreviewData) templ.Component
- func PostStreamPath(rootID, newest uint64) string
- func PostTasks(roomID uint64, tasks []app.TaskCard) templ.Component
- func ReactionPicker(d ReactionsData) templ.Component
- func Reactions(d ReactionsData) templ.Component
- func ReplySlot(parentID uint64, editor *PostEditorData) templ.Component
- func RoomComposer(d RoomData) templ.Component
- func RoomEditForm(d RoomData) templ.Component
- func RoomHeader(d RoomData) templ.Component
- func RoomMemberCount(d RoomData) templ.Component
- func RoomNav(roomID uint64, current RoomNavCurrent) templ.Component
- func RoomNewForm(d RoomNewData) templ.Component
- func RoomNewPage(d RoomNewData) templ.Component
- func RoomPage(d RoomData) templ.Component
- func RoomPath(id uint64) string
- func RoomStreamPath(roomID, newest, before uint64) string
- func RoomsBrowsePage(d RoomsBrowseData) templ.Component
- func RoomsPanel(d RoomsBrowseData) templ.Component
- func SearchBar() templ.Component
- func SearchBox(query string) templ.Component
- func SearchPage(d SearchData) templ.Component
- func SearchPanel(d SearchData) templ.Component
- func SearchPath(q string, page int) string
- func SeenMessageID(viewerID uint64, h app.ConversationHeader, messages []app.Message) uint64
- func Sidebar(d SidebarData) templ.Component
- func SignUpForm(d SignUpData) templ.Component
- func SignUpPage(d SignUpData) templ.Component
- func SizeText(n int64) string
- func TagSearchPath(tag string) string
- func TagSuggestions(editorID string, tags []string) templ.Component
- func TaskBoardPath(roomID, taskID uint64) string
- func TaskRow(editorID string, index int, row TaskRowData, options []AssigneeOption) templ.Component
- func TaskRowsSelector(editorID string) string
- func Thread(d PostPageData) templ.Component
- func UsersPanel(d AdminUsersData) templ.Component
- type AdminRoomRow
- type AdminRoomsData
- type AdminUsersData
- type AssigneeOption
- type AuditData
- type AuditDetail
- type AuditFilterForm
- type AuditRow
- type BoardData
- type BoardEditorData
- type ComposerData
- type ConversationData
- type ConversationsData
- type FeedData
- type FormErrors
- type InviteData
- type LoginData
- type MembersPanelData
- type MessageData
- type MessageEditData
- type MessageReactionsData
- type NewConversationData
- type NotificationsData
- type PostCardData
- type PostEditData
- type PostEditorData
- type PostPageData
- type PostPreviewData
- type ReactionsData
- type RoomData
- type RoomEditData
- type RoomNavCurrent
- type RoomNewData
- type RoomsBrowseData
- type SearchChip
- type SearchData
- type SidebarData
- type SignUpData
- type TaskRowData
Constants ¶
const (
// FromPost says the post is shown on its own page.
FromPost = "post"
)
The values of the form field "from" of the actions on a post: where the post is shown, so that the answer fits the page.
const FromRoomPrefix = "room-"
FromRoomPrefix starts the value of the form field "from" of a "Message" button in the member list of a room: FromRoomPrefix + the room's ID. It says where the message of a failure is shown.
const MaxVisualDepth = 6
MaxVisualDepth is the deepest level a comment is indented to. A comment deeper than that stays at this level and says whom it replies to (SPEC §7.3).
const MeStreamPath = "/me/stream"
MeStreamPath is the path of the stream of the pages that have no stream of their own: it keeps the counts and the room list of the sidebar live (SPEC D31).
const MessagesPath = "/messages"
MessagesPath is the path of the page that lists the conversations of the user; a POST to it starts a conversation.
const MessagesStreamPath = MeStreamPath + "?messages=1"
MessagesStreamPath is the path of the stream of the Messages page: the stream of the pages that have none (MeStreamPath), told to keep the list of conversations live too.
const NotificationsPath = "/notifications"
NotificationsPath is the path of the notifications page.
const NotificationsReadPath = "/notifications/read"
NotificationsReadPath is the path that marks all notifications as read.
Variables ¶
This section is empty.
Functions ¶
func AdminRoom ¶
func AdminRoom(row AdminRoomRow) templ.Component
AdminRoom is the row of one room: its name, visibility, member count, creator and creation date, and the forms that rename it, delete it and show its members. The id of the row is room-<id>, so that other pages link to it. The server sends it alone as a Datastar patch after an action.
func AdminRoomPath ¶
AdminRoomPath returns the path of the row of a room on the admin rooms page, /admin/rooms/<id>. Its actions are AdminRoomPath + "/rename", "/delete", "/members" and "/members/<user>/remove".
func AdminRoomsPage ¶
func AdminRoomsPage(d AdminRoomsData) templ.Component
AdminRoomsPage is the page of every room, with the forms that rename and delete a room and the list of its members. Only admins get it.
func AdminTabs ¶
AdminTabs is the tab bar that the admin pages share: Users, Rooms and Audit log. current is the tab of the page that is shown: "users", "rooms" or "audit".
func AdminUsersPage ¶
func AdminUsersPage(d AdminUsersData) templ.Component
AdminUsersPage is the page of the users and of the invitation form. Only admins get it.
func Attachments ¶
func Attachments(atts []app.AttachmentView) templ.Component
Attachments shows the files of a post or comment under its body: the images inline, scaled to the width of the column (the width and height attributes hold the size of the file, so that the page does not jump when it loads), each a link to the full file; then the other files as a list of links with their sizes.
func AuditFilters ¶
AuditFilters is the form of the filters. It is a plain GET form, so the result can be shared by its URL; with Datastar it fetches the events and patches the table in place.
func AuditPage ¶
AuditPage is the page of the audit log: the filter form and the events. Only admins get it.
func AuditPanel ¶
AuditPanel is the message about the filters, the table of events and the links to the newer and older page. The server sends it alone as a Datastar patch when the filters or the page change.
func BoardAddColumn ¶
BoardAddColumn is the form that adds a column at the right end of the board, for a member; empty for anyone else. It is not part of the columns, so that a live update does not clear the name that is being typed. A live update replaces it when the person joins or leaves the room.
func BoardColumns ¶
BoardColumns are the columns of the board side by side, with their cards. The server sends it alone as a Datastar patch after every action on the board and, to every open board page, when the board changes. It holds no form that the person fills in over time (the card form has its own panel and the form that adds a column sits next to it), so that a live update never takes a typed text away.
func BoardColumnsPath ¶
BoardColumnsPath returns the path that adds a column to the board of a room and, with GET, shows the columns alone (what the board asks for when a drag ends without a drop).
func BoardEditor ¶
BoardEditor is the panel of the board where the form of a card opens, empty until then. It is outside the columns, so that a live update of the columns never closes the form or clears what is typed in it. The server sends it alone as a Datastar patch to open the form and to show its problems.
func BoardHeader ¶
BoardHeader is the header of the board page: the name of the room, its visibility and the navigation back to the posts. A live update replaces it when the room is renamed.
func BoardMessage ¶
BoardMessage is the problem of the last action on the board, at the top of it. The server sends it alone as a Datastar patch when an action fails.
func BoardNote ¶
BoardNote tells a person who has not joined the room that the board is theirs to read only. It is empty for a member. A live update replaces it when the person joins or leaves.
func BoardPage ¶
BoardPage is the page of the board of a room, in the layout with the sidebar: the header with the way back to the posts, the note for a person who has not joined, the form of the card being edited, the columns with their cards, the form that adds a column, and the script of the drag and drop. The hidden form and link next to the columns are what that script uses to talk to the server through Datastar.
func BoardPath ¶
BoardPath returns the path of the board of a room, /rooms/<id>/board. Its actions are BoardPath + "/columns" and "/tasks/<id>"; its stream is BoardPath + "/stream".
func BoardStreamPath ¶
BoardStreamPath returns the path of the live stream of the board. version is the BoardVersion of the board the page showed; the stream sends the columns at once when the board changed since.
func BoardVersion ¶
BoardVersion is a short text that changes when anything the board shows changes: the columns and the cards with their places, titles, assignees and due dates, and whether the viewer may change the board. The page tells it to its stream, which finds out what happened while the page was loading.
func CommentPath ¶
CommentPath returns the path that shows a comment in its thread, on the page of the top-level post: /posts/<root>#post-<id>.
func CommentsSection ¶
func CommentsSection(d PostPageData) templ.Component
CommentsSection is the comments of the thread, or the note that there are none. A live update replaces it alone when the first comment arrives.
func ConversationBeforePath ¶
ConversationBeforePath returns the path of the page of the conversation that shows the messages older than before, for a browser without JavaScript.
func ConversationHeader ¶
func ConversationHeader(d ConversationData) templ.Component
ConversationHeader is the header of a conversation: its title, who is in it and the message of the last action on the conversation. The server sends it alone as a Datastar patch when the conversation is renamed or its members change.
func ConversationList ¶
func ConversationList(items []app.ConversationSummary, viewerID uint64) templ.Component
ConversationList is the conversations of the user, most recent first: the title, who wrote the last message and the start of it, when, and the unread mark. The server sends it alone as a Datastar patch when a conversation changes.
func ConversationMembers ¶
func ConversationMembers(d MembersPanelData) templ.Component
ConversationMembers is the panel of a group: its members, the form that adds people by username, the rename form and the Leave button. The server sends it alone as a Datastar patch after an action on the group and when the group changes.
func ConversationOlderPath ¶
ConversationOlderPath returns the path that loads the messages older than before, as a Datastar patch.
func ConversationPage ¶
func ConversationPage(d ConversationData) templ.Component
ConversationPage is the page of a conversation: its header, the messages oldest first with the newest at the bottom, the composer and, for a group, the members panel.
func ConversationPath ¶
ConversationPath returns the path of the page of a conversation, /messages/<id>. Its actions are ConversationPath + "/members", "/rename" and "/leave"; "/stream" is its live stream and "/older" loads older messages.
func ConversationReplyPath ¶
ConversationReplyPath returns the path of the page of the conversation with the composer set to reply to the message, for a browser without JavaScript.
func ConversationStreamPath ¶
ConversationStreamPath returns the path of the live stream of the conversation. newest is the ID of the newest message the page showed (0 for none); before is the before of the page (0 for the newest messages), whose messages a stream does not keep up to date.
func ErrorPage ¶
ErrorPage is the page shown for an HTTP error (404, 500 and the like): the status code and a short message, in the layout. The message is plain text, never the text of an error.
func Feed ¶
Feed is the feed of a room: the posts of the page, the empty message (shown by the stylesheet only while there is no post), and the end of the feed.
func FeedMore ¶
FeedMore is the end of the feed. When older posts exist it is the sentinel: when it scrolls into view, Datastar loads the next page (the server answers with the posts to append and a new sentinel); without JavaScript the link "Older posts" opens the older page. With no older posts it is empty.
func FeedPath ¶
FeedPath returns the path that loads the posts older than before, in the feed of the room, as a Datastar patch.
func FilePath ¶
func FilePath(a app.AttachmentView) string
FilePath returns the path that downloads an attachment, /files/<id>/<name>. The name only gives the download a good name; the ID decides.
func FormPost ¶
FormPost returns the Datastar action that sends the form it is on to path with a POST, as an ordinary form (not as signals). Put it on the form as data-on:submit. The path is escaped, so that it can sit inside the quotes of the expression.
func FormPostConfirm ¶
FormPostConfirm is FormPost behind a confirm dialog: the form is sent only when the person agrees. The message is escaped like the path.
func Home ¶
func Home(sb SidebarData) templ.Component
Home is the home page of a logged-in user: it greets the user by display name.
func InviteSection ¶
func InviteSection(d InviteData) templ.Component
InviteSection is the form that makes an invitation and the box that shows its link. The server sends it alone as a Datastar patch with the link or the problems.
func Layout ¶
Layout is the HTML page every page is rendered in: the head with the title, the stylesheet and the Datastar client, an aside for the sidebar (only when there is one: the pages of people who are not logged in have none) and a main element for the children.
func LoginForm ¶
LoginForm is the login form. The server sends it alone as a Datastar patch to show the problems of a failed login; it replaces the element with the same id.
func MembersPanel ¶
MembersPanel is the members of a room, each with a "Message" button (except the viewer) that starts a direct conversation, with the "Add member" form, for a member, and the Remove buttons, for an admin. The server sends it alone as a Datastar patch after an action on the members.
func MessageActionPath ¶
MessageActionPath returns the path of an action on a message, /messages/m/<id>/<action> with the action "edit" (the form, and the POST that saves it), "view", "delete", "react" or "reply".
func MessageAttachments ¶
func MessageAttachments(atts []app.AttachmentView) templ.Component
MessageAttachments shows the files of a message under its text: the images inline, scaled to the width of the column, each a link to the full file; then the other files as a list of links with their sizes.
func MessageComposer ¶
func MessageComposer(d ComposerData) templ.Component
MessageComposer is the place where a member writes a message: the form, or for a direct conversation with a disabled user the note that nothing can be sent.
func MessageComposerForm ¶
func MessageComposerForm(d ComposerData) templ.Component
MessageComposerForm is the form of the composer: the quote of the message being replied to, the text (Enter sends, Shift+Enter makes a new line), the files and the Send button. The server sends it alone as a Datastar patch to show the problems of a failed submit, and, replacing the old one, a fresh, empty one after a message was sent.
func MessageContent ¶
func MessageContent(d MessageData) templ.Component
MessageContent is a message without its list item: the author and time, "edited", the quote of the message it replies to, the text, the files, the reactions and the Reply, Edit and Delete buttons for the person who may. A deleted message is the placeholder "message deleted". A live update of a message replaces only this part.
func MessageContentID ¶
MessageContentID is the id of the element that holds the content of a message (see MessageContent).
func MessageCount ¶
MessageCount is the badge with the number of conversations that have unread messages, on the Messages link of the sidebar. The element is always there, so that a patch finds it; it is empty, and not shown, when the count is 0.
func MessageEdit ¶
func MessageEdit(d MessageEditData) templ.Component
MessageEdit is the content of a message replaced by its editor: the text in a field with Save and Cancel. A failed save shows its problem in it.
func MessageElementID ¶
MessageElementID is the id of the element of a message in the list.
func MessageFilePath ¶
func MessageFilePath(a app.AttachmentView) string
MessageFilePath returns the path that downloads an attachment of a message, /messages/files/<id>/<name>. The name only gives the download a good name; the ID decides.
func MessageItem ¶
func MessageItem(d MessageData) templ.Component
MessageItem is a message in the list: its content and, in a direct conversation, the place for "Seen" under an own message.
func MessageItemEditing ¶
func MessageItemEditing(d MessageEditData) templ.Component
MessageItemEditing is a message of the list replaced by its editor, for the page of a browser without JavaScript.
func MessageItems ¶
func MessageItems(items []MessageData) templ.Component
MessageItems is messages one after the other, as the list shows them.
func MessageQuote ¶
func MessageQuote(q app.MessageQuote) templ.Component
MessageQuote is the message that a message replies to, above its text: the author and the start of the text, or "message deleted".
func MessageReactionPicker ¶
func MessageReactionPicker(d MessageReactionsData) templ.Component
MessageReactionPicker is the add button of the reaction bar of a message and the picker it opens, as ReactionPicker is that of a post. Live changes of the reactions leave it alone.
func MessageReactions ¶
func MessageReactions(d MessageReactionsData) templ.Component
MessageReactions are the chips of a message, as Reactions are those of a post. The server sends it alone as a Datastar patch after a reaction and, to every open page, when the reactions of a message change; the picker next to it is not part of it.
func MessageReplySlot ¶
func MessageReplySlot(q *app.MessageQuote, convID uint64) templ.Component
MessageReplySlot is the place in the composer where the message being replied to shows as a quote with a cancel button, and holds the field "reply_to" that sends its ID. It is empty for a message that replies to nothing. The server sends it alone as a Datastar patch when the person asks to reply.
func MessageSeen ¶
MessageSeen is the place under an own message of a direct conversation where "Seen" shows, empty unless the other member read up to the message.
func MessagesOlder ¶
MessagesOlder is the top of the list of messages. When older messages exist it is the sentinel: when it scrolls into view, Datastar loads the next, older page (the server answers with the messages to put on top and a new sentinel); without JavaScript the link "Older messages" opens the older page. With no older messages it is empty.
func MessagesPage ¶
func MessagesPage(d ConversationsData) templ.Component
MessagesPage is the page of the conversations of the user, most recent first, with the form that starts one. Its stream keeps the list live.
func NewConversationForm ¶
func NewConversationForm(d NewConversationData) templ.Component
NewConversationForm is the form that starts a conversation: the usernames of the people, separated by spaces or commas (one makes a direct conversation, several a group), and the optional name of a group. The server sends it alone as a Datastar patch to show the problems of a failed submit.
func NotificationCount ¶
NotificationCount is the badge with the number of unread notifications, on the Notifications link of the sidebar. The element is always there, so that a patch finds it; it is empty, and not shown, when the count is 0.
func NotificationElementID ¶
NotificationElementID is the id of the element of a notification.
func NotificationItem ¶
func NotificationItem(n app.Notification) templ.Component
NotificationItem is one notification: who did what in which room, when, a link to it and, if it was unread, the unread mark. The mark goes when the signal readUpTo reaches the ID of the notification.
func NotificationPath ¶
func NotificationPath(n app.Notification) string
NotificationPath returns where a notification leads: the post or comment of a mention, a reply or an assignment, in its thread; the room of a room addition.
func NotificationSentence ¶
func NotificationSentence(n app.Notification) string
NotificationSentence is what the actor did, up to the room: "mentioned you in", "replied to you in", `assigned you "<task>" in` or "added you to".
func NotificationsMessage ¶
NotificationsMessage is the place of the message about the last action of the page, such as a failed "Mark all as read"; empty it shows nothing.
func NotificationsOlderPath ¶
NotificationsOlderPath returns the path of the notifications older than the notification before.
func NotificationsPage ¶
func NotificationsPage(d NotificationsData) templ.Component
NotificationsPage is the page of the notifications of the user, newest first. The unread marks are those of the notifications that were unread when the page opened; "Mark all as read" clears them through the signal readUpTo.
func NotificationsStreamPath ¶
NotificationsStreamPath returns the path of the stream of the notifications page: MeStreamPath, with the ID of the newest notification the page shows when the page shows the newest ones, so that the stream puts newer ones on top. A page of older notifications keeps no list live, and takes seen 0 with live false.
func OlderPostsPath ¶
OlderPostsPath returns the path of the page of the room that shows the posts older than before, for a browser without JavaScript.
func PostCard ¶
func PostCard(d PostCardData) templ.Component
PostCard is a post or a comment: author, time, "edited", the body, the tags as links to their search, the comment count of a post that links to its thread, and Reply, Edit and Delete for the person who may. A comment is indented to its depth (at most MaxVisualDepth) and, below that depth, says whom it replies to. A post or comment that was deleted but stays because it has replies is the placeholder "This post was deleted." or "This comment was deleted." The server sends it alone as a Datastar patch after an edit, a cancel or a failed action.
func PostCommentsPath ¶
PostCommentsPath returns the path of the comments of a post, the page of the post at its thread: /posts/<id>#comments.
func PostContent ¶
func PostContent(d PostCardData) templ.Component
PostContent is the card of a post or comment without its article and its reply slot: the message above it, the author and time, the body, the attachments, the tags and the footer with the buttons. A live update of a post or comment replaces only this part, so that a reply editor open in the slot below it, or the editor that replaced the article, is left alone.
func PostEdit ¶
func PostEdit(d PostEditData) templ.Component
PostEdit is a post or comment replaced by its editor, for the edit in place.
func PostEditor ¶
func PostEditor(d PostEditorData) templ.Component
PostEditor is the editor of a post: the body with the Text / Markdown switch, the tags field with its suggestions, the preview, and the submit button. The server sends it alone as a Datastar patch to show the problems of a failed submit; what the person typed is kept. The comments, attachments and tasks of later steps reuse it.
func PostPage ¶
func PostPage(d PostPageData) templ.Component
PostPage is the page of a post, in the layout with the sidebar: the room it was written in, the post and its thread of comments. The page of a comment is the page of its post with that comment in focus.
func PostPath ¶
PostPath returns the path of the page of a post, /posts/<id>. Its actions are PostPath + "/edit", "/view" and "/delete".
func PostPreview ¶
func PostPreview(d PostPreviewData) templ.Component
PostPreview is the preview box of an editor. The server sends it alone as a Datastar patch when the person asks for a preview.
func PostStreamPath ¶
PostStreamPath returns the path of the live stream of the thread of the top-level post rootID. newest is the ID of the newest item the page showed (PostPageData.NewestID).
func PostTasks ¶
PostTasks is the list of the tasks of a post or comment under its body: the title, the column as a badge (the last column styled as done), the names of the assignees, the due date (red when overdue) and a link to the card on the board of the room.
func ReactionPicker ¶
func ReactionPicker(d ReactionsData) templ.Component
ReactionPicker is the add button of the reaction bar of a member and the picker it opens: the common emoji and a field for any other emoji. It is empty for anyone who has not joined the room. The server sends it alone as a Datastar patch after the person's own reaction (which closes it) or a mistake in the field (which opens it); live changes of the reactions leave it alone.
func Reactions ¶
func Reactions(d ReactionsData) templ.Component
Reactions are the chips of a post or comment: one for each emoji with its count, highlighted when the person reacted, with the names of the people as its title; clicking a chip adds or removes the person's reaction. Anyone who has not joined the room sees the chips and cannot click them. The server sends it alone as a Datastar patch after a reaction and, to every open page, when the reactions of a post change; the picker next to it is not part of it, so that a live change does not close it or clear what the person typed.
func ReplySlot ¶
func ReplySlot(parentID uint64, editor *PostEditorData) templ.Component
ReplySlot is the place under a post or comment where the reply editor opens, empty until then. The server sends it alone as a Datastar patch to open the editor.
func RoomComposer ¶
RoomComposer is the place where a member writes a new post: the editor, or for anyone else the note to join the room. A live update replaces it when the viewer joins or leaves the room.
func RoomEditForm ¶
RoomEditForm is the rename form of a room, in a details element that opens after a failed submit. The server sends it alone as a Datastar patch to show the problems.
func RoomHeader ¶
RoomHeader is the header of a room: its name, visibility, the links to its posts and its board, its description and member count, the join, leave and delete buttons, the message of the last action and the rename form. The server sends it alone as a Datastar patch when an action on the room fails.
func RoomMemberCount ¶
RoomMemberCount is the number of members in the header of a room. A live update replaces it alone when someone joins or leaves.
func RoomNav ¶
func RoomNav(roomID uint64, current RoomNavCurrent) templ.Component
RoomNav is the navigation between the pages of a room: its posts and its board. The page that is shown is marked as current.
func RoomNewForm ¶
func RoomNewForm(d RoomNewData) templ.Component
RoomNewForm is the form that makes a room. The server sends it alone as a Datastar patch to show the problems of a failed submit.
func RoomNewPage ¶
func RoomNewPage(d RoomNewData) templ.Component
RoomNewPage is the page of the form that makes a room.
func RoomPage ¶
RoomPage is the page of a room: the header, the editor of a new post (for a member; others are told to join), the feed and the members panel.
func RoomPath ¶
RoomPath returns the path of the page of a room, /rooms/<id>. Its actions are RoomPath + "/join", "/leave", "/rename", "/delete" and "/members".
func RoomStreamPath ¶
RoomStreamPath returns the path of the live stream of the room. newest is the ID of the newest post the page showed, 0 for none; before is the beforeID of the page of the feed (0 for the newest posts), which a stream does not keep up to date.
func RoomsBrowsePage ¶
func RoomsBrowsePage(d RoomsBrowseData) templ.Component
RoomsBrowsePage is the page that lists the visible rooms with a Join button for each room the person has not joined.
func RoomsPanel ¶
func RoomsPanel(d RoomsBrowseData) templ.Component
RoomsPanel is the list of the visible rooms with the message of the last action above it. The server sends it alone as a Datastar patch when a join fails.
func SearchBar ¶
SearchBar is the small search box of the sidebar, on every page but the search page. It is a plain GET form.
func SearchBox ¶
SearchBox is the search box of the search page. It is a plain GET form, so the result can be shared by its URL; with Datastar the results are fetched and patched in place after a short pause in the typing.
func SearchPage ¶
func SearchPage(d SearchData) templ.Component
SearchPage is the page of the search: the box, the help, the filters as chips and the results.
func SearchPanel ¶
func SearchPanel(d SearchData) templ.Component
SearchPanel is the message about the query, the help, the filters as chips, the results and the links to the newer and older page. The server sends it alone as a Datastar patch when the query or the page changes.
func SearchPath ¶
SearchPath returns the path of the search for the text of the box, with the page number: /search?q=design&page=2. The page 1 and lower is not written, and an empty query gives /search.
func SeenMessageID ¶
SeenMessageID returns the ID of the message that "Seen" shows under in a direct conversation: the newest message of the viewer, not deleted, among messages that the other member has read. It is 0 for a group, when the other member has read none of them, and when none is the viewer's.
func Sidebar ¶
func Sidebar(d SidebarData) templ.Component
Sidebar is the sidebar of the pages of a logged-in user: the display name of the user, the search box, the navigation (Home, Messages and Notifications with their unread counts, and Admin for admins), the rooms of the user with the links to browse and to make rooms, and the logout button.
func SignUpForm ¶
func SignUpForm(d SignUpData) templ.Component
SignUpForm is the sign-up form. The server sends it alone as a Datastar patch to show the problems of a failed submit.
func SignUpPage ¶
func SignUpPage(d SignUpData) templ.Component
SignUpPage is the page of the sign-up form of an invitation.
func SizeText ¶
SizeText writes a size in bytes for people: "512 B", "12 KB", "3.4 MB". The units are powers of 1024; a value of 10 or more has no decimals, a smaller one has one unless it is whole.
func TagSearchPath ¶
TagSearchPath returns the path of the search for a tag, /search?q=%23tag.
func TagSuggestions ¶
TagSuggestions is the list of suggested tags under the tags field of an editor. The server sends it alone as a Datastar patch while the person types; a suggestion completes the tag being typed.
func TaskBoardPath ¶
TaskBoardPath returns the path of a task on the board of its room, which the board page opens at its card: /rooms/<room>/board#task-<id>.
func TaskRow ¶
func TaskRow(editorID string, index int, row TaskRowData, options []AssigneeOption) templ.Component
TaskRow is one task row of the editor: the title, the people it is assigned to (a multiple choice of the options), the due date, the hidden ID of the task (0 for a new one) and the Remove button. The fields are named tasks[<index>][id], [title], [assignees] and [due]. The server sends a row alone as a Datastar patch when the Add task button asks for one.
func TaskRowsSelector ¶
TaskRowsSelector is the selector of the list of task rows of the editor.
func Thread ¶
func Thread(d PostPageData) templ.Component
Thread is the post of the page and its comments, one after the other in reading order, each indented to its depth. The server sends it alone as a Datastar patch when a comment is written or deleted: the new thread replaces the old one.
func UsersPanel ¶
func UsersPanel(d AdminUsersData) templ.Component
UsersPanel is the table of users with the message of the last action above it. The server sends it alone as a Datastar patch after an action on a user.
Types ¶
type AdminRoomRow ¶
type AdminRoomRow struct {
// Room is the room.
Room app.Room
// Creator is the display name of the user who made the room; empty when
// that user is not known.
Creator string
// MembersOpen is true when the members list is open; Members are then the
// members of the room.
MembersOpen bool
Members []app.Member
// Message is the problem of the last action on the room (rename, delete),
// shown in the row; empty shows none.
Message string
// MembersMessage is the problem of the last action on the members, shown
// above the list; empty shows none.
MembersMessage string
// Edit is the state of the rename form. Open is true after a failed
// submit.
Edit RoomEditData
}
AdminRoomRow is one room on the admin rooms page with the state of its forms.
type AdminRoomsData ¶
type AdminRoomsData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// Rooms are all the rooms, ordered by name.
Rooms []AdminRoomRow
}
AdminRoomsData is what the admin rooms page shows.
type AdminUsersData ¶
type AdminUsersData struct {
// Viewer is the admin who looks at the page.
Viewer app.User
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// Users are all the users.
Users []app.User
// Message is the problem of the last action on a user, shown above the
// table; empty shows none.
Message string
// Invite is the state of the invitation form and of its link.
Invite InviteData
}
AdminUsersData is what the admin users page shows.
type AssigneeOption ¶
type AssigneeOption struct {
// ID is the ID of the user, the value of the option.
ID uint64
// Label is the text of the option.
Label string
}
AssigneeOption is a person the assignee picker of a task row offers.
func AssigneeOptions ¶
func AssigneeOptions(members []app.Member) []AssigneeOption
AssigneeOptions makes the options of the assignee picker from the members of a room, in their order.
type AuditData ¶
type AuditData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// Filter is the state of the filter form.
Filter AuditFilterForm
// Rooms are all the rooms, for the room filter.
Rooms []app.Room
// MissingRoom is true when the room of the filter is not in Rooms (it was
// deleted); the room filter then offers it by its ID.
MissingRoom bool
// Users are all the users, for the actor filter.
Users []app.User
// Entities and Actions are the values of the entity type and action
// filters.
Entities []string
Actions []string
// Rows are the events of the page, newest first.
Rows []AuditRow
// Page is the number of the page, starting at 1.
Page int
// HasNext is true when an older page exists.
HasNext bool
}
AuditData is what the audit log page shows.
type AuditDetail ¶
type AuditDetail struct {
// Key is the name of the field.
Key string
// Old and New are the values before and after the change. They are empty
// for a row with a Text.
Old string
New string
// Text is the whole content of a row that has no old and new value, such as
// "body changed (42 characters)" or the user of a member event. When it is
// not empty the row spans the Old and New columns.
Text string
}
AuditDetail is one row of the details table of an audit event: a field and its old and new value, or a single text that spans both columns.
func AuditDetails ¶
func AuditDetails(details map[string]any) []AuditDetail
AuditDetails makes the rows of the details table from the decoded Details of an event (SPEC §7.10), sorted by key. A field of the form {"old": ..., "new": ...} is a row with the two values. The body shape of a post or comment, {"bodyChanged": true, "length": n}, is the one row "body changed (n characters)": the text of a body is never in the details. Any other value is a row with a text.
type AuditFilterForm ¶
type AuditFilterForm struct {
// Room is the ID of the room to keep; 0 keeps every room.
Room uint64
// Actor is the ID of the user to keep; 0 keeps every user.
Actor uint64
// Entity is the entity type to keep; empty keeps every type.
Entity string
// Action is the action to keep; empty keeps every action.
Action string
// From and To are the first and the last day to keep, as 2006-01-02; empty
// leaves that end open.
From string
To string
// Message is the problem with the filters, such as a date that is not a
// date; empty shows none.
Message string
}
AuditFilterForm is the state of the filter form of the audit log: the values of the query parameters of the page. The zero value filters nothing.
func (AuditFilterForm) AuditPath ¶
func (f AuditFilterForm) AuditPath(page int) string
AuditPath returns the path of the audit log page with the filters and the page number, such as /admin/audit?actor=3&page=2.
func (AuditFilterForm) Query ¶
func (f AuditFilterForm) Query(page int) string
Query returns the query string of the filters (without the "?") for the page of the log, with empty filters left out. Page 1 and lower is not written.
type AuditRow ¶
type AuditRow struct {
// Event is the event.
Event app.AuditView
// RoomName is the name of the room of the event: the current name while
// the room exists, else the name it had in the event; empty when the event
// does not tell.
RoomName string
// RoomExists is true when the room still exists, so that the row links to
// it.
RoomExists bool
}
AuditRow is one event of the audit log with what the page shows around it.
type BoardData ¶
type BoardData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// Board is the board as the viewer sees it: its room, the columns with the
// cards, and whether the viewer may change it.
Board app.BoardView
// Message is the problem of the last action on the board, shown above the
// columns; empty shows none.
Message string
// Editor is the form of the card being edited; nil when none is open.
Editor *BoardEditorData
}
BoardData is what the page of the board of a room shows.
type BoardEditorData ¶
type BoardEditorData struct {
// Task is the card being edited, as the board shows it.
Task app.TaskCard
// Title is the text in the title field.
Title string
// Assignees are the IDs of the people selected in the picker.
Assignees []uint64
// Due is the due date as the date field holds it ("2006-01-02"), or empty.
Due string
// ClearDue is true when the box that removes the due date is ticked.
ClearDue bool
// Options are the people the picker offers: the members of the room and
// the former members who are assigned to the card.
Options []AssigneeOption
// Errors are the problems of the last submit; the fields are named title,
// assignees and dueDate.
Errors FormErrors
}
BoardEditorData is the form that edits one card. It lives in its own panel outside the columns, so that a live update of the columns never closes it or clears what is typed in it.
func NewBoardEditorData ¶
func NewBoardEditorData(task app.TaskCard, members []app.Member) BoardEditorData
NewBoardEditorData makes the editor of a card, filled with what the card has now. members are the members of the room; people assigned to the card who are no longer members stay in the picker, marked as having left, so that a save keeps them (SPEC §7.6).
type ComposerData ¶
type ComposerData struct {
// ConversationID is the conversation the composer writes in.
ConversationID uint64
// CanSend is false when the other user of a direct conversation is
// disabled: the composer is replaced by a note.
CanSend bool
// Body is the text in the field, kept after a failed submit.
Body string
// Reply is the message the new one replies to; nil for none.
Reply *app.MessageQuote
// Errors are the problems of the last submit; the fields are named body,
// attachments and replyTo.
Errors FormErrors
}
ComposerData is what the composer of a conversation shows.
type ConversationData ¶
type ConversationData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// ViewerID is the ID of the person who looks at the page.
ViewerID uint64
// Header is the conversation.
Header app.ConversationHeader
// Messages are the messages of the page, oldest first.
Messages []MessageData
// HasOlder is true when older messages exist; NextBefore is the before
// that asks for them.
HasOlder bool
NextBefore uint64
// Before is the before that asked for this page; 0 for the newest
// messages.
Before uint64
// Composer is the composer.
Composer ComposerData
// Members is the members panel of a group.
Members MembersPanelData
// Edit is the editor of the message being edited; nil for none.
Edit *MessageEditData
// Notice is the problem of the last action on the conversation, shown in
// the header; empty shows none.
Notice string
}
ConversationData is what the page of a conversation shows.
func (ConversationData) NewestID ¶
func (d ConversationData) NewestID() uint64
NewestID is the ID of the newest message of the page, 0 for none. The stream of the page is told it, to find out what was sent while the page was loading.
type ConversationsData ¶
type ConversationsData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// ViewerID is the ID of the person who looks at the page.
ViewerID uint64
// Items are the conversations, the most recent first.
Items []app.ConversationSummary
// New is the state of the form that starts a conversation.
New NewConversationData
}
ConversationsData is what the Messages page shows.
type FeedData ¶
type FeedData struct {
// RoomID is the ID of the room.
RoomID uint64
// Page holds the posts, newest first, and where the next page starts.
Page app.FeedPage
// Before is the beforeID that asked for this page; 0 for the first page.
Before uint64
}
FeedData is a page of the feed of a room.
type FormErrors ¶
type FormErrors struct {
// Form is a problem of the whole form, shown above its fields.
Form string
// Fields maps the name of an input to the message shown next to it.
Fields map[string]string
}
FormErrors are the problems to show in a form after a failed submit. The zero value shows none.
type InviteData ¶
type InviteData struct {
// Role is the role chosen in the form: "member" or "admin".
Role string
// Link is the full invitation link, <base URL>/invite/<token>; empty until
// an invitation is made. It is shown once.
Link string
// ExpiresAt is when the invitation stops working.
ExpiresAt time.Time
// Errors are the problems of the last submit.
Errors FormErrors
}
InviteData is what the invitation form shows.
type LoginData ¶
type LoginData struct {
// Username is the username typed in the last submit. The password is
// never put back.
Username string
// Next is the local path to go to after the login, already checked; empty
// means the home page.
Next string
// Errors are the problems of the last submit.
Errors FormErrors
}
LoginData is what the login page and its form show.
type MembersPanelData ¶
type MembersPanelData struct {
// Header is the conversation.
Header app.ConversationHeader
// ViewerID is the ID of the person who looks at the page.
ViewerID uint64
// AddUsers is the text in the field of the people to add.
AddUsers string
// RenameTo is the text in the name field when RenameOpen is set; the
// current name otherwise.
RenameTo string
// RenameOpen says that RenameTo is what the person typed.
RenameOpen bool
// AddErrors and RenameErrors are the problems of the last add and rename.
AddErrors, RenameErrors FormErrors
// Message is the problem of the last action on the panel (leave); empty
// shows none.
Message string
}
MembersPanelData is what the members panel of a group shows.
type MessageData ¶
type MessageData struct {
// Message is the message.
Message app.Message
// HTML is the rendered body, which comes from internal/markdown; empty for
// a message without text.
HTML template.HTML
// Own is true when the viewer wrote the message.
Own bool
// Direct is true in a direct conversation, where an own message has the
// place for "Seen".
Direct bool
// Seen is true for the message "Seen" shows under.
Seen bool
// CanReply shows the Reply link: the viewer may send messages here.
CanReply bool
// Notice is the problem of the last action on the message (it may not be
// edited or deleted), shown above it; empty shows none.
Notice string
}
MessageData is what one message shows.
type MessageEditData ¶
type MessageEditData struct {
// Message is the message being edited.
Message MessageData
// Body is the text in the field.
Body string
// Errors are the problems of the last submit; the field is named body.
Errors FormErrors
}
MessageEditData is a message replaced by its editor.
type MessageReactionsData ¶
type MessageReactionsData struct {
// Message is the message: its reactions, and whether the person may react.
Message app.Message
// Notice is the problem of the last reaction, shown above the bar; empty
// shows none.
Notice string
// Problem is the message of the emoji field of the last reaction that was
// not an emoji; the picker is open and shows it.
Problem string
// Typed is what the person typed in the emoji field, kept with Problem.
Typed string
}
MessageReactionsData is what the reaction bar of a message shows.
type NewConversationData ¶
type NewConversationData struct {
// Users and Name are the values of the last submit.
Users string
Name string
// Errors are the problems of the last submit; the fields are named users
// and name.
Errors FormErrors
}
NewConversationData is the form that starts a conversation.
type NotificationsData ¶
type NotificationsData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// Items are the notifications of the page, newest first. Their Read is
// what it was when the page was opened.
Items []app.Notification
// Before is the before of the page: 0 for the newest notifications.
Before uint64
// HasNext is true when older notifications exist; NextBefore is the
// before that asks for them.
HasNext bool
NextBefore uint64
// Message is a problem to show, such as a failed "Mark all as read".
Message string
}
NotificationsData is what the notifications page shows.
func (NotificationsData) NewestID ¶
func (d NotificationsData) NewestID() uint64
NewestID is the ID of the newest notification of the page, 0 for none.
type PostCardData ¶
type PostCardData struct {
// Post is the post or comment.
Post app.Post
// From says where the post is shown (FromPost or empty): the delete form
// takes the person to the room when the post page itself is gone.
From string
// Message is the problem of the last action on the post (edit, delete),
// shown above it; empty shows none.
Message string
// Depth is how deep a comment is in its thread (1 for a reply to the post);
// 0 for a post.
Depth int
// ParentAuthor is the author of the item a comment replies to; the zero
// value when that is deleted. It is shown for a comment deeper than
// MaxVisualDepth.
ParentAuthor app.UserRef
// Focus marks the comment that the page was opened for: highlighted and
// scrolled into view.
Focus bool
// CanReply shows the Reply button (and holds the reply slot): the post is
// shown on its own page to a member of its room.
CanReply bool
// Reply is the editor open in the reply slot under the item; nil for an
// empty slot.
Reply *PostEditorData
}
PostCardData is what one post or comment shows.
type PostEditData ¶
type PostEditData struct {
// Post is the post being edited.
Post app.Post
// Editor is the editor, filled for this post.
Editor PostEditorData
// Depth is how deep the post is, when it is a comment (see PostCardData).
Depth int
}
PostEditData is the post replaced by its editor.
type PostEditorData ¶
type PostEditorData struct {
// ID tells the editors of a page apart: "new" for the new post, "edit-12"
// for the edit of the post 12. The ids of its elements end with it.
ID string
// Action is the path the form posts to.
Action string
// Format is the value of the Text / Markdown switch: "markdown" or "text".
Format string
// Body is the text in the body field.
Body string
// Tags is the text in the tags field: tags separated by spaces or commas.
Tags string
// Errors are the problems of the last submit; the fields are named body,
// format and tags.
Errors FormErrors
// SubmitLabel is the text of the submit button.
SubmitLabel string
// CancelPath is the path that restores what the editor replaced, which
// Datastar fetches; empty for an editor that replaces nothing (it has no
// Cancel link).
CancelPath string
// CancelHref is where the Cancel link goes without JavaScript.
CancelHref string
// CancelClose makes the Cancel link close the reply slot the editor is in,
// in the browser, without asking the server (CancelHref is its target
// without JavaScript).
CancelClose bool
// From says where the post is shown (FromPost), for an edit in place.
From string
// Attachments are the files the post has now, listed with a Remove box
// each; nil for an editor that writes a new post.
Attachments []app.AttachmentView
// Removing holds the IDs of the attachments whose Remove box is ticked,
// kept from a submit that failed.
Removing map[uint64]bool
// RoomID is the ID of the room the post is written in; the Add task button
// asks the server for a row with the members of that room.
RoomID uint64
// Tasks are the task rows of the editor: the tasks of the post when it is
// edited, or the rows typed in a submit that failed. The errors of the
// rows are the message of the field "tasks".
Tasks []TaskRowData
// Assignable are the people the assignee pickers offer: the members of the
// room and, when a post is edited, the former members who are assigned to
// one of its tasks (see WithMembers).
Assignable []AssigneeOption
// contains filtered or unexported fields
}
PostEditorData is what the post editor shows. The room page uses it for the new post, the post page for the edit in place and for the replies; the attachments and tasks of M6 and M9 add their fields here.
func EditPostEditorData ¶
func EditPostEditorData(p app.Post, from string) PostEditorData
EditPostEditorData is the editor that edits the post, filled with its body, format and tags. from says where the post is shown (FromPost or empty).
func NewPostEditorData ¶
func NewPostEditorData(roomID uint64) PostEditorData
NewPostEditorData is the empty editor that writes a post in the room.
func ReplyEditorData ¶
func ReplyEditorData(parentID uint64) PostEditorData
ReplyEditorData is the empty editor that writes a comment under the post or comment parentID. It opens in the reply slot under that item.
func (PostEditorData) WithMembers ¶
func (d PostEditorData) WithMembers(roomID uint64, members []app.Member) PostEditorData
WithMembers returns the editor for the room, with the members of the room offered in the assignee pickers. People assigned to the tasks of the post who are no longer members stay in the pickers, marked as having left, so that an edit can keep them (SPEC §7.6).
type PostPageData ¶
type PostPageData struct {
// Sidebar is the sidebar of the page; the room of the post is highlighted.
Sidebar SidebarData
// Post is the top-level post of the thread.
Post app.Post
// Comments are the comments of the thread, depth first.
Comments []app.Comment
// Focus is the ID of the comment the page was opened for; 0 for the post.
Focus uint64
// CanReply is true for a member of the room: the items have Reply buttons.
// Anyone else is told to join the room.
CanReply bool
// ActiveID is the ID of the post or comment that Message, Editing and
// Replying are about; 0 is the top-level post.
ActiveID uint64
// Message is the problem of the last action on the active item, shown above
// it.
Message string
// Editing is true when the active item is replaced by its editor.
Editing bool
// Replying is true when the active item has the editor in Editor open in
// its reply slot.
Replying bool
// Editor is the editor, used when Editing or Replying is true.
Editor PostEditorData
}
PostPageData is what the page of a post shows.
func (PostPageData) CommentCard ¶
func (d PostPageData) CommentCard(c app.Comment) PostCardData
CommentCard is the card of a comment of the thread.
func (PostPageData) NewestID ¶
func (d PostPageData) NewestID() uint64
NewestID is the largest ID among the top-level post and the comments of the thread: the newest item the page shows. The stream of the page is told it, to find out what was written while the page was loading.
func (PostPageData) RootCard ¶
func (d PostPageData) RootCard() PostCardData
RootCard is the card of the top-level post of the page.
type PostPreviewData ¶
type PostPreviewData struct {
// EditorID is the ID of the editor the box belongs to.
EditorID string
// HTML is the rendered body, which comes from internal/markdown; empty for
// an empty body.
HTML template.HTML
// Message is the problem that stopped the preview (a body that is too
// long); empty shows none.
Message string
// Hidden is true for the box before the first preview.
Hidden bool
}
PostPreviewData is what the preview box of an editor shows.
type ReactionsData ¶
type ReactionsData struct {
// Post is the post or comment: its reactions, and whether the person may
// react.
Post app.Post
// From says where the post is shown (FromPost or empty), so that a plain
// form post is sent back to the right page.
From string
// Message is the problem of the last reaction, shown above the bar (the
// person may not react); empty shows none.
Message string
// Problem is the message of the emoji field of the last reaction that was
// not an emoji; the picker is open and shows it (see ReactionPicker).
Problem string
// Typed is what the person typed in the emoji field, kept with Problem.
Typed string
}
ReactionsData is what the reaction bar of a post or comment shows.
type RoomData ¶
type RoomData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// Viewer is the person who looks at the page.
Viewer app.User
// Room is the room.
Room app.Room
// Members are the members of the room.
Members []app.Member
// Candidates are the users the viewer can add; empty for a viewer who is
// not a member.
Candidates []app.User
// Message is the problem of the last action on the room (join, leave,
// delete), shown in the header; empty shows none.
Message string
// MembersMessage is the problem of the last action on the members, shown in
// the members panel; empty shows none.
MembersMessage string
// Edit is the state of the rename form.
Edit RoomEditData
// Editor is the editor of a new post, shown to a member.
Editor PostEditorData
// Feed is the page of the feed that the page shows.
Feed FeedData
}
RoomData is what the page of a room shows.
type RoomEditData ¶
type RoomEditData struct {
// Name and Description are the values in the form. Empty Name means the
// current values of the room.
Name string
Description string
// Open is true when the form is shown open (after a failed submit).
Open bool
// Errors are the problems of the last submit.
Errors FormErrors
}
RoomEditData is the state of the rename form.
type RoomNavCurrent ¶
type RoomNavCurrent string
RoomNavCurrent says which page of a room the navigation marks as current.
const ( NavPosts RoomNavCurrent = "posts" NavBoard RoomNavCurrent = "board" )
The pages of a room that the navigation links.
type RoomNewData ¶
type RoomNewData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// Admin is true when the person is an admin and so chooses the
// visibility; members always make private rooms.
Admin bool
// Name, Description and Visibility are the values of the last submit.
Name string
Description string
Visibility string
// Errors are the problems of the last submit.
Errors FormErrors
}
RoomNewData is what the page of the new room form shows.
type RoomsBrowseData ¶
type RoomsBrowseData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// Rooms are the visible rooms.
Rooms []app.Room
// Message is the problem of the last action, shown above the list; empty
// shows none.
Message string
}
RoomsBrowseData is what the page of the visible rooms shows.
type SearchChip ¶
type SearchChip struct {
// Label is the filter as it is written in a query, such as "#design" or
// "room:general".
Label string
// Path is the path of the search without this filter: the other words and
// filters of the query, on the first page.
Path string
}
SearchChip is a filter of the query, shown as a chip with a link that removes it.
func SearchChips ¶
func SearchChips(q app.Query) []SearchChip
SearchChips returns the chips of the filters of a parsed query, in the order #tags, room, from, after, before, is:post, is:comment. The path of each chip is the search for the query without that filter.
type SearchData ¶
type SearchData struct {
// Sidebar is the sidebar of the page.
Sidebar SidebarData
// Query is the text of the search box, as typed.
Query string
// Message is the problem with the query, such as a date that is not a
// date; empty shows none.
Message string
// Searched is true when the query was searched: it is not empty and has
// no problem. Without it the page shows no results and no "Nothing
// found.".
Searched bool
// Chips are the filters of the query.
Chips []SearchChip
// Results are the results of the page.
Results []app.SearchResult
// Page is the number of the page, starting at 1.
Page int
// HasNext is true when more results follow this page.
HasNext bool
}
SearchData is what the search page shows. The zero value is the page of an empty query.
type SidebarData ¶
type SidebarData struct {
// User is the logged-in user.
User app.User
// Rooms are the rooms the user is a member of, in the order to show.
Rooms []app.Room
// CurrentRoomID is the ID of the room whose page is shown, which the
// sidebar highlights; 0 on every other page.
CurrentRoomID uint64
// Unread is the number of unread notifications of the user, shown on the
// Notifications link; the badge is left out when it is 0.
Unread int
// UnreadMessages is the number of conversations of the user with unread
// messages, shown on the Messages link; the badge is left out when it is 0.
UnreadMessages int
// HideSearch leaves out the search box of the sidebar. The search page
// sets it: it has a box of its own.
HideSearch bool
}
SidebarData is what the sidebar of a logged-in page shows.
type SignUpData ¶
type SignUpData struct {
// Token is the token of the invitation, from the link.
Token string
// Username and DisplayName are the values typed in the last submit. The
// password is never put back.
Username string
DisplayName string
// Errors are the problems of the last submit.
Errors FormErrors
}
SignUpData is what the sign-up page and its form show.
type TaskRowData ¶
type TaskRowData struct {
// ID is the ID of the task for a row that edits one; 0 for a new task.
ID uint64
// Title is the text in the title field.
Title string
// Assignees are the IDs of the people selected in the picker.
Assignees []uint64
// Due is the due date as the date field holds it ("2006-01-02"), or empty.
Due string
}
TaskRowData is one task row of the editor.
Source Files
¶
- admin_audit_templ.go
- admin_rooms_templ.go
- admin_templ.go
- audit.go
- auth_templ.go
- board.go
- board_templ.go
- doc.go
- error_templ.go
- forms.go
- generate.go
- home_templ.go
- layout_templ.go
- messages.go
- messages_templ.go
- notifications.go
- notifications_templ.go
- posts.go
- posts_templ.go
- rooms_templ.go
- search.go
- search_templ.go
- sidebar_templ.go