package view
import "hauru.club/x/okrzeja/web/view"
Package view implements interactive UI layer of the Okrzeja application with reusable components and javascript libraries for hypermedia-based applications: HTMX (https://htmx.org) and Alpine.js (https://alpinejs.dev).
Index ¶
- func Account(props AccountProps) g.Node
- func Activities(entries ActivityEntries) g.Node
- func Admin(props AdminProps) g.Node
- func AdminAddBatchOfUsers() g.Node
- func AdminAddBatchOfUsersForm() g.Node
- func AdminBatchOfUsersFormSuccess(props AdminBatchOfUsersFormSuccessProps) g.Node
- func AdminConfigForm(c Config) g.Node
- func AdminLoadMoreUsers(lastID, search string) g.Node
- func AdminResetPasswordForm(password, id string) g.Node
- func AdminSuccessfulPasswordChange(id string) g.Node
- func AdminUserActions(id string) g.Node
- func AdminUserSummary(props AdminUserSummaryProps) g.Node
- func DefaultLayout(p LayoutProps) g.Node
- func Editor(content string) g.Node
- func EditorLayout(props EditorLayoutProps) g.Node
- func Error(props ErrorProps) g.Node
- func FieldsNewDirectory() g.Node
- func FieldsNewFile() g.Node
- func File(props FileProps) g.Node
- func FileCreated(props FileCreatedProps) g.Node
- func FileName(props FileNameProps) g.Node
- func FormNewFile(id string) g.Node
- func HeroFormLayout(props HeroFormLayoutProps) g.Node
- func Index(signedIn bool, csrfToken string) g.Node
- func LoginForm() g.Node
- func Logout(username string) g.Node
- func RegisterForm() g.Node
- func RegisterSuccess() g.Node
- func Settings(userID string) g.Node
- func SettingsChangePasswordForm(userID string) g.Node
- func SettingsChangePasswordSuccess(userID string) g.Node
- func Website(username string) g.Node
- func Websites(usernames []string) g.Node
- func WebsitesLoadMore(last, search string) g.Node
- type AccountProps
- type ActivityDetail
- type ActivityEntries
- type ActivityProps
- type AdminBatchOfUsersFormSuccessProps
- type AdminProps
- type AdminUserSummaryProps
- type Config
- type EditorLayoutProps
- type EditorProps
- type ErrorProps
- type FileChildProps
- type FileCreatedProps
- type FileNameProps
- type FileProps
- type HeroFormLayoutProps
- type LayoutProps
- type UserModelForAdminPanel
Functions ¶
func Account ¶
func Account(props AccountProps) g.Node
Account holds navigation tiles for user's account.
func Activities ¶
func Activities(entries ActivityEntries) g.Node
Activities component shows list of activities with proper title and subtitle.
func Admin ¶
func Admin(props AdminProps) g.Node
Admin component renders admin panel for administrative tasks.
func AdminAddBatchOfUsers ¶
AdminAddBatchOfUsers wraps AdminAddBatchOfUsersForm with header element which consists of title and explanation what how to use this component.
func AdminAddBatchOfUsersForm ¶
AdminAddBatchOfUsersForm allows admins to add batch of users at once.
Form input is being edited dynamically on the browser side with the client-side JavaScript and then submitted to the Okrzeja server with the HTMX.
func AdminBatchOfUsersFormSuccess ¶
func AdminBatchOfUsersFormSuccess(props AdminBatchOfUsersFormSuccessProps) g.Node
AdminBatchOfUsersFormSuccess is displayed when admin user successfully registers batch of users.
func AdminConfigForm ¶
AdminConfigForm renders form with fields related to the system's dynamic configuration. It allows admin to change configuration variables and see effects taken place immediately after change.
func AdminLoadMoreUsers ¶
AdminLoadMoreUsers is component that loads more users accounts for admin panel when revealed. It loads admin accounts that were created before account of user with given ID.
func AdminResetPasswordForm ¶
AdminResetPasswordForm renders form for password reset targeted for user with given id. Given password is applied as new password that can be copied into clipboard and it will be sent with the form as new password for the given user.
func AdminSuccessfulPasswordChange ¶
AdminSuccessfulPasswordChange is message box that can be rendered after successful password change procedure in the admin panel.
func AdminUserActions ¶
AdminUserOptions holds available administrative actions for user that can be performed by administrator in the admin panel.
func AdminUserSummary ¶
func AdminUserSummary(props AdminUserSummaryProps) g.Node
AdminUserSummary is admin panel component which shows informations about single user and possible administrative actions.
func DefaultLayout ¶
func DefaultLayout(p LayoutProps) g.Node
DefaultLayout is default layour wrapper for page with custom content.
func Editor ¶
Editor is textarea-based code editor component.
func EditorLayout ¶
func EditorLayout(props EditorLayoutProps) g.Node
EditorLayout is layout for page with code editor.
func Error ¶
func Error(props ErrorProps) g.Node
Error renders HTML error view component with error message and corresponding HTTP error code.
func FieldsNewDirectory ¶
FieldsNewDirectory holds article with new directory input fields for new file form.
func FieldsNewFile ¶
FieldsNewFile holds article with new file input fields for new file form.
func File ¶
File is component for viewing file properties.
func FileCreated ¶
func FileCreated(props FileCreatedProps) g.Node
FileCreated view renders message about successfully created file.
func FileName ¶
func FileName(props FileNameProps) g.Node
FileName view component for inspecting and changing name of the particular file.
func FormNewFile ¶
FormNewFile is form for submitting new file.
func HeroFormLayout ¶
func HeroFormLayout(props HeroFormLayoutProps) g.Node
HeroFormLayout is special layout for custom forms with inputs on one side and hero image on the other side.
func Index ¶
Index is layout for main index page.
func LoginForm ¶
LoginForm allows users to sign in into the system.
func Logout ¶
Logout view component. It redirects user to the index page soon after load.
func RegisterForm ¶
RegisterForm view component.
func RegisterSuccess ¶
RegisterSuccess is article web component shown after successful registration.
func Settings ¶
Settings is component which allows users to adjust their account's settings.
func SettingsChangePasswordForm ¶
SettingsChangePasswordForm allows users to change their passwords with assumption that they know their older password.
func SettingsChangePasswordSuccess ¶
SettingsChangePasswordSuccess shows message about successful password changer requested by the user itself.
func Website ¶
Website is component for presenting website link for user with given username inside list of websites.
func Websites ¶
func WebsitesLoadMore ¶
WebsitesLoadMore is component that loads more users websites links when revealed. It loads websites for accounts that were created before account with given last username.
Types ¶
type AccountProps ¶
type AccountProps struct { // Username of session's owner. Username string // UserID is unique user's ID. UserID string // RootID is unique identifier of root directory. RootID string // IsAdmin is true if user requesting this view is considered // an admin account. IsAdmin bool }
AccountProps holds properties for Account page view.
type ActivityDetail ¶
type ActivityDetail struct { // Key for detail. Key string // Value of detail associated with key. Value string }
ActivityDetail holds single details entry for details component.
type ActivityEntries ¶
type ActivityEntries []ActivityProps
ActivityEntries renders list of activities and prepare loader for more for more activities if there is need.
func (ActivityEntries) Render ¶
func (ae ActivityEntries) Render(w io.Writer) error
Render renders list of activities in the given writer.
type ActivityProps ¶
type ActivityProps struct { // Title of the activity. Title string // Type is the type of the activity. Type string // ID of activity. ID string // OwnerID is unique identifier of owner of this activity. OwnerID string // CreatedAt points to the point in time when given activity // was created. CreatedAt time.Time // Details holds debug key/values associated with given activity. Details []ActivityDetail // FileID is unique file's identifier. This field is optional, if filled with // human readable ID, it points to the file associated with given activity. It // can be filled for activities related to creation, edits etc. of files. FileID string }
ActivityProps holds properties for single activity component in the Activity account section.
type AdminBatchOfUsersFormSuccessProps ¶
type AdminBatchOfUsersFormSuccessProps struct { CSVEncodedReport string }
AdminBatchOfUsersFormSuccessProps holds properties for rendering AdminBatchOfUsersFormSuccess.
type AdminProps ¶
type AdminProps struct { Config Config Users []UserModelForAdminPanel }
AdminProps holds properties for Admin page view.
type AdminUserSummaryProps ¶
type AdminUserSummaryProps struct { // ID is unique user identifier. ID string // Username of the user. Username string // CreatedAt is time when user account was created. CreatedAt time.Time }
AdminUserSummaryProps holds properties for AdminUserSummary component.
type Config ¶
type Config struct { RegisterForm bool }
Config holds dynamic configuration variables for view components.
type EditorLayoutProps ¶
type EditorLayoutProps struct { CSRFSignature string ParentID string EditorProps }
EditorLayoutProps holds properties of EditorLayout.
type EditorProps ¶
EditorProps holds properties for Editor component.
type ErrorProps ¶
type ErrorProps struct { // Code is HTTP error code. Code int // Title of error. Title string // Body is error message. Body string }
ErrorProps holds properties for error view.
type FileChildProps ¶
type FileChildProps struct { // ID is unique id of the file. ID string // Name of the file. Name string // MIME is MIME-type of the file. MIME string }
FileChildProps holds properties for a file which is children of directory file.
type FileCreatedProps ¶
type FileCreatedProps struct { // ID is unique id of the file. ID string // ParentID is unique id of the parent directory. ParentID string }
FileCreatedProps holds properties for FileCreated page view.
type FileNameProps ¶
FileNameProps holds properties for FileName component.
type FileProps ¶
type FileProps struct { // ID is unique id of the file. ID string // ParentID is unique id of the parent directory. Empty string means // that this file hasn't any parent (it must be a root directory then). ParentID string // Name of the file. Name string // MIME is MIME-type of the file. MIME string // Content of the file. Directory's content is always nil. Content []byte // Children of file. This slice is empty, if file is not a directory. Children []FileChildProps }
FileProps holds properties of a file.
func (FileProps) IsDirectory ¶
type HeroFormLayoutProps ¶
HeroFormLayoutProps holds arguments for login layout.
type LayoutProps ¶
LayoutProps holds arguments for rendering layout.
type UserModelForAdminPanel ¶
UserModelForAdminPanel holds required properties, for Admin view, to show list of users to edit.
Source Files ¶
activities.go admin.go editor.go files.go htmx.go icons.go index.go login.go register.go settings.go vcs.go view.go websites.go
Directories ¶
Path | Synopsis |
---|---|
web/view/alpine | Package alpine implements HTML gomponents attributes for alpinejs, lightweight JavaScript framework. |
- Version
- v0.0.0-20231010043146-4292577f982b (latest)
- Published
- Oct 10, 2023
- Platform
- linux/amd64
- Imports
- 12 packages
- Last checked
- 1 day ago –
Tools for package owners.